v0.3.0-testnet
·
18 commits
to master
since this release
Consensus: BIP360 P2MR (Pay-to-Merkle-Root) Output Type
Implement SegWit version 2 P2MR outputs as specified in BIP360. P2MR provides a quantum-resistant script tree output type by removing the Taproot key path spend, which exposes a public key vulnerable to quantum key recovery via Shor's algorithm.
P2MR commits directly to the script tree Merkle root (no internal key, no tweak), enabling Dilithium post-quantum signature opcodes to provide real protection inside the script tree.
Consensus changes
- Add
SigVersion::P2MR_TAPSCRIPTandSCRIPT_VERIFY_P2MRflag - Add
VerifyP2MRCommitment(Merkle root verification without tweak) - Add
witversion==2branch inVerifyWitnessProgram - No key path (reject witness stack with fewer than 2 elements)
- Control block format
1+32*mbytes (no internal key) - Parity bit enforcement (must be
1per BIP360) - Validation weight for Dilithium signature checks
- Route
P2MR_TAPSCRIPTthroughEvalChecksigTapscript,SignatureHashSchnorr,CheckSchnorrSignature, andExecuteWitnessScript - Re-enable Dilithium opcodes in P2MR tapscript context (blocked in P2TR)
- Block
OP_CHECKMULTISIGin P2MR (inherited from BIP342 tapscript rules)
Address and type system
- Add
WitnessV2P2MRdestination type andTxoutType::WITNESS_V2_P2MR - Add
bc1zaddress encoding/decoding (SegWit v2, bech32m) - Add
P2MRBuilderfor constructing P2MR outputs from script trees - Add
P2MRSpendDatafor script path spending
Policy and activation
- Add P2MR witness standardness checks
- Activate
SCRIPT_VERIFY_P2MRon all networks
Tests
- Add
feature_p2mr.pywith coverage for output format, script-path spend/mine flow, no-key-path enforcement, all 5 Dilithium opcodes (P2MR vs P2TR), error paths,OP_CHECKMULTISIGblocking, multi-leaf trees, invalid proofs, control block size/parity validation, address encoding, and multi-input transactions - Add
p2mr_construct()andP2MRInfoin Python test framework
Additional Changes
1) Block time + retarget cadence updates
- Reduced target block spacing from 10 minutes to 1 minute across BTQ networks.
- Updated activation window math to match 1-minute blocks:
nMinerConfirmationWindow:20160(14 days at 1-minute spacing)nRuleChangeActivationThreshold:18144(90%) /15120(75% testnet)
- Fixed a hardcoded 10-minute assumption in Qt prune UI estimation (
intro.cpp) so backup-day estimates align with BTQ’s 1-minute chain.
2) Reward and emission schedule corrections
- Updated block subsidy from 50 BTQ to 5 BTQ (
GetBlockSubsidy). - Updated halving interval from 210,000 to 2,100,000 blocks for main/test/signet (and corresponding regtest scaling), keeping a Bitcoin-like ~4-year halving cadence under 1-minute blocks.
- Net effect: maintains long-term emission target alignment while supporting higher block frequency.
3) Weight, block policy, and sigop/security fixes
- Restored witness discount behavior with BTQ parameters:
WITNESS_SCALE_FACTOR = 16MAX_BLOCK_WEIGHT = 8,000,000- default miner soft cap
DEFAULT_BLOCK_MAX_WEIGHT = 7,600,000
- Fixed transaction input weight accounting to include serialized witness stack size in
GetTransactionInputWeight(). - Added Dilithium tapscript/sigop hardening (
security: fix Dilithium sigop counting and tapscript vulnerabilities), including interpreter and script error path updates plus functional tests.
4) Genesis remine and chain parameter refresh
- Re-mined genesis parameters (timestamp text, nonce/hash assertions, merkle roots, and chainTxData timestamps) for BTQ networks during Feb 2026 updates.
- Current mainnet genesis assertions are updated to:
hashGenesisBlock = 0x0000ca45ea08433961609b50cd0c3f76d14589f8f61973ebbc344c3a160f7cddhashMerkleRoot = 0xec88310bd306cf5f9554cc257db16b81147e4bd0efda75f11b38467a5d918db1
5) Peer node and seed endpoint updates
- Mainnet seed list normalized back to DNS seed form:
seed1.btq.com
- Testnet seed endpoints updated/renamed to:
testnet-seed1.bitcoinquantum.comtestnet-seed2.bitcoinquantum.com
- Intermediate temporary raw-IP seed entry was introduced then removed in later commits; latest
masterreflects DNS seed-based configuration.
6) Wallet/Dilithium performance and reliability improvements
- Removed extensive debug logging in Dilithium key generation/RPC/wallet load paths.
- Added
IsMineresult caching in wallet logic (m_ismine_cache) with invalidation on keypool/SPKM updates to reduce repeated ownership checks and improve wallet load/runtime responsiveness. - Build/linkage cleanup for Dilithium key classes:
- moved
CDilithiumPubKeyimplementation into a dedicateddilithium_pubkey.cpp - adjusted Makefile source groupings
- moved
- Fixed test build wiring for Dilithium RPC tests under wallet-enabled builds.
7) Test coverage alignment
- Updated functional, unit, and fuzz tests to reflect the 5 BTQ subsidy and revised chain economics.
- Extended script/consensus test coverage for Dilithium + P2MR policy and validation behavior.