Get the merkle path for a given a transaction and block

Returns the merkle path for a transaction included in a block.
The merkle path is the minimum number of nodes needed to calculate the merkle root.

Steps to calculate the merkle root:

  1. proofHash = hash (leaf).
  2. Concatenate proofHash with the first unprocessed item from the merklePath list as follows:
  • a) If item.position == left -> proofHash = sha_256(item.hash + proofHash).
  • b) If item.position == right -> proofHash = sha_256(proofHash+ item.hash).
  1. Repeat 2. for every item in the merklePath list.
  2. Compare if the calculated proofHash equals the one recorded in the
    block header (block.transactionsHash) to verify if the transaction was included in the block.
Language
URL
Click Try It! to start a request and see the response here!