~/bitcoin-payments/spec
[llms.txt][github]

v2 (v3.1.0-rfc) · public rfc · zero-federation · not mainnet-active

[changelog]

Part 2: Stage 0 Direct-on-L1 Bitcoin SPV Event Oracle & Stage 1A Bitcoin-L1-Canonical Authorization Domain

Document Class: Normative Bitcoin SPV Verification & L1 Authorization Domain Specification (v2 / v3.1.0-rfc — Zero-Federation Phased Architecture; supersedes archived v1 v3.0.0-rfc and v0 v2.5.0-rfc)
Philosophical Anchor: Stage 0 implements Zenon's non-custodial verification thesis (zenon-developer-commons: essays/Verify Bitcoin, Don't Bridge It.md & docs/specs/spv-event-oracle-spec.md): Event Validity only, zero custody authority. Stage 1A moves canonical zBTC authorization, data availability, and forced exit directly onto Bitcoin L1 so that 49%–100% Zenon compromise cannot forge state or censor exits.
Consistency Checker: scripts/verify_spec_bounds.py


1. Two-Layer Separation: Stage 0 Event Oracle vs Stage 1A Canonical L1 Domain

This specification strictly separates two orthogonal verification surfaces with zero federated signers anywhere:

  1. Stage 0 — Direct-on-L1 Bitcoin SPV Event Oracle (vm/embedded/btcspv):
    • Runs deterministically inside an embedded Zenon contract (BtcSpvOracleContract), wrapped in mandatory panic recovery (recover(), zero common.DealWithErr calls — closing upstream issue #239 / B1).
    • Proves Event Validity ONLY: cryptographic evidence that a Bitcoin transaction txid is included at depth >= K_oracle on the heaviest cumulative-PoW Bitcoin header chain.
    • Hard Non-Custody Invariant: Stage 0 SPV has ZERO minting, burning, sweeping, or vault-spending authority. It powers Bitcoin-verified receipts, proof-of-payment triggers, and non-custodial PTLC/HTLC atomic swaps (spec/03 §1).
  2. Stage 1A — Bitcoin-L1-Canonical Authorization Domain (vk_STF Rollup Circuit):
    • For pooled, fungible zBTC (Stage 1A), Zenon L1 does NOT authorize mints, burns, or exits.
    • Instead, an off-chain ZK prover executes the deterministic Rollup State Transition Function ($\mathcal{F}$) over complete stripped Bitcoin blocks directly on Bitcoin L1, deriving the entire canonical zBTC state root $R_h$ strictly from Bitcoin's heaviest PoW chain (0-of-N Zenon trust; 0% ZNN market-cap coupling). Inside BitVMX-CPU (RV32IM), only the constant-size wrapped SNARK verifier vk_STF runs (R8-H05), NEVER bare 1 MB block SHA-256 scanning!

2. Stage 0: Direct-on-L1 Bitcoin SPV Event Oracle (vm/embedded/btcspv)

2.1 OracleChainConfig & Finality Parameters

OracleChainConfig {
    foreignChainId         : bytes32   // u16(0x0001) || SHA3-256("BTC_MAINNET_SPV_V1" || btcGenesisHashBE)[0:30]
    genesisAnchor          : Bytes     // BitcoinAnchor { blockHashBE(32B), height(u64), header(80B), cumWork(u256),
                                       //                 retargetStartHash(32B), retargetStartTime(u32), retargetHeight(u64), mtpWindow[11](u32) }
    admissionDepthN        : u32       // 6 blocks (provisional event admission; reversible on reorg)
    finalizationDepthK     : u32       // 12 blocks (oracle event finalization depth; probabilistic PoW finality)
    minimumPostAnchorWork  : u256      // finalizationDepthK * blockWork(genesisAnchor.nBits)
    retainedReorgDepth     : u32       // 144 blocks (stale HeaderNode pruning ONLY; ActiveChainByHeight NEVER pruned)
    maximumHeaderBatch     : u32       // 2 headers per SubmitHeaderBatch call
    maximumMerkleDepth     : u32       // 16 levels (65,536 txs/block)
    minimumStrippedTxBytes : u32       // 65 B (rejects 64-byte CVE-2017-12842 interior nodes & impossibly short txs)
    maximumStrippedTxBytes : u32       // 6,144 B (per-call Stage 0 proof cap; fits 3x inside pinned 2.1M Plasma floor)
    futureTimeGuardSecs    : u32       // 7,200 s (Bitcoin consensus MAX_FUTURE_BLOCK_TIME)
    equalWorkTieBreak      : u8        // 0 = LOWEST_BLOCK_HASH_BE (deterministic across all Zenon full nodes)
}

Testnet / Signet Scope Caveat: On Bitcoin Signet (where validity rests in the Signet challenge signature) and Testnet4 (minimum-difficulty block exception), header-only PoW SPV does not resist an adversary. Stage 0 Signet SPV tests are conformance-only; full PoW security applies strictly on Bitcoin Mainnet.

2.2 Stage 0 Embedded ABI Methods, Exact Sizes & Pinned Plasma Floor (B1, B2)

All 4 Stage 0 oracle methods are panic-recovered (B1), require zero federation signatures, and stay strictly within the pinned MaxBasePlasmaInMomentum >= 2,100,000 floor (spec/05 §2.2) and dp.MaxContractBlocks = 40 per-Momentum contract-block cap (origin/dev:dp/dp.go:259-264). Base Plasma under DynamicPlasmaSpork equals tier + 68 * (abiBytes - 4) (origin/dev:vm/plasma.go:185-200):

ABI MethodSend Plasma TierExact Max PayloadExact Max ABI (32 B-padded)Exact Base Plasma (QSR @ floor 1,000)Max Storage OpsPurpose
SubmitHeaderBatch(headers)52,500 (Simple)160 B (2 × 80 B)228 B67,732 (33 QSR)<= 8Validate 1..2 mainnet headers, 2016-block [302400, 4838400]s retarget, MTP, update ActiveChainByHeight.
StepReorg()52,500 (Simple)0 B4 B52,500 (25 QSR)<= 6Walk 1 incremental reorg step; emits deterministic reorg state transition if an admitted < 12-deep event is orphaned; flags DeepReorgAlert = 1 if ReorgSteps > 144.
PruneStaleHeaders(hashes)52,500 (Simple)64 B (2 × 32 B)132 B61,204 (30 QSR)<= 4Delete 1..2 stale HeaderNodes (height < BestTip - 144 && height % 2016 != 0 && ReorgActive == 0).
ProveTxInclusion(...)73,500 (Heavy SPV)7,279 B7,620 B591,388 (282 QSR)<= 8Verify >= N-deep strippedTx (65..6,144 B) + 1-/2-block coinbase midstate + Merkle inclusion → record VerifiedEvent[txid].

Exact ProveTxInclusion ABI Derivation (Full 32 B-Padded Accounting):

  • Static head: 4 B selector + 8 × 32 B (blockHeight, txIndex, totalCoinbaseBytes, sha256Midstate, + 4 dynamic offsets) = 260 B.
  • Dynamic bodies (32 B length prefix + 32 B-padded bytes): strippedTx (32 + 6,144 = 6,176 B) + txBranch (32 + 16 × 32 = 544 B) + coinbaseTail (32 + 64 = 96 B for <= 63 B tail) + coinbaseBranch (32 + 16 × 32 = 544 B) = 7,360 B.
  • Total ABI = 260 + 7,360 = 7,620 B <= 16,384 B (MaxDataLength). Base Plasma = 73,500 + 68 × (7,620 - 4) = 591,388. Up to 3 max-size ProveTxInclusion calls (1,774,164 <= 2,100,000) fit inside a single Momentum even at the pinned floor (6 at default 4,200,000).

2.3 Exact 1- and 2-Block Coinbase Midstate Proof (CVE-2017-12842, R8-M06 Hardened)

Every ProveTxInclusion call MUST verify:

  1. ChainMeta.ReorgActive == 0 and ChainMeta.PostAnchorWork >= minimumPostAnchorWork.
  2. ActiveChainByHeight[blockHeight] exists and BestTipHeight >= blockHeight + admissionDepthN - 1.
  3. 65 <= len(strippedTx) <= 6,144 (rejects len == 64 CVE-2017-12842 interior-node forgery AND any impossibly short < 65 B non-tx byte sequence, tightened per R8-M06), txIndex != 0, valid Bitcoin non-witness transaction syntax (vin_count >= 1, vout_count >= 1, exact byte consumption), and no SegWit marker (0x00 0x01) in stripped bytes.
  4. doubleSHA256(strippedTx) verifies against merkleRootLE via txBranch at txIndex with len(txBranch) == len(coinbaseBranch) <= 16 and zero duplicate-sibling CVE-2012-2459 padding.
  5. 1- and 2-Block SHA-256 Coinbase Midstate Verification:
    • Caller supplies (sha256Midstate: bytes32, finalChunkTail: bytes, totalCoinbaseBytes: u32, coinbaseBranch: bytes32[]).
    • Normative Constraints:
      • totalCoinbaseBytes >= 65 (rejects totalCoinbaseBytes == 64 leaf forgery and impossibly short transactions).
      • len(finalChunkTail) == totalCoinbaseBytes % 64 (strictly < 64; rejects any mismatched or unaligned tail!).
    • Exact Final SHA-256 Padding (100% of valid Bitcoin coinbase lengths, avoiding the 12.5% single-compression rejection bug when rem ∈ [56, 63]): Let rem = totalCoinbaseBytes % 64 and bitLen = u64BE(uint64(totalCoinbaseBytes) * 8):
      • Case 1 (rem < 56 — 1-block final padding): Build single 64 B block B_1 = finalChunkTail[0:rem] || 0x80 || 0x00^(55 - rem) || bitLen(8B). Compute innerHash = SHA256_Compress(sha256Midstate, B_1).
      • Case 2 (56 <= rem <= 63 — 2-block final padding): Build B_1 = finalChunkTail[0:rem] || 0x80 || 0x00^(63 - rem) and B_2 = 0x00^56 || bitLen(8B). Compute state_1 = SHA256_Compress(sha256Midstate, B_1), then innerHash = SHA256_Compress(state_1, B_2).
    • Compute coinbaseTxid = SHA256(innerHash) and verify coinbaseBranch at index 0 against merkleRootLE with len(coinbaseBranch) == len(txBranch).
    • Explicit Auditability Disclosure: A midstate proof proves that Merkle index 0 is a valid non-64-byte leaf at the same tree depth as txIndex (completely closing CVE-2017-12842 interior-node forgery); it does not parse the prefix of the coinbase transaction itself. In Stage 1A below, full coinbase bytes are directly verified inside the off-chain ZK stripped-block scanner to extract the BIP-141 witness commitment.

2.4 Stage 0 Oracle Storage Layout (BtcSpvOracleContract)

PrefixKeyValuePruning Policy
0x20singletonChainMeta (BestTipHash, BestTipHeight, BestTipWork, PostAnchorWork, ReorgActive, DeepReorgAlert)Never pruned
0x21blockHashBE(32B)HeaderNode (160 B, incl. mtpWindow[11])Pruned via PruneStaleHeaders when < BestTip - 144 && height % 2016 != 0 && ReorgActive == 0
0x22u64BE(height)ActiveChainByHeight (68 B: blockHashBE || merkleRootLE || blockTime)NEVER PRUNED
0x23txid(32B)VerifiedEvent (blockHeight, blockHashBE, txIndex, finalized: bool)Never pruned

3. Stage 1A: Bitcoin-L1-Canonical Authorization Domain (0% Zenon Trust)

For pooled, fungible zBTC, Bitcoin L1 is the sole canonical ordering, data-availability, and forced-inclusion layer. Zenon Pillars act strictly as untrusted L1-subsidized soft-preconfirmation sequencers (spec/03 §2, spec/04 §2). Even if 49%–100% of Zenon Pillars are Byzantine, they cannot fork zBTC, mint 1 unbacked satoshi, or censor Bob's or Mike's exit.

3.1 Canonical Bitcoin L1 Tag Schema (OP_RETURN "ZBTX" <= 80 B + Authenticated Taproot Witness)

All Stage 1A protocol events are tagged on Bitcoin L1 with a 4 B magic prefix "ZBTX" (0x5a 0x42 0x54 0x58) and 1 B tag inside an OP_RETURN output (<= 80 B standardness limit). Bulk payloads (certBlob, complete mutated SMT leaves, π_batch, signed forced transfers) sit inside the spending transaction's Taproot script-path witness, bound by SHA-256 commitment in the OP_RETURN and verified against the block's BIP-141 coinbase witness commitment.

TagNameOP_RETURN Layout & Exact SizeTaproot Witness / Additional OutputsPurpose
0x00DEPOSIT"ZBTX"(4) || 0x00(1) || recipientAcctHash(32) || vaultParamsHash(32) = 69 Bvin[0] = confirmed U_dep_wallet (OP_DROP certBlob 104 B <= 520 B); vin[1..3] = denomination-matched AdmissionTicketUTXOs (R8-C03); vout[0..2] = {0.50, 0.25, 0.25} BTC deleted-key vaults keyed by acyclic vault_id (R8-C01).Register K-deep multi-tier deposit vaults (enforcing Cap_TVL_total via L1 ticket conservation & $2^M$ Hall invariant) and credit recipientAcctHash.
0x01FORCED_EXIT"ZBTX"(4) || 0x01(1) || exitCommitHash(32) = 37 BWitness carries (acctId, nonce, grossSats >= max(dust, MIN_EXIT_SATS=100_000), maxOpFeeSats, destScriptPubKey, cancelPubKey, sig_user) (R8-M05); additional output creates active-operator (2M_active+1)-leaf ExitSlotUTXO (546 sat dust anchor, spec/01 §5).Uncensorable L1 exit for Bob (0.50 BTC) or Mike (0.25 BTC), bypassing 49%–100% Zenon censorship & Plasma spikes.
0x02BATCH_DA"ZBTX"(4) || 0x02(1) || batchCommitHash(32) = 37 BWitness carries prevRoot(32B) || newRoot(32B) || batcherSlotId(2B) || mutatedAccounts[] (16 B existing / 48 B new, <= 1,000 new/6-blk epoch w/ 500-sat refundable leaf deposit) || mutatedRollupLocks[] || cooperativeExits[] || creditTransfers[] || π_batch (R8-C05, R8-M01, R8-M02, R8-M04).Anchor feeless Zenon-sequenced transfers, RollupLocks, cooperative PendingExits, and TransferCredit ops onto Bitcoin L1 with 100% self-contained state-diff DA across all non-L1-derivable SMT namespaces!
0x03FORCED_TRANSFER"ZBTX"(4) || 0x03(1) || txCommitHash(32) = 37 BWitness carries signed 110 B rollup transfer (or RollupHTLC/RollupPTLC / TransferCredit op).Uncensorable L1 transfer fallback if Zenon censors or Dynamic Plasma spikes.
0x04CHALLENGE_CLAIM"ZBTX"(4) || 0x04(1) || kickoffTxid(32) || verifierAcctId(4) = 41 BEmitted on every ChallengeTx_{r,i} opened in simultaneous window [0, 144] (which also creates ChalProofConnector_{r,i} for native-L1 0.15 BTC payout from Stake_r, spec/01 §4).Indexes active challengers on-chain for auditability and optional protocol insurance attribution (native L1 verifier EV comes strictly from Stake_r!).
0x05FRONT_CLAIM"ZBTX"(4) || 0x05(1) || exitId(32) || operatorId(4) = 41 BEmitted when active operator $O_j$ spends ExitSlotUTXO paying destScriptPubKey >= grossSats - maxOpFeeSats in vout[0]. (Note: even untagged ExitSlotUTXO spends are caught by full stripped-vin scanning, §3.2!)Credits ReimbursementCredit[O_j] += grossSats (tagged with exit creation height for R8-N01 oldest-exit priority; or triggers hard-partitioned B_grief slash + refund on non-paying spend!).
0x06EXIT_FEE_BUMP"ZBTX"(4) || 0x06(1) || exitId(32) || newMaxOpFeeSats(8) = 45 BWitness carries user signature over (exitId, newMaxOpFeeSats) where newMaxOpFeeSats > oldMaxOpFeeSats.Lets Bob/Mike raise fronting incentive during L1 fee spikes without re-queuing.
0x07RELEASE_ASSIGNMENT"ZBTX"(4) || 0x07(1) || vaultId(32) || operatorId(4) = 41 BWitness carries explicit O_j signature voluntarily releasing an assigned vault (AssignedObligations[vaultId] -> ReimbursementCredit[O_j], Vaults[vaultId] -> UNASSIGNED).Optional O_j-signed voluntary release preserving exact V_unassigned + V_assigned = C + L + E + R + A + B (R8-C02).

3.2 Off-Chain Stripped-Block ZK Scanner, Fail-Closed BIP-141 Witness Completeness & Full vin Tracking (R8-C05, R8-H05)

Architecture Split (R8-H05): The full stripped-block scanner and SMT updater $\mathcal{F}$ execute inside the off-chain ZK validity prover, producing a succinct proof verified by the immutable vk_STF wrapped SNARK verifier inside BitVMX-CPU (RV32IM, <= 8^9 instructions, Gate G2). Inside the off-chain ZK circuit proved by vk_STF:

  1. Complete Stripped Block Verification (<= 1,000,000 B Bitcoin consensus stripped-block cap): For every confirmed block $h$ in [h_prev + 1, h_tip - K + 1], the prover feeds the complete stripped block (tx_0 .. tx_{m-1}) into $\mathcal{F}$. $\mathcal{F}$ computes every txid_i = doubleSHA256(stripped_tx_i), reconstructs the full transaction Merkle root, and asserts equality with header[h].merkleRoot. No transaction in block $h$ can ever be omitted or censored by a malicious prover.
  2. Mandatory Full Stripped-vin Scan for Untagged Protocol UTXO Spends (R8-C05): $\mathcal{F}$ MUST inspect every vin of EVERY stripped transaction tx_1 .. tx_{m-1} in block h (regardless of whether the spending transaction carries an OP_RETURN "ZBTX" tag!) against the canonical tracked outpoint set (VaultUTXO, ExitSlotUTXO, Stake_r, VaultConnector_r, AdmissionTicketUTXO). Thus an attacker CANNOT bypass ExitSlotUTXO grief slashing, TakeTx Lamport equivocation accounting, Stake_r dual-input slashing, or RetireStakeTx_r detection by omitting a "ZBTX" tag!
  3. Exact BIP-141 Witness Commitment Extraction & Fail-Closed vs Deterministic-Skip Rule (R8-C05):
    • $\mathcal{F}$ parses the full stripped coinbase transaction tx_0 (verifying vin[0].prevout == 0x00^32 : 0xffffffff), locates the LAST output whose scriptPubKey starts with the 6-byte BIP-141 header 0x6a24aa21a9ed and satisfies len(scriptPubKey) >= 38, and extracts witnessCommitment = scriptPubKey[6:38].
    • Using coinbase wtxid_0 = 0x00^32 and the coinbase witness nonce (32 B witnessReservedValue), $\mathcal{F}$ verifies SHA256d(witnessRoot || witnessNonce) == witnessCommitment and authenticates the exact BIP-141 wtxid_i Merkle branch for every protocol transaction tx_i carrying witness data (0x00, 0x01, 0x02, 0x03, 0x06, 0x07, or any SegWit spend of a tracked UTXO).
    • Strict Fail-Closed vs Skip Classification (Eliminating Witness-Withholding Censorship):
      • FAIL CLOSED (REFUSED_DATA_UNAVAILABLE — Proof Invalid!): If a prover omits the witness bytes for a SegWit protocol transaction, submits witness bytes whose computed wtxid_i fails the coinbase BIP-141 witnessRoot Merkle proof, or fails to locate the valid last 0x6a24aa21a9ed commitment when SegWit transactions exist, the ZK circuit MUST REJECT (satisfiability = FALSE). A prover can NEVER claim a valid 0x02/0x01/0x03 tx was "malformed" by withholding its witness!
      • DETERMINISTIC SKIP (Only AFTER wtxid_i Authentication): ONLY AFTER the exact witness bytes of tx_i have been cryptographically authenticated against witnessRoot inside the coinbase commitment may $\mathcal{F}$ deterministically skip tx_i if its authenticated payload fails schema decoding, prevRoot != R_cur, slot priority, or Verify(π_batch) == false.

3.3 Canonical Intra-Block Ordering & Slotted 0x02 Batcher Priority (R8-M02)

Within each K-deep Bitcoin block $h$, $\mathcal{F}$ transitions $R_{h-1} \to R_h$ in strict deterministic order:

  1. Pass 1 — Deposits (0x00 DEPOSIT): Process in Bitcoin block transaction-index order i = 1..m-1. Verify AdmissionTicketUTXO consumption (vin[1..3]), acyclic vault_id Taproot script derivation, wtxid-authenticated certBlob (104 B), valid N-of-N setup cohort binding, {0.50, 0.25, 0.25} BTC outputs, and the $2^M$ Hall's Marriage Invariant (spec/01 §6.2). Credit Accounts[recipientAcctHash].balanceSats += D_d.
  2. Pass 2 — First Valid Sequenced Batch (0x02 BATCH_DA): Scan block $h$ in tx-index order and apply AT MOST ONE wtxid-authenticated valid 0x02 batch whose prevRoot == R_after_pass_1, π_batch verifies against the complete mutated SMT state diff (Accounts, RollupLocks, cooperative PendingExits, TransferCredit, <= 1,000 new leaves/epoch with 500-sat refundable deposit), and whose batcherSlotId matches the deterministic slotted batcher priority (primary_batcher = H(header[h-1].hash) mod K_batchers for the first 2 blocks after prevBatchHeight + 6, open permissionless fallback to any batcher thereafter — eliminating stale-root L1 fee burn races, R8-M02!). Any competing 0x02 batch (e.g. from a 49% Zenon fork) fails prevRoot matching and is deterministically skipped.
  3. Pass 3 — Mandatory L1 Forced Inclusion (0x03, 0x01, 0x06): Apply EVERY wtxid-authenticated valid 0x03 FORCED_TRANSFER, 0x01 FORCED_EXIT (grossSats >= max(dust, 100_000) sats, active-operator ExitSlotUTXO), and 0x06 EXIT_FEE_BUMP in tx-index order. 100% hostile Zenon Pillars cannot delay or censor a single forced transfer or exit by even 1 Bitcoin block.
  4. Pass 4 — Tracked-UTXO Spends, Deterministic FIFO Assignment & Slashing Events (Full vin Scan + 0x04, 0x05, 0x07): Process ALL spends of tracked ExitSlotUTXOs (universal spend-or-refund rule with hard-partitioned B_grief pro-rata burst cap, spec/01 §5), TakeTx confirmations (V_assigned -= D_v, AssignedObligations.pop(v)), 0x07 RELEASE_ASSIGNMENT (V_assigned -> V_unassigned, A[v] -> R[O_j]), deterministic tightest-slack FIFO vault assignment (V_unassigned -> V_assigned, R[O_j] -> A[v] respecting oldest-PendingExit credit priority, R8-N01), DisproveTx/TimeoutSlashTx dual-input slashes (0 vault stolen, B_custody slashed), BurnBondTx_{r,k} Lamport equivocation slashes (D_v burned from B_custody, innocent O_k restored if v was assigned to O_k, 0.05 BTC bounty), and RetireStakeTx_r (gating B_zbtc unlock on A[O_j] == 0 and Hall's invariant). Assert exact V_unassigned + V_assigned == C + L + E + R + A + B (R8-C02)!

4. Launch-Time PoW Anchor, K >= 18 Unpublished-Fork Heuristic, Heaviest-Chainwork Verification & >= K Deep-Reorg Circuit Breaker (R8-H03, R8-M07)

Because Bitcoin L1 scripts without covenants cannot inspect arbitrary future chain tips directly, each finite BitVMX StakeChain lane (j, l) (R = 64 rounds, active horizon <= ~2.3 years at T_cooldown = 13.0d) anchors Bitcoin PoW at lane launch (t = 0, before Q_lane_{j,l} deletion):

  1. Launch-Time Lane Anchor (h_lane_init, H_init, D_init): Pins an already-confirmed Bitcoin mainnet block at lane creation, together with its 2,016-block retarget-period start header and mtpWindow[11].
  2. Full 2,016-Block Retargeting & Difficulty Floor: The ZK prover validates every 80-byte Bitcoin header from h_lane_init to h_tip with exact mainnet SetCompact, [302400, 4838400]s 2,016-block retarget clamping, MTP monotonicity, and minimum difficulty floor D(h) >= 0.50 * D(h_lane_init). (If mainnet difficulty grows > 2× during a lane's active lifetime, operators retire old lanes at 2,016 blks and launch fresh lanes re-anchored to current D.)
  3. Interactive Heaviest-Chainwork Competing-Header Challenge (R8-H03 — Clementine / BitVM3 Light-Client Pattern):
    • To prevent a malicious operator from submitting a valid but lower-work private fork anchored at h_lane_init, any verifier V_i challenging RoundTx_r in [0, 144] may supply a competing valid Bitcoin header-chain proof anchored to the same (h_lane_init, H_init, D_init) whose cumulative chainwork strictly exceeds the operator's claimed chain (cumWork(H_chal) > cumWork(H_op)) and which diverges at or before the claimed K-deep confirmation block.
    • Inside vk_STF, comparing the two header-chain SNARK commitments deterministically proves the operator asserted a non-canonical/lower-work fork and slashes Stake_r + VaultConnector_r!
  4. Honest Private-Fork Heuristic (K >= 18 Hard Floor) & Budish Subsidy-Offset Disclosure (R8-H03):
    • The protocol enforces a hard minimum K >= 18 blocks (~3.0h nominal) and sizes K across halvings against Cap_TVL_total = Cap_user + M × B_zbtc using the conditional unpublished-fork opportunity-cost heuristic: $$0.50 \times K \times \text{Subsidy}(\text{era}) > \text{Cap}_{\text{TVL,total}}$$
    • Mandatory Economic Honesty Disclosure (Budish Winning-Fork Offset): This inequality measures the unpublished/orphaned fork opportunity cost. Under a majority (>50%) hashrate attack where the attacker publishes the winning fork and recaptures all K block subsidies, the attacker's direct mining cost is only the net electricity/hardware flow cost κ × K × Subsidy (κ ∈ [0.05, 0.50]) PLUS external reputational/BTC-price-crash losses (verify_spec_bounds.py prints the exact Budish sensitivity table). Consequently, K >= 18 delivers probabilistic PoW finality under <50% honest hashrate — NOT an unconditional economic guarantee against a >50% cartel!
Deployment StageCap_user / Cap_TVL_total (incl. M × B_zbtc)K (2024–2028, 3.125 BTC)0.50 × K × Sub (K × Sub nom)K (2028–2032, 1.5625 BTC)K (2032–2036, 0.78125 BTC)
Stage 1A Pilot (M = 3)<= 10 BTC / 11.80 BTC18 (~3.0h)28.125 (56.25) > 11.8018 (14.06 > 11.80)32 (12.50 > 11.80)
Stage 1A Expanded (M = 5)<= 15 BTC / 18.00 BTC18 (~3.0h)28.125 (56.25) > 18.0024 (18.75 > 18.00)48 (18.75 > 18.00)
Stage 2 Scaled (M = 20)<= 50 BTC / 62.00 BTC42 (~7.0h)65.625 (131.25) > 62.0080 (62.50 > 62.00)160 (62.50 > 62.00)
Stage 2 High-Cap (M = 40)<= 200 BTC / 224.00 BTC144 (~24.0h)225.00 (450.00) > 224.00288 (225.00 > 224.00)576 (225.00 > 224.00)
  1. Fail-Closed Deep-Reorg (>= K) Circuit Breaker (R8-M07):
    • All Rollup full nodes, batchers, operators, and verifiers MUST retain >= 144-block rollback snapshots of (R_h, SMT_h).
    • If Bitcoin ever experiences a reorg of depth >= K (>= 18 blocks), nodes MUST immediately assert DEEP_REORG_HALT: (a) freeze new 0x02 batch submissions and new operator fronting, (b) rewind canonical state to the highest common ancestor h_fork and deterministically replay the heavier canonical Bitcoin chain from h_fork + 1, (c) treat any orphaned FrontingTx as valid ONLY if confirmed on the canonical chain (operators explicitly accept < K-deep fronting risk and wait K blocks before claiming vault reimbursement), and (d) resume normal operation automatically once the canonical tip stabilizes >= K blocks past h_fork.

5. Mandatory SPV & Authorization Domain Conformance Test Vectors

  1. Stage 0 Header & Merkle Suite: All 24 Bitcoin header, 2,016-block retarget ([302400, 4838400]s), MTP, futureTimeGuardSecs = 7,200, LOWEST_BLOCK_HASH_BE tie-break, CVE-2012-2459, and CVE-2017-12842 (len < 65 rejection, R8-M06) vectors.
  2. 1- and 2-Block Coinbase Midstate Suite: Valid coinbase proofs for BOTH totalCoinbaseBytes % 64 ∈ [0, 55] (1-block) AND totalCoinbaseBytes % 64 ∈ [56, 63] (2-block — e.g. 120 B, 127 B, 250 B), plus rejection of len(finalChunkTail) != totalCoinbaseBytes % 64 and totalCoinbaseBytes <= 64.
  3. Panic-Free & Plasma-Floor Fuzz Gate (B1, B2): Malformed ABI inputs across all 4 Stage 0 oracle methods MUST return deterministic errors (zero panics, zero FIFO sequencer stalls), and exact ABI sizing of ProveTxInclusion (7,620 B, 591,388 Plasma) fits >= 3× inside the 2,100,000 floor and <= 40 contract blocks/Momentum.
  4. Stage 1A Stripped-Block, BIP-141 Completeness & Reorg Suite (R8-C05, R8-M07): Rejection (REFUSED_DATA_UNAVAILABLE) of omitted or wtxid-mismatched witnesses, extraction of the LAST 0x6a24aa21a9ed coinbase output when multiple matching outputs exist, full stripped-vin detection of untagged ExitSlotUTXO/VaultUTXO/Stake_r spends, deterministic skip of wtxid-authenticated malformed 0x02 BATCH_DA, slotted batcher priority, interactive heaviest-chainwork fork rejection, and >= K DEEP_REORG_HALT rewind/replay.

Attack this spec & submit feedback

This is a Public RFC updated to v2 (v3.1.0-rfc) in response to Consolidated Hostile Review R8 (redlining against archived v1 / v3.0.0-rfc). Humans and AI review agents are invited to run python3 -I scripts/verify_spec_bounds.py, inspect the v1 → v2 changelog & redlines, file findings, or open pull requests.