How Rivaly works
The core idea, the highlights, and how our TxLINE integration actually holds together.
Core idea
Rivaly is the most trusted way to predict football with friends. Spin up a room around a real fixture, back YES or NO with real (devnet) USDC, and get paid the moment the match ends. No admin decides the result, and you never have to wait on anyone's word for it. Football is the product. Crypto is just the settlement layer that keeps it provably fair.
Business & technical highlights
- Public rooms anyone can join, or private ones locked behind an invite code from whoever created them.
- Parimutuel staking, so winners share the losing side's pool, each in proportion to what they put in.
- A flat 2% fee, taken from the losing pool at settlement and nowhere else. Never from your own stake, never from a refund.
- Bookmarks, chat for the people actually in the room, and a leaderboard for the bragging rights.
- Next.js, TypeScript, and Tailwind up front, with Supabase (Postgres plus row-level security) behind it.
- A Solana Anchor program holds every stake in escrow: one vault per person, one position per room, all settled on-chain.
- Live fixtures, odds, and match events all come from TxLINE (TXODDS). The full flow is spelled out below.
- TrustFlow™ is the heart of it. Before a room can settle, Rivaly fetches TxLINE's Merkle proof for the real match result and verifies it on-chain, and only then does a single payout go out. That's the whole trust model: a proof you can check for yourself, not our word.
How Rivaly uses TxLINE
Step 1
Fixture sync
Every match you see on Rivaly comes from TxLINE's fixture catalog. Competitions, kickoff times, and line-ups all stay in sync on their own, so the schedule is always right.
Step 2
Live odds & scores
The moment a match kicks off, TxLINE streams live odds and everything that happens on the pitch. Goals, cards, VAR calls, and subs all land in your room in real time.
Step 3
Proof-backed verification
When the final whistle blows, TrustFlow pulls TxLINE's Merkle proof for the real result and checks it on-chain. You're trusting a proof anyone can verify, not our say-so.
Step 4
Automatic settlement
Payouts only go out once that proof checks out. There's no admin stepping in, and no button we press by hand.
On-chain proof, in detail
For anyone checking this against the TxLINE track's judging criteria directly.
Custom validation logic on TxLINE's proofs
Rivaly doesn't call TxLINE's validate_stat primitive raw. Every market type (team result, total goals, corners, both teams to score, correct score, red cards) is translated into its own predicate, a MarketSpec built from TxLINE stat keys, a period marker, and a comparison. A separate completeness gate checks that every goal a match actually produced shows up in TxLINE's own event feed before any proof for that match is trusted at all.
apps/web/src/lib/onchain/marketSpec.ts and apps/web/src/server/trustflow/marketResolver.ts
Permissionless on-chain escrow
Staking is never optional and never just a database row. Every room mints a real on-chain Room, Escrow, and Position account, and every stake moves real devnet USDC into that room's own vault before anything says a bet exists. Payouts only ever move through claim_reward, straight from that vault to the winner's wallet.
Open any settled room, scroll to TrustFlow, and use “View Merkle Proof” → “View settlement transaction” to check a real payout on Solana Explorer yourself.
Custom on-chain settlement engine via CPI
settle_room calls TxOracle's own validate_stat_v3 instruction directly through a Cross-Program Invocation, then cross-checks the proof's stat key, period, and fixture ID against the room's own immutable market_spec before ever trusting the verdict. A backend can't retarget one match's proof at another room's payout.
programs/programs/rivaly/src/instructions/settle_room.rs