2

What I have learned is that state is an abstract thing and is maintained by the node locally and the state of the current blockchain can be reached by starting all the way from the genesis block and updating the state to the current state. So the state keeps adding utxos.

Does the state keep track of only the UTXOs which are unspent or the state keeps track of both the spent and the unspent utxos. What I think is ,they should be removed from the memory pool. Also what I think is that the memory pool is nothing else but the state of the blockchain.

Please clarify my confusions. Thanks

Raghav Sood
  • 16,869
  • 3
  • 21
  • 42
Sheikh
  • 145
  • 4

1 Answers1

3

UTXO stands for Unspent Transaction Outputs. Thus, a node only keeps track of transaction outputs that are unspent. As soon as a transaction (even an unconfirmed one) consumes a UTXO, it is removed from the UTXO db (if the tx is dropped, it is added back).

What I think is ,they should be removed from the memory pool.

The mempool is a list of unconfirmed transactions consuming as-of-yet available UTXOs. UTXOs are not removed from the memory pool. There is a separate UTXO database

Also what I think is that the memory pool is nothing else but the state of the blockchain.

The state of the blockchain is the UTXO database. The mempool is essentially a list of proposed changes to the UTXO set, which can be mined and confirmed, which then results in an update to the state of the blockchain.

Raghav Sood
  • 16,869
  • 3
  • 21
  • 42
  • Hmm, I never realized that a mempool entry would remove a utxo pre-confirmation. Is that ‘standard’ across all software? I suppose that is done to mitigate against double spends? – chytrik Jul 18 '18 at 00:09
  • I'm not sure about others, but it happens in Bitcoin Core at least. You will get a `txn-mempool-conflict` if you try to broadcast a double spend. I'm not actually sure if it updates the UTXO set immediately, but it might have an additional check against mempool txs to achieve the same result – Raghav Sood Jul 18 '18 at 00:13