HOW PROOFXI SETTLES A MARKET WITHOUT ANYONE TO TRUST
ProofXI is VAR for prediction markets: a fantasy World Cup pick'em where every market outcome goes to an on-chain review that is final and cannot be rigged. The result is decided by a cryptographic proof settled on-chain — not by an operator. Track: Prediction Markets & Settlement (TxODDS World Cup hackathon). Network: Solana devnet. Data: TxLINE.
The thesis in one line
settle_market rebuilds a market's predicate on-chain from the stored market definition, CPIs into TxLINE's Txoracle.validate_stat, and records the program's own get_return_data bool as the outcome. A settler can supply the bulky Merkle-proof data, but cannot prove one proposition and record another — the predicate (stat keys, operator, comparison, threshold) is reconstructed from chain state, not taken from the caller. That is the custom check-gate the track asks for, and exactly what the on-screen VAR review visualizes.
How it works, end to end
- 01 — Real data inA live TxLINE scores feed streams over server-sent events until the match finalizes and the stat is sealed, Merkle-proven by TxLINE.
- 02 — Build a slatePlayers pick a set of boolean markets, weight them, captain one for 2×, and escrow test-USDC into the round vault (proofxi::enter).
- 03 — The reviewEach outcome is sent to VAR: settle_market rebuilds the predicate and CPIs into validate_stat. A valid proof returns the outcome bool; a tampered one aborts.
- 04 — Settlement & payoutCorrect picks score their weight (captain 2×); the pot is paid by proofxi::payout — winner-take-all, ties split, dust stays in the vault.
TxLINE endpoints used
Base origin (devnet): https://txline-dev.txodds.com
| Purpose | Method | Endpoint |
|---|---|---|
| Guest session (JWT) | POST | /auth/guest/start |
| Activate → X-Api-Token | POST | /token/activate |
| Fixtures snapshot (?startEpochDay=) | GET | /api/fixtures/snapshot |
| Scores snapshot (per fixture) | GET | /api/scores/snapshot/{fixtureId} |
| Merkle stat-validation proof | GET | /api/scores/stat-validation |
| Real-time scores stream (SSE) | GET | /api/scores/stream |
On-chain data subscription is via the Txoracle program's subscribe instruction (free World Cup tier: serviceLevelId=1, durationWeeks=4).
Where each shows up: the live match card mirrors /api/scores/stream over a genuine SSE endpoint (/api/stream, replayed feed on a real transport); the VAR receipt renders the actual bytes of a real /api/scores/stat-validation proof pulled on devnet (every hash on screen is the hex of those bytes); the slate builder and leaderboard read the deployed program and test-USDC mint live over JSON-RPC.
On-chain programs (Solana devnet)
| Program | Address | Role |
|---|---|---|
| Txoracle (TxLINE) | 6pW64gN1s2uqjHkn1unFeEjAwJkPGHoppGvS715wyP2J | serves validate_stat; the proof gate |
| proofxi | 3wqZbXRsECPBib3sfuHGFtZis9WP9JENm3JHxqBtgNCE | rounds, escrow, settlement, payout |
| proof_verifier | FLfi8rshUqV8cn71Z1nj29bFLmDdAhiHsVBoqLvhia1F | minimal CPI de-risk (Phase 1) |
| test-USDC mint | 85s4zWGJ5FLSG1RtqiekE5QQBcNwSvtBgmbEy7UwmwDD | 6-decimal devnet SPL, self-serve faucet |
proofxi instructions: faucet · create_round · enter · settle_market (the CPI seam) · score · payout. Markets are boolean propositions over TxLINE stat keys — e.g. home win = STAT[1002] − STAT[1003] > 0. Only outcomes are proven via validate_stat; odds-weights are stored game params committed at enter.
Adversarial binding (proven on devnet)
scripts/adversarial.ts runs three cheats against a live round; each reverts on-chain, while the honest settle passes. This is the "watch me try to rig it → the chain rejects it" beat, surfaced in the receipt's TRY TO RIG IT toggle.
- ✕Tampered stat value→ InvalidStatProof — Txoracle rejects the fake Merkle leaf inside the CPI
- ✕Swapped stat keys→ StatMismatch — our on-chain predicate binding catches it
- ✕Injected second stat→ UnexpectedSecondStat — single-stat market rejects the extra input
Frontend & reproduction
Next.js 14 (App Router) · TypeScript · Tailwind v3 · framer-motion, deployed on Vercel. The design is World Cup broadcast graphics × a settlement terminal. Reproduce the on-chain proof from the repo:
npm install # anchor, web3.js, spl-token npm run setup # TxLINE auth → subscribe → pull a real proof npx tsx scripts/verify-proof.ts # replay the proof through validate_stat on devnet npx tsx scripts/phase3.ts # create_round → enter → settle (CPI) → payout npx tsx scripts/adversarial.ts # three cheats, each reverts on devnet
A note on trust
ProofXI proves that settlement faithfully follows the signed oracle and cannot be tampered — it removes the operator as a point of manipulation. It does not claim the oracle's data mirrors the real world; that is the oracle's job (the classic oracle-trust boundary). On devnet the scorelines are TxLINE demo data, but the proofs are genuine signed payloads, re-verified on-chain through validate_stat.