Author

Topic: How are referenced output scriptPubKey found in a very large blockchain (Read 824 times)

full member
Activity: 203
Merit: 168
10 years?  satoshi is that you?  Getting ready to move some coins in 2019?   :-P
staff
Activity: 3458
Merit: 6793
Just writing some code
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.
member
Activity: 96
Merit: 18
Ah, I recap just to make sure I understand correctly:
Every node has a local database where it indexes all unspent tx, correct?

greets
staff
Activity: 3458
Merit: 6793
Just writing some code
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.
copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.
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).
member
Activity: 96
Merit: 18
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
Jump to: