2026-11-299 min readFrostBit Architecture Deep Dive · 3/3中文

Permissionless Deposit Witnessing, Four-Tier Zero-Sum Arbitration, and State Rent

FROST threshold vaults handle withdrawals, but how do you verify incoming deposits across six external chains without trusting centralized relayers—and stop dust accounts from bloating an on-chain orderbook's StateDB? Here is how FrostBit implements future-beacon witness sampling, crowdfunded 4→8→16→Top-4 zero-sum arbitration, and monotonic-cursor State Rent.

WitnessingGame TheoryCross-Chain DepositsState RentStateDB
Table of Contents

Cross-chain custody has two halves. The previous post covered outbound withdrawals (FROST+ROAST vaults and V3 dual-signed handovers). This post tackles the equally dangerous inbound half—how does the chain trust external deposits without embedding six fragile light clients in consensus?—plus a problem every on-chain orderbook eventually faces: how do you stop millions of dust accounts from bloating StateDB forever?

In FrostBit, external deposits across BTC, ETH, BNB, Base, Arbitrum, and TRON are verified by permissionless staked Witnesses. That immediately raises four hard questions:

  • What stops a small group of witnesses from colluding to attest a fake deposit?
  • How do you reward honest challengers without minting inflationary tokens and breaking global money conservation?
  • What if arbitrators go offline and stall a dispute?
  • What stops spam or dust airdrops from permanently bloating full-node disks and state roots?

Here is how FrostBit solves both halves in production code: Witness Arbitration Protocol v1 and State Rent.


1. Four-Stage Deposit Witnessing: Making Lies Unprofitable in Math and Economics

Deposit verification lives in witness/ and vm/witness_handler.go, with consensus constants defined in protocol/witness.go:

text
User sends funds to an external FrostBit vault
   │
   ▼
[1] WitnessRequestTx (escrows ≥0.01 FB service fee + 10 FB requester bond)
   │  → Event replay lock: account chains (chain, txHash, logIndex) / BTC (64-hex txid, vout)
   ▼
[2] Future-block-hash random sampling (each selected witness locks 10 FB case bond)
   │  → Every PASS vote commits deposit block + reference block (min depth K: BTC 2, EVM 64, TRX 20)
   ▼
[3] Original PASS enters a 300-block public challenge window (~25 min)
   ├─ Unchallenged → atomic credit (mint balance + bump TotalSupply + bump vault balance + pay witness fee)
   └─ Crowdfunded challenge reaches max(10 FB, 10% of original group's case bonds)
        ▼
[4] Four-tier escalation: ordinary rounds 4 → 8 → 16 (10,000 blocks/round, 3/4 supermajority)
        └─ Still unresolved → frozen Top-4 highest-staked final jury (3/4 decisive vote)
             └─ Same-block atomic zero-sum slashing, refunds, and burns

1. Unpredictable Sampling + Committed Block Evidence

When a deposit request lands on-chain, the VM does not pick witnesses in the same block. It schedules KeyRechargeSelectionDue and samples registered witnesses using a future block hash as the beacon, reserving 10 FB of per-case collateral from each selected witness's WitnessLockedBalance. Nobody knows in advance who will be drawn.

Furthermore, a PASS vote cannot be a naked boolean—it must commit both the external deposit block and the reference tip block at voting time. WitnessVoteTxHandler validates evidence shape and minimum confirmation depth in O(1) (2 blocks on BTC, 64 on ETH/BNB/Base/Arbitrum, 20 on TRON); malformed or shallow votes fail immediately without refunding runtime fees.

2. 300-Block Challenge Window + Open Crowdfunded Challenges

Passing the initial witness vote does not mint funds immediately. The request enters a DefaultRechargeChallengePeriodBlocks = 300 block public challenge period.

During that window, anyone in the world running an external node who spots a fraudulent attestation can open or contribute to a crowdfunded challenge (minimum 10 FB per new contribution). Once total contributions reach:

text
Challenge Threshold = max(10 FB, original_group_case_bonds × 10%)

the deposit freezes into CHALLENGE_PENDING_SELECTION (silent original witnesses remain in the denominator so abstention cannot skew the threshold). If the window expires underfunded, contributors receive exact principal refunds.

3. Escalating 4 → 8 → 16 Arbitration + Conflict-Free Top-4 Final Jury

Arbitrators vote directly on external truth (PASS / FAIL / ABSTAIN), not "agree/disagree with the prior round." Tallies reset every round, and supermajorities are measured against the frozen planned committee size, never shrinking to whoever showed up:

  • Three ordinary rounds: Committee size doubles each round (4 → 8 → 16) with a 75% (7500 bps) threshold and ArbitrationRoundBlocks = 10,000 blocks per round on mainnet.
  • Frozen Top-4 final jury: When round 3 starts, the protocol freezes the 4 highest-staked eligible witnesses (tie-broken by address). If all three ordinary rounds fail to reach 75%, the case enters the fixed 4-member final jury requiring 3 matching votes in a single round. If a final round times out, votes clear and the same jury revotes—never lowering thresholds, never defaulting to the original ruling.
  • Strict incentive isolation: Final-jury members are excluded from all slash pools and failed-challenge principal pools, even if they also contributed or served in an earlier round—removing any financial incentive to flip a verdict for slash profits.

4. Strictly Zero-Sum Integer Settlement

The moment arbitration resolves, debits, payouts, burns, and bond releases execute atomically inside one StateView transaction (vm/witness_arbitration_settlement.go, witness/arbitration_rewards.go):

Fund SourceExact Integer Allocation (Largest-Remainder Method, Address Tie-Break)
Escrowed witness fee (__witness_fee_pool__)Split equally across deduplicated eligible addresses matching the final outcome (including final jury); burned if empty
Successful challenge · challenger principalExact remaining principal refunded to each contributor (independent of reward eligibility)
Successful challenge · slashed bonds10% burned (decrementing TotalSupply); 45% pro-rata to eligible challengers; 45% split equally among eligible honest original/ordinary voters (if either group is empty, its share burns rather than redirecting)
Failed challenge · principal + slashed bondsSplit equally among eligible honest original/ordinary counterparties; burned if empty

Key invariants enforced in code:

  • No whitewashing across roles, no double-slashing: Original and ordinary positions freeze independently. Any wrong directional stance forfeits that address's case bond once and disqualifies it from all fees and slash rewards—voting correctly in another role does not erase an earlier wrong vote, nor is the same address double-slashed across rounds.
  • Zero inflationary rewards: Every reward unit comes from real escrowed fees, challenge principal, or actually slashed collateral—audited on the exact same block by AuditGlobalConservationDiff.
  • Index-driven scheduling + hot/cold compaction: Selection, challenge expiry, and round timeouts are driven strictly by height-keyed due indices (KeyChallengeTimeoutDue, etc.)—never full-table scans. Finalized cases archive to archive_challenge_* while hot state compacts to a zero-stake marker.

2. State Rent: Stopping Dust Spam and Unbounded StateDB Bloat

An on-chain orderbook L1 cannot afford millions of permanent $0.0001 zombie accounts clogging StateDB and slowing down state-root checkpoints.

FrostBit's rent/ module enforces protocol-level State Rent on all user 0x accounts (system pools are exempt).

1. Oracle-Free Exemption Thresholds

An account is permanently rent-exempt (lease cleared, zero rent deducted) whenever it meets either condition:

  • Nominal FB ≥ 10 FB: computed across available balances, locked balances, and external owned asset claims aggregated in asset_claim_total_ (open perpetual margin + active deposit challenge contributions).
  • Or holds any of the 15 built-in bridged assets above a fixed protocol quantity (config/rent.go): e.g., 10 units of a supported stablecoin, 13,000 sats BTC, 0.004 ETH, 0.014 BNB, or 30 TRX—hard-coded in native base units so block execution never depends on an external price oracle.

2. Lease Calculation, Automatic Activation, and Sweep

  • Height-based lease: Below exemption, the account receives rentExpireHeight = height + ceil(nominalFB / 100) (100 raw FB units/block) written to rent_state_ and indexed in rent_expiry_.
  • Automatic activation on non-FB transfer: Sending a non-FB token (such as USDT) to a fresh 0x address with zero nominal FB automatically transfers an extra 0.01 FB activation balance from the sender inside TransferTxHandler so the recipient is not immediately expired.
  • Expiry sweep with real asset migration: At rentExpireHeight, vm/rent_hooks.go cancels open spot/perpetual orders, invokes dedicated cleaners to migrate real external funds (open perp margins, active challenge stakes) before deleting claim indices, and sweeps remaining dust into rent.RecycleFundAccount.

3. Keeping Rent Processing Linear (Never O(N²))

Naive rent sweeps easily degrade into quadratic prefix scans under load. rent/runtime.go enforces three strict performance rules:

  1. Deduplicate, then batch prefetch: Touched and due owners for the block are merged, deterministically sorted, and prefetched in bounded batches (GetMany/GetKVs)—no per-owner point IO loops.
  2. Monotonic cursor pagination: Discovering D due accounts walks rent_expiry_ with a monotonic startAfter cursor (O(D log D) total); newly created dueHeight <= H tasks enqueue explicitly instead of rescanning from prefix start after every sweep.
  3. OwnerMarkerInit fast-skip + at-most-once future order scan: When owner markers prove completeness, due accounts without a future-order marker skip order cleanup completely; when legacy or marked accounts need perpetual order cancellation, future_orderstate_ is scanned at most once per block and grouped by owner.

This architecture also explains why FrostBit deliberately avoids blind spray-and-pray token airdrops: pushing dust to hundreds of thousands of inactive addresses looks like phishing to users and creates useless State Rent churn; opt-in eligibility checks with on-demand claims fit the state model cleanly.


3. Honest Trade-Offs and Operational Assumptions

  1. Confirmation latency vs. reorg safety: Requiring real external confirmation depth (2 BTC / 64 EVM / 20 TRON blocks) plus a 300-block challenge window means permissionless deposits finalize in tens of minutes, not seconds. We chose reorg resistance and public challengeability over instant deposits backed by a centralized relayer.
  2. Watchtower liveness assumption: Optimistic challenge windows require at least one rational watcher monitoring external chains and posting a 10 FB challenge bond when a fake deposit appears—strongly incentivized by the 45% share of slashed witness bonds.
  3. Rent sweep vs. active challenge principal: If a low-balance challenger account expires under State Rent before arbitration finishes, its active challenge contribution is genuinely moved to the recycle fund; final settlement pays out only principal still physically held in escrow—never double-refunding the same tokens, again backed by per-block conservation panics.

Source entry points (GPL-3.0-only):

Read the Source & Poke Holes: Every consensus rule, conservation check, liquidation engine, FROST vault, and witness arbitration module discussed above is open-source (GPL-3.0-only) at github.com/commonstate-labs/frostbit. Issues and adversarial edge cases are welcome.