Skip to content

Privacy-first decentralized prediction market with AI-powered settlement. Bet anonymously, settle with truth using Chainlink CRE, GPT-4, and multi-source verification.

Notifications You must be signed in to change notification settings

intelliDean/PhantomBet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PhantomBet

A privacy-first decentralized prediction market with AI-powered settlement using Chainlink Runtime Environment (CRE).

Bet in the shadows. Settle with truth.

πŸš€ Features

  • Privacy-Preserving Betting: Commitment-reveal scheme keeps bets private during betting phase
  • AI-Powered Settlement: Automated outcome verification using GPT-4 and multiple data sources
  • Multi-Source Verification: Cross-references news APIs, sports data, and social media
  • Cross-Chain Ready: Built on Arbitrum with CRE orchestration
  • Institutional Grade: Compliance-friendly privacy with transparent settlement

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         Frontend (React)                     β”‚
β”‚  Market Creation | Betting Interface | Settlement Dashboard  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   Smart Contracts (Solidity)                 β”‚
β”‚  PredictionMarket.sol | CRESettlementOracle.sol             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Chainlink Runtime Environment (CRE)             β”‚
β”‚                   Settlement Workflow                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”‚
β”‚  β”‚  News API    β”‚  β”‚ SportsData   β”‚  β”‚  OpenAI GPT-4β”‚      β”‚
β”‚  β”‚  Integration β”‚  β”‚  Integration β”‚  β”‚  Analysis    β”‚      β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Project Structure

chainlink-prediction-market/
β”œβ”€β”€ contracts/              # Smart contracts (Hardhat)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ PredictionMarket.sol
β”‚   β”‚   └── CRESettlementOracle.sol
β”‚   β”œβ”€β”€ test/
β”‚   └── scripts/
β”œβ”€β”€ cre-workflow/          # Chainlink CRE workflow
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   └── settlement-workflow.ts
β”‚   └── config/
β”‚       └── cre.config.json
β”œβ”€β”€ frontend/              # React frontend
β”‚   └── src/
β”‚       β”œβ”€β”€ components/
β”‚       β”œβ”€β”€ hooks/
β”‚       └── utils/
└── docs/                  # Documentation

πŸ› οΈ Technology Stack

  • Smart Contracts: Solidity 0.8.x, Hardhat
  • Blockchain: Arbitrum Sepolia (testnet)
  • CRE: Chainlink Runtime Environment
  • AI: OpenAI GPT-4o-MINI
  • Frontend: React, Vite, ethers.js
  • Data Sources: News API, SportsData.io

πŸ“‹ Prerequisites

  • Node.js >= 18
  • npm or yarn
  • Chainlink CRE CLI
  • Wallet with Arbitrum Sepolia ETH

πŸ”‘ API Keys Required

Create a .env file with:

OPENAI_API_KEY=your_openai_key
NEWS_API_KEY=your_newsapi_key
SPORTSDATA_API_KEY=your_sportsdata_key
PRIVATE_KEY=your_wallet_private_key
ARBITRUM_SEPOLIA_RPC=your_rpc_url

πŸš€ Quick Start

1. Install Dependencies

# Install contract dependencies
cd contracts
npm install

# Install CRE workflow dependencies
cd ../cre-workflow
npm install

# Install frontend dependencies
cd ../frontend
npm install

2. Deploy Contracts

cd contracts
npx hardhat compile
npx hardhat deploy --network arbitrum-sepolia

3. Test CRE Workflow

cd cre-workflow
chainlink-cre simulate src/settlement-workflow.ts

4. Run Frontend

cd frontend
npm run dev

πŸ§ͺ Testing

Smart Contract Tests

cd contracts
npx hardhat test

CRE Workflow Simulation

cd cre-workflow
chainlink-cre simulate src/settlement-workflow.ts --config config/cre.config.json

πŸ“– How It Works

1. Market Creation

Anyone can create a prediction market with:

  • Question (e.g., "Will it rain in London tomorrow?")
  • Possible outcomes (e.g., "Yes", "No")
  • Betting deadline

2. Privacy-Preserving Betting

Users place bets using commitment scheme:

  1. Generate random secret
  2. Create commitment: hash(betAmount + outcome + secret)
  3. Submit commitment to contract (bet is hidden)
  4. Store secret locally for later reveal

3. Reveal Phase

After betting deadline:

  1. Users reveal their bets with the secret
  2. Contract verifies commitment matches reveal
  3. Invalid reveals are rejected

4. AI-Powered Settlement

CRE workflow automatically:

  1. Fetches data from multiple sources (News API, SportsData, etc.)
  2. Sends data to GPT-4 for analysis
  3. Requires consensus from 3+ sources
  4. Submits verified outcome to blockchain
  5. Triggers settlement

5. Winner Payout

Winners claim their share of the prize pool proportional to their bet amount.

πŸ”’ Privacy Guarantees

  • During Betting: All bets are hidden via cryptographic commitments
  • After Reveal: Bets become public (necessary for prize distribution)
  • No Identity Required: Wallet addresses only, no KYC
  • Transparent Settlement: AI decision-making is auditable

πŸŽ₯ Demo Video

[Link to 3-5 minute demo video]

πŸ“„ Chainlink Integration Points

CRE Workflow

  • File: cre-workflow/src/settlement-workflow.ts
  • Purpose: Orchestrates AI-powered outcome verification
  • External Integrations: OpenAI, News API, SportsData
  • Blockchain Interaction: Reads market data, submits settlements

Oracle Contract

  • File: contracts/src/CRESettlementOracle.sol
  • Purpose: Receives verified outcomes from CRE
  • Chainlink Features: CRE integration, multi-source verification

πŸ† Hackathon Tracks

This project qualifies for:

  1. βœ… Prediction Markets - Core functionality
  2. βœ… CRE & AI - AI-powered settlement via CRE
  3. βœ… Risk & Compliance - Privacy-preserving with transparent settlement

πŸ“ License

MIT

About

Privacy-first decentralized prediction market with AI-powered settlement. Bet anonymously, settle with truth using Chainlink CRE, GPT-4, and multi-source verification.

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published