Hello list, I would like to share an unaudited regtest prototype of BIP-360 Pay-to-Merkle-Root (P2MR) together with a companion set of post-quantum signature opcodes, implemented as patches against Bitcoin Core v32.1. It is intended as a reference for discussion, not as a proposal ready for activation or as something to use with real funds. Independent review has not been done. Feedback is welcome, including on whether this direction is worth pursuing at all. Repository (code, patches, draft, test vectors, and a short brief): https://github.com/DarkincStudio/bitcoin-pq-softfork Motivation ---------- Bitcoin signs with secp256k1 (ECDSA and Schnorr). Shor's algorithm would let a cryptographically relevant quantum computer derive a private key from an exposed public key. That is a problem for outputs whose public key is already on-chain, and for any spend that reveals a public key while it sits in the mempool. SHA-256 and proof of work are a different, weaker story: Grover's algorithm only square-roots the classical search. Relation to BIP-360 ------------------- BIP-360 is by Hunter Beast, Ethan Heilman and Isabel Foxen Duke. This prototype implements their P2MR construction and does not change that specification. BIP-360 v0.12.1 specifies Pay-to-Merkle-Root: a SegWit v2 output whose 32-byte program is a tapscript Merkle root, with no key-path spend (bc1z… / bcrt1z…). That addresses long-exposure attacks on the output itself. The BIP text explicitly leaves post-quantum signatures out of scope. This prototype follows that P2MR construction (it passes 13/13 of the official BIP-360 construction vectors; three error-only vectors are skipped, as documented). The PQ opcodes are a companion design, modelled on the informative plan in earlier BIP-360 discussion, and are not part of BIP-360 itself. Opcode numbers, validation costs, and encodings here are proposals, not standards. The draft in the repository is unassigned and has not been submitted as a BIP. Design summary -------------- Two BIP9 deployments, both off by default on every network, including regtest: p2mr bit 3 P2MR outputs pqsig bit 4 PQ signature opcodes inside P2MR leaves The opcodes redefine OP_SUCCESSx 0xd0-0xd8, and only execute inside P2MR leaves: OP_CHECKMLSIG{,VERIFY,ADD} ML-DSA-44 OP_CHECKSLHSIG{,VERIFY,ADD} SLH-DSA-SHA2-128s OP_CHECKFALCONSIG{,VERIFY,ADD} Falcon-512 All verification is done by liboqs 0.16.0, pinned and built as portable C (no AVX2/AVX-512 dispatch, no OpenSSL). The consensus code is a wrapper; it does not implement the schemes itself. Validation weights, derived from a portable-build benchmark, are 150 (ML-DSA-44), 1100 (SLH-DSA-SHA2-128s) and 100 (Falcon-512), against 50 for Schnorr. In PQ-enabled leaves, elements over 520 bytes cannot be duplicated or hashed, so a large signature cannot be re-checked cheaply via OP_DUP. There is a signature cache for valid PQ signatures. On this implementation, the worst-case block of PQ checks went from about 2.9 s (ML-DSA, before the 520-byte rule) to 0.08 s (ML-DSA), 0.26 s (SLH-DSA) and 0.09 s (Falcon-512) on one core. To try the prototype on regtest, start bitcoind with -vbparams=p2mr:0:9223372036854775807 -vbparams=pqsig:0:9223372036854775807 and mine 432 blocks (3 x 144, threshold 108/144). Measured sizes -------------- 1-in/1-out spends, vsize from testmempoolaccept, weight from getrawtransaction, recorded 30 November 2026: Scheme Pubkey Signature vsize weight vs P2TR P2TR key-path 32 B 64 B 111 vB 444 WU 1x ML-DSA-44 1312 B 2420 B 1039 vB 4156 WU 9.36x SLH-DSA-SHA2-128s 32 B 7856 B 2077 vB 8307 WU 18.71x Falcon-512 897 B 666 B 497 vB 1986 WU 4.48x Portable-build single-core verify times, from the same test session, were about 67-73 us (ML-DSA-44), 476-514 us (SLH-DSA-SHA2-128s) and 34-37 us (Falcon-512), versus 27-34 us for BIP-340 Schnorr. Known issues and open questions ------------------------------- These are the main points I would like views on. A longer self-review is in docs/BIP-DRAFT.md in the repository. * liboqs is still an external research library. It is pinned and linked statically, but it has not been audited for use in Bitcoin consensus, and liboqs itself says it is not meant for production use without review. * Falcon-512 here is liboqs Falcon-padded-512, which is round-3 Falcon. It is not FIPS 206 FN-DSA; that standard is not final, and hashing or encoding may differ. If FIPS 206 is adopted later, these opcodes should not change meaning: a new opcode or leaf version would be needed. * Bytes 0xd0-0xd8 overlap Elements/Liquid tapscript opcodes in that range. A new leaf version for PQ leaves may be a cleaner namespace than redefining OP_SUCCESSx. * Two deployments are soft-fork-safe in either order, but if p2mr activates first, outputs whose leaves use 0xd0-0xd8 are anyone-can-spend until pqsig activates. A single combined deployment is an alternative. * The portable build has only been tested on x86-64 Linux (GCC 14). ARM, big-endian, macOS and Windows have not been run. * There is no wallet, descriptor, or PSBT support. Spends are built by the Python test framework. This is an unaudited regtest prototype. Consensus code can lose money if it is wrong. I am asking for feedback, not for anyone to run this on mainnet or to treat it as a finished proposal. Thank you for reading. Dark Inc / DarkincStudio -- You received this message because you are subscribed to the Google Groups "Bitcoin Development Mailing List" group. To unsubscribe from this group and stop receiving emails from it, send an email to bitcoindev+unsubscribe@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/CAMaSzvrT6NT4Fh8dg%2B0BxJ_M-MTPgqkEkyHcog5S7aRmYJR7qA%40mail.gmail.com.