Todays newsletter continues chapter 5 from Bitcoin: A Work in Progress.


In early 2019, Chaincode Labs alumnus James O’Beirne introduced a proposal for AssumeUTXO that would allow users to get started more quickly. As mentioned earlier in the chapter, the UTXO set is the collection of coins that exists right now. Every time you send someone money, it creates an UTXO, and it destroys the UTXO you sent from. It’s like you have a bank account that’s closed down when you use it, and you get a fresh bank account for the change.

Today, the only way to reconstruct the UTXO set and find out which coins exist right now is to replay all Bitcoin transactions starting from the 2009 genesis block. You take the first block and see which coins it creates and which coins it destroys. Then you take the second block and do the same. You have to start at the beginning and do it until the end, and you can only do it sequentially — all of which takes a long time.

AssumeUTXO instead uses a recent snapshot of the UTXO set and works from there, skipping hundreds of thousands of historical blocks. It starts out just like nodes today by performing a Headers First sync to determine which chain is the longest one. But once it has the headers, it can load the snapshot. This snapshot is of the UTXO set at a certain height — maybe just before the release. From there, it proceeds as normal, checking each new block to see which coins were destroyed and which were created, until finally, it reaches the most recent block (tip). So then you know your balance exactly and you can start using it.

But in the meantime, in the background, it starts at the genesis block, goes all the way to the snapshot, and verifies that the snapshot is correct. And if the snapshot isn’t correct, it starts screaming (or it unceremoniously crashes with an error message).

With Assume Valid, it still did all of the UTXO set constructing and replayed all of the transactions; it just didn’t check for the signatures. Now, with AssumeUTXO, it skips the transaction replaying altogether, or more accurately: It defers it. Instead, it takes the UTXO set at the snapshot block height, and then processes all subsequent blocks in order to construct the current UTXO set.