Toward Protocol-Level Quantum Safety in Bitcoin
A Formal, Adversarial, and Invariant-Driven Treatment
Abstract
“Quantum-safe Bitcoin” is not a property of a subset of well-behaved transactions. It is a global safety property of the consensus state machine: for every reachable consensus state and for every quantum-capable adversary, no consensus-valid execution may contain an unauthorized state transition. This paper specifies an execution model for Bitcoin at the level required for hostile review: explicit state, total validation predicates, deterministic transition functions for transactions and blocks, and a network/scheduler model sufficient to reason about mempool races and reorganizations. We define security goals in game-based form against quantum polynomial-time (QPT) adversaries, separate safety from liveness, and state concrete invariants (authorization integrity, state consistency, and determinism), proving that all invariants are preserved across valid transitions. We give a consensus-level construction for post-quantum authorization (via commit-and-reveal witness programs) and prove, via a complete game-hopping reduction, that unauthorized spends imply a break of the underlying post-quantum signature or hash binding assumptions — with a tight, non-rewinding reduction. We further define and exclude cross-input and cross-transaction witness replay attacks via sighash commitment axioms, formalize network execution as traces and prove that adversarial network control does not bypass PQ authorization, and address the quantum random oracle model. Finally, we formalize the migration dilemma — protocol-level quantum safety cannot be achieved without either freezing unmigrated legacy outputs or accepting open theft under Shor — and provide a formal migration trace model with monotonicity guarantees. All results are supported by formal artifacts: a TLA+ model exhaustively checked by TLC (zero invariant violations across 492 states; concrete counterexample for the migration dilemma) and Coq-mechanized proofs of spend predicate totality, determinism, and parse canonicality.
1 Introduction
Bitcoin’s authorization model is cryptographic: the consensus rules grant spending power to whoever can produce a witness that satisfies the locking condition of an output. In the current protocol, that locking condition ultimately depends on secp256k1 signatures (ECDSA historically; Schnorr via Taproot) [12, 20, 21, 22]. Under Shor’s algorithm [18], this assumption collapses: discrete logarithms in elliptic curve groups become efficiently solvable by a quantum polynomial-time (QPT) adversary.
The usual failure mode in “quantum Bitcoin” discussions is local reasoning: “some transactions can be made post-quantum, therefore Bitcoin can be made post-quantum”. This is structurally wrong. Consensus security is quantified over the entire reachable state space and over adversarially chosen executions. If any reachable state admits any consensus-valid unauthorized spend under a QPT adversary, the protocol is not quantum-safe at the protocol level.
1.1 Protocol-level quantum safety (informal)
At a minimum, protocol-level quantum safety requires:
-
1.
a deterministic, total validation predicate and transition function (consensus is a state machine, not an API);
-
2.
a game-based authorization definition against QPT adversaries;
-
3.
invariants stated as quantifiers over all reachable states and all consensus-valid traces;
-
4.
an explicit network model (mempool observation and transaction replacement are not accidents; they are adversarial levers);
-
5.
a migration model that acknowledges lost keys and therefore the liveness-vs-safety dilemma.
1.2 Contributions and boundary of claims
What is proven.
This paper proves the following results, all conditional on explicitly stated axioms: (i) consensus invariants (no double spend, state consistency, determinism) are preserved across all valid transitions (Theorems 1, 2), confirmed by exhaustive TLC model checking (Section 10.1); (ii) unauthorized spends of PQ-locked outputs imply a break of the underlying PQ signature scheme (EUF-CMA) or hash binding, via a tight, non-rewinding game-hopping reduction valid in the QROM (Theorem 4); (iii) cross-input and cross-transaction witness replay are excluded under the sighash commitment axiom (Theorem 5); (iv) adversarial network control (mempool observation, conflict injection, reorgs) does not bypass PQ authorization (Theorem 6); (v) no cryptographic-only protocol transition can simultaneously preserve safety and liveness for all outputs when lost keys exist (Theorems 8, 9), with a concrete counterexample produced by TLC; (vi) the PQ spend predicate is total, deterministic, and its witness parsing is canonical — machine-checked in Coq (Section 10.2, proof obligations PO-1, PO-2, PO-3, with PO-3 strengthened to full witness identity via varint-based encoding); (vii) the UTXO transition function is deterministic and preserves the no-double-spend invariant — machine-checked in Coq (PO-5); (viii) the cost function satisfies with exact equality — machine-checked in Coq (PO-7).
What is assumed.
The following are explicit axioms or implementation obligations, not proven in this paper: (a) the deployed sighash implementation satisfies the commitment property (Definition 5), including consensus-semantic injectivity — the Coq model of Sighash v2 discharges PO-4 under a SHA-256 collision-resistance axiom, and the deterministic Rust preimage transcript construction is checked against a Coq-extracted transcript function, while SHA-256 implementation correctness and compiler correctness remain outside the artifact boundary; (b) the transaction id function is collision-resistant against QPT adversaries (Definition 9); (c) the chosen PQ signature scheme is EUF-CMA secure against QPT adversaries, including in the QROM; (d) the mechanized spend predicate corresponds to the implementation used by consensus nodes — supported by bounded Coq-to-OCaml serializer extraction, golden-vector comparison, property-based correspondence tests, Kani source-level bounded parser-refinement harnesses, and release-binary translation validation against the Coq-extracted summaries, but not by a proof of compiler correctness (PO-8). All security theorems are conditional on these assumptions. Where an assumption is violated, the specific theorem that depends on it is identified.
2 System Model
We model the consensus-critical part of Bitcoin as a labeled transition system with explicit state and deterministic transitions. We intentionally separate (i) the ledger state machine (what blocks do) from (ii) the network execution (how transactions/blocks are observed, delayed, replaced).
2.1 Basic objects: outputs, outpoints, UTXO
Definition 1 (Outpoints and outputs).
An outpoint is an identifier of the form
interpreted as . An output is a tuple
where is a satoshi-denominated value domain and is a consensus-interpreted locking program (e.g., a ScriptPubKey or witness program).
Definition 2 (UTXO set).
The UTXO set is a finite partial function
We write for lookup when defined, and for its domain.
2.2 Transactions and witness evaluation
We abstract a transaction as a structured object containing inputs and outputs. An input references a prior outpoint and carries a witness.
Definition 3 (Transactions).
A transaction is a tuple
where is a list of inputs, is a list of outputs , and meta contains consensus-relevant fields (locktime, sequences, etc.). Each input is of the form with and .
Witness evaluation is treated as a deterministic total predicate:
where the third argument is the message being authorized (a canonical sighash). This hides Script-level complexity while making explicit the consensus requirement: there exists a unique message per input that is being authorized.
Definition 4 (Sighash).
We require the following commitment property, which prevents cross-transaction witness replay and partial-commitment attacks.
Definition 5 (Sighash commitment).
The sighash function satisfies commitment if:
-
1.
Injectivity (modulo input index): For fixed consensus context ctx and fixed input index ,
where denotes consensus-semantic equivalence: and are identical in all consensus-critical fields (version, inputs with outpoints, outputs with values and scripts, locktime, and all fields committed to by the sighash). Transactions that differ only in consensus-irrelevant encoding details (e.g., witness serialization padding, future annex content not committed to by the sighash) are considered equivalent under . In particular, if then and for all .
-
2.
Cross-input separation: For in the same transaction,
-
3.
Field coverage: commits to all consensus-critical fields of (version, inputs with their outpoints, outputs with their values and scripts, locktime) and to the spent output’s script and value.
Remark 1.
BIP 341 Taproot sighash satisfies these properties by construction: it hashes all input outpoints, all output scripts/values, the spent output’s scriptPubKey and amount, and the input index [21]. Legacy sighash modes (e.g., SIGHASH_NONE, SIGHASH_SINGLE) intentionally violate field coverage for specific use cases; outputs locked under such modes require separate analysis. The commitment property is an axiom of our model; any concrete instantiation must be verified against it.
Definition 6 (Consensus-semantic equivalence).
Two transactions are consensus-semantically equivalent, written , if they agree on all fields that affect consensus validation and state transition:
-
1.
version, locktime, and sequence numbers;
-
2.
the list of input outpoints ;
-
3.
the list of outputs including values and scripts;
-
4.
all fields committed to by the sighash function.
The equivalence class is the quotient of the transaction space by . Transactions in the same class may differ in consensus-irrelevant encoding details (e.g., witness serialization padding, non-committed annex content, or byte-level encoding choices that do not affect or ). By construction: implies , , and for all .
We formalize the quotient via a canonical normalization function:
strips all consensus-irrelevant fields and produces a unique representative of each equivalence class. Concretely, retains exactly the fields enumerated in items 1–4 above and sets all other fields to a fixed canonical value (e.g., empty witness, zero-length annex). The sighash commitment property (Definition 5, item 1) can then be restated as:
This eliminates any ambiguity about what “equivalent” means: two transactions are equivalent if and only if they have the same canonical representative.
Lemma 1 (Norm-preserving validation and transition).
For all UTXO sets and transactions :
-
1.
;
-
2.
;
-
3.
.
Proof.
By definition, preserves all fields enumerated in Definition 6 (items 1–4) and only modifies consensus-irrelevant fields. depends only on syntax (which preserves by retaining all structural fields), input outpoints, output values/scripts, and witness evaluation. Witness evaluation depends on the spend predicate and sighash, both of which are functions of the consensus-critical fields only. depends only on the input outpoints (for removal) and the transaction id and output list (for creation), all of which are consensus-critical. is computed from the consensus-critical serialization (SegWit txid excludes witness data), so . ∎
Remark 2 (Scope of the sighash axiom).
All security theorems in this paper (Theorems 4, 5, 6) are conditional on the deployed sighash satisfying the commitment property (Definition 5). The Coq development now proves the modeled Sighash v2 commitment property under a SHA-256 collision-resistance axiom and exposes an extractable transcript constructor for the final preimage assembly (PO-4 in Section 10.3). The extraction pipeline compares that transcript constructor against the deployed Rust byte construction, including outpoint serialization, output serialization, spent-output serialization, and final preimage assembly with supplied sub-hashes. What remains outside that proof is SHA-256 implementation/refinement, the SHA-256 collision-resistance assumption itself, and compiler/toolchain correctness. Our results should be read as: “if the deployed sighash transcript corresponds to the verified model and SHA-256 satisfies the stated collision-resistance axiom, then the stated security guarantees hold.” A full mechanization of BIP 341 itself would require formalizing the BIP 341 specification and proving refinement to the deployed serialization — a valuable but separate effort.
2.3 Validation predicates and transition functions
The critique that “you cannot prove anything without ” is correct. We therefore define total predicates and deterministic transition functions.
Definition 7 (Transaction validation).
Transaction validation is a predicate
defined as
where expands to:
with and .
Definition 8 (Transaction transition).
The transaction transition function
is defined (for all inputs) by removing spent outpoints and adding newly created outpoints:
where is the canonical transaction id and ranges over the output indices.
Remark 3.
In actual Bitcoin, the txid and outpoint formation depends on SegWit/non-SegWit serialization (wtxid, etc.). For protocol-level authorization analysis, the essential property is uniqueness and determinism: outpoint identifiers are stable and collision-resistant.
We formalize this as an explicit axiom, since the invariant preservation proof (Section 4.5) depends on it.
Definition 9 (Transaction id collision resistance).
The transaction id function satisfies collision resistance if for all QPT adversaries :
The system requirement is not generic collision search in a vacuum but collision against the active identifier set: for any reachable state and any new transaction , the newly created outpoints must not collide with any . This is a weaker requirement than arbitrary collision resistance: the adversary must find a collision against a specific, evolving set of existing identifiers rather than against an arbitrary second preimage.
Remark 4 (Concrete collision budget).
Bitcoin uses double-SHA-256 for txid computation ( output bits). The best known quantum collision attack (BHT algorithm) achieves query complexity for generic collisions. However, the system’s actual requirement is collision avoidance against the active outpoint set of size . Let denote the total number of distinct outpoints ever introduced into the reachable state space across the system’s lifetime. The probability that any pair among identifiers collides is bounded by the birthday paradox:
Under quantum speedup (BHT), an adversary actively searching for collisions achieves advantage per query, but the total collision probability over identifiers remains dominated by for passive collision (birthday) and for active quantum search against the existing set.
With (cumulative outpoints over Bitcoin’s lifetime), the passive birthday bound gives ; the active quantum search bound gives . For (aggressive long-horizon estimate), these become and respectively. Both remain negligible for practical security parameters. If future quantum capabilities or UTXO growth erode this margin, the txid function can be upgraded (e.g., to a 384-bit or 512-bit hash) as part of a witness version bump. The invariant preservation proof (Theorem 1) assumes collision resistance of ; if this assumption fails, StateConsistency may be violated by outpoint overwrites.
Definition 10 (Block validation and transition).
A block is . Block validation is a predicate requiring PoW validity and sequential transaction validity (coinbase rules elided here for brevity). The block transition function applies sequentially:
2.4 Determinism as an invariant
Consensus is well-defined only if and are deterministic and total. We capture this explicitly as a safety invariant (Section 4) rather than treating it as “implementation detail”.
3 Adversary and Network Model
We treat the adversary as QPT with explicit network control. This is not ideological; it is necessary to reason about mempool races and reorg windows.
3.1 Quantum capabilities
3.2 Network/scheduler capabilities
We model the network as a set of nodes that exchange messages (transactions, blocks). The delivery schedule is controlled by a scheduler with adversarial influence:
The adversary’s network control includes:
-
•
observing transactions in mempool prior to confirmation;
-
•
injecting conflicts and fee-bumping replacements;
-
•
delaying propagation (eclipse/partition-like behavior);
-
•
exploiting reorganizations in the chain selection rule.
For chain consistency and reorg reasoning, we lean on the Bitcoin Backbone model [7], which formalizes safety/liveness of Nakamoto consensus under bounded delay and adversarial mining power.
4 Security Goals and Invariants
The paper is invariant-driven. This requires stating invariants in a form that can be checked against traces and used in proofs. We also separate safety (nothing bad happens) from liveness (something good eventually happens).
4.1 Safety vs liveness
Definition 11 (Safety).
A safety property is a predicate such that for every execution trace of the consensus state machine, if violates then there exists a finite prefix of that already violates . Operationally: an explicit “bad event” occurs.
Definition 12 (Liveness).
A liveness property is a predicate such that for every finite execution prefix, there exists an extension where holds. Operationally: assuming adequate network and mining conditions, honest transactions eventually confirm.
Protocol-level quantum safety is primarily a safety requirement: prevent unauthorized transitions. It does not automatically imply liveness under censorship or under fee-market adversaries.
4.2 UTXO consistency invariants
Let be the UTXO set after applying a prefix of blocks. We require:
| NoDoubleSpend | |||
| StateConsistency |
4.3 Transition determinism
4.4 Authorization integrity: game-based definition
4.5 Invariant preservation
Stating invariants is necessary but not sufficient. We must prove that valid transitions preserve them.
Theorem 1 (Invariant preservation under ).
Let be a UTXO set satisfying , , and . Let be a transaction with . Assume collision resistance of (Definition 9). Then satisfies all three invariants.
Proof.
We verify each invariant in turn.
Determinism. is defined by a single expression (set difference plus union) with no branching on non-deterministic state. Given and , the result is uniquely determined.
NoDoubleSpend. requires : every referenced by is in . ensures no appears twice within . removes each from exactly once. Since and satisfies NoDoubleSpend, each has been created exactly once and not previously spent. After removal, , so it cannot be spent again.
StateConsistency. For any , either: (a) and is not a newly created outpoint of , so by the inductive hypothesis on , either never existed or was previously spent; (b) and for some input of , so has now been spent; or (c) is a newly created outpoint — but these are added to by construction, so , contradicting the assumption.
Additionally, collision resistance of (Definition 9) ensures that newly created outpoints do not collide with existing outpoints in , preventing silent overwrites that would violate state consistency. ∎
Theorem 2 (Invariant preservation under ).
If satisfies all three invariants and , then satisfies all three invariants.
Proof.
applies sequentially. requires each to be valid against the intermediate state produced by applying . By induction on and Theorem 1, each intermediate state satisfies the invariants, and therefore so does the final state. ∎
Corollary 1 (Global invariant preservation).
For any execution trace where satisfies the invariants and each , every reachable state satisfies NoDoubleSpend, StateConsistency, and Determinism.
4.6 Cryptographic primitives and authorization games
We now define the authorization predicate and the game-based security notion.
Cryptographic primitives.
Let be a post-quantum signature scheme intended for consensus use (e.g., ML-DSA [13] or SLH-DSA [14]). Let be a fixed hash function (e.g., SHA-256).
Definition 13 (PQ spend predicate).
For a commitment and an input message , define
iff the witness parses as , satisfies , and .
Definition 14 (Authorization predicate).
A transaction with satisfies the authorization predicate if, for every input of spending output with commitment , the witness could only have been produced by an entity with access to the signing oracle where and . Formally, holds iff for every input :
where is the set of messages queried to and . In other words, a transaction is authorized iff every input’s sighash was submitted to the legitimate signing oracle. This definition eliminates ambiguity about delegation: authorization is defined purely by oracle access, not by intent or identity.
Remark 5 (Delegation and multi-party signing).
The oracle-based definition of naturally accommodates delegation and multi-party signing (MPC/threshold) flows: if a party delegates signing authority, the delegate obtains access to (or a functional equivalent that produces valid signatures). In the game-based model, this is captured by the delegate being allowed to query the signing oracle. A delegated signature on results in , so holds. The definition does not require that the original key holder personally invokes the oracle — only that the oracle was invoked on the relevant message by some entity with legitimate access. Unauthorized spend means no entity with oracle access authorized the sighash, regardless of organizational structure.
Definition 15 (Unauthorized spend).
A consensus-valid transaction is unauthorized if:
A trace violates authorization integrity if .
Definition 16 (Authorization break game).
The game is:
-
1.
Challenger samples and sets .
-
2.
receives and oracle access to .
-
3.
outputs .
-
4.
wins iff and was not previously queried to the signing oracle.
Define .
Definition 17 (Protocol-level authorization integrity).
We say that PQ-locked outputs satisfy authorization integrity against QPT adversaries if for all ,
5 Why secp256k1 Authorization Fails Under Shor
Bitcoin’s legacy spend predicates are instantiations of that verify secp256k1 signatures. Under Shor, secp256k1 key recovery becomes feasible.
Lemma 2 (Key recovery under Shor).
Let be a secp256k1 public key. In the presence of Shor’s algorithm, there exists a QPT algorithm that computes from .
Theorem 3 (Impossibility with active ECDLP surface).
If the reachable state space contains any spendable output whose consensus spend predicate depends on secp256k1 signatures (ECDSA or Schnorr), then Bitcoin cannot satisfy protocol-level quantum safety against .
Proof.
Let be a reachable consensus state containing a spendable output at outpoint , where is a locking script that accepts a witness containing a valid secp256k1 signature under public key . We construct a QPT adversary that produces an unauthorized spend.
Step 1 (Key recovery). is either directly on-chain (P2PK, P2TR key path) or revealed in the mempool upon an honest spend attempt (P2PKH, P2WPKH). In either case, obtains . By Shor’s algorithm applied to the secp256k1 curve [18, 16], computes such that in polynomial time.
Step 2 (Witness construction). constructs a transaction that spends to an adversary-controlled output. Using , computes a valid ECDSA (or Schnorr) signature on . The witness satisfies .
Step 3 (Consensus acceptance). Since , InputsExist holds. is constructed to satisfy Syntax, NoDupInputs, and ValueConservation. WitnessOK holds because . Therefore , and the spend is consensus-valid.
Step 4 (Authorization violation). The spend is unauthorized: was never given by the legitimate owner, and the witness was not produced on behalf of the owner. This violates authorization integrity (Definition 16 adapted to ).
Since was an arbitrary reachable state containing such an output, protocol-level quantum safety fails. ∎
5.1 Public key exposure and mempool races
Key exposure is not homogeneous across output types. Some outputs reveal secp256k1 public keys on-chain (immediate exposure), while others reveal them only when spent (mempool window).
| Output type | Verifier exposed? | Attack window under Shor |
|---|---|---|
| P2PK (legacy) | yes (on-chain) | immediate |
| P2TR (key path) | yes (on-chain) | immediate |
| P2PKH / P2WPKH | no (hash until spend) | mempool race at first spend |
| P2SH / P2WSH | no (script until spend) | mempool race upon reveal |
Lemma 3 (Mempool race theft).
Consider an output whose verifier is revealed only in the witness of an honest spend (e.g., P2WPKH). If (i) Shor key recovery is fast relative to time-to-confirmation and (ii) can inject and preferentially propagate conflicts, then has a non-negligible probability of replacing the honest spend with a conflicting spend to an adversarial output.
Remark 6.
Quantitative analyses of this race appear in quantum attack treatments of Bitcoin [1]. The point for protocol design is qualitative: hiding a secp256k1 key until spend does not yield quantum safety; it only shifts the break into a race condition.
6 A Consensus-Level PQ Authorization Construction
The minimal consensus construction is to introduce PQ-locked outputs whose spend predicate is only , and to couple this with a migration/enforcement policy (Section 9).
6.1 Witness-program commitment
SegWit witness programs provide a clean versioning mechanism [11]. Abstractly, an output is identified by a pair where is a version byte and is a bounded-size program. For PQ, the program must remain compact; therefore we commit to the PQ verifying key using a 32-byte hash:
The witness reveals .
6.2 Spend predicate
Given an input message , the consensus spend predicate is:
6.3 Determinism, parsing, and DoS bounds
Consensus cannot tolerate ambiguous encoding. Witness parsing must be fully specified and canonical. Additionally, verification cost must be bounded and accounted for in the block resource model. We model this as a cost function and require:
for a fixed engineering constant .
At the block level, we additionally require a global cost cap:
Definition 18 (Block cost invariant).
Block validation enforces:
where is a consensus-enforced constant (analogous to the 4 MWU weight limit in current Bitcoin).
This invariant ensures that even if individual PQ witnesses are expensive to verify, the total per-block verification cost is bounded. Without it, an adversary could construct blocks that are cryptographically valid but operationally infeasible to verify, degrading network liveness without breaking authorization. The constant must be parameterized jointly with the choice of and the target verification throughput (see Section 11).
7 Security Theorems: From Unauthorized Spends to Cryptographic Breaks
The core requirement is a reduction: a consensus-valid unauthorized spend of a PQ-locked output should imply a break of the underlying assumptions. We follow the game-hopping methodology [19, 3].
7.1 Hash binding game
Define the hash binding game : the challenger samples from the key distribution of , sets , and wins if it outputs such that . Let be the winning probability.
7.2 Full game-hopping reduction
We now give the complete reduction via a sequence of games .
Definition 19 (Game : real authorization game).
is identical to (Definition 16). The challenger samples , sets , gives and signing oracle access to . outputs and wins if with unqueried.
Definition 20 (Game : binding enforcement).
is identical to except: after outputs with , if but , the game sets and the adversary still wins. Otherwise the game proceeds identically.
Lemma 4 (Transition ).
and are identical games (no behavioral change). The flag is purely bookkeeping:
Proof.
The only difference is the introduction of the flag , which does not alter any output or oracle response. The winning condition is unchanged. ∎
Definition 21 (Game : abort on binding break).
is identical to except: if (i.e., but ), the adversary loses (the game outputs ).
Lemma 5 (Transition ).
Proof.
and differ only when . By the fundamental lemma of game-playing [3]:
We construct that breaks hash binding whenever is set. receives a challenge (where for unknown ). cannot sign directly, but it simulates the signing oracle using the real (which it generates itself; the binding game is about finding a second preimage of , not about the signing key).
Concretely: samples , computes , and runs with this and honest signing oracle. If outputs with and , then outputs as a second preimage. Therefore .
Reduction model note. generates its own rather than receiving from an external challenger. This is a standard-model reduction (not black-box challenger-driven): knows and can therefore simulate the signing oracle perfectly. The reduction is valid because the binding game only requires to output a second preimage with ; it does not require to be ignorant of . An alternative formulation where receives from an external challenger and simulates signing without would require additional assumptions (e.g., a signing oracle from the challenger); we choose the self-generated formulation for simplicity and tightness. ∎
Remark 7 (Binding game model).
The hash binding game as defined in this paper is a self-generated challenge game: the reductor chooses its own and therefore knows the preimage. This is strictly weaker than a game where the challenger provides and the reductor must find any preimage — our game only requires finding a second preimage. The self-generated formulation is the correct model here because: (i) the reductor must simulate the signing oracle, which requires ; (ii) the binding property we need is second-preimage resistance (given , find with ), not collision resistance in general; (iii) second-preimage resistance of SHA-256 with 256-bit output provides quantum security under Grover, matching the system’s target. The bound should therefore be interpreted as the second-preimage advantage, not the generic collision advantage.
Lemma 6 (Reduction from to EUF-CMA).
Proof.
In , a win requires (since is aborted) and with unqueried. We construct against the EUF-CMA game of .
receives from the EUF-CMA challenger and sets . It gives to and forwards signing queries to the EUF-CMA signing oracle. When outputs , parses . If , aborts (this corresponds to the abort). Otherwise, outputs as an EUF-CMA forgery.
The simulation is perfect: ’s view is identical to . The signing oracle is faithfully forwarded. makes exactly the same number of queries as . Therefore . ∎
Theorem 4 (Authorization reduction — full).
For any QPT adversary that wins with probability , there exist QPT adversaries and such that:
Moreover, the reduction is tight: makes exactly signing queries if does, and runs in time .
Proof.
Corollary 2 (PQ outputs are safe if assumptions hold).
If is EUF-CMA secure against QPT adversaries and is binding against QPT adversaries (with 256-bit output for post-Grover margin), then is negligible for all .
7.3 Tightness and concrete security
The reduction above is tight in the sense that no security is lost in the game transitions: does not guess or rewind, and runs exactly once. This means the concrete security of the PQ authorization scheme is:
where and are the concrete advantages against the signature scheme and hash function, respectively.
Impact of Grover’s algorithm.
Grover’s algorithm [9] provides a quadratic speedup for unstructured search. For a hash function with -bit output, the best generic quantum preimage attack requires queries [23]. With (SHA-256), this yields quantum security — matching the post-quantum security target. For the signature scheme, ML-DSA (FIPS 204) at security level 2 targets bits of quantum security [13]; SLH-DSA (FIPS 205) at equivalent parameters provides comparable margins [14].
Concrete parameter guidance.
A deployment must ensure:
-
•
under QPT adversaries (NIST Level 1 or above);
-
•
for second-preimage resistance under Grover (satisfied by SHA-256 with 256-bit output);
-
•
combined: , which is negligible for any practical .
7.4 Quantum random oracle model considerations
The reduction in Section 7 treats as a classical oracle: the reductions and evaluate on classical inputs. In the quantum random oracle model (QROM) [4], the adversary may query in superposition, which affects the feasibility of certain proof techniques.
Impact on the binding transition ().
The transition relies on extracting a second preimage when is set. In the classical ROM, this is straightforward: the reductor observes in the clear. In the QROM, if computes via a quantum query, the reductor cannot directly observe the query input without disturbing the state. However, our construction does not require online extraction from hash queries. The reductor only needs to inspect ’s final classical output , which is a classical string. The check with is performed on this classical output. Therefore, the transition does not require quantum query recording or the compressed oracle technique; it remains valid in the QROM.
Impact on the EUF-CMA reduction ().
Summary.
The reduction is valid in the QROM without modification, because: (i) extraction occurs on classical outputs, not quantum query transcripts; (ii) the hash oracle is only programmed implicitly (no reprogramming is needed); (iii) the signature scheme’s QROM security is assumed. Crucially, our proof design avoids both oracle reprogramming and rewinding — two techniques that are known to be non-trivial or impossible in the QROM [4, 24]. This is a deliberate architectural choice: by structuring the spend predicate as hash-then-verify (commit to , reveal in the witness), we ensure that the reduction only needs to inspect classical outputs, sidestepping the fundamental difficulties of quantum query extraction. This construction is deliberately QROM-friendly: it avoids oracle programmability entirely, making the proof structure robust against the known barriers to QROM security (measurement disturbance, lack of extractability from superposition queries). If future analysis reveals a gap in the QROM security of a specific candidate, the reduction’s validity depends on that scheme’s QROM proof, not on our game-hopping structure. For a comprehensive treatment of random oracles under quantum access, see Boneh et al. [4] and Zhandry [24].
8 Network Model Implications: Ordering, Reorgs, and Races
8.1 Replay and cross-input attacks
The authorization game (Definition 16) covers single-output forgery. A complete treatment must also exclude witness replay across inputs and across transactions. We define two additional games and show they reduce to the sighash commitment property (Definition 5).
Definition 22 (Cross-input replay game).
The game is:
-
1.
Challenger samples , sets .
-
2.
Challenger creates a transaction with two inputs , both spending outputs locked to , and provides with a valid witness for input .
-
3.
wins if it produces a valid witness for input without querying the signing oracle on .
Lemma 7 (Cross-input replay is infeasible).
Under the sighash commitment property (Definition 5) and EUF-CMA security of :
Proof.
By the cross-input separation property of (Definition 5, item 2), . Therefore a valid signature on is not a valid signature on (except with negligible probability under EUF-CMA). Any witness that passes verification must contain a fresh signature on , which constitutes an EUF-CMA forgery if was not queried. ∎
Definition 23 (Cross-transaction replay game).
The game is:
-
1.
Challenger samples , sets .
-
2.
Challenger creates transaction spending an output locked to at input , and provides with the valid witness .
-
3.
constructs a different transaction with an input spending an output locked to .
-
4.
wins if is a valid witness for input of without querying the signing oracle on .
Lemma 8 (Cross-transaction replay is infeasible).
Under the sighash injectivity property (Definition 5, item 1) and EUF-CMA security of :
Proof.
By sighash injectivity, implies (for any ). The witness contains a signature valid under message . For to also be valid under , the signature must verify on a distinct message, which is an EUF-CMA forgery. ∎
Theorem 5 (Complete authorization security).
Under the sighash commitment property, EUF-CMA security of against QPT adversaries, and hash binding of against QPT adversaries, the PQ spend predicate resists:
-
1.
direct forgery (Theorem 4);
-
2.
cross-input witness replay (Lemma 7);
-
3.
cross-transaction witness replay (Lemma 8).
The combined advantage is bounded by:
8.2 Network-level authorization resilience
The authorization reduction above is consensus-local: it says that if a PQ output is spent, the witness cannot be forged except by breaking primitives. However, Bitcoin users do not interact with directly; they broadcast transactions into a hostile network.
We now formalize the connection between network execution and authorization safety.
Definition 24 (Execution trace).
An execution trace is a sequence
where is the genesis UTXO set and each transition satisfies and . We write for the prefix up to state .
Definition 25 (Network-valid trace).
A trace is network-valid under scheduler and adversary with network control if:
-
1.
each block is delivered according to (possibly with adversarial delay);
-
2.
may inject transactions into any block (subject to );
-
3.
may observe mempool contents and inject conflicting transactions;
-
4.
chain selection follows the longest-chain rule (or heaviest-chain variant).
Definition 26 (Unauthorized spend in network trace).
A transaction in a network-valid trace contains an unauthorized spend if (Definition 15). In the context of the authorization break game, this means the witness for at least one input constitutes a winning output in (Definition 16): the entity producing the witness was not given and did not obtain a signature on the relevant sighash from .
Theorem 6 (Network-resilient authorization safety).
Let be any network-valid trace under QPT adversary . If every spendable output in every reachable state is PQ-locked (i.e., its spend predicate is ), then for all prefixes :
where is the maximum number of transactions per block and is the maximum number of inputs per transaction.
Proof.
Each input of each transaction in each block is independently validated by via WitnessOK. By Theorem 4, each individual input’s witness can only be forged with advantage at most . A union bound over all inputs (at most per transaction), all transactions (at most per block), and all blocks (at most ) yields the stated bound. Since both advantages are negligible and , , are polynomial, the total remains negligible.
Crucially, the adversary’s network capabilities () — mempool observation, conflict injection, delay, reorgs — do not help forge witnesses for PQ-locked outputs. The witness must contain a valid PQ signature on the sighash, and the sighash is determined by the transaction the adversary constructs. Network control allows the adversary to choose which transactions to include but not to bypass the authorization predicate. ∎
Remark 8 (Conservatism of the union bound).
The bound is a worst-case union bound that treats each input’s forgery event as independent. In practice, a QPT adversary may correlate attacks across inputs (e.g., reusing intermediate quantum computations) or adapt queries based on observed witnesses. However, since each input’s sighash is distinct (by the sighash commitment property) and each forgery requires a fresh EUF-CMA break on a distinct message, the union bound remains valid: correlation does not help the adversary produce a valid signature on a message it has not queried. Even under correlated or amortized quantum attacks (e.g., reusing intermediate quantum states across inputs), each successful forgery requires a valid signature on a fresh, distinct sighash message; the EUF-CMA game is defined per-message, so amortization does not reduce the per-input advantage. Tighter bounds under structured adversaries (e.g., adversaries that control block construction) are a natural refinement but do not affect the negligibility conclusion.
Remark 9 (Block-constructing vs. observing adversaries).
The bound in Theorem 6 is worst-case: it assumes the adversary controls block construction and can place adversarial transactions in every slot. For a weaker adversary that can only observe the mempool and inject conflicting transactions (but does not mine), the effective and are limited to the adversary’s own injected transactions, not the entire block. Under the Backbone model [7], an adversary with mining fraction controls at most a fraction of blocks in expectation, tightening the bound to . We state the worst-case bound for generality; the tighter bound follows by substituting the adversary’s effective block rate.
Remark 10.
This theorem does not guarantee liveness (honest transactions may be censored or delayed) or protection against reorg-based double-spending of the adversary’s own funds. It guarantees that the authorization predicate is not the failure point: no network-level attack converts into an authorization break for PQ-locked outputs. For liveness and chain quality under bounded adversarial mining power, we rely on Backbone-style results [7, 15].
Two network-level facts remain relevant for legacy (non-PQ) outputs:
-
1.
Exposure-to-confirmation windows create theft races for schemes where the verifier/secret becomes computable after observation (secp256k1 under Shor).
-
2.
Reorgs and censorship affect liveness and the reliability of migration strategies.
Backbone-style results [7] provide a framework to state conditions under which honest transactions are eventually included (liveness) and honest views have common prefix (safety). Protocol-level quantum safety requires that the authorization predicate is not the point of failure under those executions.
9 Migration Model and the Liveness–Safety Dilemma
The hard part is not defining PQ outputs. The hard part is the existing set: legacy outputs do not commit to PQ verifiers. There is no cryptographic “reinterpretation” that turns a secp256k1-locked output into a PQ-locked output without the owner’s participation.
9.1 Migration transactions and traces
Definition 27 (Migration transaction).
A transaction is a migration transaction if:
-
1.
at least one input spends a legacy (non-PQ) output;
-
2.
all outputs are PQ-locked (their spend predicates are ).
Definition 28 (PQ fraction).
For a UTXO set , define the PQ fraction as:
Definition 29 (Migration trace).
A migration trace is an execution trace in which honest participants broadcast migration transactions. We say is honest-migration if no honest participant creates new legacy outputs after the migration announcement height .
Proposition 7 (Migration monotonicity).
In an execution trace where consensus rules reject the creation of legacy outputs after the migration announcement height (i.e., requires all new outputs in blocks to be PQ-locked), the PQ fraction is monotonically non-decreasing:
Proof.
After , rejects any transaction that creates a legacy output. Therefore every new output in is PQ-locked. Legacy outputs can only leave by being spent (migrated or otherwise); they are never created. Let and . In each block after : (legacy count can only decrease or stay) and new PQ outputs are added. Therefore . ∎
Remark 11.
The monotonicity guarantee is enforced by consensus, not by honest behavior. Even an adversarial miner cannot create legacy outputs after , because would reject the block. This is strictly stronger than the behavioral assumption in earlier drafts. Under partial deployment (e.g., a soft fork not yet activated by all miners), non-upgraded miners may produce blocks containing legacy outputs that upgraded nodes reject. In this case, monotonicity holds on the chain viewed by upgraded nodes; non-upgraded nodes see a different chain. The structural result (monotonicity under full consensus adoption) is unaffected; partial deployment weakens the operational guarantee but not the formal property.
9.2 States, transformation, and cutover
Let be the current UTXO set. Let denote a UTXO set where every spendable output is PQ-locked. Migration is not a single function applied once; it is a sequence of on-chain transitions that induces a partial transformation:
To eliminate ECDLP from the consensus attack surface, the protocol must eventually enforce a cutover height such that, for blocks beyond , legacy spend predicates are rejected:
This can be expressed as a consensus restriction (soft-fork style), but it has a consequence: any unmigrated legacy output becomes unspendable after .
Definition 30 (Migration completeness).
Migration is complete at height if , i.e., every output in the UTXO set is PQ-locked. Migration is incomplete if , meaning some legacy outputs remain.
9.3 Unavoidable trade-off
Theorem 8 (No-Free-Migration).
Under cryptographic-only authorization (no external trust assumptions such as social recovery, multisig escrow with trusted parties, or covenant-based recovery requiring protocol extensions beyond and ), there exists no protocol transition that simultaneously:
-
1.
preserves authorization integrity against QPT adversaries for all outputs (safety);
-
2.
preserves spendability for all outputs including those with irrecoverably lost keys (liveness).
Formally: such that , both and hold under Shor, where authorization is determined solely by cryptographic witness verification.
Proof.
Immediate from Theorem 9 below: for any lost-key output, safety and liveness are mutually exclusive under cryptographic-only authorization. Since at least one lost-key output exists, no can satisfy both properties universally. ∎
Remark 12.
The restriction to cryptographic-only authorization is essential. Mechanisms that introduce external trust assumptions (e.g., social recovery via a quorum of trusted parties, or time-locked covenants that transfer control to a recovery entity) can in principle break the dilemma — but they do so by weakening the authorization model, not by solving the cryptographic problem. Such mechanisms are outside the scope of this paper’s consensus-level analysis.
Theorem 9 (Lost keys force a dilemma).
Assume there exist legacy outputs whose secrets are irrecoverably lost. Then under Shor, any protocol evolution that keeps those outputs indefinitely spendable necessarily violates authorization integrity (they become stealable by ); conversely, any evolution that enforces protocol-level quantum safety must forfeit liveness for those outputs (they must be frozen/burned).
Proof.
We prove both directions by contradiction.
Direction 1: keeping legacy outputs spendable violates safety. Suppose the protocol keeps a legacy output spendable indefinitely, with spend predicate depending on secp256k1 public key . By Theorem 3, can compute from via Shor’s algorithm and construct a consensus-valid unauthorized spend. This directly violates authorization integrity (Definition 26).
Direction 2: enforcing PQ-only predicates forfeits liveness for lost-key outputs. Suppose the protocol enforces after cutover height . A legacy output can only be migrated if its owner produces a valid legacy witness (requiring knowledge of ) to spend it into a PQ-locked output. If is irrecoverably lost, no valid legacy witness can be produced before . After , the legacy spend predicate is rejected by consensus. Therefore is permanently unspendable: it cannot be spent via legacy rules (rejected) or via PQ rules (no PQ commitment exists). This is a liveness failure for .
Since at least one such lost-key output exists (an empirical fact: early Bitcoin outputs with demonstrably lost keys), the protocol must choose one direction. No third option exists: any spend predicate either depends on secp256k1 (vulnerable under Shor) or does not (requiring owner participation to migrate). ∎
Remark 13.
This is not a policy statement; it is a structural constraint imposed by cryptography and by operational reality (lost keys exist). Any proposal that avoids stating which side it chooses is incomplete.
10 Formal Verification Artifacts
The goal is to produce artifacts that reduce consensus risk, not to “prove Bitcoin”. We couple an executable model (for counterexample finding) with mechanized proofs (for critical components). Both artifacts are available in the companion repository.
10.1 TLA+ model checking: UTXO transitions
We implemented two finite-state TLA+ specifications of the UTXO transition system.
Model 1: single-input transactions (BitcoinPQ.tla).
The base model has explicit state, two output types (legacy and PQ-locked), single-input single-output transactions, migration announcement and cutover heights, and the consensus rule that rejects legacy output creation after announcement. The specification was model-checked with TLC under the following instantiation: 2 genesis outputs (1 legacy, 1 PQ-locked), outpoint universe of size 6, migration announcement at height 1, cutover at height 2.
TLC exhaustively explored 492 states (260 distinct) to depth 8 with zero violations of the structural invariant, which conjoins:
-
•
NoDoubleSpend: spent outpoints are disjoint from the UTXO domain;
-
•
ValueBound: total value never exceeds the genesis total;
-
•
StateConsistency: all outpoint identifiers are fresh and properly tracked.
Model 2: multi-input transactions with value conservation (BitcoinPQMulti.tla).
The extended model strengthens PO-6 by supporting multi-input (1–2 inputs) and multi-output (1–2 outputs) transactions with explicit value conservation (, with the difference as fee), freeze enforcement after cutover, and a MigrationMonotonicity invariant that tracks the PQ fraction as a state variable and verifies it is non-decreasing after the announcement height. The model was instantiated with 3 genesis outputs (total value 4), outpoint universe of size 8, migration announcement at height 1, and cutover at height 3. TLC exhaustively explored 58,237 states (6,365 distinct) to depth 10 with zero violations of all four invariants (NoDoubleSpend, ValueBound, StateConsistency, MigrationMonotonicity).
Result 1: structural invariants.
Both models confirm zero violations of all structural invariants across every reachable state.
Result 2: migration dilemma (counterexample).
When AuthIntegrityPQ (all outputs PQ-locked after cutover) is checked as an invariant in the base model, TLC produces a concrete counterexample in 5 states: a legacy output created before the announcement height survives to the cutover height without being migrated. The extended model produces an analogous counterexample when FreezeEnforcement is checked. This is the migration dilemma (Theorem 8) demonstrated mechanically: protocol-level quantum safety requires either complete migration or freezing of unmigrated outputs. The counterexample is not a bug in the model; it is the expected behavior that the impossibility theorem predicts.
10.2 Coq mechanization: spend predicate properties
We mechanized the PQ spend predicate and witness parsing in Coq (Rocq 9.1) across three modules.
Module 1: spend predicate and witness encoding (SpendPredPQ.v).
This module proves PO-1, PO-2, and PO-3 with a varint-based witness encoding model. The witness parse function uses an axiomatized varint encoder/decoder (6 axioms capturing round-trip, positive length, trailing-data tolerance, prefix determinism, canonical uniqueness, and consumed-length equality) whose concrete discharge is faithful to Bitcoin’s compact-size encoding through the single-byte and 0xFD/u16 cases used by the current Coq model. Properties proved:
-
•
PO-1 (Totality): . Machine-checked as spend_pred_pq_total.
-
•
PO-2 (Determinism): yields the same result on every evaluation. Machine-checked as spend_pred_pq_deterministic (reflexive) and spend_pred_pq_deterministic_ext (extensional).
-
•
PO-3 (Parse canonicality — strengthened): If two witnesses parse to the same pair, the witnesses are byte-identical: . Machine-checked as parse_varint_injective, which is strictly stronger than the original PO-3 (which only showed the relevant regions match). The proof proceeds via parse_varint_witness_determines_serialize: any accepting witness satisfies , establishing full structural canonicality.
-
•
Anti-malleability: If and and both witnesses parse to the same , then . Machine-checked as spend_pred_pq_anti_malleability.
-
•
Round-trip: for all non-empty . Machine-checked as parse_serialize_round_trip.
Additionally, we proved a complete characterization of the spend predicate (spend_pred_pq_iff): the predicate accepts if and only if parsing succeeds, the hash matches, and signature verification passes. The cryptographic primitives (, ) are axiomatized as parameters, matching the paper’s approach: the proofs hold for any instantiation.
Module 2: UTXO transitions and cost model (UTXOTransitions.v).
This module mechanizes PO-5 and PO-7. The UTXO set is modeled as an association list with lookup, remove, and add operations. The transition function is defined as removal of spent outpoints followed by addition of new outpoints with fresh identifiers. Properties proved:
-
•
PO-5 (Transition determinism): is a pure function: identical inputs produce identical outputs. Machine-checked as delta_tx_deterministic_ext. Additionally, delta_tx_preserves_no_double_spend proves that the NoDoubleSpend invariant is preserved across transitions.
-
•
PO-7 (Cost boundedness): with . Machine-checked as cost_bounded_by_weight. The stronger result cost_equals_weight proves exact equality: for the SegWit witness discount model, with cost constants matching the implementation (input overhead 144 WU, base overhead 40 WU, per-output 164 WU).
Module 3: varint axiom discharge with Bitcoin compact-size encoding (VarintConcrete.v).
This module provides a concrete implementation of Bitcoin’s compact-size varint encoding — the actual multi-byte format used in the Rust implementation — and proves that all 6 varint axioms from SpendPredPQ.v are satisfied. The encoding covers two cases: maps to (1 byte); maps to (3 bytes, little-endian u16). The decoding function enforces canonicality: it rejects non-minimal encodings (e.g., using the 3-byte prefix for values that fit in 1 byte). The key proof technique for canonicality (Axiom 5) uses Nat.Div0.mod_add and Nat.div_add to show that and when , establishing that the decoded prefix equals the canonical encoding. The proofs are packaged as a VarintAxioms record. The module also proves concrete witness canonicality and parse injectivity for the bounded parser/serializer: every accepted concrete witness is exactly the canonical serialization of its parsed public key and signature, and two accepted witnesses with the same parsed components are byte-identical. It further proves that the protocol witness cap used by the Rust implementation, MAX_WITNESS_SIZE=16,000, remains within the modeled u16 varint domain, that capped parsed or serialized concrete witnesses have public-key and signature component lengths inside that domain, and that the consensus-domain parser equals the byte-level parser below the cap while rejecting witnesses above the cap. Additionally, the extraction pipeline produces seven golden witness vectors whose witness bytes are generated by a Coq-extracted serializer and verified byte-for-byte against the Rust implementation (including the ML-DSA-44 public key length 1,312 and signature length 2,420), exhaustively compares the Coq-extracted varint encoder/decoder against the deployed Rust functions over every modeled value plus canonical rejection cases, and compares the Coq-extracted single-signature witness serializer/parser/consensus-domain parser/canonicality behavior and parser decision traces against the Rust functions over a deterministic boundary and malformed-input refinement matrix plus 111,111 symbolic bounded witnesses over modeled-domain critical bytes. On the Rust side, the parser is factored through an allocation-free witness layout function used by the public parser, consensus parser, trace hook, and canonicality predicates; five Kani harnesses verify bounded symbolic source-level alignment between those deployed Rust functions, including rejection before parsing for oversized consensus witnesses. The CI pipeline additionally builds the refinement examples as optimized release binaries, executes those compiled artifacts, compares their outputs against the Coq-extracted golden, varint-refinement, and witness-refinement summaries, and emits a certificate containing Rust toolchain metadata plus source, lockfile, binary, and generated-output hashes. This addresses PO-8 at the bounded encoding level: the Coq model uses the same single-byte and 0xFD/u16 compact-size formats as the Rust code for the consensus-valid witness subset, while the Rust-only 0xFE and 0xFF ranges remain outside the current Coq proof boundary for general-purpose CompactSize and are rejected by the executable consensus-domain witness parser.
10.3 Proof obligations: status
Table 2 summarizes the status of each proof obligation.
| ID | Property | Status | Artifact |
|---|---|---|---|
| PO-1 | Spend predicate totality | Verified | Coq (SpendPredPQ.v) |
| PO-2 | Spend predicate determinism | Verified | Coq (SpendPredPQ.v) |
| PO-3 | Witness parsing canonicality | Verified (strengthened) | Coq (SpendPredPQ.v) |
| PO-4 | Sighash commitment | Verified model + transcript evidence | Coq model + extracted transcript + Rust PBT |
| PO-5 | Transition determinism | Verified | Coq (UTXOTransitions.v) |
| PO-6 | Invariant preservation | Model-checked | TLA+/TLC (2 models) |
| PO-7 | Cost boundedness | Verified | Coq (UTXOTransitions.v) |
| PO-8 | Implementation correspondence | Bounded + source + binary evidence | Coq extraction + Kani + binary validation + Rust PBT |
10.4 Mechanizing Script/witness semantics
Script semantics and witness parsing demand mechanization to avoid consensus bugs. The Coq development covers the PQ spend predicate with varint-based witness encoding (PO-1, PO-2, PO-3), the UTXO transition function with no-double-spend preservation (PO-5), and the cost model with exact weight equality (PO-7). The varint axiom system is proved consistent by a concrete implementation (VarintConcrete.v). PO-4 (sighash commitment) is proved for the Coq Sighash v2 model under a SHA-256 collision-resistance axiom and supported at the implementation layer by transcript refinement and executable evidence: a Coq-extracted sighash_preimage_from_hashes function is compared against Rust’s deployed outpoint serialization, output serialization, spent-output serialization, and final preimage assembly, including release-binary validation; a verify_sighash_commitment_property function programmatically checks injectivity, cross-input separation, and field coverage for consensus-encodable transactions; and 9 property-based tests exercise these properties across hundreds of randomly generated transactions with BIP 340-style tagged hashes for domain separation. The Coq statement is deliberately scoped to well-formed transactions, spent outputs, and u32 input indices with fixed-width consensus fields, and is phrased over consensus-semantic input outpoints rather than full witness-bearing input records, matching the fact that sighash excludes witness bytes. The remaining PO-4 boundary is SHA-256 primitive correctness/collision resistance and compiler/toolchain correctness, not deterministic transcript serialization. The current evidence for PO-8 consists of (i) all 6 varint axioms proved for a concrete bounded encoding in Coq covering the single-byte and 0xFD/u16 CompactSize cases, (ii) direct Coq proofs that the bounded concrete parser is canonical and injective on the accepting domain, (iii) direct Coq proofs that the consensus-domain parser accepts exactly the byte-level parser below the cap, rejects above the cap, and only accepts canonical modeled-domain witnesses, (iv) exhaustive Coq-extracted vs Rust varint refinement over all modeled values plus canonical rejection cases, (v) Coq and Rust guards showing that the consensus witness cap remains inside that domain, including an executable Rust consensus-domain parser used by the spend predicate, (vi) a Coq-extracted vs Rust witness-level refinement matrix covering serialization, parsing, consensus-domain parsing, canonicality behavior, and parser decision traces over deterministic length-boundary and malformed-input representatives plus 111,111 symbolic bounded witnesses, (vii) seven golden witness vectors generated through the Coq-extracted serializer and verified byte-for-byte against the Rust implementation (including ML-DSA-44 key/signature lengths), (viii) five Kani harnesses that verify source-level bounded parser/layout/canonicality alignment over symbolic Rust byte arrays, (ix) release-binary translation validation against the Coq-extracted summaries with toolchain/source/binary hashes recorded, (x) 28 Rust tests that exercise the corresponding implementation properties, and (xi) 3 adversarial boundary tests that exercise the security properties from Theorems 4 and 5 (commitment second-preimage resistance, cross-input replay resistance, cross-transaction replay resistance). Full compiler-correctness closure remains a separate artifact class. For PO-4, the transcript/preimage serialization layer is extracted and compared against Rust, while SHA-256 itself remains an explicit cryptographic primitive boundary. For PO-8, the consensus-valid witness subset is bounded by u16, varint-level refinement is exhaustive, witness-level extracted-function plus consensus-domain operational-trace refinement is checked by CI, the Rust source parser is bounded-verified by Kani, and the release binaries are translation-validated over the modeled PO-8 domains. Extending the Coq model to 0xFE/0xFF remains necessary only for a general-purpose CompactSize verification claim or if the witness cap is raised above 65,535 bytes.
11 Engineering Reality and Parameterization
Post-quantum signatures are larger and often more expensive to verify. This impacts:
-
•
block bandwidth (weight);
-
•
signature verification throughput;
-
•
mempool policy and fee market dynamics;
-
•
hardware requirements for full nodes.
These are not reasons to avoid quantum safety; they are constraints that must be internalized into the cost model () and the activation plan (migration windows, enforcement height, and wallet operational invariants).
11.1 Witness size and verification cost comparison
Table 3 compares the witness footprint of current and candidate PQ schemes. All sizes are approximate and reflect single-signature spending; multisig and threshold constructions multiply accordingly.
| Scheme | Public key | Signature | Witness total | Security |
| (bytes) | (bytes) | (bytes) | (quantum bits) | |
| ECDSA (secp256k1) | 33 | 72 | 107 | 0 (broken) |
| Schnorr (BIP 340) | 32 | 64 | 98 | 0 (broken) |
| ML-DSA-44 (FIPS 204) | 1,312 | 2,420 | 3,734 | 128 |
| ML-DSA-65 (FIPS 204) | 1,952 | 3,309 | 5,263 | 192 |
| SLH-DSA-128s (FIPS 205) | 32 | 7,856 | 7,890 | 128 |
| SLH-DSA-128f (FIPS 205) | 32 | 17,088 | 17,122 | 128 |
Weight budget impact.
A standard SegWit block has a weight limit of 4 MWU (4,000,000 weight units), with witness data discounted at 1 WU per byte. A single ML-DSA-44 witness (3.7 KB) consumes roughly the weight of a Schnorr witness (98 B). This reduces the maximum number of single-input, single-output transactions per block from 10,000 (Schnorr) to 270 (ML-DSA-44) or 120 (SLH-DSA-128s). Batch verification techniques, witness aggregation, or increased block weight limits are engineering levers that affect throughput but do not change the security analysis.
Verification throughput.
ML-DSA verification is comparable to Ed25519 in speed (10,000 verifications/second on commodity hardware). SLH-DSA verification is slower (1,000–3,000/s for the “f” variants, faster for “s” variants). The cost function must reflect these differences to prevent DoS via blocks filled with expensive-to-verify witnesses.
12 Related Work
Quantum attacks on Bitcoin.
Aggarwal et al. [1] provide the first systematic analysis of quantum threats to Bitcoin, quantifying the advantage of a quantum miner (via Grover) and the feasibility of key recovery (via Shor) under various timing assumptions. Their treatment is primarily quantitative and attack-oriented; it does not formalize consensus as a state machine, define authorization integrity as a game, or address migration. Our work complements theirs by providing the formal framework in which their attack scenarios can be stated as theorem violations.
Bitcoin Backbone protocol.
Garay, Kiayias, and Leonardos [7] formalize the safety and liveness properties of Nakamoto consensus (common prefix, chain quality, chain growth) under synchronous networks with bounded adversarial mining power. Pass, Seeman, and Shelat [15] extend this to asynchronous settings. These results provide the network-level foundation we rely on (Section 8), but they do not address the authorization layer: their model assumes honest transaction validity, whereas our contribution is precisely to formalize what “valid authorization” means under QPT adversaries and to prove that PQ predicates preserve it.
Post-quantum signature standardization.
NIST has standardized ML-DSA (FIPS 204, lattice-based) [13] and SLH-DSA (FIPS 205, hash-based) [14] as post-quantum signature schemes. Chen et al. [6] provide the initial NIST report motivating the transition. Our construction is parametric in the choice of ; the security theorems hold for any scheme satisfying EUF-CMA under QPT adversaries.
Quantum random oracle model.
Boneh et al. [4] initiated the study of cryptographic security when adversaries can query random oracles in superposition. Zhandry [24] developed techniques for quantum-accessible random functions. Boneh and Zhandry [5] proved that certain signature schemes remain secure under quantum chosen-message attacks. We discuss the QROM implications for our reduction in Section 7.4.
Bitcoin-specific PQ proposals.
Heilman et al. [10] explore using OP_CAT to enable Lamport-like signatures within Bitcoin Script, providing a script-level path to quantum resistance without new opcodes. BIP-360 [2] proposes a “Pay to Quantum Resistant Hash” output type. These proposals address the construction layer (how to encode PQ witnesses in Bitcoin) but do not provide the formal consensus model, game-based security definitions, invariant preservation proofs, or migration formalization that we contribute.
Shor’s algorithm for elliptic curves.
Proos and Zalka [16] analyze the concrete quantum circuit complexity of Shor’s algorithm applied to elliptic curve groups. Roetteler et al. [17] provide refined resource estimates, suggesting that 2,500 logical qubits suffice for 256-bit curves. These estimates inform the timeline urgency of migration but do not affect our formal results, which assume Shor is available as a QPT oracle.
13 Conclusion
Protocol-level quantum safety is a global safety property of the Bitcoin consensus state machine. It cannot be achieved by adding a “post-quantum opcode” while leaving secp256k1 spend paths reachable. A credible design must (i) specify transitions and validation deterministically, (ii) define authorization integrity as a QPT game, (iii) provide a tight reduction from unauthorized spends to PQ signature security and hash binding via explicit game-hopping, (iv) prove that consensus invariants are preserved across all valid transitions, (v) exclude witness replay and cross-input attacks via sighash commitment properties, (vi) model network execution as formal traces and prove that network-level adversarial capabilities do not bypass PQ authorization, (vii) address the quantum random oracle model, (viii) formalize migration with monotonicity guarantees and explicitly choose how to handle unmigrated (including lost-key) outputs, and (ix) discharge proof obligations via mechanized verification.
This paper addresses all nine requirements. The formal artifacts — TLC model checking of UTXO transitions (two models: single-input with 492 states and multi-input with 58,237 states and value conservation; zero structural invariant violations; concrete migration dilemma counterexample in both models), Coq-mechanized proofs of spend predicate totality, determinism, and parse canonicality (strengthened to full witness identity via axiomatized varint model with concrete bounded compact-size discharge, consensus-size guard, golden test vectors, exhaustive varint refinement, and witness-level consensus-domain operational-trace refinement matrices), Kani source-level bounded verification of the deployed Rust witness parser layout/canonicality relation, release-binary translation validation against the Coq-extracted PO-8 summaries, Coq-mechanized proofs of the Sighash v2 commitment model under a SHA-256 collision-resistance axiom plus Coq-extracted vs Rust transcript/preimage refinement for PO-4, transition determinism (PO-5), and cost boundedness with exact weight equality (PO-7), and a reference implementation in Rust with FIPS 204 ML-DSA-44 signatures, 34 property-based tests including 9 sighash commitment properties, 28 PO-8 correspondence tests with bounded golden vectors, a Rust consensus-size guard, and 3 adversarial boundary tests — provide machine-checked and empirically validated evidence while leaving cryptographic primitive implementation correctness and compiler correctness as explicit implementation-correspondence boundaries.
References
- [1] (2017) Quantum attacks on bitcoin, and how to protect against them. Note: https://arxiv.org/abs/1710.10377Accessed 2026-04-09 Cited by: §12, Remark 6.
- [2] (2024) BIP-360: qubit – pay to quantum resistant hash. Note: https://github.com/bitcoin/bips/blob/master/bip-0360.mediawikiAccessed 2026-04-09 Cited by: §12.
- [3] (2006) The security of triple encryption and a framework for code-based game-playing proofs. In Advances in Cryptology – EUROCRYPT, pp. 409–426. External Links: Document Cited by: §7.2, §7.
- [4] (2011) Random oracles in a quantum world. In Advances in Cryptology – ASIACRYPT, pp. 41–69. External Links: Document Cited by: §12, §7.4, §7.4.
- [5] (2013) Secure signatures and chosen ciphertext security in a quantum computing world. Note: https://eprint.iacr.org/2013/088Accessed 2026-04-09 Cited by: §12, §4.4.
- [6] (2016) Report on post-quantum cryptography. In NIST Internal Report 8105, Note: https://csrc.nist.gov/publications/detail/nistir/8105/finalAccessed 2026-04-09 Cited by: §12.
- [7] (2015) The bitcoin backbone protocol: analysis and applications. In Advances in Cryptology – EUROCRYPT, pp. 281–310. External Links: Document Cited by: §12, §3.2, §8.2, Remark 10, Remark 9.
- [8] (1988) A digital signature scheme secure against adaptive chosen-message attacks. SIAM Journal on Computing 17 (2), pp. 281–308. External Links: Document Cited by: §4.4.
- [9] (1996) A fast quantum mechanical algorithm for database search. In Proceedings of the Twenty-Eighth Annual ACM Symposium on Theory of Computing (STOC), pp. 212–219. External Links: Document Cited by: item 2, §7.3.
- [10] (2024) OP_CAT and quantum-resistant bitcoin. Note: https://arxiv.org/abs/2401.15768Accessed 2026-04-09 Cited by: §12.
- [11] (2016) BIP141: segregated witness (consensus layer). Note: https://github.com/bitcoin/bips/blob/master/bip-0141.mediawikiAccessed 2026-04-09 Cited by: §6.1.
- [12] (2023) FIPS 186-5: digital signature standard (dss). Note: https://csrc.nist.gov/publications/detail/fips/186/5/finalAccessed 2026-04-09 Cited by: §1.
- [13] (2024) FIPS 204: module-lattice-based digital signature standard. Note: https://csrc.nist.gov/publications/detail/fips/204/finalAccessed 2026-04-09 Cited by: Table 3, §12, §4.6, §7.3, §7.4.
- [14] (2024) FIPS 205: stateless hash-based digital signature standard. Note: https://csrc.nist.gov/publications/detail/fips/205/finalAccessed 2026-04-09 Cited by: Table 3, §12, §4.6, §7.3, §7.4.
- [15] (2017) Analysis of the blockchain protocol in asynchronous networks. In Advances in Cryptology – EUROCRYPT, pp. 643–673. External Links: Document Cited by: §12, Remark 10.
- [16] (2003) Shor’s discrete logarithm quantum algorithm for elliptic curves. Quantum Information & Computation 3 (4), pp. 317–344. Note: arXiv:quant-ph/0301141 Cited by: §12, §5.
- [17] (2017) Quantum resource estimates for computing elliptic curve discrete logarithms. In Advances in Cryptology – ASIACRYPT, pp. 241–270. External Links: Document Cited by: §12.
- [18] (1994) Algorithms for quantum computation: discrete logarithms and factoring. In Proceedings 35th Annual Symposium on Foundations of Computer Science (FOCS), pp. 124–134. External Links: Document Cited by: §1, item 1, §5.
- [19] (2004) Sequences of games: a tool for taming complexity in security proofs. In Cryptology ePrint Archive, Report 2004/332, Note: https://eprint.iacr.org/2004/332Accessed 2026-04-09 Cited by: §7.
- [20] (2020) BIP340: schnorr signatures for secp256k1. Note: https://github.com/bitcoin/bips/blob/master/bip-0340.mediawikiAccessed 2026-04-09 Cited by: §1.
- [21] (2021) BIP341: taproot: segwit version 1 spending rules. Note: https://github.com/bitcoin/bips/blob/master/bip-0341.mediawikiAccessed 2026-04-09 Cited by: §1, Definition 4, Remark 1.
- [22] (2021) BIP342: validation of taproot scripts. Note: https://github.com/bitcoin/bips/blob/master/bip-0342.mediawikiAccessed 2026-04-09 Cited by: §1, Definition 4.
- [23] (1999) Grover’s quantum searching algorithm is optimal. Physical Review A 60 (4), pp. 2746–2751. External Links: Document Cited by: item 2, §7.3.
- [24] (2012) How to construct quantum random functions. In Proceedings of the 53rd Annual IEEE Symposium on Foundations of Computer Science (FOCS), pp. 679–688. External Links: Document Cited by: §12, §7.4.