4

If you receive a block, how can you tell whether the witness data has been tampered with between when it was mined and when you received it?

Where in the block is the wtxid root, and how do you compute the merkle root of the witness data?

1 Answer 1

3

Quoting from BIP141:

The commitment is recorded in a scriptPubKey of the coinbase transaction.

and

A witness root hash is calculated with all those wtxid as leaves, in a way similar to the hashMerkleRoot in the block header.

Indeed, the witness merkle root seems to be computed in a similar way than the hash merkle root, since it calls the same function.

I guess you can just check if the witness data has been tampered with by just computing the witness root hash yourself and checking that it matches the stored one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.