Merkle Proofs

Published by Mario Oettler on

A Merkle tree has a nice property. It saves data when verifying whether a transaction is included in the tree or not. This is called Merkle proof. The following diagram shows which information are necessary to check whether transaction TX5 (green) is in the Merkle tree.

It is sufficient to know the hashes in the blue boxes. All values in the yellow framed boxes can be calculated with the given information. In the end, one compares the Merkle root with the result of your own calculation. If it matches, the transaction is included.

This property can help saving bandwidth when verifying transactions and requesting transaction data from nodes. It also helps to maintain privacy during this check, since no other transaction data is necessary.

When using a cryptographic hash function, it is infeasible to alter the content afterward. This is due to the collision-free property of the hash function.