Author

Topic: Is it possible, at this point, to run a full bitcoin node off the UTXO? (Read 1102 times)

legendary
Activity: 3472
Merit: 4801
I may be mistaken, but I thought the UTXO set is just a list of transaction hashes indicating which transaction outputs haven't been spent yet.  It doesn't contain the scriptPubKey.  Therefore, you will be unable to confirm that the requirements have been met to spend a UTXO?

The UTXO contains the scriptPubKey.  It contains everything necessary to validate new txns.  The raw blocks are not used for anything other than building/updating the UTXO.  The Bitcoin-core stores the UTXO in the chainstate folder of the data directory.  It is in a rather (overly) complex format and redundant information is removed but it contains everything needed to validate new transactions.   In the event of a re-org you can "rollback" the UTXO using undo records created by bitcoin-core for each block.  For this reason you probably wouldn't want to be 100% blockless.  You could but it would mean a lot of extra data transfer and validation in the event of a reorg so it would make sense to retain a "few" blocks.  Maybe one block day (blocks on any chain with block height within 144 of the best block hash).

Some information I discovered while decoding the UTXO:
https://bitcointalksearch.org/topic/m.7235404

Thanks for the info.  I've deleted my incorrect post to avoid confusing anybody else that reads this thread, and I've updated my notes on Bitcoin so I don't repeat my mistake in the future.
donator
Activity: 1218
Merit: 1079
Gerald Davis
I may be mistaken, but I thought the UTXO set is just a list of transaction hashes indicating which transaction outputs haven't been spent yet.  It doesn't contain the scriptPubKey.  Therefore, you will be unable to confirm that the requirements have been met to spend a UTXO?

The UTXO contains the scriptPubKey.  It contains everything necessary to validate new txns.  The raw blocks are not used for anything other than building/updating the UTXO.  The Bitcoin-core stores the UTXO in the chainstate folder of the data directory.  It is in a rather (overly) complex format and redundant information is removed but it contains everything needed to validate new transactions.   In the event of a re-org you can "rollback" the UTXO using undo records created by bitcoin-core for each block.  For this reason you probably wouldn't want to be 100% blockless.  You could but it would mean a lot of extra data transfer and validation in the event of a reorg so it would make sense to retain a "few" blocks.  Maybe one block day (blocks on any chain with block height within 144 of the best block hash).

Some information I discovered while decoding the UTXO:
https://bitcointalksearch.org/topic/m.7235404

Quote
Could I start a full node on that hard drive, and after downloading the full blockchain and cutting it down into the UTXO, I could run that node forever without having to worry about running out of space? And will that be just as secure as running a node that keeps a full copy of blockchain, since I already know that the UTXO that I'm using is the correct one? Is there a way to do this with the bitcoin client currently?

Yes you could run a trustless node that way.  Understand you wouldn't be a "full node" as that term generally refers to nodes which can support other nodes on the network.  You would be unable to respond to requests for blocks from other nodes. 

There is no way to do this from the stock bitcoin-core, but the source code but the code could be modified to work in this manner.   One caveat is that if the UTXO became corrupt you would have no way to rebuild it.   Also you probably should retain some blocks from the tip of the blockchain in order to efficiently handle reorgs.   Bitcoin-core records both blocks and "undo" information for each block in the "blocks" directory.  Instead of retaining it for all blocks this could be modified to works as a rolling queue of blocks (and undo records).  I would also retain all blockheaders,  they are only about 5MB per block year.

I would also point out that there is no guarantee you won't run out of space.  The UTXO is only ~400MB compressed (about 1500MB uncompressed) but it is growing.  It grows at a much lower rate than the overall blockchain but it is growing. 
member
Activity: 110
Merit: 10
Let's say I want to start running a full bitcoin node. From my understanding, I first have to download the entire 20-30gb blockchain in order to verify that I have the correct information... but after I do that, I should be able to discard everything but the UTXO, while still remaining as a fully secure node. At that point, I only need to keep my UTXO updated with each new block that I recieve, and I won't ever have to store the full blockchain again because I know the UTXO that I have is correct.

To use a more specific example, let's say I only have a hard drive that is just barely big enough to store the current full blockchain + a few extra gb. Could I start a full node on that hard drive, and after downloading the full blockchain and cutting it down into the UTXO, I could run that node forever without having to worry about running out of space? And will that be just as secure as running a node that keeps a full copy of blockchain, since I already know that the UTXO that I'm using is the correct one? Is there a way to do this with the bitcoin client currently?
Jump to: