quantum-migration.md (15092B)
1 # Quantum-resistance migration 2 3 ## Status 4 5 Iuna is not currently post-quantum secure. The live mainnet-candidate protocol uses Ed25519 for 6 wallet transactions, leader proofs, burn-bundle attestations, peer identity, and release signing. 7 Its class-group Wesolowski VDF also does not carry a post-quantum security claim. 8 9 This document defines the migration constraints and staged protocol shape. The candidate-network 10 implementation now contains the fixed height-3000 transaction-v2 consensus gate. Shipping a 11 release that can reach that height still requires independent cryptographic review, adversarial 12 tests, and a multi-node migration rehearsal. 13 14 The standardized signature candidates are ML-DSA (FIPS 204) and SLH-DSA (FIPS 205). The initial 15 transaction candidate is a hybrid of Ed25519 and ML-DSA-44: both signatures must verify. Hybrid 16 mode protects the transition if either the classical or post-quantum component later fails, but it 17 does not remove the need to migrate before a cryptographically relevant quantum computer exists. 18 19 ## Stable scheme identifiers 20 21 The protocol reserves these one-byte identifiers: 22 23 | ID | Scheme | Public key bytes | Signature bytes | Consensus status | 24 |---:|---|---:|---:|---| 25 | 0 | Ed25519 | 32 | 64 | active legacy scheme | 26 | 1 | ML-DSA-44 | 1,312 | 2,420 | reserved | 27 | 2 | Ed25519 + ML-DSA-44 | 1,344 | 2,484 | reserved | 28 29 IDs identify exact parameter sets and encodings, not algorithm families. A future parameter or 30 encoding change receives a new ID. Unknown IDs must fail closed. 31 32 ## Address and authorization model 33 34 Version-0 addresses continue to contain an Ed25519 public key. This representation must remain 35 valid for historical consensus data. 36 37 Version-1 addresses should contain a fixed 32-byte, domain-separated commitment to: 38 39 1. the signature scheme ID; 40 2. the exact encoded public-key lengths; 41 3. the exact encoded public keys. 42 43 The public keys move into the spending authorization rather than the UTXO. Validation recomputes 44 the commitment before checking every required signature. This keeps outputs and user-facing 45 addresses compact while allowing large and variable-size post-quantum keys. 46 47 The consensus representation must retain the address version. Returning only the 32-byte payload 48 from Bech32m decoding is insufficient because a validator must know whether an output is an 49 Ed25519 key or a commitment. The Rust domain model should therefore replace bare address strings 50 at new protocol boundaries with a typed (version, payload) value. 51 52 ## Transaction identity 53 54 Post-quantum signatures must not become transaction identifiers. Hybrid signatures are large and 55 ML-DSA may produce different valid signatures for the same payload. Version-2 transactions should 56 use a domain-separated transaction hash over the canonical signed transaction as their fixed-size 57 ID. Outpoints and indexes must refer to this ID. Legacy signature-based transaction IDs remain 58 valid for historical transactions. 59 60 Fee and block accounting must use actual canonical byte lengths. The current fixed 32-byte public 61 key and 64-byte signature assumptions must not be applied to version-2 transactions. Mempool, 62 gossip, JSON, SQLite compaction, block selection, and the one-megabyte block limit all require 63 boundary tests with maximum-size hybrid authorizations. 64 65 ## Activation sequence 66 67 1. Crypto agility: centralize current Ed25519 operations; reserve exact scheme IDs; add typed, 68 length-delimited key and signature encodings. This is consensus-neutral. 69 2. Read support: nodes parse version-1 addresses and version-2 transactions but reject them as 70 not-yet-active. Unknown versions and schemes fail closed. 71 3. Hybrid activation: at an announced height, permit version-1 outputs and require both 72 Ed25519 and ML-DSA-44 signatures when spending them. Keep version-0 spends valid. 73 4. Wallet migration: default all new receive addresses to version 1 and provide one action that 74 consolidates every version-0 UTXO into version-1 outputs. Show remaining legacy value in node 75 status and the wallet UI. 76 5. Legacy sunset: only after measured migration coverage and extensive notice, stop creating 77 version-0 outputs. A later restriction on version-0 spending is a separate consensus decision; 78 it can strand funds and cannot distinguish an owner from a quantum attacker. 79 6. Classical removal: removing Ed25519 from hybrid authorization requires a new scheme ID and 80 activation. It is not implied by enabling ML-DSA. 81 82 All stages must be rehearsed across the height boundary with old and new nodes, snapshot restore, 83 fork recovery, mempool rebroadcast, compact-store reload, and lightweight-wallet signing. 84 85 ## Release sequence 86 87 Application, transport, and consensus versions move independently: 88 89 1. A protocol-v2 application release advertises read capabilities in the optional capabilities 90 field. Old nodes ignore the field and an omitted field means no advertised capabilities. 91 2. A later application release ships dormant transaction-v2 and hybrid verification code. 92 3. After deployment coverage is measured, the complete integration release advertises 93 transaction-v2-blocks and announces candidate height 3000 as the consensus transition. The 94 feature must not be introduced and activated in the same release. 95 4. Wallet defaults may change after activation without another consensus version. Refusing new 96 legacy outputs, changing the VDF, or removing Ed25519 each requires its own later activation. 97 5. At candidate height 3750, mine-action, finalizer, and committee rewards switch from legacy 98 Ed25519 destinations to authenticated version-1 hybrid payout addresses. This is a coordinated 99 consensus transition; every block producer and validating node must upgrade before the boundary. 100 101 There is no separate public Iuna testnet. The iuna-mainnet-candidate network is the rehearsal 102 network for this migration. Once hybrid wallet keys and the complete transaction-v2 path are 103 available, that candidate network may begin value migration at the fixed, reviewed activation 104 height 3000. This does not turn activation into a runtime flag: nodes restored from old backups 105 must still deterministically reach the same rule at the same height. 106 107 Capability names are sorted, unique, lowercase ASCII tokens. A hello may advertise at most 16 108 tokens of at most 64 bytes each. These limits are enforced before the handshake is accepted. 109 110 ### Transaction-v2 activation target 111 112 The transaction-v2 binary envelope and its canonical hash identifier are compiled into the node. 113 Blocks carry canonical lowercase-hex envelopes in a separate transactions_v2 list so legacy 114 transaction JSON remains unchanged. Candidate height 3000 is compiled in as the consensus 115 activation target; it is not an operator-controlled feature flag and cannot be changed through 116 configuration. Nodes reject v2 mempool and block entries below that height. 117 118 The reserved format binds the chain ID and genesis hash, uses typed versioned addresses, stores one 119 length-delimited authorization per spending input, and hashes the complete canonical signed bytes 120 for its transaction ID. An explicit migration transaction tags and references legacy 32-byte hash 121 or 64-byte signature transaction IDs and retains Ed25519 authorization so existing value can move 122 to a version-1 output. Ordinary v2 transactions use 32-byte hash IDs; every later spend of a 123 version-1 output requires Ed25519 + ML-DSA-44. 124 Verification uses the exact-pinned RustCrypto ml-dsa 0.1.1 implementation. That implementation 125 has not been independently audited, so an independent review and an explicit backend acceptance 126 decision remain prerequisites for treating the active rules as production-ready. Nodes advertise 127 the transaction-v2 block capability and relay canonical transaction-v2 envelopes only to peers 128 that advertise the separate transaction-v2-mempool capability. Hybrid burns extend the active 129 height-3000 consensus path, including ticket creation and committee burn bundles. Nodes therefore 130 require the additional transaction-v2-burns capability once transaction v2 is active; validators 131 that lack it must be upgraded together rather than remaining connected through a gradual relay 132 rollout. The management wallet can submit reviewed migration batches, ordinary hybrid transfers, 133 and anchored hybrid burns. It deterministically rotates hybrid receive/change addresses and uses a 134 separate reward branch that rotates after a spend reveals its current key. Broader recovery 135 rehearsal and independent review of the rotation behavior remain release blockers. 136 137 ### Hybrid reward activation target 138 139 Candidate height 3750 is the fixed activation target for hybrid reward payouts. Through height 140 3749, mine actions and implicit block rewards retain their historical legacy destinations. From 141 height 3750 onward: 142 143 - PoW mine actions must name an address-v1 hybrid recipient; 144 - every block must carry a version-1 finalizer payout address authenticated by the finalizer's 145 Ed25519 identity and committed by the block hash and VDF seed; 146 - every rewarded committee attestation must carry its own version-1 payout address inside the 147 signed burn-bundle payload; and 148 - peers preparing the activation boundary must advertise hybrid-reward-payouts. 149 150 Compact snapshot v9 preserves the authenticated payout fields while v7 and v8 remain readable. 151 Nodes without the hybrid reward rules will diverge at height 3750, so unlike the earlier gradual 152 transaction-v2 mempool rollout, this boundary requires a coordinated validator upgrade. 153 154 Pending and confirmed transaction-v2 entries are included in the management wallet history and 155 chain views. Confirmed history is materialized from the canonical chain snapshot, so a chain 156 reorganization atomically replaces entries from the abandoned branch. 157 Pending transaction-v2 envelopes are journaled in the chain database before a wallet migration 158 reports durable success; a storage failure is surfaced separately from broadcast failure. On 159 restart they are decoded and validated against the restored 160 canonical chain before re-entering the mempool and normal periodic rebroadcast path. Mining, 161 reorganization, invalidation, and an explicit chain reset reconcile or clear the journal instead 162 of blindly replaying stale spends. 163 164 The verification tests include a small audit corpus pinned to exact NIST ACVP-Server and C2SP 165 Wycheproof commits and file hashes. It covers a valid NIST signature, Wycheproof's repeated-hint 166 regression, and a valid signature at the ML-DSA-44 norm boundary. A dedicated fuzz target exercises 167 both the transaction-v2 decoder and arbitrary ML-DSA-44 verification inputs; it remains part of the 168 release's time-bounded, coverage-guided cargo fuzz gate while wallet submission is gated. Seed 169 corpora, newly discovered coverage inputs, and crash artifacts are retained as release evidence. 170 171 ### Hybrid wallet keys 172 173 The existing wallet seed phrase now deterministically derives a separate ML-DSA-44 seed using the 174 fixed iuna-wallet-ml-dsa44-seed-v1 domain. The original Ed25519 derivation is unchanged, so 175 existing addresses, encrypted wallet files, and backups remain valid. The wallet can construct an 176 address-v1 commitment and create an Ed25519 + ML-DSA-44 authorization over one byte-identical 177 payload. ML-DSA secret intermediates use the backend's zeroization support. 178 179 This key capability alone does not create spendable address-v1 outputs. The wallet UI must not 180 offer the address until transaction-v2 submission, mempool, block, gossip, persistence, and fee 181 accounting are connected and activated together on the candidate network. 182 183 The domain layer now has a separate v2 pending pool. It checks the fixed height boundary, the 184 ledger-derived chain domain, canonical encoded byte limits, UTXO ownership, value conservation, 185 legacy/v2 double-spends, and dependent v2 transactions. At and after height 3000, block selection 186 can include those transactions; their exact envelopes are committed by the VDF seed and block 187 hash, counted against the shared transaction and byte limits, applied with UTXO lineage, persisted 188 in compact snapshot v8, and carried forward after reorgs. Snapshot v7 remains readable. Snapshot 189 v9 extends that framing with authenticated hybrid reward destinations and indexed v2 burn-bundle 190 attestations while retaining v7/v8 read compatibility. Blocks 191 therefore propagate through the existing block P2P path. Standalone v2 mempool gossip now accepts, 192 validates, canonicalizes, rebroadcasts, and periodically re-announces v2 envelopes. The management 193 wallet reports legacy and hybrid balances, exposes an authenticated migration preview, submits one 194 reviewed block-bounded migration batch at a time, can spend confirmed hybrid value to another 195 address-v1 recipient, and can destroy confirmed hybrid value through the same one-block burn queue 196 used by legacy burns. Hybrid burns create ordinary lottery tickets linked to the Ed25519 component 197 of the hybrid wallet and participate in the same anti-censorship bundle rules. The original hybrid 198 address remains derivation index zero for backup compatibility. Once an external address appears 199 in the chain or local mempool, the wallet exposes the next deterministic address and sends v2 200 change there. Reward destinations use a separately domain-separated branch and rotate as soon as 201 the current reward key is revealed by a confirmed or pending spend. Seed recovery scans both 202 branches with a 20-address gap limit. Child addresses retain the wallet's Ed25519 identity for 203 ticket/finalizer compatibility while using distinct ML-DSA-44 keys. Full recovery rehearsal 204 remains incomplete. 205 206 ## Other trust boundaries 207 208 - P2P node IDs need versioned, algorithm-tagged proofs independent of wallet activation. 209 - CLI and desktop update verification need dual classical/post-quantum signatures and an update 210 path that installs the new trust root before it becomes mandatory. 211 - TLS and deployment credentials need a separate cryptographic inventory; they are not consensus 212 rules. 213 - Wallet files should move from PBKDF2-SHA256 to a versioned memory-hard password KDF as general 214 hardening. ChaCha20-Poly1305 with a 256-bit key does not need immediate replacement. 215 216 ## VDF gate 217 218 The current classgroup-wesolowski-bqfc-v1 format remains frozen for historical verification. A 219 replacement VDF needs its own format identifier, activation height, security argument, reference 220 implementation, known-answer vectors, performance measurements, and fork-choice simulations. 221 No candidate should be described as post-quantum merely because it avoids RSA setup. 222 223 ## Release gate 224 225 Iuna must not claim quantum resistance until all of the following are true: 226 227 - the active transaction and consensus signature path is independently reviewed; 228 - existing value has an operational migration path and migration telemetry; 229 - peer and updater authentication have post-quantum transition paths; 230 - the VDF has a documented quantum threat model; 231 - adversarial and six-node tests cover every activation boundary; 232 - recovery playbooks cover a failed or rolled-back activation.