SSURETYDEVNET
SOLANA DEVNET · POWERED BY TxLINE

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.

Money is set aside first

When a policy is bound, the whole payout goes into an escrow account for that policy. It's there before anyone needs it.

Re-priced as it plays

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.

Paid on proof

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:

  1. Ingest. TxLINE streams odds and scores over SSE. We save the exact bytes, so the same data can be replayed later byte for byte.
  2. 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.
  3. 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.
  4. Settle.Anyone can submit the TxLINE proof. Our program calls TxLINE's validator, and if it returns true the 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, ...)?;
Change a single bit of the proof and TxLINE returns 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):

RPChttps://api.devnet.solana.com
API originhttps://txline-dev.txodds.com
TxLINE program6pW64gN1s2uqjHkn1unFeEjAwJkPGHoppGvS715wyP2J

On-chain validation instructions (each returns a Borsh bool via Solana return data):

InstructionRequired accountPurpose
validate_oddsdaily_odds_merkle_rootsProve a quoted odds packet is in the anchored root
validate_statdaily_scores_merkle_rootsProve a single/binary score predicate
validate_stat_v2daily_scores_merkle_rootsSURETY's settlement path (StatValidationInput)
validate_stat_v3daily_scores_merkle_rootsMultiproof 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 AND

Proof-backed stat names:

goals_homegoals_awaygoals_totalyellow_cards_homeyellow_cards_awayyellow_cards_totalred_cards_homered_cards_awayred_cards_totalcorners_homecorners_awaycorners_total

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: e74f3d39032f9c393744a58851631954bcf77a87f404e118d4b89b37700f1fa8

Quote 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.

TxLINE being able to prove a stat does not mean we can price it. If the chosen fixture has no matching odds market, the quote is rejected even though the result would settle fine.

Using the app

RouteWhat it does
/dashboardGlass balance sheet — solvency and liabilities re-marked live, hash-chained to Solana
/coverageBuy coverage: pick an outcome, get a TxLINE quote, pay, and issue a collateralized policy
/underwriteVault stats decoded live on-chain; deposit capital and mint test USDC
/propsProp-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.js
import { 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

WhatReference
SURETY program3e5rBR2J…v8qVW
Authentic settlementProof verified → payout
Tampered proof rejectedOne bit flipped → denied
Broker split issuancePremium split → broker wallet
Halftime settlementPeriod settled mid-match

Evidence & gates

We track what's actually been proven in EVIDENCE.md, one numbered gate per piece:

GateProvesStatus
0Ground truth against TxLINE docsPASS
1Feed ingest + byte-exact replayPASS
2Predicate grammar + canonical compilerPASS
3Vault + collateralized policy lifecyclePASS
4Atomic settlement via TxLINE CPIPASS
5Deterministic quote engine + verdict gatePASS
6Glass balance sheetPASS
7Application layer + permissionless settlementPASS