Skip to content

Instantly share code, notes, and snippets.

@geoboom
Last active April 25, 2022 22:49
Show Gist options
  • Save geoboom/918f4edf12afb8d382bdeca5d9668e7a to your computer and use it in GitHub Desktop.
Save geoboom/918f4edf12afb8d382bdeca5d9668e7a to your computer and use it in GitHub Desktop.

Bitcoin Week 2

Question: How do blocks commit to witness data?

Witness in Bitcoin transaction refers to contents of signature scripts which prove the authenticity of a transaction. Blocks commit to witness data via putting the witness commitment into an output of the coinbase transaction.

  • Witness commitment = combined hash of witness root hash and witness reserved value.

  • Witness root hash = merkle root of witness txids (wtxids) of all transactions in the block.

  • wtxid = hash of transaction including the witness if exists.

@gefranco
Copy link

Aditional Questions:

Why was it decided to use this kind of arrangement?

This was chosen because as the coinbase transaction does not consume any UTXO as an input, there is an extra space that could be used for this purpose and doing this way avoids any kind of hard fork. Otherwise the header structure of the block would need to be modified and doing this change would be only possible through a hard fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment