Merkle proofs Explained.

This article explains how to obtain and what merkle proofs are.

Merkle proofs are used to decide upon the following factors:

  • If the data belongs in the merkle tree
  • To concisely prove the validity of data being part of a dataset without storing the whole data set
  • To ensure the validity of a certain data set being inclusive in a larger data set without revealing either the complete data set or its subset.

Merkle trees make extensive use of one way hashing.

Merkle proofs are established by hashing a hash’s corresponding hash together and climbing up the tree until you obtain the root hash which is or can be publicly known.

Given that one way hashes are intended to be collision free and deterministic algorithms, no two plaintext hashes can/should be the same.

Merkle proofs are better explained with the following example.

In order to verify the inclusion of data [K], in the merkle tree root, we use a one way function to hash [K] to obtain H(K).

In order to validate the inclusivity of K, K doesn’t have to be revealed, similarly the hash of data L can be revealed without any implicit security repercussions and so on.

H(K) when hashed with the hash of the unknown dataset L, yields H(KL).
H(KL) hashed with H(IJ) leads to H(IJKL).
H(IJKL) hashed with H(MNOP) leads to H(IJKLMNOP)
H(IJKLMNOP) when hashed with H(ABCDEFGH) yields H(ABCDEFHGIJKLMNOP) which happens to be our publically available merkle root.

We’ve hence proven that the data set K is indeed present in our merkle tree by making use of H(L), H(IJ), H(MNOP) and H(ABCDEFGH) without having to reveal K or any of the data.

In order to obtain a merkle proof of H, we need H(L), H(IJ), H(MNOP) and H(ABCDEFGH) with which we can together obtain H(ABCDEFHGIJKLMNOP) hence proving that H(K) was part of the merkle tree implying that data set K was indeed part of the universal dataset [A, B, C, … , N, O, P]

Merkle trees are extensively used to prove inclusivity in large datasets and majority of blockchain applications.

References:

I hope this was helpful and informative.

Thanks to erick calder for correcting the mistakes.

All the best