All projects

CertNAI

AI-scored sports prediction NFTs, settled automatically on-chain via Chainlink.

Prediction Markets

What it is

CertNAI is a decentralized sports prediction platform where users stake ETH on game outcomes, receive a prediction NFT as proof of their position, and get rewarded based on how accurate their prediction was — not just whether they won or lost.
How it works:
Users browse live and upcoming games powered by the ESPN API, write a natural language prediction — like "Lakers win by 12 with LeBron scoring 30+" — and stake ETH to mint a prediction NFT on Sepolia. The NFT contains their prediction text, the game ID, their stake, and their wallet address, all stored immutably on-chain.
When the game ends, a Chainlink CRE workflow automatically triggers. It fetches the real game result from ESPN, sends the prediction text and game data to an AI model (GPT-4), which reads the period scores, final score, player stats, and team stats to evaluate how accurate the prediction was — giving a score from 0 to 100. That score is written back on-chain via onReport, settling the prediction contract.
Winners can then redeem their NFT, receiving their original stake plus a proportional reward from the staking pool. If they'd rather not redeem, they can list the NFT on the built-in marketplace and sell their position to another user.
What makes it different:

  • AI scoring — predictions are evaluated on nuance, not just win/lose
  • NFT-based positions — your prediction is a tradeable asset, not a locked bet
  • Automated settlement — Chainlink DON removes any human from the result
  • No binary outcomes — partial rewards for partially correct predictions
  • Open marketplace — buy and sell prediction NFTs mid-game or post-game
    Stack: Solidity (Foundry) · Next.js · FastAPI · SQLite · Chainlink CRE · ESPN API · GPT-4 · Sepolia testnet · Railway · Vercel

How it Works

Smart Contracts (Solidity + Foundry)
Four core contracts deployed on Sepolia. PredictionNFTPull mints ERC-721 NFTs and stores predictions on-chain. StakingRegistry holds the ETH stakes and releases rewards. SportsPredictionResolver receives scores from Chainlink and triggers settlement. NFTMarketplace handles peer-to-peer NFT listings and purchases.
Middleware (FastAPI + Python)
A REST API deployed on Railway that acts as the bridge between the blockchain and external data. It stores predictions in SQLite, fetches live game data from the ESPN API, and runs AI scoring by sending prediction text + game stats to GPT-4. Exposes endpoints for the CRE workflow to call during settlement.
Chainlink CRE Workflow (TypeScript)
A workflow registered with the Chainlink Compute Runtime Engine. It listens for ResolutionRequested events on Sepolia, calls the middleware to get AI scores, and calls onReport on the resolver contract to write results on-chain — fully automated, no human in the loop.
Frontend (Next.js + wagmi + viem)
Deployed on Vercel. Users connect their wallet, browse ESPN games, write predictions, stake ETH to mint, view their NFT portfolio, redeem rewards, and list/buy NFTs on the marketplace — all from one interface.
Data flow in one line:
ESPN → Middleware → GPT-4 → Chainlink CRE → Smart Contract → User wallet

Links

Created by

  • Shubham
  • Charles