Qanum: post-quantum layer-1 monetary base

Qanum, a post-quantum layer-1 monetary base: goals and non-goals, design principles and the Base, Vault, Channels, Compute and Privacy layers.

This page reproduces docs/whitepaper.md from qanum-core v0.11.0 (release tag). Links to files that are not published on this site are shown as plain text until the source repository is public.

Contents

Architecture and Design Whitepaper

Draft aligned with the implementation and the consensus specification

Document status: architecture draft aligned with qanum-core v0.11.0 and with the companion consensus specification (spec.md) Purpose: describe what qanum is, what is implemented in the code, what is fixed at the design level, and what remains roadmap Note: this document is not a final consensus specification nor a public offering. Normative behaviour is the source in src/ and the tests that lock it.


Executive summary

qanum is a decentralized monetary network designed from the start for the post-quantum horizon. Its central thesis is that the next sovereign monetary layer should not be built as an overloaded general-purpose blockchain, but as a base layer specialized in custody, settlement, cryptographic security and robust self-custody, with scaling, advanced privacy and more complex execution pushed to higher layers or adjacent modules.

qanum adopts a UTXO model, Proof of Work consensus and NIST level 5 post-quantum signatures. ML-DSA-87 supports ordinary spending; SLH-DSA-SHAKE-256s supports recovery and other custody roles. Optional P2HPQ requires both signatures on the main and delayed recovery paths. In this source, testnet has level 5 from genesis; mainnet has no genesis and is planned at level 5 from genesis. ML-DSA-44 and SLH-DSA-SHAKE-128s are not used on this testnet or planned for mainnet. The base layer uses limited native templates; high-frequency payments, advanced privacy and more expressive execution are roadmap higher layers or adjacent modules.

The running implementation is a Rust full node (qanumd / qanum-cli) with mandatory post-quantum signature verification using AWS-LC / OpenSSL and qanum-pqverify, with enforce or shadow mode, scoped cache and optional assumevalid (§6.2), an encrypted net_v2 stack, UTXO snapshot sync with stated trust limits (AIP-0001), native vault / recovery / HTLC flows, and a test inventory of 2,440 test functions (method and inventory in TESTSUITE.md).


1. Introduction and motivation

Quantum computing capable of compromising widely deployed classical primitives is not yet part of everyday infrastructure, but its mere plausibility forces decade-long horizons. Migration to new cryptographic schemes requires years of research, standardization, libraries, tooling, audits and social coordination.

Legacy monetary networks face several structural difficulties:

  1. Historical dependence on classical primitives.
  2. Social migration surface. Changing a live network’s cryptography is institutional as well as technical.
  3. Fragile custody for the average user. Key loss and the absence of native recovery remain severe barriers.
  4. Poorly conceived base-layer scaling. Many proposals try to solve mass payments, arbitrary contracts, strong privacy, governance and final settlement inside the same L1.

These difficulties are structural, not incidental: post-quantum authorization, per-block state commitments and an auth-sized cost model cannot be migrated onto a live monetary network without forking its social consensus as well as its code, which is why qanum is a new base layer rather than a modification of an incumbent (see docs/ARCHITECTURE.md, “Why a new chain, and not a fork of Bitcoin”).

qanum’s response is conservative: the base layer must be monetary, not a platform for everything. Sophistication is moved where risk can be isolated: wallets, payment layers, external compute domains, and network improvements.

The post-quantum requirement is also why several structures in this document exist at all. Roughly 7.2 KB of authorization data per spend with the level-5 suite ML-DSA-87 (a public key plus its signature; 3.7 KB with ML-DSA-44; the ML-DSA-87 seat is what sizes the per-input auth limit, §5.1) does not fit a classical block budget; it forces the split between base block data and per-input authorization data, and makes the auth side the binding constraint. The same cost reappears downstream: a consensus-level Verify Unit budget bounds per-block cryptographic work, the dust policy is priced in raw bytes because signatures dominate transaction weight, and historical signatures can be pruned selectively (-auth-prune-depth) because they live apart from the data they authorize. Remove the post-quantum requirement and these structures lose their reason to exist; they are consequences of the cryptography, not stylistic choices.

The same logic reaches the node’s operational footprint. A chain whose spends carry ~7.2 KB of authorization data accumulates historical weight several times faster than a classical one; full initial block download and archival storage are therefore structural costs of the post-quantum requirement, not incidental ones. This is why every header commits a state root (utxo_root, spec §10): it converts the UTXO set from something a node must rebuild into something a node can verify. The snapshot bootstrap (AIP-0001) is the operational consequence of the same paragraph, not a scalability feature bolted on. A fresh node receives the state at height H, re-checks it against the commitment carried by the PoW-validated header chain, and falls back to full download the moment any check fails. Like the structures above, it exists because the cryptography demands it: a classical chain does not need an in-chain state commitment to make bootstrap verifiable, and a post-quantum chain without one would have to choose between slow onboarding and trusted state distribution.


2. Goals and non-goals

2.1 Goals

2.2 Non-goals

qanum does not attempt, in its current phase or its main thesis:

These renunciations are part of the design.


3. Design principles

3.1 The base layer must be deliberately austere

A monetary layer meant to last decades must be small in scope, comprehensible, auditable, difficult to capture, and resistant to impulsive changes.

3.2 Cryptography must not be assumed eternal

qanum treats no primitive as sacred. It designs suite versioning, alternative spending paths, gradual migration, and an explicit deprecation path.

3.3 Self-custody is a protocol and wallet function

Reasonable defaults: no address reuse, separation between operational and recovery keys, automatic change rotation, compartmentalization between accounts or roles, safer custody policies.

3.4 Scaling by layers

The base layer settles and anchors value. Higher layers process frequent payments, aggregation, stronger privacy, richer execution, and specialized environments.

3.5 Base money should not behave like a hyperactive political platform

Monetary and consensus rules must change slowly, with friction, public technical review and conservative coordination.


4. General architecture

4.1 qanum Base

The UTXO base layer: validation, consensus, custody, settlement, UTXO state commitments, native spending policies.

4.2 qanum Vault

Security policies and flows: delayed spending, hot/cold separation, recovery paths, hardened self-custody. Implemented as native templates plus wallet builders (see §14, §18.4).

4.3 qanum Channels

A payment-channels layer for low-latency off-chain payments exists as an external, client-side project (qanum-channels) with its own release cycle. It is not implemented in qanum-core, and nothing here is consensus: a channel is a P2MULTI output like any other, and the L1 sees only its funding and its settlement. That separation is deliberate and is not expected to change: work at this layer must never require a consensus rule to accommodate it.

L1 dependencies

The channel layer consumes exactly the primitives L1 already provides (no new rule, no new flag, no relative timelock):

Channel state and the commitment shape

Channels are funded by a 2-of-2 anchor (§5.3). Every state transition produces one commitment transaction per seat, signed by both parties but retained only locally: a party persists the commitment it would publish and never the peer’s. That asymmetric retention is what makes revocation safe: a peer cannot publish an old commitment of the victim’s, and a cheating peer that publishes its own revoked state can be punished.

Each commitment spends the anchor into up to three kinds of outputs:

  1. Broadcaster’s own balance: a revocable HTLC output: the counterparty can claim it by presenting the broadcaster’s per-commitment secret as the preimage; the broadcaster reclaims it through the refund branch after timeout_height = tip_at_signing + PENALTY_WINDOW (1,152 blocks = 24 h at the 75 s block time).
  2. Counterparty’s balance: a plain P2PQK output, claimable immediately.
  3. One output per in-flight HTLC, each with its own shorter absolute timeout_height (default per-hop delta 144 blocks = 3 h), so a pending conditional payment always resolves before broadcaster funds unlock.

Revocation without a relative lock

Revocation uses per-commitment secrets, the same primitive Lightning relies on, rather than any lock. At each transition both parties reveal their state-n secret to the counterparty; whoever publishes a revoked state exposes its revocable output to the holder of that secret, who spends it through the HTLC claim branch before the timeout: the entire balance the cheat claimed is forfeited.

The delay is carried as an absolute timeout_height inside the HTLC output, not as a relative lock on the L1 input. This is a deliberate simplification relative to Lightning’s OP_CHECKSEQUENCEVERIFY:

The gap is harmless in practice because the 24-hour window is one whole day of blocks, the normal path is cooperative close or prompt force-close, and a local watchtower monitors continuously (below). It is stated here honestly because it is the one true tradeoff of this design.

Fee bumping: pre-signed RBF tiers

At each state both parties sign one commitment variant per fee tier: multipliers [1, 2, 4] of the signing-time base fee. If the mempool floor rises later, the broadcaster publishes a higher-fee replacement unilaterally. A tier is only offered when the fee it reserves stays under anchor / 8, so small channels keep an affordable close path even though a 2-of-2 commitment carries 14,445 B of authorization data alone. This works because L1 transactions carry no BIP125 opt-in signal: every transaction is replaceable by a conflicting one at a strictly higher feerate (§19.6).

In-flight HTLC routing and the local watchtower

HTLC timeouts use layered absolute heights: each hop adds one CHANNEL_TIMEOUT_DELTA (144 blocks / 3 h), so the payee can claim strictly before the payer’s refund, and an HTLC expired at hop N is refundable at every earlier hop. A small local watchtower (a pure decision engine running on the operator’s own machine with the operator’s own keys, no third party) monitors the chain and raises an action before a deadline: penalties as soon as a revoked commitment is seen (they race the full window), HTLC claims a full hour before their timeout, and refunds (which have no deadline) whenever they become due.

Position in this document

The channel layer earns no privileges from Base and no commitment in this roadmap. Its only claim on this document is the honest enumeration above: the L1 limits it depends on (output templates, auth budgets, the P2MULTI key cap (§5.1), the always-replaceable mempool (§19.6)) are written down here, because a higher layer cannot design against numbers that are not.

4.4 qanum Compute

Future direction for more expressive execution off L1: rollups, sidechains, specialized domains. Not implemented, and unlike §4.3 and §4.5 no external work on it exists. Nothing in this section is consensus or scheduled.

4.5 qanum Privacy

A gradual set of privacy improvements, in this order:

  1. Implemented / operational: post-quantum encrypted transport (Noise hybridXX with X25519 + ML-KEM-1024, ML-DSA-87 node identities, TOFU), no-reuse wallet defaults, inventory trickle, echo suppression on block and tx relay.
  2. Hardening line (network, not consensus): better relay privacy and eclipse resistance.
  3. Not L1, parked: ring signatures, confidential amounts, and any scheme that hides value or the UTXO graph from a validating full node. Those belong to a future privacy domain that would settle to Base. They are not specified here and are not scheduled for the consensus templates. As with §4.3, prototype work on such a domain exists outside this repository; it settles to Base through ordinary templates, adds nothing to consensus, and its existence changes no commitment made in this document.

5. State model: UTXO with native templates

qanum uses the UTXO model because it fits discrete spending policies, isolates balances, and keeps monetary semantics simpler than a general-purpose account model.

5.1 Templates defined and enforced

ID Name Role
0x01 P2PQK Single-key spend with ML-DSA-87 (level 5). ML-DSA-44 stays in the code only for a chain that has not retired it: never testnet or mainnet
0x02 P2RKPQ Main path + delayed recovery path
0x03 P2MULTI Limited multisignature
0x04 HTLC Hash-lock + timeout (canonical 109-byte payload)
0x05 VAULT Delayed hot spend / immediate cold recovery
0x06 VAULT_PENDING Vault after init, before finalize/cancel
0x07 BURN Value destroyed; never enters the UTXO set
0x08 P2HPQ Details

Hybrid template role.

Role: ML-DSA-87 and SLH-DSA-SHAKE-256s on the main and delayed recovery paths, each with its own key pair. Optional for long-term savings.

VAULT hot-finalize delay and P2RKPQ/P2HPQ recovery delays are bounded to 144 ..= 5_256_000 blocks. VAULT creation takes an explicit delay. Identical branch keys on two-path templates, HTLC timeout_height below creation height + 2 (which guarantees a non-empty claim window), and VAULT_PENDING unlock_height == 0 are consensus-invalid. Output payloads are capped at MAX_OUTPUT_PAYLOAD_BYTES = 16_384 in the validator, not only in the parser.

The P2MULTI key cap, and why it is not free

TPL_P2MULTI accepts 1 ≤ m ≤ n ≤ P2MULTI_MAX_KEYS = 16 (n > 16 is P2MultiKeyCountTooLarge; m outside 1..=n is P2MultiThreshold). Keys must be ML-DSA-87 (from the suites5 height) or ML-DSA-44 (until the retire12 height; testnet has both heights at 0 and mainnet will too, so only ML-DSA-87 is accepted on either), one output may mix them, and they are strictly increasing by (suite_id, key_id), which also rules out duplicates: a duplicate would silently lower the real threshold.

The cap is not an independent policy dial. Spending an m-of-n output requires m signatures inside the auth entry of one input, bounded by MAX_AUTH_BYTES_PER_INPUT. At 1 + 2 + 1312 + 2420 = 3735 bytes per ML-DSA-44 seat and 1 + 2 + 2592 + 4627 = 7222 per ML-DSA-87 seat:

  budget 16_384  ->  1 + 4·3735  = 14 941 B   (ceiling 4)
  budget 65_536  ->  1 + 17·3735 = 63 496 B   (ceiling 17)
  budget 131_072 ->  1 + 18·7222 = 129 997 B  (ceiling 18 with ML-DSA-87 seats)

Raising the key cap without raising the per-input budget would produce outputs that are fundable and permanently unspendable, rejected with AuthLength, an error that never mentions multisig. constants::p2multi_max_spendable_keys() derives the ceiling rather than restating it, and a test fails if the two are ever set out of step.

The key_count field is a u8, so the wire format admits 255 keys: the limit is policy plus auth budget, not serialization. The permanent cost of a large n is the payload (2 + 34n), which lives in the UTXO set for the life of the output: 546 bytes at n = 16.

There is no general script versioning and no plan to add a ring / confidential template to this set.

5.2 Philosophy

L1 expressiveness is sufficient for money, security and advanced custody. It is not an arbitrary compute environment.


6. Post-quantum cryptography

6.1 Requirements

Maturity and standardization, auditability, reasonable verification cost, coexistence with future suites.

6.2 Implemented suites

Suite ID Public key Secret key Signature Typical use
ML-DSA-44 0x0101 1312 2560 2420 Level-1/2 hot path (retired from genesis on testnet and mainnet)
SLH-DSA-SHAKE-128s 0x0201 32 64 7856 Level-1/2 recovery / cold path (retired from genesis on testnet and mainnet)
ML-DSA-87 0x0104 2592 4896 4627 Ordinary spend; P2HPQ both paths (level 5)
SLH-DSA-SHAKE-256s 0x0203 64 128 29792 Recovery / cold; P2HPQ both paths (level 5)

The level-5 suites (NIST category 5) coexist with the first two in the code, so a chain can move from one level to the other without a flag day (crypto agility). They may appear only in outputs created from the suites5 activation height, and from the retire12 height new outputs, the coinbase included, may not use ML-DSA-44 or SLH-DSA-SHAKE-128s; spending old outputs is never gated, and a VAULT funded before the height can still be unvaulted. The anonymous coinbase pays ML-DSA-87 from the retire12 height. Testnet has both heights at 0: it is level 5 from its genesis, so no level-1/2 output ever exists on it. Regtest has suites5 at 0 and no retirement by default, both movable with -testactivationheight=suites5@<h> / retire12@<h> to exercise the transitions. Mainnet has no genesis yet; it will be level 5 from its genesis too (both heights at 0), so no level-1/2 output will exist on it either. P2PQK, P2MULTI (mixing allowed) and the VAULT hot key take ML-DSA-87; both HTLC branches and the VAULT cold key take both; a P2RKPQ pair stays within one level; a P2HPQ output takes two ML-DSA-87 keys and two SLH-DSA-SHAKE-256s keys (one of each per path), nothing else. For mainnet, the AIP condition of two independent audited implementations is half met: the node has AWS-LC / OpenSSL and qanum-pqverify (below), but qanum-pqverify is not audited yet. Their actual use depends on the network mode, cache and any configured assumevalid as described below.

Reserved, not implemented: IDs are stable and activation requires an AIP, two independent audited implementations and published consensus test vectors (spec §2.4): ML-DSA-65 0x0102, FN-DSA-512 0x0103, SLH-DSA-SHAKE-192s 0x0202.

The reference node uses two independent verification implementations: AWS-LC (ML-DSA) / OpenSSL 3.5 LTS (SLH-DSA), and qanum-pqverify, written from FIPS 204 and FIPS 205 (spec §2.4). In enforce mode, an uncached signature is accepted only if both accept; a primary rejection skips the second call. Testnet uses shadow mode: the first verdict decides and the second checks uncached candidates for disagreements. A scoped cache can reuse a previously accepted authorization after non-cryptographic checks. An eligible block under an explicitly configured assumevalid can skip signature checks; no network sets one by default. The node requires pq-crypto, tests both implementations at startup and refuses to start if either self-test fails. Non-verifying verifiers exist only in tests and the regtest-only -sim build.

For an uncached signature accepted by both, the cost is the sum of both verifiers. On the reference ARM Gold / Silver cores, ML-DSA-87 measured 162 / 525 µs for the first verifier, 220 / 790 µs for qanum-pqverify, and 380 / 1,350 µs for both. SLH-DSA-256s measured 2,100 / 6,970 µs, then 1,700 / 5,740 µs, and 3,820 / 12,740 µs for both (docs/benchmarks/2026-10-27_arm_first-verifier/). On enforce, rejection by the first costs one verification; shadow still runs the second. Verify Unit values (§11.2 of the spec) are unchanged. On the x86-64 reference VPS, SLH-DSA-128s measured 1,753 to 1,757 VU against 1,600, and SLH-DSA-256s 3,824 to 3,828 VU against 3,600; the unit is faster there (docs/benchmarks/2026-10-27_x86-64_first-verifier/). These are historical measurements, not certification of a later tree. qanum-pqverify is unaudited and a shared mistake can escape the pair (THREAT-MODEL.md).

6.3 Hashes and domain separation

Chain hash and commitments: SHA3-256. The signed message (below) uses SHA3-512 for its sub-hashes and is signed with no digest in between. Outside consensus: SHA-256 and SipHash for BIP157/158 compact filters, HMAC/HKDF-SHA-256 in the wallet key store, SHA-512 in the Noise handshake and in the release checksums.

Domain separators:

Sighash covers SIGHASH_ALL only. birth_height is not in the sighash (by design: it is a chain property, not a signing input).

Signed message. FIPS 204 §5.4 and FIPS 205 §10.2: a signature keeps the strength of its parameter set only if the signed content resists collisions at that strength. A 32-byte digest resists collisions up to about 2^128 operations, so Qanum signs the message itself, with SHA3-512 sub-hashes, and ML-DSA-87 and SLH-DSA-SHAKE-256s keep their 256 bits; it adds no bytes to a transaction. The same rule holds on every network from its genesis (spec §6).

Quantum margin of the hashes. Every commitment above (chain hash, txid/wtxid, Merkle roots, utxo_root, key_id) is 256-bit SHA3. Grover’s algorithm [17] lowers preimage and second-preimage resistance to about 2^128 quantum hash evaluations, the margin NIST assigns to AES-256 key search (category 5) [20]. Collision resistance stays at the classical birthday bound of 2^128: quantum collision search gives no practical gain once its hardware cost is counted, and 2^128 is the margin NIST uses as category 2 and the one SHA-256 gives Bitcoin today. These commitments need no change for the post-quantum horizon; the signed message, where FIPS 204 and FIPS 205 ask for the full strength, uses 512-bit hashes (above). The wallet store at rest (AES-256-GCM, Argon2id) also keeps 128 bits against Grover; its weak point is the passphrase, not the cipher.

6.4 Transaction identifiers

A global signature cache, capped at 50,000 entries, may reuse a successful authorization. Its versioned SHA3-512 key covers the full transaction, ordered spent UTXOs, validation height and verifier policy. Only a certifying verifier with a compatible scope can use it. validate_tx_no_crypto runs before lookup. The cache uses an LRU container, but a contains hit does not refresh recency; it is cleared on reorg detach.

6.5 Cryptographic agility

Each template and each address operate over versioned suites so schemes can coexist, migrate, and be deprecated without rewriting the monetary layer.

Two families in one output. Optional P2HPQ (spec §5.8) requires an ML-DSA-87 signature and an SLH-DSA-SHAKE-256s signature over the same transaction SigMsg, with a distinct domain tag for each family. Both are required on the main and delayed recovery paths, which have separate key pairs. Breaking one family alone does not authorize a spend if the other family, its implementation and its keys remain secure.

This can be evaluated for high-security savings, including institutional custody scenarios, but it is experimental and not independently audited. Both keys of a path can be held by one wallet; two signatures do not by themselves provide independent people, approvals or custody. An input carries 37,080 B of auth_data (37,084 B as a serialized auth entry) and costs 3,890 verify units, about five times the bytes and thirteen times the verify units of an ML-DSA-87 spend. The wallet offers the hybrid address type for savings; payments and change stay ML-DSA-87.


7. Addresses and output format

qanum uses Bech32m addresses.

7.1 HRP per network

7.2 Structure

An address encodes addr_version, template_id and payload. It is a compact reference to the template and its canonical payload, not a bare hashed public key.

P2PQK can encode ML-DSA-87 and ML-DSA-44 (suites::KeyRole::P2pqk). The SLH-DSA suites are stored as recovery keys and are not encoded as P2PQK strings (getnewaddress slhdsa returns {key_id, suite, note}).

7.3 Operational philosophy

No address reuse, change to fresh addresses, clear separation of roles and custody paths.


8. Scripting and L1 expressiveness

qanum rejects a general-purpose virtual machine on the base layer.

8.1 What L1 does support

Differentiated signature paths, limited multisignature, time locks, hash locks, recovery paths, delayed vaults, explicit spend policies, all as native templates plus contextual height rules.

8.2 What L1 does not intend

Turing-complete execution, EVM compatibility, stateful arbitrary contracts, general-purpose DeFi, ring / confidential ledgers, or hidden amounts.


9. Consensus: Proof of Work

9.1 Reasons

Relative neutrality, a link between security and verifiable external cost, less dependence on stake-based governance, good fit with an austere monetary layer.

9.2 PoW

bits must be the canonical compact encoding of a target in [1, POW_LIMIT]. Non-canonical encodings are rejected.

9.3 Target block time

This interval is the ASERT spacing. It is a consensus constant. The miner’s template clock is not tip + 75; see §18.5.

9.4 Difficulty adjustment

Anchored ASERT (anchor derived from genesis):

After a long idle, the first new block still carries the difficulty computed from its parent; the next one, whose parent is stamped late, typically sits at POW_LIMIT. That is the formula, not a bug. For the same reason a drop in hash power is priced one block later than with a rule on the block’s own time.

9.5 Time rules

9.6 Best chain

The active chain is the valid chain with the most accumulated work whose blocks are all stored. On equal work the tip seen first stays, and the node reorganizes only to a chain with strictly more work, as Bitcoin Core does (FindMostWorkChain, nSequenceId). The best header of the header DAG follows the same rule (Core m_best_header). A deep reorg (detach > 100) is accepted if it has more work; the node only raises a warning (log, RPC warnings, -alertnotify).

Two sibling blocks always have equal work: their bits come from the shared parent (§9.4), so the block seen first keeps the tip and a later sibling, whatever its timestamp, is stored as a side branch.

9.7 Coinbase maturity

COINBASE_MATURITY = 1152 blocks (~24 h at 75 s).

9.8 Chain-security parameters (no checkpoints)

There are no fixed consensus checkpoints: a valid chain is selected by accumulated work, not a hardcoded reorg depth. Local data availability still matters: a snapshot node cannot reorganize below its snapshot base, and a pruned node may lack older bodies or undo data. Compiled parameters cannot select a chain (CHECKPOINT-POLICY.md):

9.9 Quantum adversary and proof of work

Post-quantum signatures protect spending against Shor’s algorithm. They do not protect the nonce search, and no choice of hash function would: Grover’s algorithm [17] finds a header hash below the target with a quadratic speed-up, for SHA3-256 exactly as for SHA-256. Memory-hard or other PoW functions also keep a polynomial quantum advantage [19]. Qanum does not claim that its proof of work is quantum-resistant. Its position:


10. Resource accounting

A post-quantum network cannot measure block cost in bytes alone.

10.1 Dimensions

  1. Base bytes and auth bytes (separated in the tx / block format)
  2. Verify units

10.2 Implemented limits

Limit Value
MAX_TX_BASE_BYTES 200_000
MAX_TX_AUTH_BYTES 1_000_000
MAX_AUTH_BYTES_PER_INPUT 131_072
MAX_BLOCK_BASE_BYTES 1_000_000
MAX_BLOCK_AUTH_BYTES 3_000_000
MAX_BLOCK_VERIFY_UNITS 200_000

10.3 Verify units

Operation Units
ML-DSA-44 verify 100
SLH-DSA-128s verify 1600
ML-DSA-87 verify 290
SLH-DSA-256s verify 3600
Hash preimage check 10
Multisig overhead 20
Vault structural check 10

Measured costs (pre-release development build, examples/pq_bench on the build machine, aarch64, one core per run; raw data and method in docs/benchmarks/2026-10-14_arm/): verifying ML-DSA-87 takes 167 µs on a Gold core and 545 µs on a Silver core, SLH-DSA-256s 1,890 µs and 6,670 µs. Against ML-DSA-44 = 100, ML-DSA-87 measures 283-286 units, SLH-DSA-128s 1466-1576 and SLH-DSA-256s 3200-3492, under the constants above, which leave room above the spread between rounds. A block at the auth-bytes limit (415 ML-DSA-87 spends) validates in 152 ms / 553 ms on one thread with every signature verified, and the verify-unit worst case (57 SLH-DSA-256s recoveries, two more than fit at 3600 VU) in 125 ms / 446 ms. Numbers are indicative; the VU costs above remain the consensus budget. On an x86-64 EPYC core (docs/benchmarks/2026-10-14_x86-64/) every check is faster (worst blocks 75-86 ms) but the SLH-DSA ratios are higher (2623-2687 and 5601-5902), because liboqs runs ML-DSA with vector code there and SLH-DSA in portable C. The budget bounds time, so the constants follow the slowest core. That historical campaign used liboqs; the current source uses AWS-LC / OpenSSL. These timings do not certify a later source revision.


11. UTXO set commitment

11.1 Key elements

Every header carries utxo_root. The tree commits, for each coin:

BURN outputs never enter the set.

11.2 Engines

The consensus rule is the root itself (spec §10); the node has two ways to compute it, and both must give the same bytes. The reconstructive engine (ReconstructiveCommitmentEngine, compute_utxo_root) hashes the whole set, O(N x 256), on several threads for large sets: it is the reference, computes the genesis root and validates blocks on the paths that carry no cache (rebuilds from the block store, tests). The running node (ChainManager) passes a sparse-tree cache (src/sparse_tree_cache.rs) to block validation, reorganizations and templates: it applies only the block’s net delta, keeps the tree’s branch nodes (bounded) and a leaf hash with a chain memo per coin, and is rebuilt from the chainstate when cold. If the resulting root differs from the header, the delta is reverted and the block rejected. The cache is never a source of truth: it holds only values derived from the chainstate. Equivalence is tested (utxo_root_delta_equivalence, sparse_tree_equivalence_chain); costs are in UTXO-COMMITMENT-SCALE.md. The three #[ignore] tests in the suite are two manual large-RAM benchmarks (chainstate_scale_benchmark, utxo_commitment_scale_benchmark) and the generator of the crypto self-test vectors (regenerate_self_test_vectors). None is a consensus hole.

11.3 Strategic value

Explicit commitments let a snapshot UTXO set be checked against the utxo_root in its validated header chain. This does not replay historical transactions or independently prove that the chain is the network’s chain. P2P bootstrap adds minimum-work and peer-corroboration checks; manual offline installation skips them. See AIP-0001.


12. Storage management and pruning

12.1 Cost of post-quantum signatures

An ML-DSA-87 public key + signature is about 7.2 kB (ML-DSA-44: about 3.7 kB), versus tens of bytes for a classical Schnorr signature. At equal transaction counts the chain grows faster unless auth data is treated separately.

12.2 Base/auth separation

Implemented in the block format. Auth can be stored and served differently from base data.

12.3 What is implemented today

12.4 Selective auth-data pruning

Implemented (-auth-prune-depth=<N>): full blocks older than N confirmations are converted to base-only .qnlp files (historical non-coinbase signatures are discarded) while base data, undo data and the optional indexes (txindex, addressindex, blockfilterindex) are kept, so deep reorgs and explorer queries keep working. The coinbase retains its full auth (its txid covers the full serialization; pruning it would break the merkle root and txindex lookups). Such a node reports pruned: true, auth_pruned: true with auth_prune_depth in getblockchaininfo and advertises NODE_NETWORK only: it cannot serve full history to peers (an auth-pruned block is answered with NotFound). Archive nodes that keep full history serve IBD.

12.5 Validation compatibility

Auth pruning does not weaken consensus: IBD still needs a source of full blocks (an auth-pruned node advertises NODE_NETWORK only), and a node that has already validated can drop old signatures and still serve the current UTXO set.


13. P2P network and transport

13.1 Current state (net_v2, protocol version 3)

13.2 Hardening line (not a missing property of the stack)

More private relay, stronger eclipse resistance, peer-metadata policy. These refine the existing encrypted network; they do not replace it.

13.3 Mempool (as implemented)

Caps: 40_000 entries (DEFAULT_MAX_MEMPOOL_ENTRIES) and DEFAULT_MAX_MEMPOOL_BYTES = 32_000_000 (32 MB ≈ ten minutes of full blocks at the 4 MB / 75 s absorption rate). Both are operator-configurable (maxmempool, maxmempoolentries), and docs/STORAGE.md publishes node profiles: a low-RAM domestic node may run 4-8 MB safely (the admission, eviction and expiry machinery below does not depend on the cap), while archive or exchange nodes may raise it for deeper fee buffers. Default min_fee_rate = 1 joma/byte (configuration file; a configured 0 is published honestly). Snapshots (mempool.bin, magic QNMP, format v5) persist the live policy, the orphan relay cache (the CVE-2024-52914 class) and the priority deltas; formats v1-v4 still load.

Replacement: every tx is replaceable (sequence = 0xffffffff is required). There is no BIP125 signal. A replacement must pay replaced_sum + min_fee_rate * size and a strictly higher feerate than the highest evicted tx. Eviction scores the descendant package. Entries older than 14 days (time != 0) are dropped on refresh; time == 0 (legacy) is kept. Rebuild after reorg uses the live min_fee_rate. Inbound FeeFilter is stored and honored: inventory announcements to a peer are filtered by its announced floor.

The orphan map is wired into accept/relay: cap MAX_ORPHANS = 100 (node-configurable, -maxorphantx), TTL ORPHAN_TTL_SECS = 15 min, O(1) resolution via orphan_parents, persisted in the mempool.bin snapshot (format v4 and later). Entries restored from an older snapshot with time == 0 never expire.

Package relay on the wire (announcing ancestor sets) is not implemented.


14. Advanced custody: Vaults and recovery

14.1 Vaults

A hot VAULT init confirmed at height H creates VAULT_PENDING, whose hot finalize is valid from H plus the explicit delay. Cold recovery of the original VAULT and cold cancellation of an unspent pending output have no height delay. Each VAULT input uses the chosen hot or cold signature, not both. Wallet builders enforce branch ownership per named wallet. The cancel builder requires a confirmed pending output; a cancel signature is tied to that specific outpoint. See VAULT-ADVERSARIAL.md.

14.2 Recovery

P2RKPQ separates the main path from a delayed recovery path (typically SLH-DSA). P2HPQ needs both signature families on the main and delayed recovery paths. For both templates, the recovery delay starts at output confirmation; it does not hold up the main path or provide a cancellable spending window. The default wallet-created P2HPQ delay is 105,120 blocks, or 91.25 days at the 75-second target; actual elapsed time is not guaranteed.

14.3 Philosophy

Safer defaults and native templates. Not confiscation of inactive funds, not mandatory proof-of-life.


15. Scaling and higher layers

qanum does not promise thousands of TPS on the base layer.

15.1 Role of L1

Final settlement, high-value custody, opening and closing higher-layer structures, anchoring aggregated states.

15.2 Channels / compute

An external payment-channels project exists and works as a client-side layer (§4.3), but it is not consensus code: Base neither sees channel state nor has a rule that mentions a channel. An off-chain layer moves traffic off L1: it does not raise what L1 itself can validate, and it required no new L1 rule (not even a relative lock; revocation uses per-commitment secrets with absolute heights, §4.3). Honest L1 throughput should be thought of in tens of TPS, and that is the number to plan against.


16. Monetary policy

Documented and frozen for mainnet genesis in docs/monetary-policy-decision-record.md.

16.1 Principles

Predictability, credibility, long-term security, low political discretion.

16.2 Parameters

16.3 Subsidy

epoch = floor(height / 420480)
subsidy(epoch) = max(floor(INITIAL_SUBSIDY * 9^epoch / 10^epoch), TAIL_SUBSIDY)

There is no strict final hard cap. Emission decreases and then stays at the tail (~84_096 QAN/year). Supply when the tail is reached (epoch 36) is ~32.9 M QAN; the tail keeps adding thereafter.

As implemented (src/economics.rs), the computation is exact integer arithmetic: num = INITIAL_SUBSIDY, den = 1, both u128; each epoch applies checked_mul(9) / checked_mul(10) followed by a gcd reduction of the fraction; the result is max(num / den, TAIL_SUBSIDY). The exact tail is reached at epoch 36; the first checked overflow fires while computing epoch 41, whose exact value (10,642,235 jomas) is already below the tail and the sequence is monotonic, so returning TAIL_SUBSIDY there is exact, not an approximation.

16.4 Fees

100 % of fees to the block miner.


17. Governance

Low-intrusion. Protocol changes: public proposal, technical discussion, reference implementation, review, conservative activation. No tokenized on-chain governance of base consensus. The monetary layer must change slowly.


18. Current implementation status

A substantial Rust implementation. user_agent and getnetworkinfo.version are derived from CARGO_PKG_VERSION (/Qanum:<version>/).

18.1 Core

Binary parser (non-minimal compact-size rejected), txid/wtxid, sighash, merkle, reconstructive utxo_root, validator (height/path policy in no_crypto), PoW, anchored ASERT, header chain, chainstate, undo bound to vin.

18.2 Chain infrastructure

Block store and tree (RAM cache + persistent block_index.bin), header index with journal, undo store, graph-aware reorg, persisted mempool with post-reorg rebuild, whole-block prune, deferred chainstate snapshots (default interval 32), optional txindex / addressindex / filterindex.

18.3 P2P and sync

net_v2 as in §13: post-quantum Noise transport + TOFU on node identities, connman (reserved outbound, 1-per-netgroup outbound, inbound netgroup quota), DNS seeds, IBD invariance, single header-sync leader, download quotas, echo suppression, block-orphan lifecycle, side-branch detection, stall timeouts, decoupled scheduler<->connman backpressure, in-memory header serving, BIP157 serving when the index is current.

18.4 Wallet

Key store (Argon2id + AES-256-GCM, zeroize), named multi-wallet, scan and live balances across all custody templates, Bech32m, P2PQK / P2RKPQ / P2HPQ / VAULT / HTLC builders, getnewaddress including SLH-DSA recovery keys, dump/import with suite-length and size caps, mining rewards to a key or P2PQK address.

18.5 Miner

A single constructor: miner_v2. src/miner.rs does not exist. Template timestamp is max(MTP + 1, adjusted_now) capped at now + 2h. Selection is ancestor-package fee/vu under the block budgets. Coinbase auth is height compact-size + QAN-MINER. Daemon (-gen, generatetoaddress) and offline mine-block / mine-blocks share this path.

18.6 RPC / CLI

JSON-RPC 1.0 style plus a native envelope for qanum-cli. No aliases, no duplicate commands. Extra positional parameters are rejected. Networks and default ports:

Network HRP RPC P2P (Noise, PQ)
mainnet qn 8338 8445
testnet tqn 18338 18445
regtest rqn 28338 28445

One P2P port per network, always encrypted. There is no plain-text P2P port: the node refuses to start with -plaintextport.

18.7 Tests and testnet

18.8 Specification track (proposals, not implemented)

The companion consensus specification (spec.md) writes down four proposals that are not implemented and change no consensus rule until an AIP activates them:

Proposal Spec section One-line summary
Relative lock via sequence §3.2 bits 0-15 = relative height delay; as implemented, sequence must be 0xffffffff. Not a prerequisite for L2 channels: the external channel layer achieves revocation with per-commitment secrets and absolute timeout_heights inside HTLC outputs, so this proposal stays optional
Upper bound for long addresses §16.1 addresses longer than 90 characters already work, with no length cap; a 2,048-character cap is proposed
Compact proofs §17 binary tx-inclusion and 8 KB SMT UTXO-inclusion proof formats for light clients (the gettxoutproof RPC and BIP157/158 filters are implemented)
Reserved suite registry §2.4 stable IDs 0x0102 / 0x0103 / 0x0202 with an explicit activation rule (the level-5 0x0104 / 0x0203 are implemented, §6.2)

Until these are implemented and locked, higher layers must not design against them.


19. Risks and trade-offs

A consolidated threat model (adversary classes, attack costs, mitigations and accepted residuals) is maintained in docs/THREAT-MODEL.md.

19.1 More expensive post-quantum signatures

Mitigation: path separation, native templates, verify units, austere L1, selective auth-data prune (-auth-prune-depth).

19.2 Wallet and custody complexity

Mitigation: safe defaults, explicit templates, hot/cold separation, native flows.

19.3 Long-term security budget

Mitigation: PoW, decreasing curve, low permanent tail.

19.4 P2P transport

The P2P transport is post-quantum: a hybrid Noise handshake (X25519 + ML-KEM-1024) with ML-DSA-87 node identities. A classical X25519 key exchange alone would leave recorded traffic open to later decryption by a quantum computer (“harvest now, decrypt later”); because the session keys also depend on ML-KEM-1024, recorded traffic stays confidential unless both X25519 and ML-KEM-1024 are broken. Remaining work is hardening (relay privacy, anti-eclipse).

19.5 Incumbent network effect

Mitigation: complementary positioning as an austere PQ monetary base.

19.6 Always-replaceable mempool

Every transaction is RBF. That is the opposite of pinning: a higher-feerate conflict evicts. It is a deliberate policy, not an unfinished BIP125.

19.7 Quantum mining

The proof of work is not quantum-resistant, for any hash function (§9.9). Mitigation: per-block ASERT, stale-rate and deep-reorg monitoring; the residual risk is the same as a classical majority of hash power.


20. Indicative roadmap

Done

Rust node, chainstate, PoW + ASERT, wallet with OQS, net_v2 sync, RPC, encrypted transport, structured logging, getnewaddress, shared qanum.conf, adversarial RPC hardening, persistence hardening, mempool policy, unified miner, time/PoW tests.

Phase 2 remainder: wider public testnet

Phase 3: Mainnet preparation

Not in this phase: command aliases.

Phase 4: Advanced scaling and tooling

Phase 5: Modular compute and strong privacy


21. Conclusion

qanum is born from a simple conviction: the next great monetary infrastructure should not try to do everything in its base layer. It must be secure, austere, adaptable and designed to last.

Its proposal combines a verifiable UTXO base, PoW as an anchor of neutrality, post-quantum cryptography from genesis, an encrypted transport already in the stack, hardened multi-node sync, vaults and recovery as real self-custody, and a modular roadmap where advanced payments, stronger privacy and expressive compute live off L1.

The design reduces to three commitments: long-term security, safer self-custody and disciplined modularity. Every structure in this document should be read against them; how each component relates to prior art is recorded in ARCHITECTURE.md (provenance table) and BIP-REGISTER.md.


References

Standards and prior art used by this design. The provenance of each adopted component (what was re-parameterised, what was reimplemented clean-room) is tabulated in ARCHITECTURE.md.

Cryptographic standards

  1. NIST FIPS 202, SHA-3 Standard (2015). PoW hash (sha3_256(header)) and domain-separated hashing. https://doi.org/10.6028/NIST.FIPS.202
  2. NIST FIPS 203, Module-Lattice-Based Key-Encapsulation Mechanism Standard (ML-KEM, 2024). ML-KEM-1024 in the hybrid P2P handshake (§13.1, §19.4). https://doi.org/10.6028/NIST.FIPS.203
  3. NIST FIPS 204, Module-Lattice-Based Digital Signature Standard (ML-DSA, 2024). The ML-DSA-87 and ML-DSA-44 signing suites. https://doi.org/10.6028/NIST.FIPS.204
  4. NIST FIPS 205, Stateless Hash-Based Digital Signature Standard (SLH-DSA, 2024). The SLH-DSA-SHAKE-256s and SLH-DSA-SHAKE-128s suites. https://doi.org/10.6028/NIST.FIPS.205
  5. T. Perrin, The Noise Protocol Framework, revision 34 (2018). Base of the P2P handshake (XX pattern, extended with ML-KEM in the hybrid form implemented by the clatter crate). https://noiseprotocol.org/noise.html

Ecosystem prior art

  1. BIP-173, Base32 address format for native v0-16 witness outputs (bech32). https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki
  2. BIP-350, Bech32m format for v1+ witness outputs. https://github.com/bitcoin/bips/blob/master/bip-0350.mediawiki
  3. BIP-157, Client Side Block Filtering. https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
  4. BIP-158, Compact Block Filters for Light Clients (official test vectors used by the filter suite). https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
  5. ASERT, 2020-NOV-15 ASERT Difficulty Adjustment Algorithm (aserti3-2d), Bitcoin Cash upgrade specification. Re-parameterised here for 75 s target spacing and a 172 800 s half-life. https://upgradespecs.bitcoincashnode.org/2020-11-15-asert/
  6. Assume UTXO, J. O’Beirne, The design of assumeutxo, Bitcoin Core design docs. The out-of-band-anchored UTXO-snapshot mechanism that AIP-0001 improves on by anchoring the state root in-chain (utxo_root per header, spec §10). https://github.com/bitcoin/bitcoin/blob/master/doc/design/assumeutxo.md

Companion documents in this repository

  1. spec.md: technical specification (normative draft).
  2. ARCHITECTURE.md: architecture, prior-art provenance table, and “Why a new chain”.
  3. BIP-REGISTER.md: adopted de-facto ecosystem conventions, credited.
  4. CVE-REGISTER.md: vulnerability history and fixes.
  5. monetary-policy-decision-record.md: monetary options compared, with the exact subsidy computation.

Quantum adversary (§6.3, §9.9)

  1. L. K. Grover, A fast quantum mechanical algorithm for database search, STOC 1996. https://arxiv.org/abs/quant-ph/9605043
  2. D. Aggarwal, G. Brennen, T. Lee, M. Santha, M. Tomamichel, Quantum attacks on Bitcoin, and how to protect against them, Ledger 3 (2018). https://arxiv.org/abs/1710.10377
  3. O. Sattath, On the insecurity of quantum Bitcoin mining, International Journal of Information Security 19 (2020). https://arxiv.org/abs/1804.08118
  4. M. Amy, O. Di Matteo, V. Gheorghiu, M. Mosca, A. Parent, J. Schanck, Estimating the cost of generic quantum pre-image attacks on SHA-2 and SHA-3, SAC 2016. https://arxiv.org/abs/1603.09383

Appendix A: Parameters as implemented

Component Value
State model UTXO, 8 native templates
Consensus PoW, SHA3-256(header), big-endian
Header 152 bytes, version 1
Target block time 75 s
Difficulty ASERT, half-life 172_800, clamp [1, POW_LIMIT]
POW_LIMIT_BITS 0x1e0fffff
Time rules MTP-11 strict >; +2 h future window
Tip tie-break most work; on equal work the tip seen first (Core nSequenceId)
Coinbase maturity 1152
Main suite ML-DSA-87 (pk 2592 / sk 4896 / sig 4627), level 5, the only one on testnet and mainnet; ML-DSA-44 (pk 1312 / sk 2560 / sig 2420) only on a chain that has not retired it
Recovery suite SLH-DSA-SHAKE-256s (pk 64 / sk 128 / sig 29792), level 5, the only one on testnet and mainnet; SLH-DSA-SHAKE-128s (pk 32 / sk 64 / sig 7856) only on a chain that has not retired it
Hashes SHA3-256 (consensus), SHA3-512 (signed message); outside consensus SHA-256 + SipHash (BIP157/158), HMAC/HKDF-SHA-256 (wallet store), SHA-512 (Noise, release checksums)
Sighash SIGHASH_ALL only; no final digest, SHA3-512 sub-hashes
Sequence 0xffffffff (always replaceable)
Monetary policy 8 QAN, 10 %/epoch, tail 0.2 QAN
P2P net_v2, protocol 3, Noise hybridXX (X25519 + ML-KEM-1024)
  ML-DSA-87 identities + TOFU; magic qan1/5/3
Mempool 40 000 entries / 32 MB (defaults, operator-tunable: maxmempoolentries / maxmempool), persisted as mempool.bin (format v5), 14-day expiry, orphan TTL 15 min
Miner miner_v2 only; max(MTP+1, now)
Chain-security parameters No checkpoints; header pre-sync and dynamic work threshold
  Testnet floor: genesis work; assumevalid unset on all networks
Test inventory 2,440 test functions by static count (TESTSUITE.md)
Consensus spec spec.md, companion draft, kept in step with the code

Appendix B: Encrypted transport (not encrypted amounts)

The P2P transport is always encrypted and authenticated post-quantum: hybrid Noise XX (X25519 + ML-KEM-1024) and an ML-DSA-87 node identity, pinned trust-on-first-use per SocketAddr. A mismatch rejects; a planned rotation (rotatep2pidentity) carries a signed succession for 60 days so pins follow it, and operators clear any other pin with removetofuentry.

That encrypts the socket. Transaction amounts, templates and the UTXO graph remain public to every full node, by design, so the base stays auditable.

What remains a hardening goal is advanced relay privacy (trickle is already present, and inventory filtering by a peer’s FeeFilter is implemented) and eclipse mitigation. Those are network-stack work. They are not ring signatures and they are not confidential transactions.


Appendix C: Glossary

Terms used across this document and the companion specification.