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

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

[changelog]

Part 5: go-zenon Upgrade Plan, Zero-Hard-Fork Custody Boundary & Pre-Mainnet Conformance Gates (G1–G7)

Document Class: Engineering Upgrade & Delivery Blueprint (v2 / v3.1.0-rfc — Zero-Federation Phased Architecture; supersedes archived v1 v3.0.0-rfc and v0 v2.5.0-rfc)
Reference Codebase Verified: Local go-zenon clone is at master (e8986a6, v0.0.10-alphanet) and origin/dev (770e893); Bitcoin node floor pinned to Bitcoin Core >= 29.0 (v31.0 preferred).
Consistency Checker: scripts/verify_spec_bounds.py


1. Architectural Upgrade Principle: Zero go-zenon Custody Authority & Zero Hard Fork for Stage 1A/1B

Unlike archived v0 (which demanded deep go-zenon consensus hard forks — StateRootSpork, CommitteeRootSpork, OptimisticRefereeSpork, ZNN slashing, and single-key governance custody controls), v2 decouples Bitcoin custody completely from go-zenon upgrades and Zenon governance:

Stagego-zenon Changes RequiredZenon Spork / Governance Authority Over BTC Custody
Stage 0 (Verify Bitcoin: SPV Event Oracle + Erlang-Hardened PTLC/LN)Upstream go-zenon mainnet release (Gate G6: 0aa299e, #239/#299/#312 closed, mainnet PTLC PR #138 & DynamicPlasmaSpork w/ 5-param SetPlasmaVariables pinning, lightweight BtcSpvOracleSpork vm/embedded/btcspv).NONE (0 BTC custody in Stage 0). Oracle provides read-only Event Validity only.
Stage 1A (Right-Sized BitVMX n = 8 + Sovereign ZK Rollup)ZERO go-zenon consensus hard fork required! Rollup sequencer/indexer reads standard AccountBlock.Data (UserSend) + Bitcoin L1 (0x00–0x07). Requires Bitcoin Core >= 29.0 (v31.0 preferred) for 0-sat P2A ephemeral dust + 1P1C package relay.ZERO! vk_STF is immutably pinned on Bitcoin L1 at launch. Even total compromise of SporkAddress / CommunitySporkAddress or 100% of Pillars cannot steal 1 satoshi or censor Bitcoin L1 0x01 exits!
Stage 1B (clArk Alternative Gate)ZERO go-zenon consensus hard fork required! Uses open-source Second bark/barkd or Ark Labs arkd + automated watchtowers coordinated alongside Zenon indexing / Stage 0 SPV.ZERO! Custody lives strictly in Bitcoin L1 clArk VTXO trees.
Stage 2 (Scale / BitVM3-GC / Track B Covenants)ZERO go-zenon consensus hard fork required for BTC custody. Optional GovernanceContract / StateRoot remain purely Zenon network UX infrastructure.ZERO! Stage 1 vaults drain 1:1 via 0x01 (subject to 1-of-M operator liveness); identical-STF scaling uses N-of-N voluntary Cohort 1 handover; backend swaps launch clean non-commingled zBTC_v2.

2. Stage 0 go-zenon Prerequisites (Gate G6, B1, B2, Full Dynamic Plasma Pinning, R8-M08)

2.1 Upstream go-zenon Mainnet Readiness Gate (0aa299e, PR #138, #239, #299, #312)

  • Mainnet vs dev Honesty Disclosure (R8-M08): Live go-zenon mainnet currently runs v0.0.10 (master e8986a6, v1 Momentums capped at 100 blocks/Momentum ≈ 8.8–10.0 blocks/s network-wide). DynamicPlasmaSpork (v2) and PtlcSpork (PR #138) are implemented on dev/devnet (origin/dev 770e893) and await mainnet merge and spork activation. Upstream commit 0aa299e (post-VM hash re-verification fix for externally supplied blocks mutated by ValidateSendBlock) is not yet present in the local reference clone.
  • Explicit Open Upstream Issues Blocking Stage 0 Mainnet (Gate G6):
    1. Issue #239 (B1 — Deterministic Failed Receive / FIFO Panic Stall): Embedded receives execute strictly FIFO per contract (verifier/account_block.go:397-417, chain/account/sequencer.go:19-33). On master, a VM panic returns ErrVmRunPanic (vm/supervisor.go:228) and aborts pillar/worker_contract_generator.go:38-40 without advancing the sequencer, permanently stalling the contract. Every embedded method in BtcSpvOracleContract and vm/embedded/btcspv/ MUST wrap execution in defer func() { if r := recover(); r != nil { err = constants.ErrInvalidMethodParam } }(), contain zero calls to common.DealWithErr, and rely on #239's canonical failed-receive closure. (Provenance note: verify #239's final merged commit hash against the tagged mainnet release prior to spork activation.)
    2. Open go-zenon Issues #299 and #312 (R8-M08): Both open upstream issues MUST be resolved and verified in the tagged mainnet release before activating Stage 0 BtcSpvOracleSpork or PtlcSpork (PR #138).
    3. PTLC PR #138 Mainnet Merge & Spork Activation: PtlcSpork (PR #138) MUST be merged, tagged, and activated on mainnet alongside DynamicPlasmaSpork.

2.2 DynamicPlasmaSpork & Full 5-Parameter SetPlasmaVariables Pinning (B2)

DynamicPlasmaSpork (origin/dev:dp/dp.go, origin/dev:vm/plasma.go:172-200) is a hard precondition for Stage 0 BtcSpvOracleSpork because it enables EmbeddedSendBasePlasma (tier + 68/byte past the 4-byte selector) and stale-acknowledgement rejection (origin/dev:chain/acknowledgement_recency.go).

Complete SetPlasmaVariables Lower/Upper Parameter Pinning: In unmodified origin/dev:vm/embedded/definition/plasma.go:66-84, SetPlasmaVariables (controlled by single-key SporkAddress / CommunitySporkAddress at origin/dev:vm/embedded/implementation/plasma.go:199) permits MaxBasePlasmaInMomentumLowerLimit = 210,000 (L66) and FusedPlasmaTargetLowerLimit = 1, PowPlasmaTargetLowerLimit = 1, PriceChangeDenominatorLowerLimit = 1 (allowing a >100,000× 10-minute price spike from a single tx!). Therefore BtcSpvOracleSpork MUST enforce ALL FIVE guardrails simultaneously:

Parameter (vm/embedded/definition/plasma.go)Unmodified origin/dev BoundNormative Stage 0 Spork Floor / CeilingWhy Required
MaxBasePlasmaInMomentum>= 210,000 (L66)>= 2,100,000Guarantees >= 3 max ProveTxInclusion calls (591,388 Plasma) and dp.MaxContractBlocks >= 40 (dp/dp.go:259-264).
MaxPriceChangePercent<= 100 (L75)<= 25 (default 10)Caps per-Momentum adaptive step size.
FusedPlasmaTarget>= 1 (L69)>= 525,000 (>= 25% of 2.1M floor)Closes target = 1 exponential fused-Plasma price-spike DoS.
PowPlasmaTarget>= 1 (L72)>= 525,000 (>= 25% of 2.1M floor)Closes target = 1 exponential PoW-Plasma price-spike DoS.
PriceChangeDenominator>= 1 (L84)>= 8Damps step amplification even under sustained 100% utilization.

Honest Residual Dynamic Plasma Disclosure: origin/dev:dp/dp.go:102-151 intentionally has no absolute upper clamp on NextFusionPrice/NextWorkPrice, and fused QSR is refundable (zero burn). Even with all five bounds pinned, a well-funded QSR whale + 49% malicious Pillars can still drive Zenon Plasma prices up exponentially over tens of minutes (1.10^72 ≈ 955× at default +10%/Momentum). This is explicitly safe for Stage 1A custody because Bob and Mike can always submit 0x01 FORCED_EXIT / 0x03 FORCED_TRANSFER directly on Bitcoin L1, completely bypassing Zenon Plasma!

2.3 Stage 0 SPV Event Oracle & Non-Custodial Swaps (BtcSpvOracleSpork + PtlcSpork)

  1. Activate PtlcSpork (PR #138), EmbeddedRefundSpork, Libp2pSpork, and EpochRewardTermsSpork (implemented on origin/dev:common/types/spork.go).
  2. Deploy lightweight BtcSpvOracleContract (vm/embedded/btcspv/: header.go, tx.go with len(strippedTx) >= 65 and 1-/2-block coinbase midstate verification, oracle.go — zero custody, minting, or federation code!).
  3. Add local RPC/indexer helpers (DeleteMomentum WebSocket momentumsReverted push + HTLC/PTLC getByDestination/getByPointLock/getByHashLock) plus automated block-72 high-fee RBF PTLC refund watchtower software (R8-H07).
  4. (Recommended Non-Custodial Zenon Hygiene, Non-Blocking for BTC Custody): Replace single-key SporkAddress / CommunitySporkAddress (vm/embedded/implementation/spork.go:46-49, 117-119, which can currently terminate all nodes via os.Exit(2) after SporkMinHeightDelay = 6 Momentums at chain/momentum_pool.go:53-68) with a timelocked GovernanceContract. Even if un-upgraded, SporkAddress compromise has 0 custody power over Stage 1A/1B BTC!

3. Stage 1A / 1B Off-Chain Software Stack (Piggybacking on Open-Source Ecosystems, R8-H05)

A small young engineering team (4–6 engineers) MUST NOT write custom Bitcoin Script Groth16 compilers or custom BitVM3 garbled-circuit frameworks from scratch. Both Stage 1 paths piggyback directly on audited/open-source Bitcoin stacks:

  • Stage 1A (BitVMX n = 8 Sovereign Rollup Stack — Primary Path for Pooled Fungible zBTC):
    1. Off-Chain ZK Prover (zbtc-prover): Executes the full deterministic Rollup STF $\mathcal{F}$ (stripped-block scanning <= 1 MB, fail-closed BIP-141 witness authentication on last 0x6a24aa21a9ed coinbase output, full stripped-vin tracked-UTXO scanning, SMT conservation V_unassigned + V_assigned = C + L + E + R + A + B, $2^M$ Hall's Marriage check, interactive heaviest-chainwork comparison) off-chain and produces a constant-size wrapped SNARK proof (vk_STF).
    2. Reuse BitVMX FORCE / Fairgate Open-Source Core (RV32IM Wrapped-SNARK Verifier Only — R8-H05): BitVMX-CPU (RV32IM) executes strictly the constant-size vk_STF wrapped SNARK verifier (<= 0.5 × 8^9 steps, Gate G2 — NEVER bare 1 MB SHA-256 block scanning!) + BitVMX-protocol (pre-signed n = 8 TRUC v3 bisection graph & W-OTS commitment engine targeting Bitcoin Core >= 29.0, v31.0 preferred).
    3. Operational Daemons:
      • zbtc-sequencer / zbtc-batcher (reads Zenon AccountBlock.Data, enforces 500-sat new-leaf deposit + <= 1,000/epoch cap + slotted batcher priority, posts 0x02 BATCH_DA).
      • Operator fronting & StakeChain daemon (M = 3–5, manages AdmissionTicketUTXOs, ExitSlotUTXO fronting, TransferCredit, direct-to-miner submission rails, and >= 144-blk rollback snapshots for DEEP_REORG_HALT).
      • N = 7 Verifier watchtower daemon (monitors RoundTx_r, opens simultaneous ChallengeTx_{r,i} + ChalProofConnector_{r,i} in [0, 144], replicates & audits zbtc-vault-bundle-v1 across >= 3 public mirrors, maintains direct-to-miner P2A CPFP rails).
  • Stage 1B (clArk Alternative Gate Stack):
    • Fork/integrate mainnet-live Second bark/barkd or Ark Labs arkd (2–5 BTC active ASP liquidity) + automated VTXO refresh watchtowers + lightweight Zenon coordination/SPV client (~3–6 months).

4. Concrete 3-Stage Delivery Roadmap & Capital Gates (R8-M09, R8-H08)

StageTimeline (4–6 Engineers)Full Hard BTC Capital RequiredDeliverables & Security MilestoneExit / Migration Guarantee
Stage 0: Verify Bitcoin Foundation (Mandatory Start)0–6 months0 BTC bonds (0–5 BTC voluntary LP)Gate G6 (0aa299e, #239/#299/#312, mainnet PR #138 & DynamicPlasmaSpork 5-param pin) + Stage 0 BtcSpvOracleContract (len >= 65, 1-/2-block midstate) + Erlang-hardened PTLC (>= 48h, block-72 RBF watchtower) / LN HTLC (>= 24h) swaps. Parallel Signet prototype of vk_STF on BitVMX-CPU & BitVM3-GC evaluation (Gate G2).Zero custody risk; users hold native BTC on L1/LN at all times.
Stage 1 Decision GateMonth 6 GateGate CheckChoose Stage 1A ONLY if pooled fungible non-expiring zBTC is non-negotiable AND >= 14.75–21.25 BTC single-dispute operational hard BTC (12.80–18.80 locked + reserves, plus multi-dispute headroom) is committed for 12–18+ months (incl. audit). Otherwise choose Stage 1B (clArk) (2–5 BTC active liquidity, 3–6 mo launch) — NEVER under-bond BitVMX/BitVM2!Explicit upfront commitment; zero hidden federation fallback.
Stage 1A: Right-Sized BitVMX (n = 8, M = 3–5, N = 7) Sovereign Rollup12–18+ months (incl. Gates G1–G5 & M-15 external audit)Locked: 12.80 (M=3) / 18.80 BTC (M=5); Op Baseline: 14.75 / 21.25 BTC (~17–26+ multi-dispute)Mainnet Core >= 29.0 TRUC v3 vaults ({0.50, 0.25, 0.25}, acyclic vault_id, AdmissionTicketUTXO, $2^M$ Hall, V=C+L+E+R+A+B, native-L1 Stake_r verifier payouts +0.0645/+0.0232 BTC EV @ 500/750 sat/vB), graduated TVL ramps (2 → 5 → 10/15 BTC).Non-expiring deleted-key vaults redeemable 1:1 via 0x01 subject to 1-of-M operator liveness (plus voluntary unwind circuit breaker, spec/01 §6.3).
*Stage 1B (Alt): clArk + Zenon SPV/PTLC*3–6 months2–5 BTC active ASP liquidity (0 bonds)Mainnet bark/arkd VTXO rounds + automated watchtowers + Zenon coordination. Pure 0-of-N post-round unilateral exit; explicit UX separation of trustless in-round VTXOs vs arkoor balances.Users hold self-custodial pre-signed L1 exit branches at all times.
Stage 2: Zero-TTP Scale & Upgrade12+ months post-Stage 1Scales with TVL (K = 42 → 50 BTC; K = 144 → 200 BTC)(a) Identical-STF scaling (M = 5 → 20, L = 1 → 4) via voluntary N-of-N Cohort 1 handover; (b) Backend upgrade to mature reusable BitVM3-GC, BitVM2, or Track B Pure Tier-0 Covenants (OP_CCV + OP_TXHASH + OP_VERIFY_STARK / OP_CAT) via clean non-commingled zBTC_v2.Zero dead-end migration: Stage 1 vaults drain organically 1:1 via 0x01 exits (zero deleted-key L1 rollover magic!).

5. Mandatory Pre-Mainnet Conformance Gates (G1–G7, Closing R8 §22 & M-15)

Mainnet deployment of Stage 0 or Stage 1A MUST remain blocked until every applicable gate below publishes publicly reproducible verification artifacts:

  1. Gate G1 — Bitcoin Core v29.0+ (v31.0 Preferred) regtest & signet End-to-End Graph Execution: Execute consensus-valid serialized DepositTx (acyclic vault_id + AdmissionTicketUTXO consumption), active-operator ExitSlotUTXO (fronting, cyclic priority, k = 20 grief burst, EXIT_CANCEL), RoundTx_r, full 20-step n = 8 bisection with 153 vB 0-sat P2A 1P1C package relay, sibling-eviction stress + direct-to-miner rails, TakeTx (<= 3,200 vB recycling AdmissionTicketUTXO), DisproveTx_{r,i} + ChalPayoutEscrow native-L1 payouts, and BurnBondTx_{r,k} on live Bitcoin Core >= 29.0 regtest and signet with zero policy or consensus rejections.
  2. Gate G2 — Compiled RV32IM Wrapped-SNARK Verifier Trace Proof (or Reusable BitVM3-GC Evaluation): Publish reproducible Rust → RV32IM source and compiled ELF binary of the exact disputed vk_STF wrapped SNARK verifier guest, executing worst-case adversarial inputs and proving init_steps + exec_steps <= 0.5 × 8^9 = 67,108,864 (if exceeded, bump l = 10 or benchmark mature reusable BitVM3-GC + Clementine before code freeze).
  3. Gate G3 — Independent Execution of Extended Consistency & Bounds Checker: Run python3 -I scripts/verify_spec_bounds.py (recording exact Git commit, public/raw/SHA256SUMS.txt, Python version, stdout, and exit code 0) verifying all Stage 0 Erlang tails, Stage 1A acyclic Lamport/TRUC v3/native-L1 EV/$2^M$ Hall/Budish/DA bounds, and >= 2,000 (and CI >= 100,000-step nightly) randomized transitions exercising V_unassigned + V_assigned == C + L + E + R + A + B.
  4. Gate G4 — vk_STF Formal Verification & Bitcoin Core Differential Consensus Fuzzing (R8-H08): Formally verify V_unassigned + V_assigned == C + L + E + R + A + B, the $2^M$ Hall's Marriage Invariant, fail-closed BIP-141 witness completeness (last 0x6a24aa21a9ed coinbase output), and full stripped-vin tracking inside the ZK constraint system, AND differentially fuzz the Bitcoin parser against Bitcoin Core's tx_valid/tx_invalid, CVE-2012-2459, and CVE-2017-12842 suites alongside an independent third-party audit (M-15).
  5. Gate G5 — Public zbtc-vault-bundle-v1 Archival Disaster-Recovery Drill (R8-H06): Destroy all private operator and presigner databases on Signet and prove 100% recovery of both honest TakeTx reimbursements and DisproveTx/BurnBondTx fraud-proof slashing strictly from >= 3 public zbtc-vault-bundle-v1 mirrors plus Bitcoin headers.
  6. Gate G6 — go-zenon Mainnet Readiness, Panic/FIFO Fuzz & Stage 0 PTLC Suite (R8-M08, B1, B2, R8-H07): Confirm mainnet merge, tag, and spork activation of 0aa299e, PTLC PR #138 (PtlcSpork), DynamicPlasmaSpork (with MUST-fail tests verifying all 5 SetPlasmaVariables bounds), Stage 0 BtcSpvOracleContract (zero-panic FIFO fuzz gate, len(strippedTx) >= 65, 1-/2-block coinbase midstate vectors), closure of open go-zenon issues #239, #299, and #312, and Signet↔Zenon PTLC/LN adversarial tests (T_znn >= 48h, Δ_safety_sec >= 24h, automated block-72 RBF watchtower, hashType = 1, LN Hold Invoice 5-min cancel TTL).
  7. Gate G7 — Local Repository Audit Trail & Release Integrity Pinning (R8-L02): Verify every v2 normative file against generated public/raw/SHA256SUMS.txt and frozen versions/v1/SHA256SUMS.txt & versions/v0/SHA256SUMS.txt in CI, keeping CHANGELOG.md synchronized with every R1–R8 disposition.

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.