5 C
New York
Tuesday, April 8, 2025

merkle tree – Transaction ordering for setting up the identical merkel node from a given merkel path


Charges & reward

The order of transactions in a block doesn’t have an effect on the transaction charges or the block reward. Or vice versa.

Due to this fact, after exhausting nonce and extra-nonce and many others values for a transaction order, the miner can range the order of unconfirmed transactions in a block template with out the miner needing any change to the coinbase transaction (at place 1).

As you say, altering the order of transactions means the miner has to recalculate the Merkle root. However till a block is printed with a particular transaction order, nobody else is aware of or cares about prior unsuccessful transaction orders.


Merkle proof / Merkle path

A skinny shopper can verify if a transaction is in a block with out understanding in regards to the contents or ordering of virtually all different transactions within the block.

Here is an instance of a Merkle tree calculated from a block of 11 transactions.


                                      da07
                    ┌──────────────────┴────────────────┐
                   7460                                f94a
          ┌─────────┴─────────┐                   ┌─────┴─────┐
         b5fb                87fd                fcc1        fcc1*
     ┌────┴────┐         ┌────┴────┐         ┌────┴────┐
    0238      5ed3      8fca      1013      ee23      8c51
  ┌──┴──┐   ┌──┴──┐   ┌──┴──┐   ┌──┴──┐   ┌──┴──┐   ┌──┴──┐
 95cd 709b 27ca 1f3c 41b6 a8c0 d20a 281b df74 3e81 3ebc 3ebc*


Supply: Reference 3 under. Observe {that a} duplicate hash is inserted if there’s an odd variety of transactions (3ebc*), or an odd variety of hashes (fcc1*) at any stage of the tree.

To show transaction 41b6 is in block da07 we solely want Merkle path a8c0 1013 b5fb f94a. We do not care in regards to the worth or order of 95cd and 709b and many others.

                                    da07
                    ┌──────────────────┴────────────────┐
                   7460                                𝗳𝟵𝟰𝗮
          ┌─────────┴─────────┐                   ┌─────┴─────┐
         𝗯𝟱𝗳𝗯                87fd                ····        ····
     ┌────┴────┐         ┌────┴────┐         ┌────┴────┐
    ····      ····      8fca      𝟭𝟬𝟭𝟯      ····      ····
  ┌──┴──┐   ┌──┴──┐   ┌──┴──┐   ┌──┴──┐   ┌──┴──┐   ┌──┴──┐
 ···· ···· ···· ···· 𝟜𝟙𝕓𝟞 𝗮𝟴𝗰𝟬 ···· ···· ···· ···· ···· ····

Observe that we will do that verify with none must know the variety of transactions within the block. From the size of the Merkle path we solely know it’s someplace between 9 and sixteen transactions, however that is unimportant.


References:

  1. How is a Merkle tree path generated? (stackoverflow.com)
  2. Why is the complete Merkle path wanted to confirm a transaction?
  3. Merkle Tree, a easy clarification and implementation (Jeremy Then, medium.com)

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles