All projects

Confidential Prediction Market with Chainlink CRE

A private, automated prediction market using Chainlink CRE to securely fetch external data and settle bets on-chain.

Prediction Markets

What it is

Confidential Prediction Market is a decentralized platform where users can place encrypted bets on real-world events (e.g., "Will the temperature in London exceed 5°C tomorrow morning?"). The market leverages Chainlink's Runtime Environment (CRE) to automate the entire settlement process – from event trigger to external data fetching, cryptographic signing, and on-chain result submission – without any manual intervention.
How does it work?

  1. Market Creation & Encrypted Bets: An admin creates a market with a description, betting deadline, and resolution window. Users bet by sending encrypted data (choice + amount) using a temporary AES key. The actual choice remains hidden on-chain until settlement.
  2. Request Settlement: After the deadline, anyone can call requestSettlement(), emitting an event that triggers the CRE workflow.
  3. CRE Workflow in Action:
    • Log Trigger captures the event.
    • HTTP Capability calls a public weather API (e.g., OpenWeatherMap) to fetch real-time temperature.
    • Sign Capability signs the outcome report with the CRE DON's private key, ensuring authenticity.
    • EVM Write Capability submits the signed result to the contract via submitResult().
  4. On-Chain Resolution & Payout: The contract verifies the signature, updates the market state, and allows winners to claim their proportional rewards.
    What problem does it solve?
    Existing prediction markets like Polymarket suffer from three major flaws:
  • Privacy Leakage: All bets are public, enabling front-running and strategy exposure.
  • Manual/Unreliable Settlement: Outcomes often rely on community voting or slow arbitrators.
  • Trust Issues: Results come from opaque sources, eroding user confidence.
    Our solution fixes these by:
  • Encrypting bets to protect user privacy.
  • Automating settlement with a Chainlink CRE workflow – fast, tamper-proof, and verifiable.
  • Trusting cryptographic signatures from a decentralized oracle network instead of human judgment.

How it Works

  • Smart Contract: Written in Solidity (0.8.19), deployed on Sepolia testnet. Manages markets, encrypted bets, and payouts.
  • CRE Workflow: Written in Go, using Chainlink’s CRE SDK. Orchestrates event listening, HTTP API calls, signing, and on‑chain submission.
  • External Data: Public weather API (e.g., OpenWeatherMap) providing real-time temperature.
  • Frontend: Simple Vue app for interaction (optional, for demo).
  • Deployment: Contract on Sepolia; workflow can be simulated via CRE CLI or deployed on Chainlink’s DON.

Links

Created by

  • Dong DaYou
  • Gao DuoYang