Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: TierNolan on January 09, 2014, 11:38:30 AM



Title: Merkle root instead of previous link
Post by: TierNolan on January 09, 2014, 11:38:30 AM
This is an alternative to the High Hash Highway (https://bitcointalk.org/index.php?topic=98986.0).

It is a system to allow new nodes to quickly determine which peers possess the highest POW chain without having to download the entire chain.

The previous link could be replaced by a merkle root of a tree containing all the headers previous to the block. 

This could be implemented using a soft fork, if the extra field was added to an OP_RETURN transaction (maybe the 2nd transaction).

On connect, a peer would indicate the root of the longest chain.  The new peer could ask for the path to the highest POW 10 (or 100) block headers.

The new peer would

1) verify that the newest header is valid given the stated merkle root
2) extract the previous merkle field from the OP_RETURN transaction (needs extra path info)
3) verify that the previous merkle field is valid
4) repeat with the next newest header using the new merkle as root, until all are checked

The path info given automatically gives enough information for step 3.

If you delete a node from the tree, there are 2 possibilities.  If it has no sibling, then it causes its parent to be deleted.  If it has a sibling, then it causes its parent's hash to change.

Either way, it only affects the nodes along the path from the block to the root.

If the root ends up being deleted, then the root's other child becomes the new root.

The total POW of the top 100 blocks gives a very accurate indication of the total proof of work of the chain.

Even with 1 million blocks, the path would be around 20 links.  That is 32 * 20 = 640 bytes per path.  The top 100 blocks would require 64kB per node that is connected to.  Including the path to the OP_RETURN transaction would add 13 steps to the path.  That would increase it to around 100kB for the top 100 block headers.

Download 300k headers is 24MB.

Checkpoints could be maintained as advisory fields.  If a header is checkpointed, then there is no need to do as much verification on transactions in blocks prior to that point.