Freelance engineering contracts, DAO grants, and open-source bounties usually fail at the same edge case: paying 100% upfront shifts all risk to the client, paying 100% on completion shifts all risk to the contributor, and binary win/lose arbitration breaks down whenever partial deliverables are genuinely shipped.

To solve this cleanly without external package dependencies, I designed and deployed MilestoneEscrow — a stateful multi-milestone ugnot escrow realm written in pure Gno (v1.8.0) on the Gno.land onyx-1 testnet (Block #1355214).

1. Strict Checks-Effects-Interactions (CEI) Accounting

Every payout path mutates milestone state (RELEASED / SPLIT / REFUNDED) and updates protocol-wide accounting (totalLocked, totalReleased, totalRefunded) before invoking chain/banker SendCoins:

// Mutate state & accounting before coin transfer (strict CEI) m.Status = StatusReleased c.LockedAmount -= m.Amount totalLocked -= m.Amount totalReleased += m.Amount banker := banker.NewBanker(banker.BankerTypeRealmSend) banker.SendCoins(runtime.CurrentRealm().Address(), c.Contractor, chain.Coins{{Denom: "ugnot", Amount: m.Amount}}) 

2. Zero-Dust Basis-Point Arbiter Splits (0..10000 bps)

Rather than forcing an all-or-nothing ruling, a designated arbiter resolves disputed milestones using basis points (0 to 10000). Computing the client refund by subtraction guarantees zero rounding dust:

contractorPayout := (m.Amount * contractorBps) / 10000 clientRefund := m.Amount - contractorPayout 

Across all 5 unit test suites (gno test -v .), the realm asserts the global conservation invariant after every transition:

totalLocked + totalReleased + totalRefunded == totalDeposited 

3. Native 4-Route gnoweb UI + Live Onyx RPC Sandbox

Gno realms render Markdown directly on-chain via Render(path string) string. MilestoneEscrow exposes 4 routes ("", contract/<id>, stats, and guide) alongside an interactive browser-side Gno VM State Machine Sandbox & live onyx-1 RPC explorer:

Bonus: Free Zero-Backend Developer Utilities

If you build Web3 or full-stack tools and prefer pure static client-side apps with zero server cost, check out our free browser tools hub (Token Cost Calculator, JSON/JWT DevBox, Chain Fee Calculator, Invoice & Markdown Resume builders): https://devbox-zero-ops.github.io/xiaheai-hub/ (or grab the full 7-in-1 self-hostable source bundle at https://devbox-zero-ops.github.io/xiaheai-hub/pro.html).

Feedback and edge-case reviews on the Gno realm state machine are always welcome!