Inspiration

Every sports town has a bar with a sign that says "If our team wins, drinks are on us." The promise packs the room on game night. If the upset happens, the bar can lose far more than the promo ever earned.

Big businesses already insure this. Houston's Mattress Mack has hedged "refund if the Astros win" promotions for years, paying insurers 10 to 20% of the refund. A neighbourhood bar can't call a broker the afternoon before kickoff. I wanted that bar to buy the same protection in one click, and I wanted its customers to be able to check that the money is really there.

The name comes from the Roman arrha, earnest money paid up front to make a promise binding.

What it does

A merchant picks a game on Gemini Prediction Markets, picks the long shot and sets a payout. Arra quotes a premium from Gemini's live order book. One wallet transaction on Arc locks the full payout in USDC and gives the merchant a QR code for the table.

A customer who scans it lands on a proof page that reads straight from the chain. It shows that the promise exists, that the payout is locked, that the vault can pay every open promise at once, the Gemini hedge order ID, and how the game will settle. When Gemini settles the market, the keeper votes the result and the USDC goes to the merchant's wallet.

A $5,000 payout on a 12% underdog costs about $737, or 14.7%. Mattress Mack paid 10 to 20%, through a broker, at a much larger size.

Why not have the bar buy YES contracts on Gemini itself? It would need a Gemini account, KYC and a feel for how deep the book is before the afternoon of the game. Even then its customers could not see that the money exists. Arra also pools many merchants: when bars back different teams in the same market, the vault locks only the largest payout, which no single bar can do alone. Liquidity providers take the leftover risk for the premium, and the bar pays one fixed price.

How I built it

  • The contract, ArraVault, is an ERC-4626 USDC pool on Arc testnet. Liquidity providers deposit USDC and earn the premiums. Merchants buy cover with a 60-second EIP-712 quote tied to their address and a one-time nonce.
  • Only one team can win, so the vault locks only the largest payout across a game's outcomes. Five bars backing five NBA title contenders at $5 each insure $25 with $5 locked. The contract tracks this incrementally for up to 128 outcomes, so gas stays flat.
  • The pricer streams Gemini's WebSocket order book and walks it for the full payout. The premium is the hedge cost plus a 5% buffer, a utilization surcharge that grows as a game fills up, and a 2% capital charge on the collateral the cover adds. It refuses favourites above 50%, where cover would cost nearly as much as the promo.
  • The hedger buys the same outcome on Gemini once unhedged exposure crosses a threshold, then records the Gemini order ID onchain. My sandbox run filled order 145853902323013843 and recorded it.
  • Three settlers vote Gemini's result along with a hash of Gemini's raw response. A unanimous vote settles at once. A 2-of-3 vote opens a 60-second dispute window with a guardian veto. Ties and cancellations refund every premium.
  • A hash only proves which bytes the settlers voted on, so I added a zkTLS proof that Gemini sent them. Reclaim's zkFetch requests Gemini's event endpoint through an attestor and proves the winning contract came back with "resolutionSide":"yes". A second contract on Arc, ArraResultProofs, rebuilds the exact request for that game and winner, requires a byte-for-byte match, and checks the attestor's signature before it records the result.
  • The frontend (React, viem and three.js) has three pages: Make a promise, Proof of promise and a public Risk desk. All of them read the vault live from Arc.

The contracts have 74 tests, including 8 invariants, a test that verifies a real Reclaim proof of api.gemini.com, and four forged proofs that must be rejected. The offchain services have 92 tests that run on captured Gemini data.

Challenges I ran into

  • Real order books are thin. On Nov 19 the Boston NBA-title book held 526 contracts of asks, and my first model assumed 10,000. I switched to Gemini's WebSocket depth, and the pricer now refuses cover the book can't fill.
  • Gemini can leave a finished game open. One stayed open for 103 hours after the final whistle, so I close in-game sales by a time limit per sport and ignore the market state.
  • Arc's public RPC rate-limits and caps log ranges. Reads go through Multicall3 and history comes from the Blockscout API.
  • Refunds had to stay solvent. Collateral per game is the larger of the worst payout and the total premiums, so a voided game can always refund everyone.

Accomplishments that I'm proud of

  • A live vault on Arc testnet with real Gemini prices, a real sandbox hedge, and a proof page any customer can check without trusting me.
  • Netting that makes championship cover cheap, since one lock backs every team in the market.
  • A public script that re-checks any settlement against Gemini's bytes and the onchain hash.
  • A zkTLS proof of a real Gemini result, checked by a contract on Arc.

What I learned

Prediction markets already price sports risk well. What small businesses were missing was a way to buy that price as cover. I also learned to test against live data early: every serious bug I fixed showed up first in Gemini's real feeds.

What's next

  • Sweep hedge proceeds back to Arc through Circle Mint and CCTP.
  • Let the vault accept a valid zkTLS proof in place of a settler vote.
  • Hand the three settler keys to independent operators.
  • Sell through a licensed insurer or MGA, with Gemini as the regulated hedge venue.
  • Pilot with a few bars during the NBA season.

Built With

  • arc
  • blockscout
  • circle
  • eip-712
  • erc-4626
  • foundry
  • gemini-prediction-markets
  • github-actions
  • node.js
  • openzeppelin
  • react
  • reclaim-protocol
  • render
  • solidity
  • three.js
  • usdc
  • viem
  • vite
  • websocket
  • zktls
Share this project:

Updates

Submission history