Pythia
Sybil-Resistant Prediction Markets
What it is
Polymarket processed $9B in 2024 election volume. One wallet moved BTC odds 12% with a single $30M position. Another user created 50+ wallets to farm airdrops and manipulate market odds. The platform had no way to distinguish 1 whale from 1,000 real humans.
Pythia fixes this. It enforces true sybil resistance: every bet requires a World ID ZK proof verified on-chain. 1 human = 1 capped bet per market. No whale manipulation. No multi-wallet gaming. The nullifier hash is stored on-chain and can never be reused for that market.
The resolution pipeline is fully automated via Chainlink CRE:
- CRE Runtime reads active markets and pending resolutions from the Pythia contract on World Chain Sepolia
- CRE Secrets protects API keys (OpenRouter, event data sources) inside TEE
- Confidential HTTP fetches real-time event data from 3 sources:
- CoinGecko for crypto price markets
- ESPN for sports markets
- Open-Meteo for weather markets (location-aware, extracts lat/lon from market question)
- AI Analysis via OpenRouter (Gemini 2.0 Flash) analyzes fetched data against the market question, returns outcome (YES/NO/INVALID) with confidence score
- On-chain resolution only fires if AI confidence >= 70%. Merkle attestation (bets root + payouts root) submitted after resolution is confirmed
Markets that never reach 70% confidence have a 30-day emergency resolution fallback, preventing locked funds.
Mobile-first UX: Tinder-style swipe right for YES, left for NO. Designed for World Mini Apps distribution to 15M+ World ID holders.
How it Works
Smart Contract (Solidity + Foundry):
Pythia.sol(531 lines) handles market creation (6 categories: CRYPTO, SPORTS, POLITICS, WEATHER, ENTERTAINMENT, OTHER), World ID verification, betting with per-market nullifier tracking, AI-powered resolution, proportional payout distribution, and emergency fallback- 39/39 Foundry tests covering market lifecycle, sybil resistance, odds calculation, resolution, claims, Merkle attestation, and admin functions
- Deployed on World Chain Sepolia:
0x6158fa6bA28a664660B3beb4F8992694dbAD4fAC
CRE Workflow (TypeScript, 830 lines):
- 6-step pipeline: Read markets -> Fetch prices via Data Feeds -> World ID verification layer -> Fetch event data via Confidential HTTP -> AI outcome analysis via OpenRouter -> On-chain resolution + Merkle attestation
- Real keccak256 Merkle tree computation from actual on-chain bet records (not mocked)
- Location-aware weather data: parses city names from market questions and fetches geo-specific forecasts
ConsensusAggregationByFieldsfor DON consensus on resolution outcomes
Frontend (Next.js + wagmi):
- Swipe-based trading UI for mobile World Mini App
- Live market feeds from on-chain contract
- AI-powered price predictions via Jupiter integration
- Real-time odds display and market statistics
Links
Created by
- Aarav Raj