bitcoind – How is an unspent TX output value verified?


A transaction will consume some previously existing UTXOs as inputs, and it will create some new UTXOs as outputs. One of the checks to ensure the transaction is valid is ensuring that the value of the outputs is equal to or less than the value of the inputs (in most cases, it is less than, as the difference in value is claimed by the miner as the transaction fee).

So with each new transaction, nodes will check that the inputs are valid (ie, they are pre-existing UTXOs), and that the outputs do not sum to a larger value than those inputs.

Is there a way to walk forwards from the genesis block to compute the value of each UTXO as the UTXO set changes each block?

That is precisely how full nodes gain an accurate view of the network state (the UTXO set). Starting from block 1 (not the genesis block), nodes will create a ‘UTXO set’, which will be updated with each new valid block that the node hears about. This allows the node to maintain a UTXO set, that is used to validate new transactions/blocks.

Source link

Leave a reply