<p>You don't actually need to commit to the chainstate in blocks - just compute it the normal way, but throw away the block data after validation.</p>

<p>In fact, that's exactly what the pruned mode in Bitcoin Core 0.11 does, and it supports mining.</p>

<p>Storing the hash of the chainstate into blocks does have other advantages, like being able to skip processing historical blocks entirely if you're willing to trust a miner majority to commit to a correct one. However, it comes at a very significant cost for validation, as this hash would have to be recomputed and verified with the entry inside every block.</p>

CC BY-SA 3.0
2015-07-26T00:22:47.490Z
It seems like we could lower the cost of validating it by taking a few measures. For example, 1) the hash of the utxo set could be computed only every 100 blocks, and 2) it could refer to the utxo set from 10 blocks ago, meaning it could be computed in advance.
Nick ODell
CC BY-SA 3.0
2015-07-26T22:44:34.200Z
If block N were to contain the hash of block N-1's chainstate, the cost is exactly hashing the chainstate once per block.  Does staggering it like that remove the cost problem you mentioned?  If not, what did you mean?
Dave Scotese
CC BY-SA 3.0
2015-07-27T01:10:54.373Z
Blocks are sometimes found a few seconds apart, so just using the previous block may still affect relay performance significantly for such blocks. You could go back further in time, but that also has costs, as you somehow need to be able to relay old chainstates to new nodes, so they have to be accessible. There has been some work around merkleizing the chainstate itself, so that its root hash can be recomputed on the fly for each update, but this still adds very significant validation costs.
Pieter Wuille
CC BY-SA 3.0
2015-07-27T02:48:54.013Z
New nodes need "old" chainstate, but current chainstate will be old as soon as the next block gets solved.  Significant chunks of the utxo database will not change.  While a new node collects chunks at random, some pieces will be invalidated as new blocks get solved, so it will have to get them again.  Eventually, it has complete current chainstate and then it can wait for the next block to validate the whole thing.  That leaves only validating the chunks.  Torrent files do this already, right?
Dave Scotese
CC BY-SA 3.0
2015-07-26T00:18:06.957Z
2015-07-26T00:18:06.957Z
Pieter Wuille
<p>Spending freshly generated coins is prohibited by the protocol until there are at least 100 blocks on top of the block from which they came.  This is because the chances of a 100-block reorg is virtually zero.</p>

<p>The chances of a reorg of 1,000 or 10,000 blocks is even lower.  If the chainstate data is normalized, then its hash can be included in each block so that messing with it is as impossible as messing with the blockchain itself.  Would we then be able to prune off all but the last 10,000 blocks?</p>

<p>I know the transaction history is valuable, but under the assumption that we will never see a reorg larger than a particular number of blocks, I suspect it isn't necessary for mining once the chainstate is protected as well as the entire blockchain has been.</p>

<p>It seems to me that normalizing the chainstate so that it can be hashed and protected (like block headers are) would allow validation and mining without having to save the entire blockchain.  That way, only those who really want the history would need to save it.</p>

<p>Am I missing something?</p>

<storage><validation>
Would a normalized, hashed, protected chainstate reduce miner storage costs?
Dave Scotese
# Would a normalized, hashed, protected chainstate reduce miner storage costs?

(Asked by: username_0 on 2015-07-25)

Spending freshly generated coins is prohibited by the protocol until there are at least 100 blocks on top of the block from which they came. This is because the chances of a 100-block reorg is virtually zero.

The chances of a reorg of 1,000 or 10,000 blocks is even lower. If the chainstate data is normalized, then its hash can be included in each block so that messing with it is as impossible as messing with the blockchain itself. Would we then be able to prune off all but the last 10,000 blocks?

I know the transaction history is valuable, but under the assumption that we will never see a reorg larger than a particular number of blocks, I suspect it isn't necessary for mining once the chainstate is protected as well as the entire blockchain has been.

It seems to me that normalizing the chainstate so that it can be hashed and protected (like block headers are) would allow validation and mining without having to save the entire blockchain. That way, only those who really want the history would need to save it.

Am I missing something?

**Tags:** storage, validation


---

## 1 answers

### Answer by username_1 on 2015-07-26. Score: 1

You don't actually need to commit to the chainstate in blocks - just compute it the normal way, but throw away the block data after validation.

In fact, that's exactly what the pruned mode in Bitcoin Core 0.11 does, and it supports mining.

Storing the hash of the chainstate into blocks does have other advantages, like being able to skip processing historical blocks entirely if you're willing to trust a miner majority to commit to a correct one. However, it comes at a very significant cost for validation, as this hash would have to be recomputed and verified with the entry inside every block.

> **Comments:**
> **username_2**: It seems like we could lower the cost of validating it by taking a few measures. For example, 1) the hash of the utxo set could be computed only every 100 blocks, and 2) it could refer to the utxo set from 10 blocks ago, meaning it could be computed in advance.  
> **username_0**: If block N were to contain the hash of block N-1's chainstate, the cost is exactly hashing the chainstate once per block.  Does staggering it like that remove the cost problem you mentioned?  If not, what did you mean?  
> **username_1**: Blocks are sometimes found a few seconds apart, so just using the previous block may still affect relay performance significantly for such blocks. You could go back further in time, but that also has costs, as you somehow need to be able to relay old chainstates to new nodes, so they have to be accessible. There has been some work around merkleizing the chainstate itself, so that its root hash can be recomputed on the fly for each update, but this still adds very significant validation costs.  
> **username_0**: New nodes need "old" chainstate, but current chainstate will be old as soon as the next block gets solved.  Significant chunks of the utxo database will not change.  While a new node collects chunks at random, some pieces will be invalidated as new blocks get solved, so it will have to get them again.  Eventually, it has complete current chainstate and then it can wait for the next block to validate the whole thing.  That leaves only validating the chunks.  Torrent files do this already, right?  

---

