SURETY documentation
A shop runs a promo: "if France wins the final, everyone gets their money back." That's a real bill they might have to pay, and usually nobody has set the money aside for it. SURETY lets them lock up the full payout in advance and have it released automatically once the result is proven on-chain. Prices come from TxLINE's odds, and the payout is released by TxLINE's own validator, so no middleman decides who won.
Overview
A promo like "refund everyone if France wins" is money the business may owe but hasn't set aside. Right now these get settled by hand: someone checks the result and decides whether to pay. SURETY handles it three ways instead.
When a policy is bound, the whole payout goes into an escrow account for that policy. It's there before anyone needs it.
Open policies are re-priced from TxLINE's live odds while the match runs, and each figure is written to Solana so the history is there to check.
A policy only pays out after TxLINE's on-chain program checks the Merkle proof and confirms the result.
How it works
Four steps, all built on real TxLINE data:
- Ingest. TxLINE streams odds and scores over SSE. We save the exact bytes, so the same data can be replayed later byte for byte.
- Quote.The price depends on two things only: one saved TxLINE odds packet and the vault's current book. We publish a hash of the quote so anyone can recompute it and check the number wasn't changed.
- Bind. When you pay, the full coverage is locked in an escrow account for that one policy. If a broker referred the sale, their 5% is paid in the same transaction.
- Settle.Anyone can submit the TxLINE proof. Our program calls TxLINE's validator, and if it returns
truethe escrow pays out in the same transaction.
Settlement (the core)
Nothing in SURETY gets to decide the result on its own, not a keeper and not the program itself.settle_policy hands the proof to TxLINE's validate_stat_v2 program and only pays out if TxLINE says the proof is good. Here is what it does:
// programs/surety_core/src/lib.rs — settle_policy (condensed)
// 1. Confirm the score-root account is really owned by TxLINE
require_keys_eq!(*daily_scores_merkle_roots.owner, txline::PROGRAM_ID, ...);
// 2. CPI into TxLINE's on-chain validator with the authentic proof
invoke(&validation_ix, &[daily_scores_merkle_roots, txline_program])?;
// 3. Require the boolean return data to come from TxLINE and be true
let (return_program, return_bytes) = get_return_data().ok_or(...)?;
require_keys_eq!(return_program, txline::PROGRAM_ID, ...);
require!(return_bytes.as_slice() == [1u8], SuretyError::TxlinePredicateRejected);
// 4. Atomic payout in the SAME instruction
transfer_tokens(&policy_escrow, &payout_account, policy.coverage, ...)?;false. The require! fails, the transaction is thrown out, and the money stays in escrow. It is TxLINE's Merkle root doing the checking, not us.TxLINE integration
Network ground truth (Solana devnet):
| RPC | https://api.devnet.solana.com |
| API origin | https://txline-dev.txodds.com |
| TxLINE program | 6pW64gN1s2uqjHkn1unFeEjAwJkPGHoppGvS715wyP2J |
On-chain validation instructions (each returns a Borsh bool via Solana return data):
| Instruction | Required account | Purpose |
|---|---|---|
validate_odds | daily_odds_merkle_roots | Prove a quoted odds packet is in the anchored root |
validate_stat | daily_scores_merkle_roots | Prove a single/binary score predicate |
validate_stat_v2 | daily_scores_merkle_roots | SURETY's settlement path (StatValidationInput) |
validate_stat_v3 | daily_scores_merkle_roots | Multiproof optimization candidate |
We only allow a bet type when two things are true: TxLINE can prove that stat, and the fixture actually has a matching odds market. Not every match quotes corners, cards, or player props, so we read the real odds for each fixture instead of assuming they exist.
Predicate grammar
A policy is stored as a fixed binary format, not the text you typed. That way two policies that mean the same thing get the same identity even if the spacing, capitalization, or clause order is different. Allowed forms:
outcome(match_id) == WIN_HOME | DRAW | WIN_AWAY
stat(match_id, stat_name) op i32 // op ∈ >, >=, <, <=, ==
stat(match_id, period, stat_name) op i32 // period is matrix-gated
// at most two comparisons, joined by ANDProof-backed stat names:
The SHA-256 of those bytes is the predicate hash, which is part of the policy's on-chain address. Worked example:
text: outcome(18237038) == WIN_HOME
bytes: 0101026e46160100000000000000000000
sha256: e74f3d39032f9c393744a58851631954bcf77a87f404e118d4b89b37700f1fa8Quote engine
The premium comes from two inputs and nothing else: one saved TxLINE odds packet and the vault's current book. A quote comes back with a verdict (accept, surcharge, or reject), the implied probability, how much of the bucket it would use, the premium, and a commitment hash. Feed the same packet and book back in and you get the same hash, so you can check the price yourself.
Using the app
| Route | What it does |
|---|---|
| /dashboard | Glass balance sheet — solvency and liabilities re-marked live, hash-chained to Solana |
| /coverage | Buy coverage: pick an outcome, get a TxLINE quote, pay, and issue a collateralized policy |
| /underwrite | Vault stats decoded live on-chain; deposit capital and mint test USDC |
| /props | Prop-style predicate policies (goals, cards, corners) where a market exists |
You'll need a Wallet-Standard wallet (Phantom, Solflare, or Backpack) set to Devnet, plus a little devnet SOL for fees. The Get test USDCbutton in the nav mints 2,000 tUSDC. It's devnet play money with no real value.
npm package
The part that verifies and replays TxLINE data is published on npm under MIT, so you can use it without pulling in the rest of SURETY. It has none of our pricing or insurance code in it.
npm install @surety-tx/txline-verify @anchor-lang/core @solana/web3.jsimport { readFile } from "node:fs/promises";
import { assertAuthenticProofShape, type RawOddsValidation } from "@surety-tx/txline-verify";
const proof = JSON.parse(
await readFile("txline-odds-proof.json", "utf8"),
) as RawOddsValidation;
assertAuthenticProofShape(proof);
console.log(proof.odds.MessageId, "has a valid, bounded proof payload");Pass an Anchor provider to validateOddsOnDevnet or validateFixtureOnDevnetand it asks TxLINE's deployed validator to check the proof for you. View on npm →
On-chain references
| What | Reference |
|---|---|
| SURETY program | 3e5rBR2J…v8qVW |
| Authentic settlement | Proof verified → payout |
| Tampered proof rejected | One bit flipped → denied |
| Broker split issuance | Premium split → broker wallet |
| Halftime settlement | Period settled mid-match |
Evidence & gates
We track what's actually been proven in EVIDENCE.md, one numbered gate per piece:
| Gate | Proves | Status |
|---|---|---|
| 0 | Ground truth against TxLINE docs | PASS |
| 1 | Feed ingest + byte-exact replay | PASS |
| 2 | Predicate grammar + canonical compiler | PASS |
| 3 | Vault + collateralized policy lifecycle | PASS |
| 4 | Atomic settlement via TxLINE CPI | PASS |
| 5 | Deterministic quote engine + verdict gate | PASS |
| 6 | Glass balance sheet | PASS |
| 7 | Application layer + permissionless settlement | PASS |