Fetching latest headlinesโ€ฆ
I open-sourced Open-source Solana Prediction Market smart contract built with Anchor
NORTH AMERICA
๐Ÿ‡บ๐Ÿ‡ธ United Statesโ€ขJune 27, 2026

I open-sourced Open-source Solana Prediction Market smart contract built with Anchor

1 views0 likes0 comments
Originally published byDev.to

Open-source Solana Prediction Market smart contract built with Anchor

Open-source Solana Prediction Market smart contract built with Anchor. Enables creation of binary YES/NO outcome markets with bonding curve trading (SOL tokens), platform + creator fees, Metaplex metadata, whitelist support, and optional backend co-signing for controlled launches.

I open-sourced solana-prediction-market-smart-contract for developers in Solana / Anchor smart contract development. This post walks through what it does, how the pieces fit together, and how to run it locally.

Live demo / site: https://takes.fun/

Why I built this

  • Automate trading or snipe strategies with a typed codebase
  • Backtest ideas before deploying with real capital
  • Extend the bot with your own risk rules and market filters

Most tutorials stop at a smart contract or a UI mockup. I wanted a complete vertical slice โ€” wallet flow, on-chain logic, backend state, and a responsive frontend โ€” so you can study or fork a production-shaped codebase.

What it does

  • Open-source Solana Prediction Market smart contract built with Anchor
  • Enables creation of binary YES/NO outcome markets with bonding curve trading (SOL tokens), platform + creator fees, Metaplex metadata, whitelist support, and optional backend co-signing for controlled launches
  • Platform fees on buy and sell (standard and reduced โ€œsmallโ€ fee tiers for whitelisted users).
  • Creator fees on buy and sell.
  • Cross-side liquidity shift on buys (configurable cross_sol_factor), which links YES and NO reserve dynamics.
  • amount โ€” Input amount (lamports for buy, token amount for sell depending on direction).
  • direction โ€” 0 = buy, 1 = sell.
  • token_type โ€” 0 = NO, 1 = YES.

Architecture at a glance

  • On-chain program โ€” Anchor/Rust logic for escrow, rooms, and settlement
  • Application layer โ€” TypeScript backend/frontend tying on-chain and off-chain flows
  • Feature โ€” Open-source Solana Prediction Market smart contract built with Anchor
  • Feature โ€” Enables creation of binary YES/NO outcome markets with bonding curve trading (SOL tokens), platform + creator fees, Metaplex metadata, whitelist support, and optional backend co-signing for controlled launches
  • Feature โ€” Platform fees on buy and sell (standard and reduced โ€œsmallโ€ fee tiers for whitelisted users).
User Wallet  โ†’  On-chain Program  โ†’  VRF / Settlement
                    โ†“
              Backend (API + WebSockets)  โ†’  MongoDB / state
                    โ†“
                 Frontend UI (real-time)

Adjust the diagram to match your repo layout if components differ.

Tech stack

  • Rust
  • Solana
  • Anchor
  • TypeScript

Quick start

git clone https://github.com/DexCrancer/solana-prediction-market-smart-contract.git
cd solana-prediction-market-smart-contract

Setup steps:

  1. Install dependencies (see README โ€” typically npm install or yarn)
  2. Copy .env.example to .env and fill in RPC, wallet, and API keys
  3. Run local validator or point to devnet/mainnet as documented
  4. Start the backend and frontend; connect wallet and create a test room

See the full README for environment variables, deploy scripts, and test commands: https://github.com/DexCrancer/solana-prediction-market-smart-contract

What to explore in the repo

  • Program / contract entrypoints and account models
  • API routes and WebSocket event handlers
  • Frontend wallet adapter and game room components
  • Tests, scripts, and deployment configs

Contributing

Issues and PRs are welcome. If this helped you learn something, a โญ on GitHub makes it easier for others to find.

Links

Disclaimer: Educational content only. Not financial advice. Gambling and trading involve risk; use responsibly and comply with local laws.

anchor #bondingcurve #decentralizedbetting #forecasting #openbook #predictionmarket

Comments (0)

Sign in to join the discussion

Be the first to comment!