Bitcoin blockchain pruning trees


Originally published 4 Nov on the Bitcoin StackExchange. This post has not been reviewed by any Bitcoin experts and so likely contains errors. This seems especially important given recent scalability concerns. Unfortunately, Nakamoto-style blockchain pruning is not safe with current blocks and transactions, although future improvements may allow us to prune some space bitcoin blockchain pruning trees future blocks and transactions. Sure, that sounds like that might be a reasonable trade off of reduced security for increased convenience.

At some point in the future, Bob goes to spend his 50 bitcoins. Everything else, such as the large public keys and signatures we use to prove Alice was authorized to spend those 50 bitcoins. Here we encounter an additional problem with transaction pruning, a limitation of the way Nakamoto designed Transaction Identifiers txids. Happily, some smart people have been working on improving the situation.

First, some background on witnesses in cryptography:. This probably derives from contract law, where you often get other people to witness your signature on important bitcoin blockchain pruning trees. In the case of Bitcoin, the witness to a particular spend being valid is the scriptPubKey bitcoin blockchain pruning trees the output being spent and scriptSig of the input that references it in the spending transaction.

That means that nodes who want to reduce their download requirements can skip downloading witnesses for transactions with more than say 50, confirmations.

However, now bitcoin blockchain pruning trees can still use the block header merkle root to verify that all of the non-witness data including the amounts transferred are correct, and use that to build a correct UTXO set. Previously, it had been thought that a hard fork would be necessary. The payer pays to a scriptPubKey that always returns true but which contains the hash of a redeem script like P2SH does:.

When the person paid later goes to spend, they provide an empty scriptSig in the transaction itself. This is valid bitcoin blockchain pruning trees old nodes, but upgraded nodes know to look somewhere else in the block for the actual scriptSig.

The witness has been segregated. For both old nodes and new nodes, they calculate the txid using the empty scriptSig, so the data covered by the merkle root still covers the important value amounts and references.

That looks like 50 bitcoins appeared out of nowhere! What if that transaction has lots of proof of work? Why not just keep track of amounts and purge the rest? One way around this dilemma would be if we could split transactions into different parts: First, some background on witnesses in cryptography: When will this appear in Bitcoin? The payer pays to a scriptPubKey that always returns true but which contains the hash of a redeem script like P2SH does:

Announcing World Trade Francs: The Official Ethereum Stablecoin 01st April, Ethereum scalability research and development subsidy programs 02nd January, First of all, let us begin by bitcoin blockchain pruning trees why the current Ethereum client database is so large. The purpose of this is simple: For light clients, the state root is even more advantageous: However, this state tree mechanism has an important disadvantage if implemented naively: To see why, consider this diagram here:. The change in the tree during each individual block is fairly small, and the magic of the tree as a data structure bitcoin blockchain pruning trees that most of the data can simply be referenced twice without being copied.

However, bitcoin blockchain pruning trees still, for every change to the state that is made, a logarithmically large number of nodes ie. In practical terms, the Ethereum blockchain is only 1. So, what can we do? The alternative approach is to implement state tree pruning: Essentially, we store the tree nodes that are part of the current state, and we even store recent history, but we do not store history older than blocks. X should be set as low as possible to conserve space, but setting X too low compromises robustness: Once this is done, bitcoin blockchain pruning trees database should only be storing state nodes associated with the last X blocks, so you will still have all the information you need from those blocks but nothing more.

On top of this, there are further optimizations. Now, how much savings can this give us? As it turns out, quite a lot! At every value in between, we can expect the disk space growth to be linear ie.

Note that we may want to pursue bitcoin blockchain pruning trees hybrid strategy: That bitcoin blockchain pruning trees, light clients will also need to prune block headers if they are to survive in low-memory circumstances. The strategy described above has been implemented in a very early alpha form in pyeth ; it will be implemented properly in all clients in due time after Frontier launches, as such storage bloat is only a medium-term and not a short-term scalability concern.

Are the current state trees generated locally by each client, or are they being pulled over the wire when synchronizing with the network? And even people with fast connections may be limited by the bitcoin blockchain pruning trees speeds of their peers…. In networking, we solve problems like this with a hierarchical model. As long as there are a suitable number of supernodes participating in the network, this method allows scale relatively easily. This sounds vaguely similar to my quadratic scaling model here https: Thanks very much for the link Vitalik; still digging through it.

Blocks simply come with some pre-computed data in them, but if you have all the blocks, you can compute the data locally and if you bitcoin blockchain pruning trees block is no longer the head, the state root is effectively stale cache that can be deleted, or am I missing something? Nice, learned about Entereum today, and by seeing the state is keep in a tree, I think this provides much more scalability than BitCoin.

For audit purposes, can there be a procedure to recover the pruned sections of the tree? Just my 2 cents. You may use these HTML tags and attributes: State Tree Pruning Introduction. The Official Ethereum Stablecoin 01st April, Ethereum scalability research and development subsidy programs 02nd January, Author oliverkx Posted at 9: And even people with fast connections may be limited by the connection speeds of their peers… Reply.

Author Vitalik Buterin Posted at 7: Generated locally by the client. Author William Mougayar Posted at 2: Author Simon de la Rouviere Posted at Author Blake Posted at Author Vitalik Buterin Posted at 9: Author Blake Posted at 1: Author Kobi Gurkan Posted at 3: Author Rick Dudley Posted at 2: Author Marco Hernandez Posted at 5:

I'm still really happy with the software on the whole, just wanted to point out some areas for improvement Thanks bitcoin blockchain pruning trees your feedback and support. I created a spreadsheet that aggregates coin prices across bitcoin blockchain pruning trees exchanges for all of the top cryptocurrencies. So yes, the buy trades will be at top of the hour. It provides quick access to market data for storage, analysis, visualization, indicator development, trading strategy backtesting, bot programming, building trading algorithms on top of it, webshop integration and related software engineering.