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
Secret Claude Tracker Shocks Users After Anthropic's Anti-Surveillance Stance
12h ago
EV Batteries Defy Expectations, Last Hundreds of Thousands of Miles
1d ago
GBase 8a Performance Anomaly Case Study: How a Single Parameter Change Sparked a Chain Reaction
1d ago
Who Else Has Inherited a Codebase With Zero Comments and a Prayer?
1d ago
ๅฎ็พ็ๅนณๅบธ
3h ago