2

https://blog.ethereum.org/2015/11/15/merkling-in-ethereum/ :

If the light client wants to determine the status of a transaction, it can simply ask for a Merkle proof showing that a particular transaction is in one of the Merkle trees whose root is in a block header for the main chain.

enter image description here

Please note that image is taken from reference 1.

Verification of a Merkle path proceed from the leaf node to the Merkle root.

As seen from the example image, we actually could not know that transaction-3 is located under that specific block and leaf-node since a light client only downloads the merkle root.

[Q] How could we determine that a particular transaction in which block's Merkle tree and Merkle tree's which leaf node? In order to determine the status of that transaction should we iterate through all blocks in the blockchain until we find the specific transaction? And when we find its block number, how could be actually determine its leaf node.

Thank you for your valuable time and help.

(1) https://blog.ethereum.org/2015/11/15/merkling-in-ethereum/

1

As seen from the example image, we actually could not know that transaction-3 is located under that specific block and leaf-node since a light client only downloads the merkle root

As a light client, you would be given the branch/path of the tree which corresponds to the transaction you wish to know about, not just the merkle root. By giving you the transaction itself, and the branch of the tree, it lets you verify that the transaction was indeed part of that merkle root. Otherwise there is no way to tell, it is not possible to extra transaction IDs from a merkle root without being given the tree of transactions themselves. A merkle root is just a hash, a 'summary' and commitment to the transactions, it doesn't actually contain any information.

  • As I understand with the merkle root, we should also have/store the 'branch/path' for all the transactions under each block? that will eventually help us to verify the transaction. @MeshCollider♦ – alper Dec 6 '17 at 18:27
  • 1
    The merkle tree is always determined by the order of the transactions in the block, you don't need to store it separately unless you want to save a bit of time :) – MeshCollider Dec 6 '17 at 22:12
  • 1
    What do you mean by "The merkle tree is always determined by the order of the transactions in the block"? @MeshCollider♦ – alper Dec 24 '17 at 12:53
  • @Alper the order of the transactions is the same as the order of the leaf nodes in the merkle tree – MeshCollider Dec 24 '17 at 12:58
  • Got it. I get lost about. For example: I am a light-client or full-client. There is thousands of TXs on the blockchain. When we want to validate one Tx, should we iterate all blocks on the blockchain or do we know the exact block-number of the each Tx, where we can focus on that block to check Tx's validity? @MeshCollider♦ – alper Dec 24 '17 at 13:01
0

From a previous Stack answer.

"We start with just our transaction and its sibling (if it has one) and calculate the hash of those two and verify that it matches the expected value. From that we can ask for the sibling branch of that and calculate the hash of that and verify it. And continue with this process, up the tree. Which only takes ten verifications for 868 transactions. (That's one of the great things about trees, they can hold a lot of values with only a relatively small number of layers.)"

So if we start at TX3, we can work our way up the tree to the merkle root and verify that the transaction took place.

  • I guess you did not get my question. How could we know that Tx-3 located under that specific block? – alper Dec 5 '17 at 16:58

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.