Bitcoin Forum
May 03, 2024, 02:05:03 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How are referenced output scriptPubKey found in a very large blockchain  (Read 804 times)
schnuber (OP)
Member
**
Offline Offline

Activity: 96
Merit: 18


View Profile
April 29, 2016, 09:45:29 PM
Merited by ABCbits (1)
 #1

Hi all

Imagine you made a tx that moves bitcoins that had been lying a very long time on the same address (let's say 10 years).
So in this tx, you have to reference this old transaction, which is done by declaring the hash of that tx (you can read that on the bitcoin wiki, topic: transaction).
To validate whether you have the right to claim those funds, the validating node has to retrieve the scriptPubKey of the referenced tx.
But how is this done? I wonder.
In 10 years the blockchain will have grown by over 1000GB (2MB Blocks assumed). So how does the validating node search for the referenced tx? Does it simply go backwards, searches every block? But how long would that take with 1000GB?

Sincerely
1714701903
Hero Member
*
Offline Offline

Posts: 1714701903

View Profile Personal Message (Offline)

Ignore
1714701903
Reply with quote  #2

1714701903
Report to moderator
1714701903
Hero Member
*
Offline Offline

Posts: 1714701903

View Profile Personal Message (Offline)

Ignore
1714701903
Reply with quote  #2

1714701903
Report to moderator
1714701903
Hero Member
*
Offline Offline

Posts: 1714701903

View Profile Personal Message (Offline)

Ignore
1714701903
Reply with quote  #2

1714701903
Report to moderator
In order to get the maximum amount of activity points possible, you just need to post once per day on average. Skipping days is OK as long as you maintain the average.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714701903
Hero Member
*
Offline Offline

Posts: 1714701903

View Profile Personal Message (Offline)

Ignore
1714701903
Reply with quote  #2

1714701903
Report to moderator
shorena
Copper Member
Legendary
*
Offline Offline

Activity: 1498
Merit: 1499


No I dont escrow anymore.


View Profile WWW
April 29, 2016, 09:47:54 PM
Merited by ABCbits (1)
 #2

Hi all

Imagine you made a tx that moves bitcoins that had been lying a very long time on the same address (let's say 10 years).
So in this tx, you have to reference this old transaction, which is done by declaring the hash of that tx (you can read that on the bitcoin wiki, topic: transaction).
To validate whether you have the right to claim those funds, the validating node has to retrieve the scriptPubKey of the referenced tx.
But how is this done? I wonder.
In 10 years the blockchain will have grown by over 1000GB (2MB Blocks assumed). So how does the validating node search for the referenced tx? Does it simply go backwards, searches every block? But how long would that take with 1000GB?

Sincerely

It keeps a record of all unspend transaction outputs (aka UTXO set).

Im not really here, its just your imagination.
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6578


Just writing some code


View Profile WWW
April 29, 2016, 09:50:28 PM
 #3

It depends on the software implementation. A poorly written software will crawl though the entire blockchain and that will waste time and energy. Well written software keep their own databases of every single Unspent Transaction Output. This is much smaller and easier to search through. Once a UTXO is spent, it is removed from this database. This database is built from scanning all of the blocks as it receives them and updating this database when transactions are confirmed.

schnuber (OP)
Member
**
Offline Offline

Activity: 96
Merit: 18


View Profile
April 29, 2016, 09:52:23 PM
 #4

Ah, I recap just to make sure I understand correctly:
Every node has a local database where it indexes all unspent tx, correct?

greets
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6578


Just writing some code


View Profile WWW
April 29, 2016, 09:54:45 PM
 #5

Ah, I recap just to make sure I understand correctly:
Every node has a local database where it indexes all unspent tx, correct?

greets
yes.

danda
Full Member
***
Offline Offline

Activity: 201
Merit: 157


View Profile WWW
April 30, 2016, 08:03:16 PM
 #6

10 years?  satoshi is that you?  Getting ready to move some coins in 2019?   :-P

mybitprices.info - wallet auditing   |  hd-wallet-derive - derive keys locally |  hd-wallet-addrs - find used addrs
lightning-nodes - list of LN nodes  |  coinparams - params for 300+ alts  |  jsonrpc-cli - cli jsonrpc client
subaddress-derive-xmr - monero offline wallet tool
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!