1

Suppose I have Merkle Tree with Transactions 'A','B','C','D','E','F' and I want to know how to check if particular transaction i.e 'A' exists in a Tree or not ?. And if it is present then how to traverse using root hash to the node with transaction 'A' ?

3

A Merkle tree is just a particular way of hashing a list of elements. In this application, the elements are transactions.

Finding something in a Merkle tree is just looking through the list. The Merkle structure does not help you.

However, what you can do with a Merkle tree is create a compact proof that a particular element is included (by giving the hashes higher up in the tree it is combined with).

So to summarize: you don't use a Merkle tree for searching. You use it to prove things are in it. This means the searching can be outsourced: if some (software) party tells you about a piece of data that allegedly belongs to a tree, instead of checking it for yourself (which requires having the tree), you can ask for a proof (which can be verified by only having the root).

| improve this answer | |
1

You cannot tell just by looking at the root hash. If you have the entire tree, you would have to look through the leaf nodes and see if one of them is A. Each step up the tree involves hashing which is a one-way function, there is no way to see which two things made up the hash.

| improve this answer | |

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