Skip to content

Commit de73f71

Browse files
committed
Import some sections from BIP-360, improve flow
1 parent 41213bd commit de73f71

File tree

1 file changed

+46
-30
lines changed

1 file changed

+46
-30
lines changed

bip-xxxx.mediawiki

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-???
88
Status: Draft
99
Type: Standards Track
10-
Created: 2025-6-21
10+
Created: 2025-10-26
1111
License: BSD-3-Clause
1212
</pre>
1313

@@ -30,27 +30,33 @@ This document is licensed under the 3-clause BSD license.
3030

3131
Motivation for making Bitcoin quantum resistant is given in [https://github.com/bitcoin/bips/blob/master/bip-0360.mediawiki BIP-360]
3232

33-
=== Rationale ===
33+
=== Design ===
3434

35-
Based on these design principles in [https://github.com/bitcoin/bips/blob/master/bip-0360.mediawiki BIP-0360]. In this BIP we enable tapscript programs to verify two Post-Quantum (PQ) signature algorithms, ML-DSA (CRYSTALS-Dilithium) and SLH-DSA (SPHINCS+).
36-
We choose to use the SHA-256 variant of SLH-DSA rather than the SHA-3 variant as dedicated SHA-256 instructions make it far more performant on mobile devices.
35+
In this BIP we enable tapscript programs to verify two Post-Quantum (PQ) signature algorithms, ML-DSA (CRYSTALS-Dilithium) and SLH-DSA (SPHINCS+) via the addition of four new opcodes.
36+
For each signature algorithm we define two new opcodes, an OP_CHECKSIG equivalent and an OP_CHECKSIGADD equivalent.
37+
These opcodes preserve the behavior of OP_CHECKSIG and OP_CHECKSIGADD opcodes applied to a new PQ signature algorithm.
38+
We define four new opcodes: OP_CHECKSIG_SLH, OP_CHECKSIGADD_SLH, OP_CHECKSIG_ML, and OP_CHECKSIGADD_ML.
3739

38-
The addition of PQ signatures to tapscript used in tandem with [https://github.com/bitcoin/bips/blob/master/bip-0360.mediawiki BIP-0360] provides Bitcoin
39-
transactions that fully resist quantum attacks.
40-
Additionally PQ signature opcodes can be used in P2TR outputs.
41-
However PQ signature opcodes in P2TR outputs would only provide quantum resistance if the key-spend paths will be disabled in P2TR.
40+
These opcodes will only be available in tapscript and can be used with P2TSH (Pay-to-Tapscript-Hash), P2TR (Pay-to-Taproot) and any future Tapscript supporting output types.
41+
When used in tandem with P2TSH (Pay-to-Tapscript-Hash) [https://github.com/bitcoin/bips/blob/master/bip-0360.mediawiki BIP-0360], this enables Bitcoin transactions that fully resist quantum attacks.
42+
This includes both short-exposure and long-exposure attacks.
43+
These opcodes can be used in P2TR outputs, however they would not provide quantum resistance due to P2TR key-spend paths being vulnerable to quantum attacks.
44+
If at some point in the future P2TR key-spend paths were to be disabled, then these opcodes enable P2TR to also provide quantum resistance.
4245

43-
Consider the P2QRH or P2TR output with three tapscripts:
46+
=== Rationale ===
4447

45-
* Spend requires a Schnorr signature
46-
* Spend requires a ML-DSA signature
47-
* Spend requires a SLH-DSA signature
48+
We used the following principles to guide our rationale and design decisions:
4849

49-
One intent in supporting Schnorr, ML-DSA, and SLH-DSA in tapscript is to allow parties to construct outputs such that funds are still secure even if two of the three signature algorithms are completely broken.
50-
In the event that Schnorr signatures are broken, users can spend their coins using ML-DSA.
51-
If both Schnorr and ML-DSA are broken, the user can still rely on SLH-DSA.
52-
This is motivated by the use case of securely storing Bitcoins in a cold wallet for very long periods of time (50 to 100 years).
50+
'''Minimize changes.''' We should reuse existing Bitcoin code and preserve existing software behavior, workflows, user expectations and compatibility whenever possible.
51+
52+
'''Use standardized post-quantum signature algorithms.''' Standardized algorithms have undergone the most scrutiny and are likely to be most well supported and well studied going forward. The entire Bitcoin ecosystem will benefit
53+
from using the most popular post-quantum signature algorithms, including leveraging hardware acceleration instructions, commodity trusted hardware, software libraries and cryptography research.
5354

55+
'''Provide security against unexpected cryptanalytic breakthroughs.''' Consider the risk if Bitcoin only supported one PQ signature algorithm, and then following the widespread rollout of CRQCs, a critical
56+
weakness is unexpectedly discovered in this signature algorithm.
57+
There would be no safe algorithm available.
58+
We believe that prudence dictates we take such risks seriously and ensure that Bitcoin always has at least two secure signature algorithms built on orthogonal cryptographic assumptions. In the event one algorithm is broken, an alternative will be available. An added benefit
59+
is that parties seeking to securely store Bitcoin over decades can lock their coins under multiple algorithms, ensuring their coins will not be stolen even in the face of a catastrophic break in one of those signature algorithms.
5460

5561
==== Algorithm Choice ====
5662

@@ -59,6 +65,7 @@ Of these three algorithms, SLH-DSA has the largest signature size, but is the mo
5965
Both FN-DSA and ML-DSA signatures are significantly smaller than SLH-DSA signatures but are based on newer lattice-based cryptography.
6066
Since ML-DSA and FN-DSA are both similar lattice-based designs, we choose to only support one of them as the additional value in diversity of cryptographic assumptions would be marginal. It should be noted that ML-DSA and FN-DSA do rely on different lattice assumptions and it may be that case that a break in one algorithm's assumptions would not necessarily
6167
break the assumptions used by the other algorithm.
68+
We choose to use the SHA-256 variant of SLH-DSA rather than the SHA-3 variant as dedicated SHA-256 instructions make it far more performant on mobile devices.
6269

6370
We also considered SQIsign.
6471
While it outperforms the three other PQ signature algorithms by having the smallest signatures,
@@ -71,6 +78,21 @@ SLH-DSA has a radically different design and set of cryptographic assumptions th
7178
P2TSH, ML-DSA, and SLH-DSA could be activated simultaneously in a single soft fork or P2TSH could be activated first and then ML-DSA and SLH-DSA could be independently activated.
7279
If at some future point another signature algorithm was desired it could follow this pattern.
7380

81+
==== Multi-Algorithm Security ====
82+
83+
Consider the P2TSH or P2TR output with three tapscripts:
84+
85+
* Spend requires a Schnorr signature
86+
* Spend requires a ML-DSA signature
87+
* Spend requires a SLH-DSA signature
88+
89+
One intent in supporting Schnorr, ML-DSA, and SLH-DSA in tapscript is to allow parties to construct outputs such that funds are still secure even if two of the three signature algorithms are completely broken.
90+
In the event that Schnorr signatures are broken, users can spend their coins using ML-DSA.
91+
If both Schnorr and ML-DSA are broken, the user can still rely on SLH-DSA.
92+
This is motivated by the use case of securely storing Bitcoins in a cold wallet for very long periods of time (50 to 100 years).
93+
94+
==== Activation ====
95+
7496
We consider two different paths for activating PQ signatures in Bitcoin. The first approach is to redefine OP_SUCCESSx opcodes for each signature algorithm.
7597
For ML-DSA this would give us OP_CHECKSIG_ML and OP_CHECKSIGADD_ML.
7698
The second approach is to use a new tapleaf version that changes the OP_CHECKSIG opcodes to support the new PQ signature algorithms.
@@ -90,8 +112,6 @@ In the OP_SUCCESSx case, the increased size limit would only be in effect for tr
90112
Otherwise this stack element size limit increase would be a soft fork.
91113
If the tapleaf version is used, then the stack element size limit increase would apply to any tapscript program with the new tapleaf version.
92114

93-
94-
95115
==== Raising tapscript's stack element size ====
96116

97117
A problem faced by any attempt to add PQ signatures to tapscript is that the stack elements in tapscript can not be larger than 520 bytes because the MAX_SCRIPT_ELEMENT_SIZE=520. This is programmatic because PQ signature algorithms often have signatures and
@@ -115,7 +135,6 @@ Note this change to OP_DUP is not consensus critical and does not require any so
115135
As OP_DUP isn’t the only opcode which duplicates stack elements, we would also need to extend this to all opcodes that duplicate stack elements.
116136
The opcodes which must have a limitation added are: OP_DUP, OP_2DUP, OP_3DUP, OP_DUPIF, OP_TUCK and OP_OVER, OP_2OVER, OP_PICK, and OP_TUCK.
117137

118-
119138
==== Public keys larger than 520 bytes ====
120139

121140
Turning our attention to public keys larger than 520 bytes.
@@ -136,7 +155,7 @@ tapscript = [OP_PUSHDATA HASH256(expected_pubkey), OP_CHECKSIG_ML]
136155
</source>
137156

138157
1. OP_PUSHDATA HASH256(expected_pubkey) updates the stack to [HASH256(expected_pubkey), pubkey||signature]
139-
2. OP_CHECKMLSIGVERIFY pops HASH256(expected_pubkey) and pubkey||signature, checks HASH256(expected_pubkey) == pubkey and verifies signature against pubkey.
158+
2. OP_CHECKSIG_ML pops HASH256(expected_pubkey) and pubkey||signature, checks HASH256(expected_pubkey) == pubkey and verifies signature against pubkey.
140159

141160
This approach has four benefits: First, it does not necessitate altering OP_PUSHBYTES so that it can push objects larger than 520 bytes onto the stack.
142161
This allows us not to have to reason about any complex consequences of such a change. Second, it allows the large public keys used by ML-DSA to make use of the witness discount.
@@ -146,13 +165,14 @@ To explain this third benefit, let's look at an example. Consider a 1-of-3 multi
146165
If we commit to the entire public key in the tapscript, the script contains three 520 byte public keys despite only needing to verify one public key.
147166
If we commit only to the 32-byte hash of the public key, we would only need to include three 32-byte hashes, and then only include the single 520-byte public key in the witness input stack.
148167

168+
149169
==== Future considerations ====
150170

151171
TBD
152172

153173
== Specification ==
154174

155-
We define the PQ signature op codes as follows:
175+
We define the PQ signature opcodes as follows:
156176

157177
SLH_DSA opcodes:
158178
OP_CHECKSIG_SLH - OP_SUCCESS127
@@ -163,14 +183,14 @@ OP_CHECKSIG_ML - OP_SUCCESS129
163183
OP_CHECKSIGADD_ML - OP_SUCCESS130
164184

165185

166-
In progress
186+
TBD
167187

168188

169189
=== Compatibility with tapscript ===
170190

171-
These op codes will be activated in tapscript. Any output that evaluates tapscript will be able to make use of them.
191+
These opcodes will be activated in tapscript. Any output that evaluates tapscript will be able to make use of them.
172192

173-
=== Security ===
193+
== Security ==
174194

175195
==== SHL-DSA ====
176196

@@ -197,13 +217,9 @@ Developers can choose to implement support for multiple algorithms in wallets an
197217

198218
==== Backward Compatibility ====
199219

200-
Older wallets and nodes that have not been made compatible with op codes will treat them as OP_SUCCESSx opcodes.
201-
202-
The op codes added here will be fully compatible with tapscript and will be available in all P2TR and P2QRH.
203-
204-
== Security ==
220+
Older wallets and nodes that have not been made compatible with opcodes will treat them as OP_SUCCESSx opcodes.
205221

206-
222+
The opcodes added here will be fully compatible with tapscript and will be available in all P2TR and P2TSH.
207223

208224
== Test Vectors and Reference Code ==
209225

0 commit comments

Comments
 (0)