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
P2QRH (Pay to Quantum Resistant Hash) is a new output type that commits to the root of a tapleaf merkle tree. It is functionally
187
-
the same as a P2TR (Pay to Taproot) output with the quantum vulnerable key-spend path removed. Since P2QRH has no key-spend path, P2QRH omits the
187
+
the same as a P2TR (Pay to Taproot) output with the quantum vulnerable key path spend removed. Since P2QRH has no key path spend, P2QRH omits the
188
188
taproot internal key as it is not needed. Instead a P2QRH output is just the 32 byte root of the tapleaf merkle tree as defined
189
189
in [https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki BIP-341] and hashed with the tag "QuantumRoot" as shown below.
190
190
@@ -218,7 +218,7 @@ be evaluated by the tapleaf script, a.k.a. the redeem script.
218
218
The control block is a 1 + 32 * m byte array, where the first byte is the control byte and the next 32*m bytes are the
219
219
Merkle path to the tapleaf script. The control byte is the same as the control byte in a P2TR control block,
220
220
including the 7 bits are used to specify the tapleaf version. The parity bit of the control byte is always 1
221
-
since P2QRH does not have a key-spend path. We omit the public key from the control block as it is not needed in P2QRH.
221
+
since P2QRH does not have a key path spend. We omit the public key from the control block as it is not needed in P2QRH.
222
222
We maintain support for the optional annex in the witness (see specification for more details).
223
223
224
224
=== Rationale ===
@@ -253,7 +253,7 @@ be designed to support the addition of these PQ signature algorithms. The full d
253
253
254
254
==== P2QRH ====
255
255
256
-
P2QRH is simply P2TR with the quantum vulnerable key-spend path removed so that it commits to the root of
256
+
P2QRH is simply P2TR with the quantum vulnerable key path spend removed so that it commits to the root of
257
257
the tapleaf merkle tree in the output. This allows P2QRH to reuse the mature and battle tested P2TR, tapleaf
258
258
and tapscript code already in Bitcoin. This reduces the implementation burden on wallets, exchanges, and
259
259
libraries since they can reuse code they already have.
@@ -469,7 +469,7 @@ language verbatim from the [[bip-0341.mediawiki|BIP341]] script validation secti
469
469
** If ''q ≠ r'', fail.
470
470
** Execute the script, according to the applicable script rules, using the witness stack elements excluding the script ''s'', the control block ''c'', and the annex ''a'' if present, as initial stack. This implies that for the future leaf versions (non-''0xC0'') the execution must succeed.
471
471
472
-
The steps above follow the script path spending logic from [[bip-0341.mediawiki|BIP-341]] with the following changes:
472
+
The steps above follow the script path spend logic from [[bip-0341.mediawiki|BIP-341]] with the following changes:
473
473
* The witness program is the tapleaf merkle root and not a public key. This means that we skip directly to BIP-341 spend path tapleaf merkle tree validation.
474
474
* We compute the tagged tapleaf merkle root r and compare it directly to the witness program q.
475
475
* The control block is 1 + 32*m bytes, instead of 33 + 32*m bytes.
@@ -502,9 +502,9 @@ processing rules. Nodes that do not recognize SegWit version 3 will treat these
502
502
Equivalent P2QRH and P2TR outputs are always the same size. P2QRH inputs can be slightly larger or smaller than
503
503
their equivalent P2TR inputs. Let's consider the cases:
504
504
505
-
'''P2TR key-spend''' P2QRH inputs will be larger than P2TR inputs when the P2TR output would have been spent via the key-spend path.
506
-
P2QRH quantum resistance comes from removing the P2TR key-spend path. Consequently it cannot make use of taproot's optimization
507
-
where P2TR key-spends do not require including a merkle path in the P2TR input. If the Merkle tree only has a single tapleaf,
505
+
'''P2TR key path spend''' P2QRH inputs will be larger than P2TR inputs when the P2TR output would have been spent via the key path spend.
506
+
P2QRH quantum resistance comes from removing the P2TR key path spend. Consequently it cannot make use of taproot's optimization
507
+
where P2TR key path spends do not require including a merkle path in the P2TR input. If the Merkle tree only has a single tapleaf,
508
508
no Merkle path is needed in the control block giving us a 1 byte control block.
Thus, the P2QRH input would be 103 - 66 = 37 bytes larger than a P2TR key-spend input.
524
+
Thus, the P2QRH input would be 103 - 66 = 37 bytes larger than a P2TR key path spend input.
525
525
526
526
If the Merkle tree has more than a single tapleaf, then the Merkle path must be included in
527
527
the control block.
@@ -534,15 +534,15 @@ control block = [size] [control byte, 32 * m byte Merkle path] (1 + 1 + 32 * m
534
534
</source>
535
535
536
536
For a Merkle path of length m, it would add an additional ~32 * m bytes to the P2QRH input. This would
537
-
make it 37 + 32 * m bytes larger than a P2TR key-spend input<ref>If m >= 8, then the compact size will use 3 bytes rather than 1 byte</ref>.
537
+
make it 37 + 32 * m bytes larger than a P2TR key path spend input<ref>If m >= 8, then the compact size will use 3 bytes rather than 1 byte</ref>.
538
538
539
539
Considering a P2QRH output that has a PQ signature tapleaf and a Schnorr tapleaf. The P2QRH witness to spend the Schnorr path
540
-
would be 103 + 32 * 1 = 135 bytes. It is unfortunate that we can not use the key-spend optimization for P2QRH inputs, but the key-spend optimization is
541
-
exactly what makes P2TR vulnerable to quantum attacks. If spend-key was quantum resistant we wouldn't need P2QRH at all.
540
+
would be 103 + 32 * 1 = 135 bytes. It is unfortunate that we can not use the key path spend optimization for P2QRH inputs, but the key path spend optimization is
541
+
exactly what makes P2TR vulnerable to quantum attacks. If key path spend was quantum resistant we wouldn't need P2QRH at all.
542
542
543
-
'''P2TR script-spend''' P2QRH inputs will be smaller than equivalent script-spend path P2TR inputs. This is because P2QRH inputs
543
+
'''P2TR script path spend''' P2QRH inputs will be smaller than equivalent script path spend P2TR inputs. This is because P2QRH inputs
544
544
do not require that the input includes a public key in the witness control block to open the commitment to the tapleaf merkle root.
545
-
An equivalent P2QRH input will be 32 bytes smaller than a P2TR script-spend input.
545
+
An equivalent P2QRH input will be 32 bytes smaller than a P2TR script path spend input.
546
546
547
547
=== Performance Impact ===
548
548
@@ -559,8 +559,8 @@ P2QRH is fully compatible with tapscript and existing tapscript programs can be
559
559
560
560
== Security ==
561
561
562
-
P2QRH outputs provide the same tapscript functionality as P2TR outputs, but without the quantum-vulnerable key-spend
563
-
path. This enables users, exchanges and other hodlers to easily move their coins from taproot outputs to P2QRH outputs
562
+
P2QRH outputs provide the same tapscript functionality as P2TR outputs, but without the quantum-vulnerable key path spend.
563
+
This enables users, exchanges and other hodlers to easily move their coins from taproot outputs to P2QRH outputs
564
564
and thereby protect their coins from long-exposure quantum attacks. The protection from long-exposure quantum attacks
565
565
does not depend on the activation of post-quantum signatures in Bitcoin but does require that users do not expose their
566
566
quantum vulnerable public keys to attackers via address reuse or other unsafe practices.
and related BIPs [https://github.com/bitcoin/bips/blob/master/bip-0116.mediawiki BIP-116], [https://github.com/bitcoin/bips/blob/master/bip-0117.mediawiki BIP-117],
658
658
share the idea of committing to a Merkle tree of scripts. While MAST was never activated, taproot
659
659
[https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki BIP-341] incorporated this idea of a Merkle tree of
660
-
scripts into its design. P2QRH inherits this capability from taproot because P2QRH is simply taproot with the key-spend
661
-
path removed. As a result, P2QRH does have the taproot internal key or tweak key, instead P2QRH commits directly to the
660
+
scripts into its design. P2QRH inherits this capability from taproot because P2QRH is simply taproot with the key path
661
+
spend removed. As a result, P2QRH does have the taproot internal key or tweak key, instead P2QRH commits directly to the
662
662
Merkle tree of scripts.
663
663
664
664
Below we attempt to summarize some of the ideas discussed on the Bitcoin Bitcoin-Dev that relate to P2QRH.
665
665
666
-
The idea of a taproot but with the key-spend path removed has been discussed a number of times in the Bitcoin community.
666
+
The idea of a taproot but with the key path spend removed has been discussed a number of times in the Bitcoin community.
667
667
[https://gnusha.org/pi/bitcoindev/CAD5xwhgzR8e5r1e4H-5EH2mSsE1V39dd06+TgYniFnXFSBqLxw@mail.gmail.com/ OP_CAT Makes Bitcoin Quantum Secure]
668
-
notes that if we disable the key-spend in taproot and activated CAT [https://github.com/bitcoin/bips/blob/master/bip-0347.mediawik BIP-347],
668
+
notes that if we disable the key path spend in taproot and activated CAT [https://github.com/bitcoin/bips/blob/master/bip-0347.mediawik BIP-347],
669
669
we could achieve quantum resistance by using Lamport signatures with CAT. Lamport and WOTS (Winternitz One-Time Signatures) built from CAT
670
670
are quantum resistant but are one-time signatures. This means that if you sign twice for the same public key, you leak your secret key.
671
671
This would require major changes to wallet behavior and would represent a significant security downgrade.
672
672
[https://groups.google.com/g/bitcoindev/c/8O857bRSVV8/m/rTrpeFjWDAAJ Trivial QC signatures with clean upgrade path] and
673
673
[https://groups.google.com/g/bitcoindev/c/oQKezDOc4us/m/T1vSMkZNAAAJ Re: P2QRH / BIP-360 Update] discusses the idea of
674
-
taproot but with the future ability to disable the key-spend path.
675
-
The design of P2QRH is partly inspired by these discussions as P2QRH can be understood as P2TR without the key-spend path.
674
+
taproot but with the future ability to disable the key path spend.
675
+
The design of P2QRH is partly inspired by these discussions as P2QRH can be understood as P2TR without the key path spend.
676
676
677
677
Commit-reveal schemes such as
678
678
[https://gnusha.org/pi/bitcoindev/[email protected]/ Re: Transition to post-quantum (2018)]
@@ -685,8 +685,8 @@ to spend to. Then, in reveal, the user sign and reveals their public key. While
685
685
a commitment to the user's public key earlier than the user's commitment as it does not learn it until the reveal step.
686
686
687
687
Commit-reveal schemes can only be spent from and to outputs that are not vulnerable to long-exposure quantum attacks, such as
688
-
P2PKH, P2SK, P2WPKH, etc... To use tapscript outputs with this system either a soft fork could disable the key-spend path of P2TR outputs
689
-
or P2QRH could be used here as it does not have a key-spend path and thus is not vulnerable to long-exposure quantum attacks.
688
+
P2PKH, P2SK, P2WPKH, etc... To use tapscript outputs with this system either a soft fork could disable the key path spend of P2TR outputs
689
+
or P2QRH could be used here as it does not have a key path spend and thus is not vulnerable to long-exposure quantum attacks.
690
690
691
691
== References ==
692
692
@@ -703,7 +703,7 @@ or P2QRH could be used here as it does not have a key-spend path and thus is not
703
703
704
704
To help implementors understand updates to this BIP, we keep a list of substantial changes.
705
705
706
-
* 2025-07-07 - P2QRH is now a P2TR with the vulnerable key-spend path disabled. Number of PQ signature algorithms supported reduced from three to two. PQ signature algorithm support is now added via opcodes or tapleaf version.
706
+
* 2025-07-07 - P2QRH is now a P2TR with the vulnerable key path spend disabled. Number of PQ signature algorithms supported reduced from three to two. PQ signature algorithm support is now added via opcodes or tapleaf version.
707
707
* 2025-03-18 - Correct inconsistencies in commitment and attestation structure. Switch from merkle tree commitment to sorted vector hash commitment. Update descriptor format.
708
708
* 2025-03-12 - Add verification times for each algorithm. 256 -> 128 (NIST V -> NIST I). Add key type bitmask. Clarify multisig semantics.
709
709
* 2025-02-23 - More points of clarification from review. Update dead link.
0 commit comments