v1 (v3.0.0-rfc) · archived baseline · superseded
Part 5: go-zenon Upgrade Plan, Zero-Hard-Fork Custody Boundary & 3-Stage Delivery Roadmap
Showing word-highlighted redline changes from archived v0 (v2.5.0-rfc) to v1 (v3.0.0-rfc). For structured finding-by-finding rationale, see theChangelog.
| @@ -1,122 +1,95 @@ | |||
| 1 | - | # Part 5: Detailed `go-zenon` Node Upgrade Specification | |
| 1 | + | # Part 5: `go-zenon` Upgrade Plan, Zero-Hard-Fork Custody Boundary & 3-Stage Delivery Roadmap | |
| 2 | 2 | ||
| 3 | - | **Document Class:** Engineering Upgrade Blueprint (`v2.5.0-rfc`) | |
| 4 | - | **Inspected Ground-Truth Branches in [`go-zenon`](https://github.com/zenon-network/go-zenon):** | |
| 5 | - | - `origin/release/0.0.11-rc1`: `f19955f3d28a35868b0488fd7010073241561a7f` *(Normative U0 release baseline)* | |
| 6 | - | - `origin/dev`: `770e893a0aa78240685043c1d396c65caa1a6635` *(All `dev:` file & line citations below verified directly against `770e893` / `f19955f`)* | |
| 7 | - | - `master`: `e8986a63f164259053e0342ceaf9a68cb85d649e` (`v0.0.10-alphanet`, legacy reference only) | |
| 3 | + | **Document Class:** Engineering Upgrade & Delivery Blueprint (`v1` / `v3.0.0-rfc` — Zero-Federation Phased Architecture; supersedes archived `v0` `v2.5.0-rfc`) | |
| 4 | + | **Reference Codebase Verified:** Local `go-zenon` clone is at `master` (`e8986a6`, `v0.0.10-alphanet`) and `origin/dev` (`770e893`). | |
| 5 | + | **Consistency Checker:** [`scripts/verify_spec_bounds.py`](../scripts/verify_spec_bounds.py) | |
| 8 | 6 | ||
| 9 | 7 | --- | |
| 10 | 8 | ||
| 11 | - | ## 1. Baseline Delta Matrix (`master` vs `release/0.0.11-rc1` / `dev` vs Upgrades) | |
| 12 | - | ||
| 13 | - | | Capability | `master` (`e8986a6`) | `release/0.0.11-rc1` (`f19955f`) & `dev` (`770e893`) | Phase | | |
| 14 | - | |---|---|---|---| | |
| 15 | - | | `AcceleratorSpork`, `HtlcSpork`, `BridgeAndLiquiditySpork` | Active | Active | Live | | |
| 16 | - | | `PtlcSpork` (`e59f1e97...`), `DynamicPlasmaSpork` (v2 + `EmbeddedSendBasePlasma` at `dev:vm/plasma.go:192`), `EmbeddedRefundSpork`, `Libp2pSpork`, `EpochRewardTermsSpork`, composable `embeddedVariants` (`dev:vm/embedded/embedded.go:246`) | Missing (16 KiB embedded bypass) | Implemented | **Phase U0** | | |
| 17 | - | | `StateRootSpork` (v3, `common/trie/smtcore` + `proof-format.md` V1, `chain/state_tree.go`) | Missing | Missing | **Phase U1** | | |
| 18 | - | | `CommitteeRootSpork` (v4: 30-day BLS12-381 `min-sig` `FinalityCommitteeRoot` w/ distinct POP DSTs & depth-5 SHA-256 tree, `ContentRoot`, U2 finality gadget, `pillars.go` `RegisterFinalityKey`+PoP, `RequestExitCommittee`, historical-root full-preimage `SubmitInvalidCertProof` + `SubmitEquivocationProof`, `72d` post-service stake lock, `A-PILLAR-1`) | Missing | Missing | **Phase U2** | | |
| 19 | - | | `OffchainExecutionSpork` & `MintedZbtcSpork` (`SettlementContract`, `TokenContract.IssueMinted` → single-use `ReceiveTreasury()`, monotonic `batchId` + `domainInputSeq`, latency- & reservation-aware `G-21`, multi-gen `VaultUtxoSet`, aligned state machine + `RepointTrappedPegOut` + `ResetFailedReimbursementSlot` + `SlotBondZnn` + `SyncPendingTrapVault` + `SyncRetiredLane` + `SyncVaultGraphEpoch`, `ChallengeDepositZnn` priority lane) | Missing | Missing | **Phase U3** | | |
| 20 | - | | `OptimisticRefereeSpork` (panic-free `vm/embedded/btcspv/` 17 tags incl. decoupled `0x06`, full-status SMT absence/inclusion `0x08`, strict multi-gen `0x0D` incl. `RELEASED`, `0x10`, bounded Multi-Tx Sessions + ancestor refunds, commit-reveal, streaming SHA-256 verifier) | Missing | Missing | **Phase U4** | | |
| 21 | - | | `GovernanceContract` + `MultisigContract` (**HARD GATE before Stage 1B**), `DeleteMomentum` WS reorg push (`dev:rpc/api/subscribe/api.go:357`), HTLC/PTLC indexes, optional `BtcAnchorSpork` | Missing | Missing | **Phase U5** | | |
| 22 | - | ||
| 23 | - | --- | |
| 9 | + | ## 1. Architectural Upgrade Principle: Zero `go-zenon` Custody Authority & Zero Hard Fork for Stage 1A/1B | |
| 24 | 10 | ||
| 25 | - | ## 2. Phase U0 — Release `release/0.0.11-rc1` (`f19955f`) Prerequisites | |
| 11 | + | Unlike archived `v0` (which demanded deep `go-zenon` consensus hard forks — `StateRootSpork`, `CommitteeRootSpork`, `OptimisticRefereeSpork`, ZNN slashing, and single-key governance custody controls), **`v1` decouples Bitcoin custody completely from `go-zenon` upgrades and Zenon governance**: | |
| 26 | 12 | ||
| 27 | - | 1. Ship `origin/release/0.0.11-rc1` (`f19955f`) / `origin/dev` (`770e893`) to mainnet. | |
| 28 | - | 2. Calibrate `PlasmaVariables` (`dp/dp.go`, `PlasmaContract.SetVariables`) to prevent multi-month decay lockup and 2-heavy-tx saturation. | |
| 29 | - | 3. Verify `PtlcSpork` (`e59f1e97...`) on-chain status; activate `DynamicPlasmaSpork`, `EmbeddedRefundSpork`, `Libp2pSpork`, `EpochRewardTermsSpork`. | |
| 13 | + | | Stage | `go-zenon` Changes Required | Zenon Spork / Governance Authority Over BTC Custody | | |
| 14 | + | |---|---|---| | |
| 15 | + | | **Stage 0 (`Verify Bitcoin`: SPV Event Oracle + Non-Custodial PTLC/LN)** | Upstream `go-zenon` U0 release (`0aa299e` + `#239` closed) + `DynamicPlasmaSpork` (w/ 5-parameter variable bounds) + `PtlcSpork` + lightweight `BtcSpvOracleSpork` (`vm/embedded/btcspv`). | **NONE (`0 BTC` custody in Stage 0).** Oracle provides read-only Event Validity only. | | |
| 16 | + | | **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`). | **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! | | |
| 17 | + | | **Stage 1B (`clArk` Alternative Gate)** | **ZERO `go-zenon` consensus hard fork required!** Uses open-source `Second bark/barkd` or `Ark Labs arkd` coordinated alongside Zenon indexing / Stage 0 SPV. | **ZERO!** Custody lives strictly in Bitcoin L1 `clArk` VTXO trees. | | |
| 18 | + | | **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`; identical-STF scaling uses `N`-of-`N` voluntary Cohort 1 handover; backend swaps launch clean non-commingled `zBTC_v2`. | | |
| 30 | 19 | ||
| 31 | 20 | --- | |
| 32 | 21 | ||
| 33 | - | ## 3. Phase U1 — `StateRootSpork` (Momentum Version 3 & `common/trie/smtcore`) | |
| 34 | - | ||
| 35 | - | - **`common/trie/smtcore/`** (shared frozen core for L1 & `d_btc_asset`): `hash.go`, `compute.go`, `proof.go` implementing **`proof-format.md` V1 byte-exact** (`flags || key || leaf_hash || deepest-first bitmap || sib_count || siblings [|| value_len || value]`, `VerifyProofByPath`, `VerifyAbsenceByPath`). | |
| 36 | - | - **`common/trie/`** (L1 Momentum adapter): `FoldFilter` (excludes `{0}/{1}/{2}`), empty-value-as-deletion convention, LevelDB `NodeTree`. | |
| 37 | - | - **`chain/state_tree.go`**: `InitStateTree`, `UpdateStateTree`, `TruncateStateTreeTo`, `17,380`-momentum retention (`StateTreeArchive: true` disables pruning). | |
| 38 | - | - **`chain/nom/protobuf.proto` & `momentum.go`**: Tag `14` (`types.HashProto stateRoot = 14`), `StateRootMomentumVersion = 3`, `rlp:"optional"`, appended in `ComputeHash()` iff `Version >= 3`. | |
| 39 | - | - **`verifier/momentum.go` & `pillar/worker_momentum.go`**: Stamp/verify `StateRoot` (`ErrMStateRootInvalid`, `ErrMStateRootMustBeZero`). | |
| 40 | - | - **`rpc/api/ledger.go`**: `ledger.getStateRoot(height)`, `ledger.getProof(height, key)`. | |
| 41 | - | ||
| 42 | - | --- | |
| 22 | + | ## 2. Stage 0 `go-zenon` Prerequisites (`U0` Gate, `B1`, `B2`, Full Dynamic Plasma Pinning) | |
| 43 | 23 | ||
| 44 | - | ## 4. Phase U2 — `CommitteeRootSpork` (Momentum v4, 30-Day BLS12-381 Finality, Full-Preimage Slashing & `72`-Day Lock) | |
| 24 | + | ### 2.1 Upstream `go-zenon` Release Gate (`0aa299e` & Issue `#239`) | |
| 45 | 25 | ||
| 46 | - | 1. **`chain/nom/protobuf.proto` & `momentum.go`**: | |
| 47 | - | - Tag `15`: `types.HashProto finalityCommitteeRoot = 15;` (immutable per 30-day finality epoch) | |
| 48 | - | - Tag `16`: `types.HashProto contentRoot = 16;` (domain-separated Merkle root of `MomentumContent`) | |
| 49 | - | - `CommitteeRootMomentumVersion = 4`; both `rlp:"optional"`, appended in `ComputeHash()` iff `Version >= 4`. | |
| 50 | - | 2. **`consensus/finality_committee.go` (NEW)**: | |
| 51 | - | - Derived from `dev:consensus/consensus.go:45,86`: `finalityEpochIndex = consensusEpoch / 30` (`finalityEpochStartTs(E) = genesis.TimestampUnix + E * 30 * 86400`). | |
| 52 | - | - At exact transition Momentum `h_trans(E)`, snapshots top `30` active BLS12-381-registered Pillars (excluding `ExitCommitteeRequested == true`) by `(totalDelegatedZnn desc, producerAddress asc)`, records `LastFinalityCommitteeEpoch = E`, and defines canonical `nextFinalityCommitteeRoot(h)` at EVERY height `h` ([`spec/04 §3.2`](./04-bitcoin-anchoring-and-light-client.md#L69-L74)). | |
| 53 | - | 3. **`consensus/finality_cert.go` (NEW), BLS12-381 `min-sig`, Finality Gadget & `/zenon/finality/v1` topic**: | |
| 54 | - | - Fixed `204 B` BLS12-381 `min-sig` `FinalityCertificate` (`48 B` G1 agg sig + `4 B` bitfield for up to all 30 signers), signed ONLY at depth `>= 6` Momentums every `30` Momentums and at `h_trans(E)`. | |
| 55 | - | - **Finality Gadget (`chain/momentum_pool.go` & `chain/account_pool.go`)**: Refuse `DeleteMomentum` / fork switch across any Momentum backed by a valid dual-supermajority `FinalityCertificate`. | |
| 56 | - | 4. **Full-Preimage Slashing, BLS Key Registration & `72`-Day Lock (`dev:vm/embedded/{definition,implementation}/pillars.go`, `A-PILLAR-1`)**: | |
| 57 | - | - **`RegisterFinalityKey(blsPubKey96, popSig48)`**: Verifies BLS12-381 Proof-of-Possession (distinct IETF POP DST — `R6-L7`) before allowing finality committee eligibility. | |
| 58 | - | - **`RequestExitCommittee()`**: Opts Pillar out of future 30-day finality snapshots. | |
| 59 | - | - **`SubmitEquivocationProof(certA, certB)`**: Slashes conflicting signatures for same `(finalityEpochIndex, height)`. | |
| 60 | - | - **`SubmitInvalidCertProof(cert)` (`R6-H1`)**: Looks up historical Tag-15 committee matching **`cert.FinalityCommitteeRoot`**, verifies valid dual-supermajority BLS12-381 signature under THAT historical committee (NOT merely `canonicalSigningCommitteeRoot(cert.Height)`!), and checks **ALL 7 certificate fields** in Case A (`finalityEpochIndex`, `height`, `timestampUnix`, `momentumHash`, `stateRoot`, `finalityCommitteeRoot`, `nextFinalityCommitteeRoot` — slashing committee-`E` forged handoffs at `h_trans(E+1)+1` AND targets in epoch `E+1`!) plus Case B (`cert.Height > frontier.Height + 60`). Forfeits 100% of `15,000 ZNN` (`dev:vm/constants/embedded.go:108`), revokes Pillar, triggers Settlement pause. | |
| 61 | - | - **`72`-Day Post-Service Lock & Clean Exit**: Modifies `PillarContract.Revoke` (`dev:vm/embedded/implementation/pillars.go:132-138,395-400`) to hold `PillarStakeAmount` until `now >= finalityEpochEndTs(LastFinalityCommitteeEpoch) + 72 days`; once `ExitCommitteeRequested == true` and `72d` elapses, allows immediate withdrawal without waiting another `% 90d` cycle! | |
| 62 | - | 5. **`rpc/api/ledger.go`**: `ledger.getFinalityCommittee(finalityEpochIndex)`, `ledger.getFinalityCertificate(height)`, `ledger.getContentProof(height, accountBlockHash)`. | |
| 26 | + | - **Local Clone Honesty Disclosure:** As verified directly against the local `go-zenon` reference clone, `HEAD` (`master`) is `e8986a6` (`v0.0.10-alphanet`) and `origin/dev` is `770e893`. Upstream commit **`0aa299e`** (*post-VM hash re-verification fix for externally supplied blocks mutated by `ValidateSendBlock`*) is **not yet present in this local clone** and remains a hard upstream release prerequisite before activating Stage 0 sporks on mainnet. | |
| 27 | + | - **Close Upstream Issue `#239` (`B1` Blocking Gate for Stage 0 SPV Oracle):** | |
| 28 | + | - 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. | |
| 29 | + | - **Normative Gate:** 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 deterministic failure provenance so bounded receive retries ALWAYS terminate in a canonical failed receive (never a FIFO stall). | |
| 63 | 30 | ||
| 64 | - | --- | |
| 31 | + | ### 2.2 `DynamicPlasmaSpork` & Full 5-Parameter `SetPlasmaVariables` Pinning (`B2`) | |
| 65 | 32 | ||
| 66 | - | ## 5. Phase U3 — `OffchainExecutionSpork` & `MintedZbtcSpork` (`SettlementContract` & Treasury `zBTC`) | |
| 33 | + | `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`). | |
| 67 | 34 | ||
| 68 | - | ### 5.1 Embedded Address, Sporks & Registry | |
| 35 | + | **Complete `SetPlasmaVariables` Lower/Upper Parameter Pinning:** | |
| 36 | + | 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: | |
| 37 | + | - `MaxBasePlasmaInMomentumLowerLimit = 210,000` (`L66`, blocking every SPV call `> 2,011 B` in `pillar/content_selector.go:328`), AND | |
| 38 | + | - `FusedPlasmaTargetLowerLimit = 1` (`L69`), `PowPlasmaTargetLowerLimit = 1` (`L72`), `PriceChangeDenominatorLowerLimit = 1` (`L84`). Setting `target = 1` and `denom = 1` allows a single transaction to trigger the maximum per-Momentum price jump (`1.25^52 > 100,000×` in ~10 minutes!). | |
| 69 | 39 | ||
| 70 | - | - **`common/types/address.go`**: Add `SettlementContract = parseEmbedded("z1qxemdeddedxsettlementxxxxxxxxxxx<checksum>")` to `EmbeddedContracts`. | |
| 71 | - | - **`common/types/spork.go`**: Add `OffchainExecutionSpork` (`...000A`) and `MintedZbtcSpork` (`...000B`). | |
| 72 | - | - **`vm/embedded/embedded.go`**: Add spork bits at `dev:vm/embedded/embedded.go:246` wiring `SettlementContract` and `TokenContract.IssueMinted`. | |
| 40 | + | Therefore, `BtcSpvOracleSpork` MUST enforce **ALL FIVE** `SetPlasmaVariables` guardrails simultaneously: | |
| 73 | 41 | ||
| 74 | - | ### 5.2 Exact `TokenContract` Modifications (`dev` Ground Truth) | |
| 42 | + | | Parameter (`vm/embedded/definition/plasma.go`) | Unmodified `origin/dev` Bound | Normative Stage 0 Spork Floor / Ceiling | Why Required | | |
| 43 | + | |---|---|---|---| | |
| 44 | + | | `MaxBasePlasmaInMomentum` | `>= 210,000` (`L66`) | **`>= 2,100,000`** | Guarantees `>= 3` max `ProveTxInclusion` calls (`591,388` Plasma) and `dp.MaxContractBlocks >= 40` (`dp/dp.go:259-264`). | | |
| 45 | + | | `MaxPriceChangePercent` | `<= 100` (`L75`) | **`<= 25`** (default `10`) | Caps per-Momentum adaptive step size. | | |
| 46 | + | | `FusedPlasmaTarget` | `>= 1` (`L69`) | **`>= 525,000`** (`>= 25%` of `2.1M` floor) | Closes `target = 1` exponential fused-Plasma price-spike DoS. | | |
| 47 | + | | `PowPlasmaTarget` | `>= 1` (`L72`) | **`>= 525,000`** (`>= 25%` of `2.1M` floor) | Closes `target = 1` exponential PoW-Plasma price-spike DoS. | | |
| 48 | + | | `PriceChangeDenominator` | `>= 1` (`L84`) | **`>= 8`** | Damps step amplification even under sustained `100%` utilization. | | |
| 75 | 49 | ||
| 76 | - | 1. **`TokenContract.IssueMinted(name, symbol, domain, decimals, maxSupply)`**: | |
| 77 | - | - Guard: `if sendBlock.Address != types.SettlementContract { return nil, constants.ErrPermissionDenied }`. | |
| 78 | - | - Exempts `checkToken` regexes (`dev:vm/embedded/implementation/token.go:40,43`), requires `1 ZNN` fee, sets `TotalSupply = MaxSupply = 21M*10^8`, `IsMintable = false`, `IsBurnable = false`, `Owner = types.SettlementContract`. | |
| 79 | - | - Descendant `ContractSend` carrying `21M*10^8 zBTC` packs **`Data = ABISettlement.PackMethod("ReceiveTreasury")`** (`dev:vm/vm.go:204-226`). | |
| 80 | - | 2. **Sealing `TokenContract.Burn` (`dev:vm/embedded/implementation/token.go:330`) AND `TokenContract.UpdateToken`**: | |
| 81 | - | - Both reject if `context.IsMintedZbtcSporkEnforced() && tokenInfo.Owner == types.SettlementContract`. | |
| 50 | + | > **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! | |
| 82 | 51 | ||
| 83 | - | ### 5.3 `SettlementContract` Files & `ChallengeDepositZnn` Priority Lane | |
| 52 | + | ### 2.3 Stage 0 SPV Event Oracle & Non-Custodial Swaps (`BtcSpvOracleSpork` + `PtlcSpork`) | |
| 84 | 53 | ||
| 85 | - | - `vm/embedded/definition/settlement.go`: ABI (`ABISettlement`, including `ReceiveTreasury()`, `ClaimInputDepositRefund()`, `DispatchDeferredLock()`, `ClaimFrontingSlot()`, `SlashLapsedSlot()`, `ClaimReimbursementSlot()`, `ResetFailedReimbursementSlot()`, `RepointTrappedPegOut()`, `RegisterOperatorRound()`, `SyncRetiredLane()`, `SlashOperatorBond()`, `SyncPendingTrapVault()`, `SyncRecoveredVaultOutpoint()`, `SyncVaultGraphEpoch()`, `QuarantineExpiredVault()`, `SyncOrphanedVaultOutpoint()`, `CommitChallenge()`, `ExpireChallengeCommit()`, `OpenChallenge()`, `UploadWitnessProof()`, `ExecuteChallenge()`, `ExpireChallengeSession()`, `RefundRejectedBatchChallenge()`, `ChallengeStep()`, `ChallengeContinuity()`), storage prefixes `0x01`–`0x17` ([`spec/03 §2.1`](./03-settlement-minted-zbtc-and-feeless-rails.md#L30-L56)), canonical binary codecs (`StepTraceLeaf` `328 B`, `BatchCommitmentV3`). | |
| 86 | - | - `vm/embedded/implementation/settlement_core.go`: `RegisterDomain`, `SubmitInput` (ALWAYS open, contiguous `domainInputSeq`), `SubmitBatch` (monotonic `batchId`, `parentBatchId`, `PreStateRoot` chaining, `finalLeaf`, per-executor + aggregate caps, dispatch-only `dispatchFrozenByBatch`), `FinalizeBatch` (Shadow Mode active, freezing batch exempt, session/commit guard, exposure release), `ClaimInputDepositRefund` (`<= 16` global duplicates/batch). | |
| 87 | - | - `vm/embedded/implementation/settlement_minted.go`: `InitiateMintedToken`, single-use `ReceiveTreasury`, `BindMintedAsset` (`GOVERNANCE_ADD_BINDING`), `RequestPegOut` (open during `DRAINING_*`, `+3.0d` latency-aware per-epoch eligibility), anti-censorship `ClaimFrontingSlot` (`500 ZNN` `SlotBondZnn`, reservation, no consecutive re-claim, single-authority expiry), `SlashLapsedSlot`, `RegisterOperatorRound` (`OperatorBond >= 31,500 ZNN`, `epoch < 4096`, exact `anchorExpiryTs == finalityEpochStartTs(epoch) + 58d`, `CommSig`), `SyncRetiredLane`, `ClaimReimbursementSlot`, `ResetFailedReimbursementSlot`, `RepointTrappedPegOut`, `SlashOperatorBond`, `SyncPendingTrapVault`, `SyncRecoveredVaultOutpoint`, `SyncVaultGraphEpoch` (`unrotatedVaultCount--` iff `UNROTATED`), `QuarantineExpiredVault` (`day >= T_cutoff + 60h`, `UNASSIGNED`/`ASSIGNED`), deterministic `SyncOrphanedVaultOutpoint`, closed handlers (`MINTED_LOCK_V1` latency-aware `G-21`, `MINTED_RELEASE_V1` keying strictly on domain `operatorId`, `MINTED_REFUND_V1`). | |
| 88 | - | - **`chain/account_pool.go` Priority Lane**: Reserve `10` of `100` Momentum slots ordered by `ChallengeDepositZnn` descending; paired with 48h (`+12h` session) window. | |
| 54 | + | 1. Activate **`PtlcSpork`**, **`EmbeddedRefundSpork`**, **`Libp2pSpork`**, and **`EpochRewardTermsSpork`** (all implemented on `origin/dev:common/types/spork.go`). | |
| 55 | + | 2. Deploy lightweight **`BtcSpvOracleContract`** (`vm/embedded/btcspv/`: `header.go`, `tx.go` with 1-/2-block coinbase midstate verification, `oracle.go` — **zero** custody, minting, or federation code!). | |
| 56 | + | 3. Add local RPC/indexer helpers (`DeleteMomentum` WebSocket `momentumsReverted` push + HTLC/PTLC `getByDestination`/`getByPointLock`/`getByHashLock`) for wallets and Stage 0 swap LPs. | |
| 57 | + | 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!** | |
| 89 | 58 | ||
| 90 | 59 | --- | |
| 91 | 60 | ||
| 92 | - | ## 6. Phase U4 — `OptimisticRefereeSpork` (`vm/embedded/btcspv/` & Bounded Multi-Tx Sessions) | |
| 61 | + | ## 3. Stage 1A / 1B Off-Chain Software Stack (Piggybacking on Open-Source Ecosystems) | |
| 93 | 62 | ||
| 94 | - | - **`vm/embedded/btcspv/`** (pure Go, zero `common.DealWithErr` panics, imports `dev:go.mod:7` `btcec/v2` + `btcec/v2/schnorr` and `common/trie/smtcore`): | |
| 95 | - | - `header.go` (`ActiveChainByHeight` `68 B` incl. `blockTime`, `BTC_PRUNE_STEP` rejecting while `ReorgActive == 1`), `stream.go` (`BTC_TX_STREAM_CHUNK`), `tx.go` (`len != 64`, `txIndex != 0`, CVE-2012-2459), `taproot.go` (mandatory 2-in `RolloverTx`, BIP-68/112 CSV, `Q_vault_d`/`Q_rec_d` tweaks, `CommitteeIdentityKey` sig verification), `apply.go` (all 17 tags `0x00..0x10`, multi-epoch `TrackedVaultRecord`, SMT absence/inclusion `BTC_VAULT_SPEND_PROOF`, `BTC_ROUND_RETIRED`). | |
| 96 | - | - **`vm/embedded/implementation/settlement_challenge.go`** (`OptimisticRefereeSpork` `...000C`): `CommitChallenge` (`T_reveal = 1h`), `ChallengeContinuity` (`1,700 B`), 1-tx `ChallengeStep`, bounded Multi-Tx Sessions (`T_session = 12h`, `UploadWitnessProof = 8,676 B` @ depth 256, `ExecuteChallenge` re-verifying `(batchId, traceRoot)`), blocking `FinalizeBatch` while open, and `RefundRejectedBatchChallenge`. | |
| 63 | + | 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: | |
| 97 | 64 | ||
| 65 | + | - **Stage 1A (`BitVMX` `n = 8` Sovereign Rollup Stack — Primary Path for Pooled Fungible `zBTC`):** | |
| 66 | + | 1. **Reuse `BitVMX FORCE` / Fairgate Open-Source Core:** `BitVMX-CPU` (`RV32IM` RISC-V verifier & single-opcode Bitcoin Script evaluator) + `BitVMX-protocol` (pre-signed `n = 8` bisection graph builder & W-OTS commitment engine). | |
| 67 | + | 2. **Zenon Team's Focused Scope (Pure Rust → `RV32IM`):** | |
| 68 | + | - Deterministic Rollup STF $\mathcal{F}$ (stripped-block parser, BIP-141 witness verifier, SMT transitions, `ExitSlotUTXO` spend-or-refund, `B_zbtc` slashing) compiled cleanly to `RV32IM` (zero custom Bitcoin Script Groth16 circuits!). | |
| 69 | + | - `zbtc-sequencer` / `zbtc-batcher` daemon (reads Zenon `AccountBlock.Data`, builds `π_batch`, posts `0x02 BATCH_DA`). | |
| 70 | + | - Operator fronting & `StakeChain` daemon (`M = 3–5`) + `N = 7` Verifier watchtower daemon (monitors `KickoffTx_r` and opens simultaneous `ChallengeTx_{r,i}` in `[0, 144]`). | |
| 71 | + | - **Stage 1B (`clArk` Alternative Gate Stack):** | |
| 72 | + | - Fork/integrate mainnet-live **`Second bark/barkd`** or **`Ark Labs arkd`** (`2–5 BTC` active ASP liquidity) + lightweight Zenon coordination/SPV client (`~3–6` months). | |
| 73 | + | ||
| 98 | 74 | --- | |
| 99 | 75 | ||
| 100 | - | ## 7. Phase U5 — Governance Decentralization (Stage 1B Hard Gate), Reorg Push & Indexes | |
| 76 | + | ## 4. Concrete 3-Stage Delivery Roadmap & Capital Gates | |
| 101 | 77 | ||
| 102 | - | 1. **`GovernanceContract` & `MultisigContract` (Stage 1B Hard Gate)**: | |
| 103 | - | - **`MultisigContract`** (Guardian M-of-N Ed25519, e.g. `5-of-9`): Narrowing actions ONLY (`GuardianPause`, `GuardianLowerSupplyCap` on `> +10%` 24h TWAP deviation across `>= 3` venues, `GuardianBeginDrain` with mandatory `7-day` expiry timer). | |
| 104 | - | - **`GovernanceContract`** (Pillar stake-weighted voting replacing single `SporkAddress` at `dev:chain/genesis/embedded_genesis_string.go:7`): Proposal deposit, `>= 33%` quorum, `> 66%` approval, weekly supply-cap & `MinOperatorBondZnn` review cadence, pre-halving `K`/cap rule, `GOVERNANCE_ADD_BINDING` (`0x0E`), on-chain timelocks (`>= 48h` sporks/resume, `>= 7d` asset bind, cap raises, `ORPHANED` vault disposition, migrations). **Hard Gate before Stage 1B!** | |
| 105 | - | 2. **Fix `DeleteMomentum` Reorg Push (`dev:rpc/api/subscribe/api.go:357`)**: Emit `momentumsReverted` WebSocket event `{height, hash, previousHash}`. | |
| 106 | - | 3. **HTLC/PTLC Local Indexer (`chain/index/`, `rpc/api/embedded/{htlc,ptlc}.go`)**: `getByDestination`, `getByPointLock`, `getByHashLock`. | |
| 107 | - | 4. **Optional `BtcAnchorSpork` (`...000D`)**: Structured `<= 64 B` anchor receipts relaxing `dev:verifier/momentum.go:198` (`ErrMDataMustBeZero`) ONLY for valid receipts + `ledger.getLatestBtcAnchor()`. | |
| 78 | + | | Stage | Timeline (4–6 Engineers) | Hard BTC Capital Required | Deliverables & Security Milestone | Exit / Migration Guarantee | | |
| 79 | + | |---|---|---:|---|---| | |
| 80 | + | | **Stage 0: `Verify Bitcoin` Foundation** *(Mandatory Start)* | **`0–6 months`** | **`0 BTC` bonds** (`0–5 BTC` voluntary LP) | Upstream `U0` (`0aa299e` + `#239`) + `DynamicPlasmaSpork` (5-param pin) + `PtlcSpork` + Stage 0 `BtcSpvOracleContract` (1-/2-block midstate) + non-custodial PTLC/LN swaps. Parallel Signet prototype of Rollup STF $\mathcal{F}$ on `BitVMX-CPU`. | Zero custody risk; users hold native BTC on L1/LN at all times. | | |
| 81 | + | | **Stage 1 Decision Gate** | **Month 6 Gate** | *Gate Check* | **Choose Stage 1A ONLY if** pooled fungible non-expiring `zBTC` is non-negotiable **AND** `>= 12.8–18.8 BTC` of independent bonded BTC 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 below `500 sat/vB`! | Explicit upfront commitment; zero hidden federation fallback. | | |
| 82 | + | | **Stage 1A: Right-Sized `BitVMX` (`n = 8`, `M = 3–5`, `N = 7`) Sovereign Rollup** | **`12–18+ months`** *(incl. external Bitcoin Script + STF audit)* | **`12.8 BTC`** (`M = 3`, `Cap <= 10 BTC`) / **`18.8 BTC`** (`M = 5`, `Cap <= 15 BTC`) | Mainnet `BitVMX` `n = 8` TRUC v3 vaults (`{0.50, 0.25, 0.25}`), `0-of-N` Zenon trust (`49%–100%` proof), Bob `0.50` & Mike `0.25` L1 forced exits, `100%` positive-EV `N = 7` verifiers even under `6-of-7` collusion. | Deleted-key vaults remain 100% live forever; zero governance capture surface. | | |
| 83 | + | | **Stage 1B *(Alt)*: `clArk` + Zenon SPV/PTLC** | **`3–6 months`** | **`2–5 BTC`** active ASP liquidity (`0` bonds) | Mainnet `bark`/`arkd` VTXO rounds + Zenon coordination. Pure `0-of-N` post-round unilateral exit; honest disclosure of `arkoor` sender+ASP collusion, VTXO expiry, and discrete non-pooled VTXOs. | Users hold self-custodial pre-signed L1 exit branches at all times. | | |
| 84 | + | | **Stage 2: Zero-TTP Scale & Upgrade** | **`12+ months` post-Stage 1** | Scales with TVL (`K = 36` → `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!). | | |
| 108 | 85 | ||
| 109 | 86 | --- | |
| 110 | 87 | ||
| 111 | - | ## 8. Spork Release Flow & Automated Conformance Gates | |
| 112 | - | ||
| 113 | - | Follows `dev:common/types/spork.go:17-34` 4-step choreography (placeholder → `CreateSpork` → pin real hash & upgrade `>= 90%` Pillars → `ActivateSpork` → `SporkMinHeightDelay = 6` Momentums; un-upgraded nodes halt via `dev:chain/momentum_pool.go:254-283`). | |
| 88 | + | ## 5. Mandatory CI & Conformance Verification Gates | |
| 114 | 89 | ||
| 115 | - | Mandatory CI & Testnet Gates before Stage 1A: | |
| 116 | - | 1. Full Genesis-to-Tip historical replay parity across v1 → v2 → v3 → v4. | |
| 117 | - | 2. `common/trie/smtcore` passes upstream `smt-v1-test-vectors.json` byte-for-byte. | |
| 118 | - | 3. **`go-zenon` unit test (G-11)**: `InitiateMintedToken` → `IssueMinted` → single-use `ReceiveTreasury()` → `BindMintedAsset` → atomic mint/burn/rollback + `Burn`/`UpdateToken` rejection. | |
| 119 | - | 4. 30-day BLS12-381 `FinalityCommitteeRoot` PoP (distinct DSTs) + depth-5 SHA-256 tree + U2 finality gadget reorg protection + **historical-root `SubmitInvalidCertProof` MUST-fail tests (`R6-H1`: committee-`E` forged handoff at `h_trans(E+1)+1` with canonical momentum/state ⇒ slashable; committee-`E` target in epoch `E+1` ⇒ slashable!)** + `72`-day post-service lock & `RequestExitCommittee` exit test. | |
| 120 | - | 5. All **15 MUST-fail bullets + 18 conformance vectors** (`MINTED` v0.1.1 §13–§14) + all **29 SPV vectors** + cross-store vault state machine tests (decoupled `BTC_RELEASE_PROOF` + `RepointTrappedPegOut`, `PENDING_TRAP` mirror, `unrotatedVaultCount` inc/dec without underflow, deterministic `SyncOrphanedVaultOutpoint`), latency- & reservation-aware `G-21` + `BTC_ROUND_RETIRED`, anti-censorship `ClaimFrontingSlot` (`500 ZNN` `SlotBondZnn` + `lastLapsedOperatorId`), bounded Multi-Tx Session at `T-1` + depth-256 ground-tree fuzzer (**G-9**). | |
| 121 | - | 6. Signet↔Zenon PTLC (Bob-locks-first, BIP-327 `PartialSigAgg`, odd-$y$) & HTLC (`hashType = 1`, LN Hold Invoice) adversarial swap suite (**G-18**). | |
| 90 | + | 1. **Symbol & Line-Hash Citation CI:** Automated check pinning every `go-zenon` symbol cited in Parts 2–5 against the tagged U0 release containing `0aa299e` and `#239`. | |
| 91 | + | 2. **Panic & FIFO-Stall Fuzz Gate (`B1`):** Continuous fuzzer across all 4 Stage 0 `BtcSpvOracleContract` methods asserting zero panics, zero `common.DealWithErr` calls, and zero sequencer stalls. | |
| 92 | + | 3. **Dynamic Plasma 5-Parameter Bounds & 1-/2-Block Midstate Vectors (`B2`):** MUST-fail tests verifying `SetPlasmaVariables` rejects ANY violation of the 5 pinned bounds (`MaxBasePlasmaInMomentum < 2.1M`, `MaxPriceChangePercent > 25`, `FusedPlasmaTarget < 525k`, `PowPlasmaTarget < 525k`, `PriceChangeDenominator < 8`), plus 1-block and 2-block SHA-256 coinbase midstate vectors. | |
| 93 | + | 4. **Stage 0 PTLC/LN Adversarial Suite (`M-4`):** Signet↔Zenon tests asserting absolute Unix timestamp `now + 108,000`, `2.3×` slow-block `25.3h < 30h` margin, `>= 72`-block CSV, CPFP confirm `<= h_conf + 66`, BIP-327 odd-$y(R')$ parity, `hashType = 0` rejection, and LN Hold Invoice `ACCEPTED`-first + 5-minute cancel TTL. | |
| 94 | + | 5. **Stage 1A `BitVMX` `n = 8` & Rollup STF Conformance Suite:** Deterministic verification of `scripts/verify_spec_bounds.py` (`7.44 kvB <= 10 kvB` TRUC v3, `0.40 BTC` `F_chal` @ `500 sat/vB`, `1,104 < 1,152 < 1,296 < 1,440` timelocks, `k_collude = 0..6` positive verifier EV, `0.01 BTC` `ExitSlotUTXO` grief slash, `256`-bit Lamport `TakeTx` `<= 3.2 kvB`, real Bitcoin reorgs, and 2,000-step strict 1:1 solvency conservation). | |
| 122 | 95 | ||
Document Class: Engineering Upgrade & Delivery Blueprint (v1 / v3.0.0-rfc — Zero-Federation Phased Architecture; supersedes archived v0 v2.5.0-rfc)
Reference Codebase Verified: Local go-zenon clone is at master (e8986a6, v0.0.10-alphanet) and origin/dev (770e893).
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), v1 decouples Bitcoin custody completely from go-zenon upgrades and Zenon governance:
| Stage | go-zenon Changes Required | Zenon Spork / Governance Authority Over BTC Custody |
|---|---|---|
Stage 0 (Verify Bitcoin: SPV Event Oracle + Non-Custodial PTLC/LN) | Upstream go-zenon U0 release (0aa299e + #239 closed) + DynamicPlasmaSpork (w/ 5-parameter variable bounds) + PtlcSpork + 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). | 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 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; 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 (U0 Gate, B1, B2, Full Dynamic Plasma Pinning)
2.1 Upstream go-zenon Release Gate (0aa299e & Issue #239)
- Local Clone Honesty Disclosure: As verified directly against the local
go-zenonreference clone,HEAD(master) ise8986a6(v0.0.10-alphanet) andorigin/devis770e893. Upstream commit0aa299e(post-VM hash re-verification fix for externally supplied blocks mutated byValidateSendBlock) is not yet present in this local clone and remains a hard upstream release prerequisite before activating Stage 0 sporks on mainnet. - Close Upstream Issue
#239(B1Blocking Gate for Stage 0 SPV Oracle):- Embedded receives execute strictly FIFO per contract (
verifier/account_block.go:397-417,chain/account/sequencer.go:19-33). Onmaster, a VM panic returnsErrVmRunPanic(vm/supervisor.go:228) and abortspillar/worker_contract_generator.go:38-40without advancing the sequencer, permanently stalling the contract. - Normative Gate: Every embedded method in
BtcSpvOracleContractandvm/embedded/btcspv/MUST wrap execution indefer func() { if r := recover(); r != nil { err = constants.ErrInvalidMethodParam } }(), contain zero calls tocommon.DealWithErr, and rely on#239's deterministic failure provenance so bounded receive retries ALWAYS terminate in a canonical failed receive (never a FIFO stall).
- Embedded receives execute strictly FIFO per contract (
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, blocking every SPV call> 2,011 Binpillar/content_selector.go:328), ANDFusedPlasmaTargetLowerLimit = 1(L69),PowPlasmaTargetLowerLimit = 1(L72),PriceChangeDenominatorLowerLimit = 1(L84). Settingtarget = 1anddenom = 1allows a single transaction to trigger the maximum per-Momentum price jump (1.25^52 > 100,000×in ~10 minutes!).
Therefore, BtcSpvOracleSpork MUST enforce ALL FIVE SetPlasmaVariables guardrails simultaneously:
Parameter (vm/embedded/definition/plasma.go) | Unmodified origin/dev Bound | Normative Stage 0 Spork Floor / Ceiling | Why Required |
|---|---|---|---|
MaxBasePlasmaInMomentum | >= 210,000 (L66) | >= 2,100,000 | Guarantees >= 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) | >= 8 | Damps step amplification even under sustained 100% utilization. |
Honest Residual Dynamic Plasma Disclosure:
origin/dev:dp/dp.go:102-151intentionally has no absolute upper clamp onNextFusionPrice/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 submit0x01 FORCED_EXIT/0x03 FORCED_TRANSFERdirectly on Bitcoin L1, completely bypassing Zenon Plasma!
2.3 Stage 0 SPV Event Oracle & Non-Custodial Swaps (BtcSpvOracleSpork + PtlcSpork)
- Activate
PtlcSpork,EmbeddedRefundSpork,Libp2pSpork, andEpochRewardTermsSpork(all implemented onorigin/dev:common/types/spork.go). - Deploy lightweight
BtcSpvOracleContract(vm/embedded/btcspv/:header.go,tx.gowith 1-/2-block coinbase midstate verification,oracle.go— zero custody, minting, or federation code!). - Add local RPC/indexer helpers (
DeleteMomentumWebSocketmomentumsRevertedpush + HTLC/PTLCgetByDestination/getByPointLock/getByHashLock) for wallets and Stage 0 swap LPs. - (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 viaos.Exit(2)afterSporkMinHeightDelay = 6Momentums atchain/momentum_pool.go:53-68) with a timelockedGovernanceContract. Even if un-upgraded,SporkAddresscompromise has0custody power over Stage 1A/1B BTC!
3. Stage 1A / 1B Off-Chain Software Stack (Piggybacking on Open-Source Ecosystems)
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 (
BitVMXn = 8Sovereign Rollup Stack — Primary Path for Pooled FungiblezBTC):- Reuse
BitVMX FORCE/ Fairgate Open-Source Core:BitVMX-CPU(RV32IMRISC-V verifier & single-opcode Bitcoin Script evaluator) +BitVMX-protocol(pre-signedn = 8bisection graph builder & W-OTS commitment engine). - Zenon Team's Focused Scope (Pure Rust →
RV32IM):- Deterministic Rollup STF $\mathcal{F}$ (stripped-block parser, BIP-141 witness verifier, SMT transitions,
ExitSlotUTXOspend-or-refund,B_zbtcslashing) compiled cleanly toRV32IM(zero custom Bitcoin Script Groth16 circuits!). zbtc-sequencer/zbtc-batcherdaemon (reads ZenonAccountBlock.Data, buildsπ_batch, posts0x02 BATCH_DA).- Operator fronting &
StakeChaindaemon (M = 3–5) +N = 7Verifier watchtower daemon (monitorsKickoffTx_rand opens simultaneousChallengeTx_{r,i}in[0, 144]).
- Deterministic Rollup STF $\mathcal{F}$ (stripped-block parser, BIP-141 witness verifier, SMT transitions,
- Reuse
- Stage 1B (
clArkAlternative Gate Stack):- Fork/integrate mainnet-live
Second bark/barkdorArk Labs arkd(2–5 BTCactive ASP liquidity) + lightweight Zenon coordination/SPV client (~3–6months).
- Fork/integrate mainnet-live
4. Concrete 3-Stage Delivery Roadmap & Capital Gates
| Stage | Timeline (4–6 Engineers) | Hard BTC Capital Required | Deliverables & Security Milestone | Exit / Migration Guarantee |
|---|---|---|---|---|
Stage 0: Verify Bitcoin Foundation (Mandatory Start) | 0–6 months | 0 BTC bonds (0–5 BTC voluntary LP) | Upstream U0 (0aa299e + #239) + DynamicPlasmaSpork (5-param pin) + PtlcSpork + Stage 0 BtcSpvOracleContract (1-/2-block midstate) + non-custodial PTLC/LN swaps. Parallel Signet prototype of Rollup STF $\mathcal{F}$ on BitVMX-CPU. | Zero custody risk; users hold native BTC on L1/LN at all times. |
| Stage 1 Decision Gate | Month 6 Gate | Gate Check | Choose Stage 1A ONLY if pooled fungible non-expiring zBTC is non-negotiable AND >= 12.8–18.8 BTC of independent bonded BTC 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 below 500 sat/vB! | Explicit upfront commitment; zero hidden federation fallback. |
Stage 1A: Right-Sized BitVMX (n = 8, M = 3–5, N = 7) Sovereign Rollup | 12–18+ months (incl. external Bitcoin Script + STF audit) | 12.8 BTC (M = 3, Cap <= 10 BTC) / 18.8 BTC (M = 5, Cap <= 15 BTC) | Mainnet BitVMX n = 8 TRUC v3 vaults ({0.50, 0.25, 0.25}), 0-of-N Zenon trust (49%–100% proof), Bob 0.50 & Mike 0.25 L1 forced exits, 100% positive-EV N = 7 verifiers even under 6-of-7 collusion. | Deleted-key vaults remain 100% live forever; zero governance capture surface. |
*Stage 1B (Alt): clArk + Zenon SPV/PTLC* | 3–6 months | 2–5 BTC active ASP liquidity (0 bonds) | Mainnet bark/arkd VTXO rounds + Zenon coordination. Pure 0-of-N post-round unilateral exit; honest disclosure of arkoor sender+ASP collusion, VTXO expiry, and discrete non-pooled VTXOs. | Users hold self-custodial pre-signed L1 exit branches at all times. |
| Stage 2: Zero-TTP Scale & Upgrade | 12+ months post-Stage 1 | Scales with TVL (K = 36 → 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 CI & Conformance Verification Gates
- Symbol & Line-Hash Citation CI: Automated check pinning every
go-zenonsymbol cited in Parts 2–5 against the tagged U0 release containing0aa299eand#239. - Panic & FIFO-Stall Fuzz Gate (
B1): Continuous fuzzer across all 4 Stage 0BtcSpvOracleContractmethods asserting zero panics, zerocommon.DealWithErrcalls, and zero sequencer stalls. - Dynamic Plasma 5-Parameter Bounds & 1-/2-Block Midstate Vectors (
B2): MUST-fail tests verifyingSetPlasmaVariablesrejects ANY violation of the 5 pinned bounds (MaxBasePlasmaInMomentum < 2.1M,MaxPriceChangePercent > 25,FusedPlasmaTarget < 525k,PowPlasmaTarget < 525k,PriceChangeDenominator < 8), plus 1-block and 2-block SHA-256 coinbase midstate vectors. - Stage 0 PTLC/LN Adversarial Suite (
M-4): Signet↔Zenon tests asserting absolute Unix timestampnow + 108,000,2.3×slow-block25.3h < 30hmargin,>= 72-block CSV, CPFP confirm<= h_conf + 66, BIP-327 odd-$y(R')$ parity,hashType = 0rejection, and LN Hold InvoiceACCEPTED-first + 5-minute cancel TTL. - Stage 1A
BitVMXn = 8& Rollup STF Conformance Suite: Deterministic verification ofscripts/verify_spec_bounds.py(7.44 kvB <= 10 kvBTRUC v3,0.40 BTCF_chal@500 sat/vB,1,104 < 1,152 < 1,296 < 1,440timelocks,k_collude = 0..6positive verifier EV,0.01 BTCExitSlotUTXOgrief slash,256-bit LamportTakeTx<= 3.2 kvB, real Bitcoin reorgs, and 2,000-step strict 1:1 solvency conservation).
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.