20

I understand what the merkle root is and how it is calculated, but I have not been able to figure out what is the actual purpose behind using this kind of hashing solution?

I mean, I know that the root itself must be there, to identify the exact block's payload, but what I don't get is why didn't he just choose to calculate the hash using a normal double SHA256 over the entire block's transactions? Why did he come out with this tree-idea instead?

I do not see the tree based hashing to be adding any security, neither to have any useful advantages over a regular (linear) hash... so am I missing something?

13

The Merkle tree allows verifying that a transaction exists in the block without having the entire block, by following its Merkle branch. Among other things this enables:

  1. SPV (lightweight) clients

  2. Blockchain pruning

  3. Smart pool miners

  • 2
    What are "blockchain pruning" and "smart pool miners"? – Pacerier May 14 '13 at 19:01
  • 2
    @Pacerier: Pruning means deleting old spent transactions from the blockchain. Smart miners means that the miner constructs the block himself, and sends the pool the Merkle branch of the generation transaction to prove that it credits the pool. – Meni Rosenfeld May 22 '13 at 15:01
12

To see how it simplifies verification, consider that in order to verify a transaction T is part of the blockchain, the verifier has to get from the transaction hash to the merkle root. If there are n transaction, there are log_2(n) levels to climb in the merkle tree, so to speak. To climb from the transaction T's hash to its parent P, we only need its sibling, since that is how the tree is built. Then to climb the next level we only need the sibling of the parent we calculated P, and so forth.

To climb all log_2(n) levels of the tree we only need T's hash plus log_2(n) extra hashes (including the merkle root). If we did a linear concatenation of blocks, we would need much more information than log_2(n) << n

I found this article helpful for illustration:

https://en.bitcoin.it/wiki/Merged_mining_specification#Merkle_Branch

Hope this helps

  • This is the answer that really explains the question – why Merkle root vs straight hash. – uzyn Jul 26 '16 at 3:13
6

I believe it's to enable Simplified Payment Verification (SPV). A client who doesn't wish to download the full blockchain can still verify that a transaction exists in the blockchain by confirming that the block headers are linked, and validating the relevant parts of the merkel tree to confirm the transaction really exists in the block.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.