Wraith
Privacy-first prediction markets on Arbitrum with fully automated, trustless resolution powered by Chainlink.
What it is
Wraith is a decentralized prediction market protocol built on Arbitrum that solves two fundamental problems with existing on-chain prediction markets: bet privacy and manual resolution.
On every existing prediction market, anyone can see exactly which wallet bet which way on which market. Wraith eliminates this by using a commitment scheme — bettors submit a hash of their position rather than the position itself. The secret and nullifier that generated that hash never touch the chain. Winnings can be claimed from any wallet, completely de-linking a user's identity from their bet.
Resolution is the second problem. Most markets rely on a trusted operator or a DAO vote to determine the outcome. Wraith removes humans from the resolution path entirely using Chainlink CRE (Compute and Runtime Environment) — a confidential off-chain compute layer that reads external data inside a TEE and writes tamper-proof results back on-chain.
How it works:
- Market Creation — A Chainlink CRE workflow scrapes trending Reddit posts, sends them to an AI, and suggests a ready-to-deploy prediction market question with a full resolution config. The creator reviews the suggestion and calls createMarket() on-chain, locking the resolution rules permanently.
- Betting — Participants place bets by submitting a commitment hash (keccak256(marketId, outcome, amount, secret, nullifier)). The ETH is held in PrivacyPool. No one can see which outcome a user bet on.
- Automated Settlement — When a market's deadline passes, WraithKeeper (a Chainlink Automation contract) triggers settlement. The CRE settlement workflow resolves the market via one of four resolution paths:
- PRICE_FEED — reads a Chainlink Data Feed and evaluates a numeric condition
- API_POLL — makes a confidential HTTP call to an external API inside the TEE, extracts a value via dot-notation JSON path
- AI_VERDICT — fetches recent news from NewsAPI, asks Claude to return YES/NO with reasoning
- OPTIMISTIC — creator proposes the outcome, 48-hour dispute window, any challenger can post a counter-bond; if disputed, AI_VERDICT breaks the tie
- Privacy-Preserving Claims — After settlement, winners reveal their secret and nullifier to ClaimRegistry. The contract verifies the commitment, checks the nullifier hasn't been used, and pays out proportionally. Claims can be submitted from any wallet.
What problem does it solve?
- Privacy: On-chain bets are fully public on every existing platform. Wraith keeps positions private until (and after) settlement.
- Trustless resolution: No oracle committee, no DAO vote, no admin key. Resolution logic is locked at market creation and executed autonomously by Chainlink infrastructure.
- Manipulation resistance: The OPTIMISTIC path uses bonded disputes escalated to AI arbitration, punishing dishonest proposers economically.
Live demo: https://wraith-peach.vercel.app/
How it Works
Smart Contracts (Solidity / Foundry)
- MarketFactory.sol — core contract: market lifecycle, resolution config, CRE entry point (onReport)
- PrivacyPool.sol — holds ETH, releases only to ClaimRegistry upon verified claim
- ClaimRegistry.sol — commitment verification, nullifier tracking, proportional payout
- WraithKeeper.sol — Chainlink Automation keeper, scans markets and triggers settlement
- Types.sol — shared enums and structs
Chainlink CRE Workflows (TypeScript) - settlement/main.ts — Log-triggered workflow; listens for SettlementRequested and DisputeEscalated events; resolves markets via PRICE_FEED, API_POLL, or AI_VERDICT; writes results back on-chain via onReport()
- market-suggester/main.ts — HTTP-triggered workflow; scrapes Reddit, calls an AI to generate a market question + resolution config, returns a suggestion to the frontend for human review
Other Stack - Chainlink Data Feeds — price source for PRICE_FEED markets
- Chainlink Automation — permissionless trigger for market settlement deadlines
- OpenAI GPT — AI arbitrator for AI_VERDICT resolution, dispute settlement, and market suggestion generation
- viem v2 — EVM encoding/decoding inside CRE TypeScript workflows
- NewsAPI — news source for AI_VERDICT resolution context
- Arbitrum (Sepolia testnet)
Links
Created by
- Akinsanya Daniel