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).