Partial Pruned Nodes

Pruned nodes prune the blockchain up to a particular height. This saves on disk space while still giving many of the benefits of running a full node.

If all nodes on the network operate as pruned nodes, then initial block download becomes impossible.

In a future where the blockchain is much larger, the number of nodes that are set to pruning could increase. This would make initial sync slower for everyone.

A middle ground with pruning would be to keep some of the blocks that are marked for pruning.

The prune target could be split into 2 portions and a new parameter added.

-prune_target_size=10000
-prune_target_old_percent=25

This would assign 10 GB for block data but split it 7.5GB for recent blocks and 2.5GB for old blocks.

The node would store 7.5GB worth of the most recent blocks and 2.5 GB for older blocks.

The node could select the 2.5GB worth of blocks using a rule that is easy to publish. For example, the node could pick two bytes (start and end).

The node will keep a block if

start <= ((height & 0x0000FF00) >> 8) < end

This takes 2 bytes for the node to indicate which blocks that it has. (Wrap around if end < start would be desirable.)

If start was 10 and end was 11, then it picks blocks with height so that

height mod 65536 is in the range [2560 - 2815]

The minimum is 1/256 of the blockchain to store. As long as all blocks are stored somewhere nodes could complete initial block download. To achieve a “leach ratio” of 1.0, a node would have to send 1/256 of the blockchain to 256 other peers.

It could be worth having more than 1 byte for start and end so that the node can store even less. If 2.5GB is 1/256 of the blockchain, then the total size would be 640GB, which is 3 times what it is now.

The two bytes could be included in the addr message. This would make it easier for nodes to find other nodes that have blocks of interest for download.

Another option would be 12 bits for start and 4 bits for size. That means a pruned node could store from 1/4096 of the blockchain up to 15/4096 of the blockchain. Perhaps, there could be multiple modes.

It would be best not to waste service bits.

1 Like