All projects

OracleX

AI-powered prediction markets on World Chain, settled by Chainlink CRE's decentralized oracle network.

CRE & AI Prediction Markets DeFi & Tokenization World Thirdweb

What it is

What is it?
OracleX is a fully on-chain prediction market platform where anyone can create yes/no markets on any topic crypto prices, sports results, tech events, news and trade YES or NO shares using USDC. The key innovation is that every market outcome is determined by AI running inside the Chainlink Runtime Environment (CRE), not by human governance or centralized admins.
OracleX is built primarily as a World Mini App that runs natively inside World App on World Chain mainnet. Users sign in with World App, trade gas-free, verify their humanness with World ID, and let AI settle every market all without leaving the app.

How does it work?

  1. Market Creation:
    Users create prediction markets by writing a yes/no question (e.g., "Will ETH be above $3,000 by June 2026?"), choosing a category, and providing initial liquidity (minimum 10 USDC). The liquidity is split 50/50 into YES and NO pools. In the World Mini App, World ID verification is required before creating a market ensuring one unique human per market creation.
  2. Trading:
    Users buy YES or NO shares using USDC. The price is determined by pool-based ratio pricing the more people buy one side, the more expensive it gets:
  • YES Price = yesPool / (yesPool + noPool)
  • NO Price = noPool / (yesPool + noPool)
    Users can also sell shares before the market closes. The sell price is calculated as (yourShares × yourSidePool) / totalPool, with a 1% protocol fee. The spread redistributes to the opposite pool.
    In the World Mini App, all transactions are gas-free via World Chain and executed through MiniKit's sendTransaction. No wallet popups, no approval transactions the custom MockUSDCWorld token auto-approves the OracleX contract.
  1. AI Settlement via Chainlink CRE:
    When a market's closing time passes, anyone can tap "Request AI Settlement," which emits a SettlementRequested event on-chain. The Chainlink CRE workflow detects this event via an EVM-log trigger and each DON node independently:
  • Reads the market question from the blockchain via EVMClient.callContract()
  • Fetches real-world data from external APIs (CoinGecko for crypto, Odds API for sports, NewsAPI for news) via HTTPClient.sendRequest()
  • Calls Groq AI (llama-3.3-70b-versatile) with a structured prompt containing the question + real-world data
  • Returns a JSON response: { outcome: "YES"|"NO"|"INVALID", confidence_bps: 0-10000, reasoning: "..." }
    All nodes must reach identical consensus via consensusIdenticalAggregation. If confidence is below 80%, the market resolves as INVALID and everyone gets refunded. The DON writes the verified settlement on-chain via EVMClient.writeReport().
  1. Outcomes:
  • YES or NO (≥80% confidence): Winners claim proportional payouts from the total pool. Losers receive nothing.
  • INVALID (<80% confidence): Everyone gets a full refund. No fees charged. This protects traders from ambiguous or premature markets.

What problem does it solve?
Traditional prediction markets suffer from three fundamental problems:

  1. Centralized resolution — A single admin or governance token holders decide outcomes, creating bias and manipulation risk. OracleX eliminates this entirely, AI running on Chainlink's decentralized oracle network is the only arbiter.
  2. Friction and inaccessibility — Prediction markets require wallet setup, gas fees, token approvals, and technical knowledge. OracleX as a World Mini App removes all friction open World App, sign in, trade. Zero gas fees. No approvals. 10M+ potential users on day one.
  3. No safety net for bad questions — Traditional markets force an answer even when evidence is insufficient. OracleX's confidence threshold means the AI can say "I don't know" marking the market INVALID and refunding everyone. This protects traders from ambiguous or premature markets.

How it Works

Smart Contracts (Solidity 0.8.20 + Hardhat)

  • OracleX.sol — Main prediction market contract with pool-based pricing, settlement functions (requestSettlement, receiveSettlement), and claim logic (claimWinnings, claimRefund). Deployed on both Ethereum Sepolia and World Chain mainnet.
  • MockUSDCWorld.sol — Custom ERC20 with a trustedOperator mechanism. When OracleX calls transferFrom, no approval is needed solving World App's restriction on approve() calls in mini apps.
  • Deployed using Hardhat with separate deploy scripts for each chain.

Chainlink CRE Workflows (TypeScript + @chainlink/cre-sdk)

  • market-resolver (Sepolia) and world-resolver (World Chain) two workflows with identical AI logic targeting different chains.
  • EVM-log trigger detects SettlementRequested events on-chain.
  • EVMClient.callContract() reads market details from the blockchain at DON level.
  • Per-node execution via runtime.runInNodeMode():
    • HTTPClient.sendRequest() fetches data from CoinGecko, Odds API, and NewsAPI
    • HTTPClient.sendRequest() calls Groq AI with a structured prompt
  • consensusIdenticalAggregation ensures all nodes agree on the outcome.
  • EVMClient.writeReport() writes the AI-verified settlement on-chain.
  • All capability calls use .result() (synchronous) CRE runs in a WASM sandbox, not async Node.js.

Frontend (Next.js 15 + thirdweb v5 + MiniKit SDK)

  • Single codebase serves both web app (Sepolia + thirdweb wallet) and World Mini App (World Chain + MiniKit).
  • MiniKit integration: walletAuth for sign-in, sendTransaction for gas-free trading, verify for World ID.
  • Chain-aware hooks: All contract reads (useMarket, useMarketCount, useUserPositions) accept a chain parameter to read from the correct contract.
  • Tinder-style swipe interface for market discovery (Framer Motion drag gestures).
  • Retro UI custom Brice font family, lavender/purple color scheme.
  • Auto-refresh after MiniKit transactions (2-3s delay for block confirmation).

Backend (Node.js + Express + Prisma + Supabase)

  • Dual-chain event indexer — watches contract events on both Sepolia and World Chain simultaneously using viem.
  • REST API — markets, positions, leaderboard, AI market generation.
  • Socket.io — real-time event broadcasting (marketCreated, positionTaken, marketSettled).
  • World ID verification endpoint — validates proofs before market creation.
  • Chain-aware indexer with different block chunk sizes (10 for Sepolia/Alchemy limits, 2000 for World Chain).

AI (Groq llama-3.3-70b-versatile)

  • Free tier with 14,400 requests/day — sufficient for hackathon demo.
  • Temperature 0.1 for near-deterministic outputs (critical for DON consensus).
  • Structured JSON output format for reliable parsing.
  • Used in both CRE workflows (settlement) and backend (AI market auto-fill).

Links

Created by

  • Kaustubh Pardeshi
  • Atharva Waghachoure