Opening this here for wider discussion and feedback.
edit: Probably need to add implementation section: https://github.com/instagibbs/bitcoin/tree/2025-07-op_templatehash
Opening this here for wider discussion and feedback.
edit: Probably need to add implementation section: https://github.com/instagibbs/bitcoin/tree/2025-07-op_templatehash
Some previous related discussions:
I'm afraid I'm going to write a lot and say very little, but I have a few thoughts maybe worth sharing. TL;DR I like this proposal. As-is I prefer it slightly over CTV, but I think committing to the annex may be undesirable, and it's worth further discussion (as much as I'd like to avoid excessive bikeshedding).
The improvements on CTV are obvious, pushing the hash onto the stack is better, leveraging only cached intermediate hashes is better.
Dropping the scriptSig commitment seems debatable, but I accept the given rationale for omitting it. Furthermore, CTV's scriptSig commitment introduces a new variable length chunk of data to hash.
The annex commitment is of course the most controversial addition. On the one hand, it is incredibly useful to eltoo style protocols, and TEMPLATEHASH commits to similar items as the taproot sighash, which includes the annex. On the other hand, the annex is the only witness item committed to, and there are plausible conflicts with future annex usage. I have to plead ignorance on the future annex usage issues, I can only say it seems plausible. Furthermore, it could be desirable to commit to only part of the annex, which is not permitted by TEMPLATEHASH, and developing a structured annex format adds a significant development dependency to TEMPLATEHASH.
I can imagine, for example, that CISA might leverage the annex to set the order of public keys in an aggregate key. In this scenario, committing to the entire annex ahead of time would prevent using CISA, though once again I confess I don't know what such a scheme would actually look like.
My instinct here is to reduce the scope of TEMPLATEHASH. When in doubt, leave it out (how can it be wrong if it rhymes?) I could envision a future OP_TEMPLATEHASH_ANNEX if annex commitments proved to be that desirable, but at present it seems to me like the practical motivation for committing to the annex is entirely around eltoo, and there's a non-zero chance it could conflict with other annex usages.
On the other hand, introducing a future OP_TEMPLATEHASH_NO_ANNEX would be similarly simple if the annex commitment proved to be a problem, and OP_TEMPLATEHASH (with annex) would be immediately useful for, and remain useful for eltoo style constructions.
This is why I'm ok with the proposal as-is, if the annex commitment proves to be a mistake, it can still serve a useful purpose now and into the future, and a second opcode could be introduced to address the annex-less case.
I'd like to very tentatively float another way to dodge the annex issue: a hash selector bitfield. To this, instagibbs said something like "why not go full TXHASH then?" Unlike TXHASH which has a huge amount of flexibility, a bitfield that permits choosing to commit to all or none of the sequences, all or none of the outputs, and all or none of the annex should not change the stopping point. One could also leverage the other five bits of a 1 byte stack item to potentially commit to the first N<32 outpoints, to support the sibling commitments. This last one in particular changes the performance profile of TEMPLATEHASH by an order of magnitude (though 5 bits is arbitrary, it could be 1, it could be 32) and drastically increases the surface area to consider, but it might be worth considering if it's useful enough to the BitVM crowd. (The sibling commitment might be well past the point of "we should just go full TXHASH" however)
I can say that for me, committing to all of the outputs but none of the input sequences (and therefore not the input count) would be very useful for one of my projects which currently uses a deleted key ALL|ANYONECANPAY signature.
Today one can use the script PUSHDATA2 0x0802 <520 bytes> DUP SHA256 DROP to hash 520 bytes, requiring a 526 byte script. Repeating DUP SHA256 DROP can cause a verifier to hash 520 more bytes. You can cause a verifier to hash hashed_bytes(n) = 520 * n bytes for a script of script_len(n) = 523 + 3 * n bytes.
With TEMPLATEHASH as proposed and implemented, one can use the script 1 TEMPLATEHASH DROP to hash 109 bytes. Repeating TEMPLATEHASH DROP can cause a verifier to hash 109 more bytes. Therefore, you can cause a verifier to hash hashed_bytes(n) = 2 * n bytes for a script of script_len(n) = 2 * n bytes.
At exactly n = 80, the SHA256 script will hash 41600 bytes with a 763 byte script. TEMPLATEHASH on the other hand, will hash only 41529 bytes with a 763 byte script, and the SHA256 script's worst case hashing will get considerably worse from there.
Less naively, one can use the script PUSHDATA2 0x0802 <520 bytes> 3DUP SHA256 DROP SHA256 DROP SHA256 DROP to hash 1560 bytes, requiring a 530 byte script. Repeating 3DUP SHA256 DROP SHA256 DROP SHA256 DROP will cause a verifier to hash 1560 more bytes. This works out to hashed_bytes(n) = 1560 * n bytes for a script of length script_len(n) = 523 + 7 * n bytes.
Similarly, the TEMPLATEHASH abusing script can be made more efficient with 1 TEMPLATEHASH TEMPLATEHASH 2DROP to hash 218 bytes. Repeating TEMPLATEHASH TEMPLATEHASH 2DROP can cause a verifier to hash 218 more bytes. Therefore you can cause a verifier to hash hashed_bytes(n) = 218 * n bytes for a script of length script_len(n) = 1 + 3 * n bytes.
The less naive SHA256 script will hash 57720 bytes in 782 script bytes, and the less naive TEMPLATEHASH hashes 56898 bytes in 784 script bytes. Once again, beyond this point, the SHA256 script is worse, therefore at the limit of script size, the SHA256 script will be worse.
I suppose all of that is to say "This is strictly less hashing than is necessary for other existing operations." seems correct, assuming there aren't more clever pathological scripts. Furthermore, the result of TEMPLATEHASH would be trivial to cache, while the result of DUP SHA256 DROP would be more difficult.
the
TEMPLATEHASHabusing script
Wouldn't the hash naturally be cached in implementation?
Thanks for the feedback @Ademan.
as much as I'd like to avoid excessive bikeshedding
Some amount of bikeshedding is justified for a proposal as consequential as a consensus change. :)
annex commitment
If i understand correctly, your criticism is that while committing to the annex is very useful for the flagship usecase of this proposal, this may clash with potential future usages of the annex. That on its own i don't think is a valid reason not to have the annex commitment, if only because you can make the same argument in the other direction: not committing to the annex would be a design mistake as it allows to be forward-compatible with future usages of the annex, and is already provably useful for some of the main applications enabled by this proposal.
To substantiate your point you bring up that the annex would be the only witness element committed to by TEMPLATEHASH and that it might be useful for CISA. But the annex is different from other witness elements, it was a new field expected to be useful precisely because it is committed to by signatures. In this sense, it's the only witness element committed to by TEMPLATEHASH in the same way it is by CHECKSIG/CHECKSIGADD today. Now, i don't quite understand your point about CISA. You present a scenario where "committing to the entire annex ahead of time would prevent using CISA", but in this case it would also prevent any other opcode that commits to the transaction, like the signature opcodes. If those needs to be re-designed (new pubkey types?) then it seems fine to do TEMPLATEHASH along with it. And until then, i'd much rather the opcodes that commit to a transaction be consistent with each other.
As more of a general point, i think starting from CTV to analyze TEMPLATEHASH is the wrong way to approach this. We should start from what we want to enable and argue the best way to achieve it. If what we want to enable is committing to a transaction, then since Taproot the annex is just another transaction field that should be committed to.
Wouldn't the hash naturally be cached in implementation?
In the Taproot signature hash (which this proposal re-uses), various parts of the transaction are pre-hashed such that the hash can be cached across signatures. For each signature, those pre-computed hashes are hashed together along with some fixed-size transaction fields, such that the maximum amount of data hashed per signature is capped: https://github.com/bitcoin/bips/blob/87f3fe164484f73c30cdb122481bed96a1f79af9/bip-0341.mediawiki#L128
This final hash is pointless to cache, because other opcodes let you hash strictly more arbitrary (i.e. uncachable) data (and even have less restrictions on them).
The Annex Commitment
Clearly, I think, this is the most debatable point precisely because there isn't widespread use (or demand yet) for such space.
the practical motivation for committing to the annex is entirely around eltoo
Any scheme that wants to shift from sign-time OP_RETURN to witness data may want to use it in the same manner. It's my fault for making ln-symmetry the go-to during discussion. Granted, this is a fairly minimal improvement, and can be done by many other means with CSFS and friends, or just eating the OP_RETURN cost.
In the end, "Any annex scheme that is compatible with OP_CHECKSIG(ADD) is compatible with OP_TEMPLATEHASH" seems the most straight-forward and least foot-gunny to me.
Crazy Talk
I feel like without a specific proposal, we're going to miss the real costs in terms of complexity.
I'm also worried that if a proposal becomes "general purpose" without actually being general, it won't capture the behavior we actually want, with respect to "programmable money".
(The sibling commitment might be well past the point of "we should just go full TXHASH" however)
No BitVM bridge has launched, and the space is moving very very fast. It's on my docket to try to learn more about the fundamental requirements of these systems to transition from permissioned systems to permissionless for both safety of funds and unilateral exit (these are different concepts IIUC), but I think this is out of scope, and the answer may be "we need GSR / btclisp / Simplicity" and stop trying to guess what specific systems need? I have plenty of controversial thoughts on this but seems way out of scope here, unless we find the next-tx capability and rebindable signatures insufficient motivation for a softfork.
My take on the annex is as long as there is no clear potential use for the annex proposed, treating it consistently seems to make the most sense. We treat it exactly like the taproot sighashes are, so that's consistent. Take note that we're only committing the current input's annex, if the annex would be used for something that doesn't work with TEMPLATEHASH, it just means they can't be used together, which seems fine. It would also not be able to be used together with any other sighash-(all/default)-using scheme.
I feel that since new use-cases for the annex will almost certainly come with their own soft fork, they can be resolved when the time comes. You speak about CISA, which I think is a great example, but in my opinion by the time we have a solid CISA soft fork proposal, the TXHASH and TXSIGHASH ideas will hopefully also be more mature and they can solve the annex aspect more elegantly.
This proposal is trying to move the needle for simple next-tx commitment and basic rebindable signatures. Two arguably very simple features that are undeniably useful for almost all second-layer protocols currently being developed and used.
If nodes start relaying transactions with non-empty annex the result will predictably a new exogenous asset protocols and a new simpler more efficient ways to inscribe arbitrary data without the need for pre-commitment.
Unleashing the annex is a predictable footgun socially speaking.
Unleashing the annex is a predictable footgun socially speaking.
To be clear, this PR / implementation isn't about relaxing these rules for relay.
To be clear, this PR / implementation isn't about relaxing these rules for relay.
Yes, this is only relevant further down the line. I think what @Ademan was also picking at is that this proposal feels predictive direction wise.
Thanks for the feedback @Ademan.
Sure! I hope it's productive...
you can make the same argument in the other direction: not committing to the annex would be a design mistake as it allows to be forward-compatible with future usages of the annex,
From my very limited perspective, that seems considerably less likely than the opposite, but that is kind of the problem, this is ~guessing. Maybe it would be useful to at least attempt to identify concrete or partially specified proposals that use the annex. I suppose the onus is on me since I'm the one suggesting they may conflict, but you, instagibbs, steven and moonsettler are all likely closer to the people who might be working on them.
and is already provably useful for some of the main applications enabled by this proposal.
Absolutely! I just want to ensure that "it's useful" isn't overriding compatibility concerns. There are other ways to do data publication, it doesn't necessarily need to be a part of TEMPLATEHASH.
but in this case it would also prevent any other opcode that commits to the transaction, like the signature opcodes.
To be clear, I'm distinguishing between ahead of time commitment (via TEMPLATEHASH or a pre-signed transaction) and signing time commitment. Obviously with CHECKSIG{,VERIFY,ADD} you can typically modify the annex and re-sign at any point before confirmation. This is a significant difference in flexibility. (OTOH, you can also modify the non-witness portions of the TX and re-sign, but I don't accept that as an argument against committing to sequences or outputs... after all that's the whole point here.)
I think I may have been talked out of my position, but I still think it deserves some litigation (perhaps with a better advocate than I).
To give it one last go, I suspect (admittedly without evidence!) that varying annex data independently of the rest of the TX will be the norm and desirable if/when the annex finds uses besides data publication.
i think starting from CTV to analyze TEMPLATEHASH is the wrong way to approach this. We should start from what we want to enable and argue the best way to achieve it.
Fair enough, I definitely agree with the second part.
92 | + 93 | +Unlike `OP_TEMPLATEHASH`, `OP_CHECKTEMPLATEVERIFY` also commits to the scriptSig of all inputs of the spending 94 | +transaction. `OP_CHECKTEMPLATEVERIFY` gives txid stability when the committed spending transaction has a single input, 95 | +and when the scriptSig of this single input has been committed by the hash. 96 | +Taproot scriptSigs must be empty and therefore under the single input case `OP_TEMPLATEHASH` has no requirement 97 | +to commit to scriptSigs to achieve txid stability.
everytime I read through this always my biggest question is "why not commit to all script sigs being empty" or "what are the potential downsides to having multi input malleability"
would be nice to have an explanation in this to explain why this trade off is okay
Given that it doesn't ensure the "next transaction" commitment we are aiming for which includes additional hashing on top of taproot hashes already existing, it was not added to the proposal.
@instagibbs how do you feel about adding OP_SHA256TAGGED to this mix? Even with the "French CTV" it would be a pretty viable LNhance alternative I could support without any misgivings.
62 | +existing operations. 63 | + 64 | +The specific fields from the BIP341 signature message that are ommitted when computing the template hash are the 65 | +following: 66 | +- *hash_type*: this is the sighash type identifier. Only a single hash type is supported by `OP_TEMPLATEHASH`, so there 67 | + is no need to commit to such an identifier.
If that’s the case, it should be mentioned in the specification.
The specification only specifies a single hash type, I'm not sure what you mean for me to do?
I don’t see any references to sighash types in the specification section, let alone that OP_TEMPLATEHASH only supports a single hash type. What is the sighash type that you need to use with OP_TEMPLATEHASH, and shouldn’t that be mentioned in the spec?
There is no signature, so there is no sighash type byte. It is absent, so it is not part of the specification. In this paragraph we simply underline the differences with the BIP341 signature message. Because the sighash type is committed there, the difference is underlined here.
Ah, I see. The phrase “only a single hash type is supported by OP_TEMPLATEHASH” confused me in the context of hash_type being omitted, and I think the context could be made clearer. Perhaps something like:
- *hash_type*: refers to the sighash type identifier in the context of BIP341 signatures. The input for `OP_TEMPLATEHASH` is fixed, so there
is no need for a mechanism to modify the hash composition.
This comment is still unresolved and didn’t get a response, perhaps you overlooked it.
69 | + signature message, *ext_flag* is set to 0. Therefore we commit directly to *annex_present*. 70 | +- *sha_prevouts* / *sha_scriptpubkeys*: committing to these fields as is would introduce a hash cycle when the hash is 71 | + committed in the output itself. Committing to all other prevouts or scriptpubkeys would introduce hashing a quantity 72 | + of data quadratic in the number of inputs. It would also prevent spending two coins encumbered by a template hash 73 | + check in the same transaction. Finally, the flexibility of not committing to the specific coins spent is also 74 | + desirable to recover from mistakes[^no-commit-other-coins].
Wouldn’t the commitment to all of the inputs’ sequence fields, sha_sequences, indirectly commit to the count of inputs, and therefore prevent adding another input?
(Or maybe I’m misconstruing what sha_sequences exactly is, feel free to correct me in that case.)
commit to the count of inputs, and therefore prevent adding another input?
Yes, it commits to the total number of inputs. Typically this would be 1, but you can certainly have more for batching scenarios.
Right, but when your OP_TEMPLATEHASH commits to the spending transaction having a single input, you would not have the flexibility to add a second output to provide more funds, i.e., doesn’t that contradict your flexibility point?
there's an included footnote for a (weak) example with respect to value, though it doesn't apply to prevouts per se. If the other coin gets swept, you can "contribute" a new utxo to make it whole and rescue the locked funds.
It's not the primary motivation for the design decision compared to the others.
On second reading, I do see what you mean. It seems to me that this could be discussed more explicitly than such a subtle footnote.
124 | +simple test cases exercising the various fields of a transaction committed to when using `OP_TEMPLATEHASH`. The [second 125 | +one](bip-templatehash/test_vectors/script_assets_test.json) is a more exhaustive suite of tests exercising `OP_TEMPLATEHASH` 126 | +under a large number of different conditions. It reuses the [Bitcoin Core Taproot test framework][feature_taproot.py] 127 | +introduced with the implementation of BIP341. Format details and usage demonstration are available 128 | +[here](bip-templatehash/test_vectors/README.md). 129 | +
Is there already a reference implementation for this proposal? If so, please include a section linking to it.
done
0 | @@ -0,0 +1,115 @@ 1 | +``` 2 | + BIP: ? 3 | + Layer: Consensus (soft fork) 4 | + Title: OP_TEMPLATEHASH + OP_CHECKSIGFROMSTACK + OP_INTERNALKEY
Title exceeds 44 characters.
renamed for now
14 | +``` 15 | + 16 | +## Abstract 17 | + 18 | +This document proposes bundling three new operations for [Tapscript][tapscript-bip]: 19 | +[`OP_TEMPLATEHASH`][templatehash-bip], [`OP_CHECKSIGFROMSTACK`][csfs-bip], and [`OP_INTERNALKEY`][internalkey-bip].
Please include the BIP numbers for the BIPs that already exist in the text here.
done
23 | + 24 | +## Motivation 25 | + 26 | +The three proposed operations are simple, well-understood, and enable powerful new capabilities while minimizing the 27 | +risk of surprising behavior or unintended applications. They improve existing, well-studied protocols and make promising 28 | +new ones possible, while minimizing the risk of surprising behavior or unintended or undesirable applications.
This duplicates “while minimizing the risk of surprising behavior or unintended or undesirable applications.” This phrase also appears a third time below.
removed the second and third ones
25 | + 26 | +The three proposed operations are simple, well-understood, and enable powerful new capabilities while minimizing the 27 | +risk of surprising behavior or unintended applications. They improve existing, well-studied protocols and make promising 28 | +new ones possible, while minimizing the risk of surprising behavior or unintended or undesirable applications. 29 | + 30 | +`OP_TEMPLATEHASH` enables commitment to the transaction spending an output. `OP_CHECKSIGFROMSTACK` enables
“enables commitment” sounds funny to me:
`OP_TEMPLATEHASH` enables committing to the transaction spending an output. `OP_CHECKSIGFROMSTACK` enables
taken
46 | +in second layer protocols, as illustrated by the Ark variant "[Erk][ark-erk]" or the [dramatic simplification][greg-rebindable-ptlcs] 47 | +they bring to upgrading today's Lightning to [Point Time Locked Contracts][optech-ptlcs]. 48 | + 49 | +The ability to push the Taproot internal key on the stack is a natural and extremely simple optimisation for rebindable 50 | +signatures. 51 | +
This BIP appears to be missing a Specification section.
added mini implementation section for completeness
Looking at this again, I currently don’t see this document meeting the criteria for a BIP, let alone a Specification BIP.
This could for example be remedied by adding a Deployment section, even if the content were TBD.
Alternatively, I would still recommend that this document were split off from BIP 446, given that OP_TEMPLATEHASH in itself is basically ready for publication.
I would still recommend that this document were split off from BIP 446
I think OP_TEMPLATEHASH only really makes sense as part of the bundle. I'd rather take the time to clean up the bundle.
75 | +This document proposes to give meaning to three Tapscript `OP_SUCCESS` operations. The presence of an `OP_SUCCESS` in a 76 | +Tapscript would previously make it unconditionally succeed. This proposal therefore only tightens the block validation 77 | +rules: there is no block that is valid under the rules proposed in this BIP but not under the existing Bitcoin consensus 78 | +rules. As a consequence these changes are backward-compatible with non-upgraded node software. That said, the authors 79 | +strongly encourage node operators to upgrade in order to fully validate all consensus rules. 80 | +
If there is a reference implementation for this opcode package, could you please add a section that links to the corresponding code?
no current one exists, we haven't moved forward on bitcoin-inquisition with templatehash and likely won't until the BIP becomes stable
@instagibbs how do you feel about adding OP_SHA256TAGGED to this mix? Even with the "French CTV" it would be a pretty viable LNhance alternative I could support without any misgivings.
Seems out of scope here, unless I'm missing some key motivation.
Seems out of scope here, unless I'm missing some key motivation.
You came up with the motivation yourself afaik (for LN-Symmetry). It's about the whole annex/nulldata/paircommit data availability thing. It is also mildly useful for MATT stuff in a more expressive future script, otherwise it gives us a safe pair-commitment for two stack elements.
Assuming this proposal is activated as-is (as a thought experiment), even if core would be reluctant to, as proven by precedents, it would be a trivial exercise for an LSP to break the annex "filter" using the libre strategy with just a few tens of nodes. Forcing core to "face the reality of the network" and relax policy. Hence our comments on this proposal being predictive of annex use.
I don't want to waste too much time on this topic. But this is exactly why after much agonizing PC was included in LNhance.
Thanks for writing these specifications. I like the general direction and think that TEMPLATEHASH is cleaner and addresses the undesirable side-effect of CTV of accidentally enabling brother commitments using legacy Script.
One small observation is that the chosen opcode OP_SUCCESS187 (0xbb) is the same as CHECKCONTRACTVERIFY as currently specified in BIP-443, which is of course fine since they are both just proposals at this stage, but a bit of a bummer as I'm planning to make a CCV activation PR to bitcoin-inquisition imminently.
@bigspider Our bad, we can switch to another value
edit: trying to find something not colliding :sob:
0xcd is PAIRCOMMIT btw which has an implementation and activation client sort of "out there".
// Tapscript expansion
OP_INTERNALKEY = 0xcb,
OP_CHECKSIGFROMSTACK = 0xcc,
OP_PAIRCOMMIT = 0xcd,
Thanks for adopting the changes and sidestepping the collision with CCV. I’m still a bit confused as to what the bundle document is trying to be. It seems that it is perhaps a placeholder for the activation parameters, and while it does provide some additional motivation for the bundle, it feels like there is still some crunch missing here.
The TH proposals is looking pretty close to number assignment to me.
Overall, both documents could perhaps use some more reviewers?
I’m still a bit confused as to what the bundle document is trying to be
A possible alternative would be to add a Deployment section to the templatehash BIP draft that explicitly links it with bip348/349, like https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki#deployment . I'm not sure what the best thing is, but having motivating "glue" text is important. Would be curious as to what others think.
Overall, both documents could perhaps use some more reviewers?
:100:
I think a separate bundle BIP is preferable for at least two reasons:
OP_TEMPLATEHASH is useful enough on its own to warrant a soft fork. The main motivation for introducing OP_TEMPLATEHASH is because of how it interacts with OP_CHECKSIGFROMSTACK. Rebindable signatures and its possible use cases should be featured as the main motivation for the bundle. It would be awkward to have the weaker OP_TH motivations at the top of the document and then the stronger motivations for the bundle at the end of the document in a Deployment section.That said, if we can make a reasonably clear document that features both the main motivations of the proposal and the specification of OP_TH, i would be fine with that.
It isn’t that they should be combined or that the FISHSTCK proposal is a bad idea. My point is that its type is “Standards Track”, but it lacks a Specification that an implementation could be in compliance with. It therefore appears incomplete.
I didn't mean to imply you suggested that. I was just chiming in as it appeared to have been welcome above. Anyways, what would you recommend here?
Not sure, perhaps separate the two documents into different PRs. The Templatehash one is probably close to ready, and the FISHSTCK one would be draft stage and could be moved forward when there is a Specification section that describes activation or smth. Open to other ideas.
Let’s refer to the OP_TEMPLATEHASH document as BIP 446. I’d like to see some follow-up on the bundle proposal.
8 | + Comments-Summary: No comments yet. 9 | + Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-? 10 | + Status: Draft 11 | + Type: Standards Track 12 | + Created: ? 13 | + License: CC0-1.0
Please update the Preamble to comply with BIP3.
BIP: 446
Layer: Consensus (soft fork)
Title: OP_TEMPLATEHASH
Authors: Gregory Sanders <gsanders87@gmail.com>
Antoine Poinsot <mail@antoinep.com>
Steven Roose <steven@stevenroose.org>
Status: Draft
Type: Standards Track
Assigned: 2026-02-06
License: CC0-1.0
done
6 | + Antoine Poinsot <mail@antoinep.com> 7 | + Steven Roose <steven@stevenroose.org> 8 | + Comments-Summary: No comments yet. 9 | + Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-? 10 | + Status: Draft 11 | + Type: Standards Track
Authors: Gregory Sanders <gsanders87@gmail.com>
Antoine Poinsot <mail@antoinep.com>
Steven Roose <steven@stevenroose.org>
Status: Draft
Type: Specification
done
Note that the preamble needs some changes due to BIP 3 deploying.
11 | +``` 12 | + 13 | +## Abstract 14 | + 15 | +This document proposes bundling three new operations for [Tapscript][tapscript-bip]: 16 | +[`OP_TEMPLATEHASH`][templatehash-bip], [`BIP348 OP_CHECKSIGFROMSTACK`][csfs-bip], and [`BIP349 OP_INTERNALKEY`][internalkey-bip].
nit
[`OP_TEMPLATEHASH`][templatehash-bip], [BIP348 `OP_CHECKSIGFROMSTACK`][csfs-bip], and [BIP349 `OP_INTERNALKEY`][internalkey-bip].
@murchandamus i took a shot at merging the bundle document inside the OP_TEMPLATEHASH document. I think it makes sense. Here is the branch. This is just a PoC, some details need cleaning up. What do you think of this approach?
@murchandamus i took a shot at merging the bundle document inside the OP_TEMPLATEHASH document. I think it makes sense. Here is the branch. This is just a PoC, some details need cleaning up. What do you think of this approach?
Thanks for the PoC branch. I’m not excited about this approach. I like the name “Twine” for the bundle, but putting everything into one BIP muddles the scope.
I would prefer OP_TEMPLATEHASH to remain a separate document as proposed (and numbered) previously, and the bundle BIP be renamed to Twine, extended with a short and sweet Specification section that reiterates which OP_SUCCESS opcodes are used, defines the three proposals as a bundle to be activated together, and proposes a concrete deployment.
nit from when i played with merging the two documents.
From communicating out of band, my understanding is that this PR is waiting for an update from the authors to expand the content of the Twine document.
90 | + 91 | +[^large-txs-mining-centralization]: Large transactions are difficult to relay through the p2p network as they make it 92 | +harder for nodes to reason about miners' block templates. This may lead to a situation where such transactions get 93 | +submitted directly to miners. See [this discussion][sipa-large-txs] for more details. 94 | + 95 | +[templatehash-bip]: bip-templatehash.md
Missed an update post number assignment.
removed a few more
took commits from https://github.com/instagibbs/bips/pull/2
I can squash commits, just let me know
0 | @@ -0,0 +1,110 @@ 1 | +``` 2 | + BIP: ? 3 | + Layer: Consensus (soft fork) 4 | + Title: a Taproot-native (re)bindable transaction proposal 5 | + Authors: Gregory Sanders <gsanders87@gmail.com> 6 | + Antoine Poinsot <mail@antoinep.com> 7 | + Steven Roose <steven@stevenroose.org> 8 | + Status: Draft 9 | + Type: Specification
Type: Specification
Assigned: 2026-03-11
0 | @@ -0,0 +1,110 @@ 1 | +``` 2 | + BIP: ?
BIP: 448
Let’s call the bundle BIP448. Please update the file name, add the table entry, and update the preamble.
I can squash commits, just let me know
Yeah, if they are just fixups like this, please squash to a single commit (or we can do that when we merge the PR to publish the proposals).
squashed
157 | +about this input. Committing to an annex adds 32 additional bytes of data about this input, bringing the total to 109. 158 | + 159 | + 160 | +[schnorr-bip]: bip-0340.mediawidi 161 | +[taproot-bip]: bip-0341.mediawidi 162 | +[tapscript-bip]: bip-0342.mediawidi
[schnorr-bip]: bip-0340.mediawiki
[taproot-bip]: bip-0341.mediawiki
[tapscript-bip]: bip-0342.mediawiki
done
158 | + 159 | + 160 | +[schnorr-bip]: bip-0340.mediawidi 161 | +[taproot-bip]: bip-0341.mediawidi 162 | +[tapscript-bip]: bip-0342.mediawidi 163 | +[csfs-bip]: bip-0348.md
Unused link
removed, as well as others that were left over
159 | + 160 | +[schnorr-bip]: bip-0340.mediawidi 161 | +[taproot-bip]: bip-0341.mediawidi 162 | +[tapscript-bip]: bip-0342.mediawidi 163 | +[csfs-bip]: bip-0348.md 164 | +[ctv-bip]: bip-0119.md
[ctv-bip]: bip-0119.mediawiki
fixed
125 | +vectors are separated into two JSON files. The [first one](bip-0446/test_vectors/basics.json) is a short list of 126 | +simple test cases exercising the various fields of a transaction committed to when using `OP_TEMPLATEHASH`. The [second 127 | +one](bip-0446/test_vectors/script_assets_test.json) is a more exhaustive suite of tests exercising `OP_TEMPLATEHASH` 128 | +under a large number of different conditions. It reuses the [Bitcoin Core Taproot test framework][feature_taproot.py] 129 | +introduced with the implementation of BIP341. Format details and usage demonstration are available 130 | +[here](bip-0446/test_vectors/README.md).
All of these links are broken.
fixed
0 | @@ -0,0 +1,111 @@ 1 | +``` 2 | + BIP: 448 3 | + Layer: Consensus (soft fork) 4 | + Title: a Taproot-native (re)bindable transaction proposal
This works, but it’s not a particularly catchy title. Something a bit more handy would probably help this proposal get mindshare. We do see that this is "a proposal". ;)
How about at least:
Title: Taproot-native (Re)bindable Transactions
taken, @darosior can nack :P
Sure
60 | +Bitcoin payments. The operations proposed to achieve 61 | +these capabilities are contained within the more modern and well-studied Tapscript context. They are simple, composable 62 | +and unlikely to be made obsolete by future extensions to Bitcoin Script. They build upon existing operations and 63 | +therefore present a minimal cost to validation and implementation complexity. 64 | + 65 | +More modular operations (such as [BIP 346][txhash-bip]) also enable these capabilities, and more. However they come with
TXHASH was published meanwhile:
More modular operations (such as [BIP 346][bip-0346.md]) also enable these capabilities, and more. However they come with
I kept the link but updated to actual file instead of PR
43 | +`OP_INTERNALKEY` allows to push the [Taproot][taproot-bip] internal key on the stack. This is a natural and extremely 44 | +simple optimisation for rebindable signatures. 45 | + 46 | +## Specification 47 | + 48 | +In BIP 342 Tapscript, the following operations are updated. `OP_TEMPLATEHASH` redefines `OP_SUCCESS206` (0xce) as per
In [BIP 342 Tapscript](bip-0342.mediawiki), the following operations are updated. `OP_TEMPLATEHASH` redefines `OP_SUCCESS206` (0xce) as per
done
This is shaping up nicely and is pretty close to publication. I went over it again today and found that a lot of links are broken, though.
also removed the TODO in the test directory, adding the actual link
ACK