PQChain: A Crypto-Agile, Post-Quantum UTXO Blockchain
NIST FIPS 204 (ML-DSA-65), NIST FIPS 205 (SLH-DSA / SPHINCS+), Authenticated NIST FIPS 203 (ML-KEM-768) P2P, 256-Bit Compact-Target PoW, Historical Witness Pruning, SHA3-256 SPV Proofs, and the Hardened PQScript VM.
1. Abstract
Existing public blockchains depend on elliptic-curve cryptography (ECDSA / Ed25519) and classical Diffie-Hellman
key exchange—primitives broken in polynomial time by Shor's algorithm on a cryptographically relevant quantum
computer (CRQC). PQChain is a clean-slate Layer-1 UTXO Proof-of-Work blockchain written in pure
safe Rust (zero unsafe core cryptographic code, zero C dependencies) that eliminates classical
public-key assumptions across every layer while mitigating single-family cryptanalytic risk via native
cryptographic agility.
Protocol v4 freezes the normative consensus ruleset for public testnet and independent security
audit (docs/CONSENSUS-SPEC.md and docs/THREAT-MODEL.md), verified by
31/31 automated integration tests covering consensus, MITM-resistant P2P, ACID storage,
PQScript VM bounds, encrypted wallets, and Rosetta v1.4.13 reconciliation.
2. Post-Quantum Cryptographic Architecture
| Version | Identifier | NIST Standard | Hardness Family | PK / Sig Size | Role |
|---|---|---|---|---|---|
0x01 | ml-dsa-65 | FIPS 204 | Module-Lattice (MLWE/MSIS) | 1,952 B / 3,309 B | Fast everyday transactions |
0x02 | slh-dsa-128f | FIPS 205 | Stateless Hash-Based (SHAKE256) | 32 B / 17,088 B | Fast zero-lattice fallback |
0x03 | slh-dsa-128s | FIPS 205 | Stateless Hash-Based (SHAKE256) | 32 B / 7,856 B | Compact cold-storage vaults |
0x04 | pq-script | PQChain v4 | Deterministic Stack VM | 32 B Hash + Witness | Cross-family multisig, CLTV, HTLC |
address_payload = [ scheme_version (1B) || SHA3-256(domain || scheme || key_or_script) (32B) ]
address = Bech32m("pq", address_payload) # canonical lowercase round-trip enforced
PQCHAIN_TX_SIGHASH_V3, signed under context pqchain-tx-sig-v3) commits to all input
outpoints and schemes, every spent UTXO's exact (amount, scheme, recipient_hash), all outputs,
lock_time, and input_index. Consensus strictly enforces
input.scheme == utxo.output.scheme, eliminating fee-manipulation attacks on offline/hardware signers
and preventing cross-scheme downgrade or key-substitution attacks.
3. Protocol v4 Consensus & Block Structure
Protocol v4 enforces 17 normative consensus rules (C-01–C-17) over a canonical
128-byte block header hashed with domain-separated BLAKE3-256
(PQCHAIN_POW_HEADER_V4):
header_bytes = version (u32 LE) || height (u64 LE) || prev_hash (32B) || merkle_root (32B)
|| witness_root (32B) || timestamp (u64 LE) || compact_target (u32 LE) || nonce (u64 LE)
- 256-Bit Compact Target (
nBits) & Cumulative Work: Valid headers satisfyU256(pow_hash) <= U256::from_compact(compact_target). Difficulty retargeting clamps adjustment ratios to[1/4, 4]per epoch within[8, 64]bit bounds, and fork choice selects the chain with the highest cumulativeU256workΣ floor(2^256 / (target + 1)). - Timestamp Hardening: Every block must strictly exceed the 11-block
Median-Time-Past (MTP-11) lower bound and stay within +2 hours
(
7,200 s) of local node time. - Coinbase Maturity: Newly mined coinbase outputs require 100 confirmations
(
COINBASE_MATURITY = 100) before they can be spent, preventing orphaned-reward cascades during reorganizations. - Weight, Size & Fee-Rate Limits: Blocks are capped at 4,000,000 weight units
(
4 × base + 1 × witness), individual transactions at 128 KiB, and relay enforces a minimum weight-based fee rate (1,000 quanta / 1,000 WU) with an 8 MiB fee-rate-evicting mempool.
4. Witness Separation, Pruning & SPV Light Clients
Because post-quantum signatures range from 3.3 KB to 17.1 KB, PQChain splits every transaction into a non-witness
txid (PQCHAIN_TXID_V2, committed in header.merkle_root) and a
witness-inclusive wtxid (PQCHAIN_WTXID_V2, committed in
header.witness_root).
- Historical Witness Pruning: Deeply confirmed blocks strip
public_key,signature,redeem_script, andscript_witnessbytes while preservingtxid,pruned_wtxid, and UTXO integrity—achieving 85%–97% historical storage reduction. - Strict Trust Boundary: Untrusted network peers can never inject pruned blocks into consensus
(Rule
C-17); pruned blocks are accepted only when reloading a node's own previously validated local database. - Compact SHA3-256 SPV Proofs: Domain-separated Merkle inclusion proofs (
0x00leaf,0x01internal node) verify BLAKE3 PoW + transaction inclusion in ~226–292 bytes, even when served from witness-pruned blocks.
5. PQScript Deterministic Smart Contract VM
PQScript is a non-Turing-complete stack VM bounded by strict deterministic limits: 128 stack items,
20,000 B max stack/witness item size, 256 opcodes, 64 KiB max canonical
script size, and an explicit per-opcode execution cost cap of 10,000 cost units
(with signature verification weighted by cryptographic cost: ML-DSA-65 = 100, SLH-DSA-128s =
500, SLH-DSA-128f = 1,500). Protocol v4 enforces strict clean-stack
(final stack must equal [[0x01]]), minimal integer encoding, and MINIMALIF boolean
semantics.
- Cross-Family M-of-N Multisig (
OP_CHECKPQMULTISIG): Combine ML-DSA-65 + SLH-DSA-128f + SLH-DSA-128s keys in one vault with distinct signer-index enforcement so breaching one cryptographic family cannot compromise custody. - Height Timelocks (
OP_CHECKLOCKTIMEVERIFY): Enforcestx.lock_time >= unlock_height && block_height >= unlock_heightfor vesting schedules, cold-vault locks, and refund timeouts. - SHA3-256 HTLCs: Atomic swaps and trustless cross-chain bridges using
OP_SHA3_256hashlocks paired with CLTV refund branches—with full client-side HTLC construction and claim signing supported directly in the browser WASM wallet.
6. Authenticated P2P Networking, Storage & Sync
- Authenticated ML-KEM-768 + ML-DSA-65 Transport: Every TCP peer session completes an ephemeral
NIST FIPS 203 ML-KEM-768 key exchange (
0.151 ms), derives directional 256-bit ChaCha20-Poly1305 AEAD keys, and performs mutual ML-DSA-65 identity authentication over the ML-KEM transcript hash (PQCHAIN_P2P_HANDSHAKE_V1). Nodes persist encrypted identities (pqnode-<hex>) and support--pin-peeragainst active MITM attacks. - Peer Discovery & DoS Defense: Bounded
GetPeers/Peersgossip (max 32 per message, persisted 512-entry address book), seed-node bootstrapping, 8 MiB max wire frames, per-peer sliding-window rate limits, and automated IP banning at misbehavior score≥ 100. - Headers-First IBD & ACID Storage: Nodes persist chain state and O(log N) address/tx
indices in embedded pure-Rust
redb(chain.redb, zero C dependencies) and synchronize via headers-firstGetHeaders/Headers(up to 500/msg) plus block-locatorGetBlocksByHash/Blocksdelta fetches. - Non-Custodial Wallets & Institutional APIs: CLI wallets encrypt secret keys at rest with Argon2id v19 + ChaCha20-Poly1305. The 292 KB browser WASM wallet generates standard BIP-39 12/24-word mnemonics and signs P2PQPKH + PQScript HTLC transactions entirely client-side. Nodes expose Rosetta / Mesh v1.4.13 (with historical balance lookup) and SSRF-hardened, reorg-safe HMAC-SHA3-256 webhooks.
7. Measured Release Benchmarks
| Algorithm | PK / EK | Sig / CT | KeyGen | Sign / KEX | Verify |
|---|---|---|---|---|---|
| ML-DSA-65 (FIPS 204) | 1,952 B | 3,309 B | 0.343 ms | 0.759 ms | 0.122 ms |
| SLH-DSA-SHAKE-128f (FIPS 205) | 32 B | 17,088 B | 2.841 ms | 67.094 ms | 4.144 ms |
| SLH-DSA-SHAKE-128s (FIPS 205) | 32 B | 7,856 B | 185.56 ms | 1,482.10 ms | 1.188 ms |
| ML-KEM-768 P2P KEX (FIPS 203) | 1,184 B | 1,088 B | — | 0.151 ms | Forward-Secret + ML-DSA Auth |
| BLAKE3-256 PoW (Single Thread) | 32 B Digest | 5,606,575 H/s | |||
8. Tokenomics & Monetary Policy (PQC)
| Parameter | Specification |
|---|---|
| Hard Supply Cap | 21,000,000 PQC (1 PQC = 100,000,000 quanta) |
| Initial Block Subsidy | 50 PQC per block, halving every 210,000 blocks (~4 years at 10-min mainnet target) |
| Premine | 0% hidden premine |
| Coinbase Maturity | 100 blocks before coinbase rewards become spendable |
| Optional Protocol Treasury | Genesis-committed 90% Miner / 10% on-chain PQScript 2-of-3 Multisig + CLTV Treasury during Epochs 0–1 (hard-capped at 25% in consensus, sunsets automatically at height 420,000; fees remain 100% miner-only), or 0% pure PoW. |
| Fee Market | SegWit-style 4x base / 1x witness discount (4M WU block limit, 1,000 quanta/kWU min relay fee) so prunable SLH-DSA signatures remain affordable. |
9. Audit & Mainnet Launch Path
- Public Multi-Region Testnet: Dockerized seed nodes with authenticated P2P, rate-limited faucet, live explorer, and 292 KB BIP-39/HTLC WASM browser wallet.
- Independent Security Audit: Formal third-party review of the frozen Protocol v4 specification (
docs/CONSENSUS-SPEC.md), threat model (docs/THREAT-MODEL.md), FIPS 203/204/205 integration, PQScript VM, fuzz harnesses, and P2P DoS resistance. - DEX Bridge Bootstrapping: 1:1 HTLC/multisig wrapped
wPQCpools on Base/Ethereum/Solana DEXs for immediate price discovery and CoinGecko/CMC tracking. - Native L1 Exchange & Hardware Wallet Listings: Rosetta/Mesh v1.4.13 deposit/withdrawal APIs (with historical balance reconciliation) and BIP-143/341-style v3 sighash offline signing for Tier-2 and Tier-1 CEXs.