<p>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).</p>
<p>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.</p>
<blockquote>
<p>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?</p>
</blockquote>
<p>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.</p>

CC BY-SA 4.0
2021-11-05T02:24:27.277Z
Interesting. I would have thought it was the other way around, where a UTXO would have been calculated walking backwards as that is the only reference any node would have starting with the UTXO and the reference of the previous transaction(s) to compute the current UTXO, not the other way around (since going forwards can only be done once) but going backwards is always available.
LeanMan
CC BY-SA 4.0
2021-11-05T02:49:59.690Z
@LeanMan it is simply more efficient to work forwards once and keep a continuously updated UTXO set, than it is to work backwards for each new transaction a node hears about. Especially in the (not uncommon) case where a UTXO may have a shared history with a massive number of previous outputs! Each node's 'reference point' is the genesis block that is hardcoded in, and it is from there that the node can work to independently figure out the state of the network.
chytrik
CC BY-SA 4.0
2021-11-05T03:29:12.203Z
I was thinking that too. Thanks for the confirm!
LeanMan
CC BY-SA 4.0
2021-11-05T01:48:01.567Z
2021-11-05T01:48:01.567Z
chytrik
<p>I know that the current UTXO set is the set of all unspent transaction outputs in the blockchain that is equal to the total number of all bitcoins mined currently and that each UTXO has a reference to its input UTXO that was unlocked to create it. I'm interested in understanding how Bitcoin establishes that each UTXO is proper initially before it begins to operate on further blocks. I assume this is a necessary initial step for any node syncing to the network in order to trust any future assumptions and validation on future UTXOs.</p>
<p>How are unspent TX output values verified? Does the bitcoin software walk back all UTXOs from the current UTXO set all the way to their coinbase block for &quot;properness&quot;?</p>
<p>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?</p>

<bitcoind><utxo><utxo-set>
How is an unspent TX output value verified?
LeanMan
# How is an unspent TX output value verified?

(Asked by: username_0 on 2021-11-05)

I know that the current UTXO set is the set of all unspent transaction outputs in the blockchain that is equal to the total number of all bitcoins mined currently and that each UTXO has a reference to its input UTXO that was unlocked to create it. I'm interested in understanding how Bitcoin establishes that each UTXO is proper initially before it begins to operate on further blocks. I assume this is a necessary initial step for any node syncing to the network in order to trust any future assumptions and validation on future UTXOs.

How are unspent TX output values verified? Does the bitcoin software walk back all UTXOs from the current UTXO set all the way to their coinbase block for "properness"?

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?

**Tags:** bitcoind, utxo, utxo-set


---

## 1 answers

### Answer by username_1 on 2021-11-05. Score: 1

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.

> **Comments:**
> **username_0**: Interesting. I would have thought it was the other way around, where a UTXO would have been calculated walking backwards as that is the only reference any node would have starting with the UTXO and the reference of the previous transaction(s) to compute the current UTXO, not the other way around (since going forwards can only be done once) but going backwards is always available.  
> **username_1**: @username_0 it is simply more efficient to work forwards once and keep a continuously updated UTXO set, than it is to work backwards for each new transaction a node hears about. Especially in the (not uncommon) case where a UTXO may have a shared history with a massive number of previous outputs! Each node's 'reference point' is the genesis block that is hardcoded in, and it is from there that the node can work to independently figure out the state of the network.  
> **username_0**: I was thinking that too. Thanks for the confirm!  

---

