A Solana-based prediction market where users can make private binary predictions (YES/NO) using a commit-reveal scheme. Markets resolve automatically using Pyth Network's SOL/USD oracle.
- Admin creates a market with a question, resolution time, and SOL price threshold
- Users stake wSOL and commit their hidden prediction (YES or NO)
- Market resolves automatically when resolution time passes, using Pyth oracle
- Users reveal their prediction before the deadline
- Winners get their stake back (1x refund), losers lose their stake
Your prediction is stored as a hash on-chain until you reveal it. No one can see what you bet until after the market resolves. This prevents front-running and manipulation.
- Program ID (devnet):
6CY8YgqAoXq66baW5B41Yw72D7unQjFN3wuMkZr2bCRM - Key accounts:
Config: Global settings (admin, token mint, fee recipient)Market: Market data (question, resolution time, price threshold, vault)UserPosition: Per-user commitment and reveal state
- Wallet integration via Solana Wallet Adapter
- Server-side Pyth price fetching (API route)
- Full admin panel for market management
- Rust + Anchor CLI
- Node.js + npm/yarn
- Solana CLI (devnet configured)
- Devnet SOL:
solana airdrop 2
anchor build
anchor deploycd frontend
npm install
npm run dev- Connect wallet → Initialize tab → Initialize config
- Create Market → Set question, resolution time, price threshold
- Stake & Commit → Enter market ID, amount, choose YES/NO → Save the salt!
- Wait for resolution time → Admin → Resolve Market
- Reveal & Claim → Enter market ID, outcome, salt → Get refund if correct
- Commit-reveal: Predictions hidden until reveal
- Pyth oracle: Automatic resolution based on SOL/USD price
- Simple payouts: 1x refund for correct predictions
- Admin tools: Create markets, resolve, forfeit unrevealed stakes
initialize: Set up global config (admin only)create_market: Create new prediction marketstake_and_commit: Stake tokens and commit hidden predictionreveal_and_claim: Reveal prediction and claim refund if correctresolve_market: Resolve market using Pyth oracle (admin only)forfeit_unrevealed: Transfer unrevealed stakes to protocol (admin only)
- Push repo to GitHub
- Import in Vercel → Set root directory to
frontend/ - Add environment variables
- Deploy
- Devnet only: This is an MVP, not production-ready
- Re-initialize after redeploy: New program ID means fresh start
- Save your salt: You need it to reveal and claim
- Reveal deadline: 2 weeks after market resolution
Educational purposes only. UNAUDITED - use at your own risk.