You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -24,7 +24,7 @@ This document is licensed under the 3-clause BSD license.
24
24
25
25
=== Motivation ===
26
26
27
-
This proposal aims to improve the quantum resistance of bitcoin's signature security should the Discrete Logarithm Problem (DLP) which secures Elliptic Curve Cryptography (ECC) no longer prove to be computationally hard, likely through quantum advantage by Cryptographically-Relevant Quantum Computers (CRQCs). [https://arxiv.org/pdf/quant-ph/0301141 A variant of Shor's algorithm] is believed to be capable of deriving the private key from a public key exponentially faster than classical means. The application of this variant of Shor's algorithm is herein referred to as quantum key decryption. Note that doubling the public key length, such as with a hypothetical secp512k1 curve, would only make deriving the private key twice as hard. The computational complexity of this is investigated further in the paper, [https://pubs.aip.org/avs/aqs/article/4/1/013801/2835275/The-impact-of-hardware-specifications-on-reaching ''The impact of hardware specifications on reaching quantum advantage in the fault tolerant regime''].
27
+
This proposal aims to improve the quantum resistance of bitcoin's signature security should the Discrete Logarithm Problem (DLP) which secures Elliptic Curve Cryptography (ECC) no longer prove to be computationally hard, likely through quantum advantage by Cryptoanalytically-Relevant Quantum Computers (CRQCs). [https://arxiv.org/pdf/quant-ph/0301141 A variant of Shor's algorithm] is believed to be capable of deriving the private key from a public key exponentially faster than classical means. The application of this variant of Shor's algorithm is herein referred to as quantum key decryption. Note that doubling the public key length, such as with a hypothetical secp512k1 curve, would only make deriving the private key twice as hard. The computational complexity of this is investigated further in the paper, [https://pubs.aip.org/avs/aqs/article/4/1/013801/2835275/The-impact-of-hardware-specifications-on-reaching ''The impact of hardware specifications on reaching quantum advantage in the fault tolerant regime''].
28
28
29
29
The primary threat to Bitcoin by CRQCs is [https://en.bitcoin.it/wiki/Quantum_computing_and_Bitcoin#QC_attacks generally considered to be to its breaking of ECC used in signatures and Taproot commitments], hence the focus on a new address format. This is because Shor's algorithm enables a CRQC to break the cryptographic assumptions of ECC in roughly 10^8 quantum operations. While a CRQC could use [https://en.wikipedia.org/wiki/Grover's_algorithm Grover's algorithm] to gain a quadratic speed up on brute force attacks on the hash functions used in Bitcoin, a significantly more powerful CRQC is needed for these attacks to meaningfully impact Bitcoin. For instance, a preimage attack on HASH160<ref>used by P2PKH, P2SH, and P2WPKH addresses, though not P2WSH because it uses 256-bit hashes</ref> using Grover's algorithm would require at least 10^24 quantum operations. As for Grover's application to mining, see [https://quantumcomputing.stackexchange.com/a/12847 Sam Jaques’ post on this].
30
30
@@ -89,7 +89,7 @@ The Commercial National Security Algorithm Suite (CNSA) 2.0 has a timeline for s
89
89
90
90
This is the first in a series of BIPs under a QuBit soft fork. A qubit is a fundamental unit of quantum computing, and the capital B refers to bitcoin. The name QuBit also rhymes to some extent with SegWit.
91
91
92
-
It is proposed to use SegWit version 3. This results in addresses that start with bc1r, which could be a useful way to remember that these are quantum [r]esistant addresses (similar to how bc1q corresponds to Se[q]Wit and bc1p corresponds to Ta[p]root). This is referencing the lookup table under [https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32 BIP-173].
92
+
It is proposed to use SegWit version 3. This results in addresses that start with bc1r, which could be a useful way to remember that these are quantum (r)esistant addresses (similar to how bc1q corresponds to Se(q)Wit and bc1p corresponds to Ta(p)root). This is referencing the lookup table under [https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32 BIP-173].
93
93
94
94
The proposal above also leaves a gap in case it makes sense to use version 2, or bc1z, for implementation of other address formats such as those that employ Cross Input Signature Aggregation (CISA).
95
95
@@ -123,9 +123,102 @@ We first build up a definition of the signature scheme by going through the desi
123
123
124
124
=== Design ===
125
125
126
-
For P2QRH descriptors, <code>qrh()</code> should be used.
126
+
==== Descriptor Format ====
127
127
128
-
> Further specific details to be completed later in the draft process as outlined in [https://github.com/bitcoin/bips/blob/master/bip-0002.mediawiki BIP-2]
128
+
To integrate P2QRH into existing wallet software and scripts, we introduce a new output descriptor function <code>qrh()</code>. This function represents a P2QRH output, similar to how <code>wpkh()</code> and <code>tr()</code> are used for P2WPKH and P2TR outputs respectively.
129
+
130
+
The <code>qrh()</code> function takes the HASH256 of the concatenated HASH256 of the quantum-resistant public keys as its argument. For example:
This allows wallets to manage P2QRH addresses and outputs while accommodating multiple public keys of varying lengths, such as in multisig schemes, while keeping the public keys hidden until the time of spending.
137
+
138
+
139
+
==== Address Format ====
140
+
141
+
P2QRH uses SegWit version 3 outputs, resulting in addresses that start with bc1r, following [https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32 BIP-173]. This is because the Bech32 encoding maps version 3 to the prefix r.
142
+
143
+
Example P2QRH address:
144
+
145
+
<code>
146
+
bc1r... (32-byte Bech32m-encoded HASH256 of the HASH256 of the public keys)
147
+
</code>
148
+
149
+
==== ScriptPubKey ====
150
+
151
+
The <code>scriptPubKey</code> for a P2QRH output is:
152
+
153
+
<code>
154
+
OP_PUSHNUM_3 OP_PUSHBYTES_32 <hash>
155
+
</code>
156
+
157
+
Where:
158
+
159
+
* <code>OP_PUSHNUM_3</code> (<code>0x03</code>) indicates SegWit version 3.
160
+
* <code><hash></code> is the 32-byte HASH256 of the concatenated HASH256 of each public key.
* <code>marker</code>: <code>0x00</code> (same as SegWit)
179
+
* <code>flag</code>: <code>0x02</code> (indicates the presence of both witness and attestation data)
180
+
* <code>attestation</code>: Contains the quantum-resistant public keys and signatures.
181
+
182
+
==== Attestation Structure ====
183
+
184
+
The attestation field consists of:
185
+
186
+
* <code>[num_pubkeys]</code>: The number of public keys (VarInt encoded).
187
+
* For each public key:
188
+
** <code>[pubkey_length]</code>: VarInt encoded length of the public key.
189
+
** <code>[pubkey]</code>: The public key bytes.
190
+
* <code>[num_signatures]</code>: The number of signatures (VarInt encoded).
191
+
* For each signature:
192
+
** <code>[signature_length]</code>: VarInt encoded length of the signature.
193
+
** <code>[signature]</code>: The signature bytes.
194
+
195
+
This structure repeats for each input, in order, for flexibility in supporting multisig schemes and various quantum-resistant algorithms.
196
+
197
+
For each input, a separate attestation field is used. To know how many attestation fields are present, implementations must count the number of inputs present in the transaction.
198
+
199
+
The specific algorithm is determined by the size of the public key and signature, as described in the next section.
200
+
201
+
==== Signature Algorithm Identification ====
202
+
203
+
The specific quantum-resistant signature algorithm used is inferred from the length of the public key and signature. Implementations must recognize the supported algorithms and validate accordingly.
204
+
205
+
Supported algorithms and their NIST Level V parameters:
206
+
207
+
* '''FALCON-1024''':
208
+
** Public Key Length: 1793 bytes
209
+
** Signature Length: 1280 bytes
210
+
* '''CRYSTALS-Dilithium Level 5''':
211
+
** Public Key Length: 2592 bytes
212
+
** Signature Length: 4595 bytes
213
+
* '''SQIsign (NIST Level V equivalent)''':
214
+
** Public Key Length: 128 bytes
215
+
** Signature Length: 335 bytes
216
+
217
+
Implementations must reject public keys and signatures that do not match expected lengths for supported algorithms.
218
+
219
+
==== Compatibility with BIP-141 ====
220
+
221
+
By adhering to the SegWit transaction structure and versioning, P2QRH outputs are compatible with existing transaction processing rules. Nodes that do not recognize SegWit version 3 will treat these outputs as anyone-can-spend but, per BIP-141, will not relay or mine such transactions.
129
222
130
223
131
224
== Security ==
@@ -182,51 +275,114 @@ An additional consideration is security level. Longer signature sizes provide mo
182
275
183
276
How the attestation is differentiated from the witness can be accomplished similar to how [https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#user-content-Transaction_ID BIP-141] introduced the marker and flag, with the QuBit flag being set to 0x02. This means all QuBit transactions are also SegWit transactions. The additional data would be included as a second array of byte arrays following the witness stack.
184
277
185
-
The new transaction serialization format is as follows:
278
+
32-byte attestation fields are assumed to be Schnorr public keys for Taproot fields because they are ordinarily included in the spend script, but they cannot be included in P2QRH for security reasons. Public key / signature pairs for Taproot fields come before QuBit public key / signature pairs.
The exact key type is inferred by its size, as provided by the attestation variant pair, which determines whether it's processed as secp256k1 Schnorr, SPHINCS, XMSS, FALCON, or SQIsign.
188
281
189
-
QuBit spend scripts are as follows:
282
+
If the transaction fails to include the public keys needed to match the spend script hash, it is an invalid transaction because the cryptographic commitment for the keys has not been met. Consequently, only valid public keys and signatures can be included within the attestation and no other data.
190
283
191
-
* OP_PUSHNUM_3 to indicate SegWit version 3
192
-
* OP_PUSHBYTES_32
193
-
* HASH256 of the following bytes concatenated:
194
-
* HASH256 of the public key at attestation index 0
195
-
* If there are more public keys:
196
-
* All public keys are hashed via HASH256 and concatenated
197
284
198
-
In short, the new spend script serialization format is as follows:
285
+
=== Script Validation ===
199
286
200
-
OP_PUSHNUM_3 HASH256([HASH256(Public Key Bytes at Attestation Index 0)][HASH256(PK Q1)][..])
287
+
To spend a P2QRH output, the following conditions must be met:
201
288
202
-
Addresses then encode this script using bech32m.
289
+
1. The scriptPubKey must be of the form:
203
290
204
-
32-byte attestation fields are assumed to be Schnorr public keys for Taproot fields because they are ordinarily included in the spend script, but they cannot be included in P2QRH for security reasons. Public key / signature pairs for Taproot fields come before QuBit public key / signature pairs.
291
+
<code>
292
+
OP_PUSHNUM_3 <32-byte hash>
293
+
</code>
205
294
206
-
The exact key type is inferred by its size, as provided by the attestation variant pair, which determines whether it's processed as secp256k1 Schnorr, SPHINCS, XMSS, FALCON, or SQIsign.
295
+
2. The attestation must include:
207
296
208
-
If the transaction fails to include the public keys needed to match the spend script hash, it is an invalid transaction because the cryptographic commitment for the keys has not been met. Consequently, only valid public keys and signatures can be included within the attestation and no other data.
297
+
** The quantum-resistant public key(s) whose HASH256 concatenated and hashed again matches the <hash> in the scriptPubKey.
298
+
** Valid signatures corresponding to the public key(s) and the transaction data.
209
299
300
+
3. For multi-signature schemes, all required public keys and signatures must be provided for that input within the attestation. This includes classical Schnorr signatures.
210
301
211
-
=== Public Key Generation ===
212
302
213
-
TBD, pending test vectors
303
+
==== Public Key Hashing ====
214
304
215
-
=== Public Key Conversion ===
305
+
All public keys included in the attestation are hashed using HASH256 (double SHA-256). The concatenation of these hashes is then hashed again using HASH256 before being included in the <code>scriptPubKey</code>. This ensures a fixed-size commitment to potentially multiple public keys of varying lengths.
Note: This contrasts with multisig inputs, where the attestation structure repeats for each public key and signature.
226
362
227
363
=== Usage Considerations ===
228
364
229
-
TBD
365
+
==== Transaction Size and Fees ====
366
+
367
+
Quantum-resistant signatures are significantly larger than traditional signatures, increasing transaction sizes and potentially the fees required for timely confirmation. Users and wallet developers should be aware of this and plan accordingly.
368
+
369
+
For example, using CRYSTALS-Dilithium Level V, a single signature is 4595 bytes, which is substantially larger than current ECDSA or Schnorr signatures.
370
+
371
+
372
+
==== Performance Impact ====
373
+
374
+
Verification of quantum-resistant signatures will be computationally more intensive, and any attestation discount will also increase storage requirements. Node operators should consider the potential impact on resource usage, and developers may need to optimize signature verification implementations.
375
+
376
+
377
+
==== Algorithm Selection ====
378
+
379
+
Different quantum-resistant algorithms offer trade-offs between security levels, signature sizes, and performance. Users should select algorithms that provide NIST Level V security to align with the default for P2QRH.
380
+
381
+
382
+
==== Backward Compatibility ====
383
+
384
+
Older wallets and nodes that have not been updated to understand SegWit version 3 and P2QRH will not recognize these outputs. Users should ensure they are using updated wallets and nodes to use P2QRH addresses.
385
+
230
386
231
387
== Test Vectors and Reference Code ==
232
388
@@ -255,6 +411,7 @@ It is worth noting by way of comparison that [https://ethresear.ch/t/how-to-hard
255
411
256
412
To help implementors understand updates to this BIP, we keep a list of substantial changes.
257
413
414
+
* 2024-12-01 - Add details on attestation structure and parsing.
258
415
* 2024-11-20 - Clarifications based on feedback from Murch. Remove some sections that are not yet ready.
259
416
* 2024-10-21 - Replace XMSS with CRYSTALS-Dilithium due to NIST approval and size constraints.
260
417
* 2024-09-30 - Refactor the ECC vs PoW section. Swap quitness for attestation.
0 commit comments