1

I am confused with the block chaining, as i know a block header contains a reference to the previous block header hash with the merkle root and other fields. This header hash is related (computed) to the header and not including the block of transactions, so if the header is tampered the chain will fail. I understood that, but if the transactions in the block are edited, it will not change the header hash only if the merkle root is re-calculated.

My question is when a node receive a block, how it verifies it (just rehashing the header, or recalculating merkle root first then rehashing the header)?

1

Merkle root is a part of the block header and is calculated based on the transactions included in the block. If transactions in the block are changed, it would change the merkle root in the header. If the merkle root is changed, the block header will change and the header hash which was calculated initially will no longer be valid.

When a node receive a block, how it verifies it (just rehashing the header, or recalculating merkle root first then rehashing the header)?

When a full node receives a block it performs various checks to ensure the block conforms to the consensus rules. This includes checking that all the transactions in the block are valid. If any particular transaction is not valid, then the entire block will be rejected by the full node. After verification of the transactions, the full node would verify the merkle hash. Then full node will look at the block header and verify the timestamp rule, previous block hash, and other components and then calculate the block header hash and check if it is less than the target. If one of the verification rules fail, the node will reject the block. You can find a complete list of block verification rules here.

  • ok i got it now, i was missing these verification rules. You were talking about full nodes, what about other simple nodes, do they do these verifications too ? – anis herbadji Apr 15 at 9:34
  • Simple Payment Verification (SPV) nodes that many lightweight wallet uses, downloads only the block headers and not the transactions included in each block. SPV nodes rely on a slightly different method of verification and banks on peers to provide partial views of the relevant parts of the blockchain on demand. SPV nodes link the transaction and the block containing it using Merkle path. Thus it does not have full visibility of the blockchain, but however, it cannot be fooled into assuming that a transaction is included in a block when in fact it isn't. – Ugam Kamat Apr 15 at 9:45

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.