TrialByFire
Subjective prediction markets resolved by adversarial AI debate, orchestrated by a CRE workflow on the DON.
What it is
Traditional prediction markets can only resolve objective questions with clear numeric answers. TrialByFire
resolves subjective questions — "Is Chainlink's oracle model more decentralized than competitors?", "Should DAOs be
recognized as legal entities?" — using an adversarial trial system where AI advocates debate both sides and an
impartial AI judge delivers a verdict.
How it works: (1) Anyone creates a market with a subjective question, a deadline, and stakes ETH on YES or NO. (2)
When the deadline passes, a SettlementRequested event fires on-chain. The CRE workflow catches this via Log
Trigger, runs a condensed adversarial trial through Anthropic's Claude API, and DON nodes reach consensus on the
verdict using consensusIdenticalAggregation. (3) The CRE workflow writes a cryptographically signed report through
KeystoneForwarder to the contract's onReport() function, resolving the market. Winners claim proportional payouts.
The adversarial structure prevents AI bias — the trial prompt forces consideration of both YES and NO perspectives
before rendering judgment. If confidence is too low, markets escalate and all stakers receive full refunds.
How it Works
Monorepo with four packages: (1) Smart Contract (Solidity 0.8.24) — TrialMarket.sol with CRE onReport(), Chainlink
Functions fallback, Automation via checkUpkeep/performUpkeep, and Data Feeds for ETH/USD price. (2) CRE Workflow
(TypeScript) — Log Trigger catches SettlementRequested events, calls Anthropic Claude API for a condensed
adversarial trial, uses consensusIdenticalAggregation for DON consensus, and writes a signed report via
evmClient.writeReport(). (3) Engine (TypeScript) — Local fallback pipeline with dynamic AI-powered evidence
routing, parallel YES/NO advocate debate, judge scoring against rubric criteria, and IPFS transcript storage via
Pinata. (4) Frontend (React/TypeScript/Vite) — Dashboard with wallet connection (ethers.js v6), market creation,
staking, outcome display with adversarial debate transcripts, and Chainlink Data Feed price display.
Stack: Solidity, Hardhat, OpenZeppelin, @chainlink/cre-sdk, Anthropic Claude API, ethers.js v6, React, Vite, Pinata
IPFS. Deployed on Ethereum Sepolia.
Links
Created by
- Jeremic Arose