Skip to content

Conversation

@darosior
Copy link

@darosior darosior commented Dec 9, 2025

This is a port of instagibbs#3 for inquisition.

In draft for now until we get a BIP / BINANA number. See bitcoin/bips#1974 to track progress there.

darosior and others added 5 commits December 8, 2025 11:56
This introduces a new Script operation exclusively available in Tapscript context: OP_TEMPLATEHASH.
This operation pushes the hash of the spending transaction on the stack. See BIP xx for details.

This operation is introduced as replacing OP_SUCCESS187 (0xbb).

Co-Authored-By: Greg Sanders <[email protected]>
Sanity check the template hash by using it to commit to the transaction that must spend an output.
Malleating committed fields must lead to a consensus failure, and changing non-committed fields is
fine.

We also add the option to generate test vectors from this unit test.
We introduce one specialized target focused on exercising the new `GetTemplateHash()` logic
introduced for OP_TEMPLATEHASH, and one broader fuzz target which exercises using OP_TEMPLATEHASH
on a variety of transactions while asserting invariants.
This leverages the extensive feature_taproot.py test framework to generate coverage for the numerous
scenarii and mutations exercised there.

Additionally, a separate feature_templatehash.py functional test is introduced for end-to-end
testing of the commit-to-next-transaction use case, which does not fit nicely into the
feature_taproot.py framework (assumes input independence).
@darosior darosior marked this pull request as draft December 9, 2025 16:46
@ajtowns ajtowns added this to the 29.x milestone Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants