Inspiration
I spent the past year trying to beat prediction markets: a favorite-longshot strategy on tens of thousands of 15-minute crypto contracts, and a weather nowcast that beat the government's model. Neither beat the market price. Most "signal" was noise. With x402, agents will soon buy data per API call, paying the same for alpha and for noise. I wanted forecasts priced by whether they were right.
What it does
An agent pays $0.001 over x402 (Circle Gateway on Arc) for a seller's quote: the Gemini market price \(m\) and a committed forecast \(p\). Both sides lock a USDC stake \(k\) in an edge swap on Arc. When the market resolves to \(y\):
$$ \Delta = (m - y)^2 - (p - y)^2 $$
If \(\Delta > 0\) the buyer pays the seller \(k\Delta\); otherwise the seller pays the buyer. Truth-telling is optimal, and a seller who knows nothing beyond the market earns exactly zero.
How I built it
- Arc:
EdgeEscrow.sol(Foundry, EIP-712, commit–reveal), with 28 tests including fuzzing; deployed and source-verified. - x402: Circle Gateway nanopayments to each seller.
- Gemini: live books set \(m\),
resolutionSidesettles swaps, sandbox orders for trading. - QuickNode Streams: escrow events go to a webhook that drives reveals, settlement and the leaderboard.
- Claude agent buys forecasts and trades; a policy engine in code enforces every limit.
- ERC-8004: sellers are registered agents, and every settled score is posted to Arc's Reputation Registry.
Challenges
- My first payout (log score with a refund floor) secretly rewarded exaggeration. I switched to a bounded Brier swap.
- Circle's x402 middleware charged for quotes the seller then refused, so all refusal checks now run before the paywall.
- Gemini order IDs exceed \(2^{53}\), so JavaScript rounded them and cancels hit the wrong order.
- QuickNode posts without a Content-Type header; my server read empty bodies until the Stream terminated, twice.
What I learned
After 36 settled swaps on live markets, echo is at exactly 0.000 and no seller has an edge that clears its confidence interval. The market is hard to beat, and now nobody gets paid for pretending.
Built With
- anthropic
- arc
- circle
- circle-gateway
- claude
- eip-712
- elevenlabs
- erc-8004
- express.js
- ffmpeg
- foundry
- gemini-prediction-markets
- javascript
- node.js
- openzeppelin
- playwright
- quicknode-streams
- solidity
- tailscale
- typescript
- usdc
- viem
- x402