All projects

ChaosOracle

AI-powered prediction market settlement layer using CRE for decentralized consensus

CRE & AI Prediction Markets Tenderly

What it is

ChaosOracle is a decentralized prediction market settlement layer that uses Chainlink CRE to orchestrate AI-powered research, verification, and on-chain consensus.

The problem: Prediction markets today rely on centralized oracles or simple price feeds for settlement. Complex, real-world questions - "Will SpaceX land Starship by Q3?" or "Will the WHO declare a new pandemic?" - require nuanced research, evidence gathering, and quality assessment that no single oracle can provide.

How it works: Markets register with the ChaosOracleRegistry smart contract, specifying a question, outcome options, and a deadline. Once the deadline passes, CRE takes over:

  1. A CRE cron trigger detects expired markets and deploys a ChaosChain Studio (on-chain workspace) for each one.
  2. AI worker agents use OpenAI's web search to research the question, upload evidence to IPFS/Arweave, and submit their outcome predictions on-chain. All threads of agents' communication are saved to XMTP topics (one per Studio) for later calculation of participants' weights to ensure fair rewards.
  3. AI verifier agents audit the workers' evidence quality across 9 scoring dimensions and submit score vectors on-chain. ["Initiative", "Collaboration", "Reasoning Depth", "Compliance", "Efficiency", "Accuracy", "Evidence Quality", "Source Diversity"]
  4. After (when enough workers and verifiers submitted) epoch close, a CRE log trigger fires onEpochClosed - it reads finalized quality scores from the RewardsDistributor, fetches each worker's evidence to extract their predicted outcome, computes a score-weighted consensus, and calls settleWithOutcome() to resolve the market on-chain.

The result is fully decentralized, AI-driven settlement where outcome quality is cryptographically verified and economically incentivised - workers and verifiers stake ETH and earn rewards proportional to their quality scores.

How it Works

  • Smart Contracts (Solidity/Foundry): ChaosOracleRegistry (central hub), PredictionSettlementLogic (9-dimension scoring via delegatecall), ExamplePredictionMarket (binary Yes/No pool). 90 tests across 7 suites. Deployed on Sepolia.
  • Chainlink CRE Workflow (TypeScript): Three triggers — onCheckDeadlines (cron) creates studios for expired markets, onReadyToClose (cron) finalizes epochs, and onEpochClosed (LogTrigger on RewardsDistributor) reads finalized scores and settles consensus. Business logic extracted into pure functions (core.ts) for testability, with thin CRE handler wrappers in main.ts.
  • AI Agents (Python): Worker agents use OpenAI Responses API with web_search tool to research market questions. Verifier agents audit evidence across 9 quality dimensions with a robust JSON extraction fallback chain. Both use ERC-8004 for on-chain identity and x402 for payment.
  • ChaosChain Integration: StudioProxy pattern with delegatecall for per-market workspaces. RewardsDistributor handles stake/reward economics (85% worker, 10% validator, 5% orchestrator).
  • XMPT: for storing agents' communication threads. Uses as a source of truth for the Distributed Knowledge Graph. DKG is used for participation weights calculation.
  • End-to-End Sandbox: 14-service Docker Compose environment (Anvil fork, IPFS, ChaosChain Gateway, CRE runner, 3 workers, 3 verifiers) with an orchestration script running 10 phases from market creation to final balance sheet.

Links

Created by

  • Ihor