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
When spending, if a public key hash is provided in the attestation with an empty signature, that hash will be used
357
-
directly in the merkle tree computation rather than hashing the full public key. This allows unused public keys to be
346
+
directly in the vector computation rather than hashing the full public key. This allows unused public keys to be
358
347
excluded from the transaction while still proving they were part of the original commitment.
359
348
360
-
The merkle tree construction creates an efficient cryptographic commitment to multiple public keys while enabling
349
+
The vector construction creates an efficient cryptographic commitment to multiple public keys while enabling
361
350
selective disclosure.
362
351
363
352
A threshold is provided to indicate the number of signatures required to spend the output. This is used in the
364
-
cryptographic commitment in the merkle tree hash computation and revealed in the attestation when spent.
353
+
cryptographic commitment in the hash computation and revealed in the attestation when spent.
365
354
366
355
Only a single 32-byte X-only secp256k1 public key can be provided as key type 0. There are a few reasons for this:
367
356
@@ -370,25 +359,23 @@ Only a single 32-byte X-only secp256k1 public key can be provided as key type 0.
370
359
3. When a secp256k1 key is specified in the key type bitmask, how many keys it commits to is unambiguous.
371
360
4. If multiple keys need to be committed to, they must be aggregated, which saves on transaction size.
372
361
373
-
This design maintains compatibility for [https://github.com/bitcoin/bips/blob/master/bip-0114.mediawiki BIP-114] Taproot
374
-
Merkelized Alternative Script Tree (MAST) merkle root in the attestation, which makes P2QRH a quantum-resistant
375
-
version of Taproot transactions.
362
+
This design maintains compatibility for [https://github.com/bitcoin/bips/blob/master/bip-0114.mediawiki BIP-114]
363
+
Taproot Merkelized Alternative Script Tree (MAST) merkle root in the commitment, which makes P2QRH a
364
+
quantum-resistant version of Taproot transactions. The TapScript itself must however be provided in the witness,
365
+
as no script execution is allowed in the attestation.
376
366
377
-
In a multisig context, aside from secp256k1 keys, the number of keys provided in the attestation is variable and must
378
-
meet the threshold as committed to in the merkle tree hash computation and revealed in the attestation.
367
+
In a multisig context, aside from secp256k1 keys, the number of keys provided in the attestation is variable and
368
+
must meet the threshold as committed to in the hash computation and revealed in the attestation.
379
369
380
-
If an implementation for public key or signature aggregation for PQC algorithms is developed, key and signature
381
-
aggregation must become the default behavior for P2QRH.
370
+
When the address is generated, all public keys must be known in advance, and they must be sorted, first by key
371
+
type, then by public key value, so as to be deterministic.
382
372
383
-
When the address is generated, all public keys must be known in advance, and they must be sorted, first by key type,
384
-
then by public key value, so as to be deterministic.
373
+
The key count does not need to be provided for PQC keys because the key type bitmask and threshold are sufficient
374
+
to validate a multisig transaction.
385
375
386
-
The key count does not need to be provided for PQC keys because the key type bitmask and threshold are sufficient to
387
-
validate a multisig transaction.
388
-
389
-
In a singlesig context, multiple PQC keys can be provided, but the key type bitmask and threshold must still also be
390
-
provided to be consistent with the multisig semantics. The threshold will be set as 0x01, and the key type bitmask will
391
-
indicate how many keys of each type are present.
376
+
In a singlesig context, multiple PQC keys can be provided, but the key type bitmask and threshold must still also
377
+
be provided to be consistent with the multisig semantics. The threshold will be set as 0x01, and the key type
378
+
bitmask will indicate how many keys of each type are present.
392
379
393
380
=== Transaction Serialization ===
394
381
@@ -412,11 +399,14 @@ attestation is present.
412
399
413
400
The attestation field consists of:
414
401
415
-
* <code>num_pubkeys</code>: The number of public keys ([https://learnmeabitcoin.com/technical/general/compact-size/ compact size]).
402
+
* <code>key_type_bitmask</code>: A [https://learnmeabitcoin.com/technical/general/compact-size/ compact size] value indicating which key types are present.
403
+
* <code>threshold</code>: A compact size value indicating the number of signatures required to spend the output.
404
+
* <code>num_pubkeys</code>: The number of public keys (compact size).
416
405
417
406
For each public key:
418
407
419
-
* <code>pubkey_length</code>: compact size length of the public key.
408
+
* <code>key_type</code>: The key type (compact size). Only one bit is used to indicate the key type.
409
+
* <code>pubkey_length</code>: compact size length of the public key (compact size).
For each input, a separate attestation field is used. To know how many attestation fields are present, implementations
435
425
must count the number of inputs present in the transaction.
436
426
427
+
==== Attestation Parsing Example ====
428
+
429
+
Signing for a single input using both secp256k1 Schnorr and FALCON-512:
430
+
431
+
Number of public keys:
432
+
433
+
[key_type_bitmask]: 0x03
434
+
[threshold]: 0x01
435
+
[num_pubkeys]: 0x02
436
+
437
+
Pubkey 1:
438
+
[key_type]: 0x01
439
+
[pubkey_length]: 0x20 (32 bytes)
440
+
[pubkey]: public_key_secp256k1
441
+
442
+
Pubkey 2:
443
+
[key_type]: 0x02
444
+
[pubkey_length]: 0x0701 (1793 bytes)
445
+
[pubkey]: public_key_falcon_512
446
+
447
+
Number of signatures:
448
+
449
+
[num_signatures]: 0x02
450
+
451
+
Signature 1:
452
+
[signature_length]: 0x40 (64 bytes)
453
+
[signature]: signature_secp256k1
454
+
455
+
Signature 2:
456
+
[signature_length]: 0x0500 (1280 bytes)
457
+
[signature]: signature_falcon_512
458
+
459
+
Note: This contrasts with multisig inputs, where the attestation structure repeats for each public key and signature.
460
+
437
461
=== Signature Algorithms ===
438
462
439
-
The specific quantum-resistant signature algorithm used is inferred from the length of the public key.
440
-
Implementations must recognize the supported algorithms and validate accordingly.
463
+
The specific quantum-resistant signature algorithm used cannot be inferred from the length of the public key due to
464
+
collisions in length between algorithms. Instead, when each key is revealed in the attestation, the key type bitmask
465
+
indicates which algorithm was used.
441
466
442
467
Supported PQC algorithms and their NIST Level I parameters:
443
468
@@ -470,14 +495,11 @@ Supported PQC algorithms and their NIST Level I parameters:
470
495
** Cycles to sign: 4,682,570,992
471
496
** Cycles to verify: 4,764,084
472
497
473
-
Implementations must reject public keys and signatures that do not match expected lengths for supported algorithms.
474
-
475
-
If a new algorithm is added, and one of the byte sizes overlaps, then an additional byte should be prepended to the
476
-
new algorithm's public key length that indicates the specific algorithm used.
498
+
Implementations must recognize the supported algorithms and validate accordingly.
477
499
478
-
A bitmask is used to indicate the algorithm used for each public key and signature pair. The bitmask is enumerates based on
479
-
the key type as indicated above. This is used in the cryptographic commitment in the merkle tree hash computation and
480
-
revealed in the attestation when spent.
500
+
A bitmask is used to indicate the algorithm used for each public key and signature pair. The bitmask enumerates based on
501
+
the key type as indicated above. This is used in the cryptographic commitment in the hash computation and
502
+
revealed in the attestation for each public key when spent.
481
503
482
504
=== Script Validation ===
483
505
@@ -494,9 +516,12 @@ the <code>scriptPubKey</code>.
494
516
495
517
* Valid signatures corresponding to the public key(s) and the transaction data.
496
518
519
+
* The key type bitmask and threshold must match the commitment in the <code>scriptPubKey</code>.
520
+
497
521
3. For multi-signature schemes, all required public keys and signatures must be provided for that input within the
498
522
attestation. Public keys that are not needed or available can be selectively disclosed by including their hash in the
499
-
attestation accompanied with an empty signature by providing a 0x00 signature length byte.
523
+
attestation accompanied with an empty signature by providing a 0x00 signature length byte. This works so long as
524
+
enough keys to meet the threshold are provided.
500
525
501
526
==== Sighash Calculation ====
502
527
@@ -531,36 +556,6 @@ Signature verification is as follows:
531
556
4. Ensure that the signature algorithm used matches the expected lengths for NIST Level I security, and is supported by
532
557
the implementation.
533
558
534
-
==== Attestation Parsing Example ====
535
-
536
-
Signing for a single input using both secp256k1 Schnorr and FALCON-512:
537
-
538
-
Number of public keys:
539
-
540
-
[num_pubkeys]: 0x02
541
-
542
-
Pubkey 1:
543
-
[pubkey_length]: 0x20 (32 bytes)
544
-
[pubkey]: public_key_secp256k1
545
-
546
-
Pubkey 2:
547
-
[pubkey_length]: 0x0701 (1793 bytes)
548
-
[pubkey]: public_key_falcon_512
549
-
550
-
Number of signatures:
551
-
552
-
[num_signatures]: 0x02
553
-
554
-
Signature 1:
555
-
[signature_length]: 0x40 (64 bytes)
556
-
[signature]: signature_secp256k1
557
-
558
-
Signature 2:
559
-
[signature_length]: 0x0500 (1280 bytes)
560
-
[signature]: signature_falcon_512
561
-
562
-
Note: This contrasts with multisig inputs, where the attestation structure repeats for each public key and signature.
563
-
564
559
=== Compatibility with BIP-141 ===
565
560
566
561
By adhering to the SegWit transaction structure and versioning, P2QRH outputs are compatible with existing transaction
@@ -691,6 +686,7 @@ seeds to act as the authoritative secret when signing. These measures are deemed
691
686
692
687
To help implementors understand updates to this BIP, we keep a list of substantial changes.
693
688
689
+
* 2025-03-18 - Correct inconsistencies in commitment and attestation structure. Switch from merkle tree commitment to sorted vector hash commitment.
694
690
* 2025-03-12 - Add verification times for each algorithm. 256 -> 128 (NIST V -> NIST I). Add key type bitmask. Clarify multisig semantics.
695
691
* 2025-02-23 - More points of clarification from review. Update dead link.
696
692
* 2025-01-20 - Remove SQIsign from consideration due to significant performance concerns. Refactor language from long-range attack to long-exposure so as to not be confused with the language around block re-org attacks.
0 commit comments