What is the definition of "control block" in the context of Taproot?
It is referred to in standard.cpp in the Bitcoin Core repo and in BIP 341.
Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It only takes a minute to sign up.
Sign up to join this communityWhat is the definition of "control block" in the context of Taproot?
It is referred to in standard.cpp in the Bitcoin Core repo and in BIP 341.
There are two possible ways of spending a Taproot output:
When spending through the script path, the signer has to provide a number of pieces of data to let their spend be verified:
The tweak itself is not revealed. It is recomputed by the verifier from the revealed script, leaf version, and internal key. Then it is verified that tweaking the internal key with that tweak matches the public key in the output being spent.
This brings us to the question of how all this information is encoded in the spending input's witness stack:
The control block is the data required to prove that a specific script is within the Taproot tree (script path).
Murch defines the control block here (replacing "inner key" with "internal key"):
When a fallback to the backup key is necessary, the existence of the Taproot tree must be revealed. If there is only a single leaf, the spender provides only the internal key. Tweaking the internal key with the hashed leaf results in the public key. In sum, the data necessary to prove the existence of a script path is called the control block.
BIP 341 adds additional details on the "control block":
The last stack element is called the control block c, and must have length 33 + 32m, for a value of m that is an integer between 0 and 128, inclusive. Fail if it does not have such a length.
To prove D (the hash of a particular script) is in the Taproot tree, the control block would need to contain the following data in this order:
<control byte with leaf version and parity bit> <internal key p> <C> <E> <AB>
To prove D is in the Taproot tree you need to be able to hash up to the Merkle root (ABCDE) and to do that you need to hash C with D, then E with CD, and then AB with CDE.