get http://localhost:3000/blocks//transactions//merkle
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:
- proofHash = hash (leaf).
- 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).
- Repeat 2. for every item in the merklePath list.
- 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.