Private prediction markets and a Uniswap v4 privacy layer. The odds are public, the bettors aren't.
QuietOdds is a private prediction market and a privacy layer for Uniswap v4, live on Ethereum Sepolia at quietodds.vercel.app.
On today's prediction markets and DEXs, every bet and every swap is tied to your wallet forever. Anyone can see what you backed, how much, and when, and bots can see your swap coming and trade around it. QuietOdds fixes that. You deposit USDC or ETH once, publicly. From then on your money sits in a shielded pool as hidden notes, and everything else you do is private:
Bet on F1 races, football matches and crypto prices. Your browser makes a zero-knowledge proof that you own a note, without saying which one, and a relayer sends the transaction. The chain only sees "someone bet 1 USDC on Verstappen". Not who.
Claim winnings. A second proof works out your exact share of the pot and pays it back to you as a new hidden note.
Shield while you swap. Our Uniswap v4 hook moves part of any ETH/USDC swap straight into your private balance, inside the same swap. You can also queue a private bet that the relayer places a few minutes later, so the bet can't be linked to the swap.
Swap privately in batches. You join a batch from your hidden balance, and every 5 minutes the whole batch swaps through the v4 pool as one trade, with a minimum price from Chainlink. Everyone gets the same price, and nobody can see who was in it.
Withdraw to any address, even a brand new wallet with 0 ETH.
The same hook protects swappers and liquidity providers. If someone tries a sandwich attack in one block, the second half of the attack pays a fee as large as the price move it caused, so the attack doesn't pay. The extra goes to the liquidity providers, and the 1% market fees are donated to them as well.
Markets are settled by a Chainlink CRE workflow that reads ESPN for sports and F1 and Chainlink price feeds for crypto. It also runs due batch swaps and donates fees, all in one report. Every read the app makes goes through the Ethereum Foundation's Anon-RPC mixnet, so the RPC node can't link your IP to the pool reads that come just before your private bet. The core money rules (no money created by a spend, exact payouts, winners never take more than the pot, and sandwiches don't pay) are proved in Lean 4.
Everything is real on Sepolia: real proofs, real swaps through our hooked pool, real resolution. The README lists the transaction hashes.
Circuits: two Noir circuits, proved with UltraHonk via Barretenberg (bb.js) right in the browser in about one second. The page runs with COOP/COEP headers so the prover can use every CPU core. spend (25.7k gates) proves a note is in a depth-20 Poseidon Merkle tree, burns its nullifier, and checks amount = change + public amount + fee with 128-bit range checks. The action, market, side, relayer, fee and recipient are all public inputs, so the relayer can't redirect anything.
"redeem" (27.7k gates) proves payout = floor(stake × pot / winning side) using a range-checked remainder. The contract supplies the payout ratio, never the user. There are three note types (balance, bet position, batch ticket), and all three live in one tree. Each note is posted on chain encrypted to your viewing key, so logging in on any browser rescans and recovers everything.
Contracts (Foundry, 118 tests including real proof fixtures, fuzzing and invariants): ShieldedPool, Markets, BatchSwapper, ResolverReceiver, the generated verifiers, and QuietOddsHook.
Uniswap v4: the hook uses beforeSwap and afterSwap, both with return deltas.
The swap's hookData carries a shield amount and an encrypted note. The hook takes that amount from the swap with poolManager.take and deposits it into the shielded pool, all within one swap, for all four swap shapes.
The anti-sandwich part is ported from OpenZeppelin's AntiSandwichHook. The hook stores the price at the start of the block. A swap that reverses the block's price move gets a higher fee through a dynamic fee override. One-direction overpayments are skimmed and donated to liquidity providers in the same swap.
BatchSwapper runs batches through poolManager.unlock (swap, settle, take). Its minimum output comes from Chainlink, so a manipulated pool makes the batch revert instead of filling badly. Market fees go to liquidity providers via poolManager.donate.
A Next.js server route uses the Uniswap Trading API for comparison quotes and plain cash-out swaps, keeping the API key on the server.
Chainlink CRE: a TypeScript workflow on a cron trigger.
treads every market, batch and the fee balance in a single Multicall3 call, because CRE allows 15 chain reads per run.
It fetches ESPN results through the HTTP capability with median consensus, and price markets through Chainlink feeds.
It sends one report per run to ResolverReceiver, which resolves or cancels markets, executes due batches and donates fees.
F1 winners come from ESPN's race "winner" flag, with an "Anyone else" side for the rest of the grid.
We run it with "cre workflow simulate --broadcast", which sends real reports to Sepolia.
Anon-RPC: the app's single wagmi/viem transport uses a fetchFn that sends every request through a hash-pinned AnonRpcWorker on the EF's mixnet. Reads are batched so each slow mixnet round trip carries many calls. If 3 mixnet requests fail in a row, reads go direct while the worker reconnects with backoff, and the nav chip always shows the real state. This matters for privacy: otherwise the RPC node could link your IP'sMerkle-path reads to the relayer's spend a few seconds later.
Relayer: Hono + viem on Vercel. It verifies each proof with bb.js, simulates the transaction, then sends it and pays the gas. It is rate-limited and keeps no IP logs.
App: Next.js and wagmi. Keys come from one wallet signature or a passkey (WebAuthn PRF) and stay in memory only. Queued bets are saved perwallet, and the app places them once you unlock.
Lean 4 + Mathlib: zero sorry. Theorems show that the circuits' field equations and range checks really mean value is conserved with no wraparound, that payouts are exact, that pro-rata payouts never exceed the pot, and that the directional fee makes a one-block sandwichunprofitable. There is also a counterexample showing where our 50% fee cap stops protecting.

