Opening this PR for feedback & discussion on the specification for OP_TWEAKADD.
Mailing list post: https://groups.google.com/g/bitcoindev/c/-_geIB25zrg
Opening this PR for feedback & discussion on the specification for OP_TWEAKADD.
Mailing list post: https://groups.google.com/g/bitcoindev/c/-_geIB25zrg
235+This proposal extends the Taproot tweak mechanism (BIP340/341) into script, inspired by prior work on scriptless scripts and key-evolution constructions. There has been various discussion of OP_TWEAKADD over the years, including by Russell O'Connor and Steven Roose.
236+
237+## References
238+
239+- [CATT: Thoughts about an alternative covenant softfork proposal](https://delvingbitcoin.org/t/catt-thoughts-about-an-alternative-covenant-softfork-proposal/125)
240+- [Bitcoindev mailing list discussion](https://gnusha.org/pi/bitcoindev/e98d76f2-6f2c-9c3a-6a31-bccb34578c31@roose.io/)
32+
33+Input (top last):
34+
35+```
36+
37+... \[h32] \[pubkey32] OP\_TWEAKADD -> ... \[pubkey32\_out]
I think these backslashes are unnecessary in the preformatted code. At least they render for me in the preview.
34+
35+```
36+
37+... \[h32] \[pubkey32] OP\_TWEAKADD -> ... \[pubkey32\_out]
38+
39+````
0@@ -0,0 +1,317 @@
1+```
2+BIP: TBD
3+Layer: Consensus (soft fork)
4+Title: OP_TWEAKADD - x-only key tweak addition
5+Author: Jeremy Rubin <jeremy@char.network>
6+Status: Draft
7+Type: Standards Track
8+Created: 2025-08-22
9+License: BSD-3-Clause
24+## Specification
25+
26+### Applicability and opcode number
27+
28+- Context: Only valid in tapscript (witness version 1, leaf version 0xc0). In legacy or segwit v0 script, `OP_TWEAKADD` is disabled and causes script failure.
29+- Opcode: OP_TWEAKADD (0xBE, or TBD, any unused OP_SUCCESSx, preferably one which might never be restored in the future).
E.g., it’s desirable to not use 0x7f because that’s OP_SUBSTR and if we ever did a soft fork like that, it’s simpler to not change those opcodes.
from bip-347:
We specifically choose to use OP_SUCCESS126 rather than another OP_SUCCESSx as OP_SUCCESS126 uses the same opcode value (126 in decimal and 0x7e in hexadecimal) that was used for OP_CAT prior to it being disabled in Bitcoin. This removes a potential source of confusion that would exist if we had a opcode value different from the one used in the original OP_CAT opcode.
0@@ -0,0 +1,315 @@
1+```
2+BIP: TBD
3+Layer: Consensus (soft fork)
4+Title: OP_TWEAKADD - x-only key tweak addition
5+Author: Jeremy Rubin <jeremy@char.network>
6+Status: Draft
7+Type: Standards Track
8+Created: 2025-08-22
9+License: BSD-3-Clause
Since BIP3 was deployed meanwhile, the preamble would need a few tweaks:
0BIP: ?
1Layer: Consensus (soft fork)
2Title: OP_TWEAKADD - x-only key tweak addition
3Authors: Jeremy Rubin <jeremy@char.network>
4Status: Draft
5Type: Specification
6Assigned: ?
7License: BSD-3-Clause
Co-authored-by: Mark "Murch" Erhardt <murch@murch.one>
8+Assigned: ?
9+License: BSD-3-Clause
10+```
11+## Abstract
12+
13+This proposal defines a new tapscript opcode, `OP_TWEAKADD`, that takes an x-only public key and a 32-byte integer `h` on the stack and pushes the x-only public key corresponding to `P + h*G`, where `P` is the lifted point for the input x-coordinate and `G` is the secp256k1 generator. The operation mirrors the Taproot tweak used by BIP340 signers and enables simple, verifiable key modifications inside script without revealing private keys or relying on hash locks.
The integer h appears to be called t in the specification section.
0This proposal defines a new tapscript opcode, `OP_TWEAKADD`, that takes an x-only public key and a 32-byte integer `t` on the stack and pushes the x-only public key corresponding to `P + t*G`, where `P` is the lifted point for the input x-coordinate and `G` is the secp256k1 generator. The operation mirrors the Taproot tweak used by BIP340 signers and enables simple, verifiable key modifications inside script without revealing private keys or relying on hash locks.
76+
77+- Even-Y x-only is consistent with BIP340/Taproot.
78+- Infinity outputs are rejected to avoid invalid keys.
79+- Functionality is narrowly scoped to Taproot-style tweaks, avoiding arbitrary EC arithmetic.
80+- Push opcode rather than verification opcode for script compactness.
81+- Argument order to permit tweak from witness onto fixed key without OP_SWAP.
Argument order to permit tweak from witness onto fixed key without OP_SWAP
This sentence is not clear to me. Perhaps it could use more context.
83+## Compatibility
84+
85+This is a soft-fork change which is tapscript-only. Un-upgraded nodes will continue
86+to treat unknown tapscript opcode as OP_SUCCESSx.
87+
88+A future upgrade, such as an OP_CAT or OP_TAPTREE opcode, can prepare a tweak for a
OP_TAPTREE? I don’t think I’ve seen that one before.
The Rationale still seems a bit brief to me, but I would expect that it would be backfilled with the responses to the questions and issues raised as this proposal gets more review. Would be great if some other covenant researchers took a look at it. Otherwise the idea generally seems well described.
cc: @brandonblack, @ajtowns, @roconnor-blockstream, @moonsettler, @Roasbeef for some likely candidates to take a look.
Without any additional opcodes the supported use cases seem to be:
Also along with #1974 TA could be used instead of the annex for data availability, by tweaking the internal key with the data required to reconstruct the script for that state.
Something like <sig> <da> | SHA256 INTERNALKEY TWEAKADD TEMPLATEHASH SWAP CSFS