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:
- Install dependencies (see README β typically npm install or yarn)
- Copy .env.example to .env and fill in RPC, wallet, and API keys
- Run local validator or point to devnet/mainnet as documented
- 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
- GitHub: https://github.com/DexCrancer/solana-prediction-market-smart-contract
- Website: https://takes.fun/
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
United States
NORTH AMERICA
Related News

Mattress Firm Coupons: Save up to $600
4h ago
π I Built a Dropshipping Automation Pipeline β Here's What I Learned (and What I'd Do Differently)
11h ago
How I Cut My LLM API Bill by 40x: A Freelancer's Migration Story
11h ago
Cursor AI Review 2026: The AI-Native Code Editor
8h ago

Another Model Rewrote My Memories. Here's How I Caught It.
8h ago