Buy option-coins on prediction polls. Winners take the entire losing pool.
Real SOL · Real stakes · Fully on-chain
Quick Start · Features · Architecture · Tech Stack · Contributing
Live Demo: https://instinct-fi.vercel.app (Solana Devnet)
- About the Project
- Civic Engagement & Janamat (जनमत)
- Features
- Tech Stack
- Architecture
- How It Works
- Quick Start
- Project Structure
- On-Chain Programs
- Tokenomics
- Security
- Roadmap
- Contributing
- License
InstinctFi is a decentralized prediction-market platform built on Solana using the Anchor framework. Users connect their Phantom wallet, create or participate in prediction polls by purchasing "option-coins" with real SOL, and earn proportional rewards when their predicted option wins.
All poll creation, voting, settlement, and reward distribution logic runs entirely on-chain via Program Derived Addresses (PDAs) — no centralized servers control funds.
| Problem | Solution |
|---|---|
| Centralized platforms can manipulate outcomes | Fully on-chain, transparent, immutable |
| No audit trail for votes or fund distribution | Every vote and transfer recorded on Solana |
| Free polls → low-quality predictions | Real SOL stakes → skin in the game |
| No financial incentive | Winners take the entire losing pool |
InstinctFi isn't just a prediction market — it's a decentralized civic engagement platform. Traditional opinion polls are cheap: anyone can click a button without consequence. Prediction markets flip this by requiring participants to stake real value, ensuring opinions are informed and genuine.
This makes InstinctFi a powerful tool for Janamat (जनमत — public opinion) collection:
| Use Case | How InstinctFi Helps |
|---|---|
| Policy Forecasting | Will a proposed policy succeed? Citizens stake their conviction with real SOL. |
| Community Governance | DAOs and local bodies can gauge informed public sentiment through prediction polls. |
| Accountability Tracking | Track whether elected officials deliver on promises via community-driven markets. |
| Decentralized Janamat Sangrah (जनमत संग्रह) | On-chain, transparent, tamper-proof public opinion collection — no central authority can censor or manipulate results. |
Why prediction markets > traditional polls? Research consistently shows that prediction markets produce more accurate forecasts than surveys or expert panels, because participants have skin in the game. InstinctFi brings this proven mechanism on-chain with Solana's speed and transparency.
Example civic polls:
- 🇳🇵 "Should Kathmandu implement an odd-even vehicle rule?"
- 🏗️ "Will Nepal's digital ID rollout complete by 2027?"
- 🗳️ "Should ward-level budgets be decided by community polls?"
✈️ "Will Pokhara International Airport reach 1M passengers by 2028?"
- Phantom Wallet Auth — One-click login, no passwords or email
- Create Prediction Polls — Custom options, duration, unit price, and initial SOL investment
- Option-Coin Voting — Buy coins for your predicted option; more coins = higher conviction & reward
- Trustless Settlement — Anyone can trigger settlement after the poll ends; highest-vote option wins
- Proportional Rewards — Winners split the entire prize pool proportional to their coin count
- Multi-Period Leaderboard — Weekly, monthly, and all-time rankings with multiple sort criteria
- Rich Profile Dashboard — Personal stats, created polls, vote history, net profit tracking
- Dark Mode UI — Polished dark theme with smooth Framer Motion animations
- PWA Support — Installable as a Progressive Web App
- Image Uploads — Poll images via Supabase storage with compression
- Multi-Language Support — Internationalization-ready with language toggle
- Real-Time Notifications — In-app notification bell for poll activity
- Poll Comments — Community discussion on each poll
- Share & Embed — Share polls via link or embed in external sites
- Activity Feed — Platform-wide activity stream
- Admin Panel — Admin wallet management for poll moderation
| Layer | Technology |
|---|---|
| Blockchain | Solana (Devnet) |
| Smart Contracts | Anchor 0.30.1 (Rust) |
| Frontend | Next.js 15, React 19, TypeScript |
| Styling | Tailwind CSS 3.4, Framer Motion |
| Wallet | Phantom (via @solana/wallet-adapter) |
| Off-Chain Storage | Supabase (images, caching) |
| Testing | ts-mocha, Chai |
┌──────────────────────────────────────────────────────────┐
│ FRONTEND (Next.js 15) │
│ │
│ ┌──────────┐ ┌──────────┐ ┌────────────┐ ┌────────┐│
│ │ Landing │ │ Polls │ │ Leaderboard│ │Profile ││
│ │ Page │ │ CRUD │ │ (3 tabs) │ │ Stats ││
│ └────┬─────┘ └────┬─────┘ └─────┬──────┘ └───┬────┘│
│ └──────────────┴──────────────┴──────────────┘ │
│ │ │
│ Providers.tsx (App Context) │
│ Wallet auth · State management · TX layer │
└──────────────────────────┬───────────────────────────────┘
│ @solana/web3.js
▼
┌──────────────────────────────────────────────────────────┐
│ SOLANA BLOCKCHAIN (Devnet) │
│ │
│ ┌────────────────────────────────────────────────────┐ │
│ │ instinctfi (Unified Program) │ │
│ │ │ │
│ │ initialize_user · create_poll · edit_poll │ │
│ │ delete_poll · cast_vote · settle_poll │ │
│ │ claim_reward · sweep_dust │ │
│ └────────────────────────────────────────────────────┘ │
│ │
│ PDAs: UserAccount · PollAccount · Treasury · Vote │
└──────────────────────────────────────────────────────────┘
Creator (SOL) ──→ create_poll ──→ Treasury PDA (holds SOL)
│
Voter (SOL) ──→ cast_vote ──→ Treasury PDA (more SOL)
│
Anyone ──→ settle_poll ──→ Winner determined (highest votes)
│
Winner ──→ claim_reward ←── Treasury PDA sends proportional SOL
- Connect — User connects Phantom wallet; on-chain UserAccount PDA is created
- Create or Browse — Create a poll with SOL investment, or browse existing polls
- Vote — Buy option-coins for a predicted outcome (SOL → Treasury PDA)
- Settle — After expiry, anyone triggers settlement; highest-voted option wins
- Claim — Winners call
claim_rewardto receive proportional SOL from the pool
| Requirement | Version | Purpose |
|---|---|---|
| Node.js | ≥ 18 | Frontend development |
| npm or yarn | Latest | Package management |
| Phantom Wallet | Browser extension | Wallet connection (set to Devnet) |
| Rust & Cargo | Latest stable | (Optional) Smart contract development |
| Solana CLI | ≥ 1.18 | (Optional) Blockchain interaction |
| Anchor CLI | 0.30.1 | (Optional) Smart contract framework |
git clone https://github.com/rajanpanth/instinctfi.git
cd instinctfi# Navigate to the frontend app
cd app
# Install dependencies
npm install
# Start the development server
npm run devOpen http://localhost:3000 in your browser.
Note: Make sure your Phantom wallet is set to Devnet (
Settings → Developer Settings → Change Network → Devnet).
Only needed if you want to modify the on-chain programs.
# Return to root directory
cd ..
# Install root dependencies
yarn install
# Build all Anchor programs
anchor build
# List generated program keys
anchor keys list
# Configure Solana CLI for devnet
solana config set --url devnet
# Airdrop SOL for deployment fees
solana airdrop 2
# Deploy to devnet
anchor deployAfter deployment, update the program IDs in:
Anchor.tomlapp/src/lib/program.ts
- Use the in-app "Claim SOL" button (devnet airdrop)
- Or run:
solana airdrop 2 <YOUR_WALLET_ADDRESS> --url devnet
instinctfi/
├── Anchor.toml # Anchor workspace configuration
├── Cargo.toml # Rust workspace manifest
├── package.json # Root dependencies (Anchor testing)
├── tsconfig.json # TypeScript config for tests
│
├── programs/
│ └── instinctfi/ # ★ Unified Anchor program
│ └── src/
│ ├── lib.rs # Program entry (8 instructions)
│ ├── state.rs # Account structs (PDAs)
│ ├── errors.rs # Custom error enum
│ └── instructions/ # One file per instruction
│ ├── cast_vote.rs
│ ├── claim_reward.rs
│ ├── create_poll.rs
│ ├── delete_poll.rs
│ ├── edit_poll.rs
│ ├── initialize_user.rs
│ ├── sweep_dust.rs
│ └── settle_poll.rs
│
├── tests/
│ └── voting.ts # End-to-end Anchor tests
│
└── app/ # Next.js 15 Frontend
├── package.json
├── next.config.js
├── tailwind.config.js
└── src/
├── app/ # App Router pages
│ ├── page.tsx # Landing page
│ ├── create/ # Poll creation
│ ├── polls/ # Poll listing & detail
│ ├── leaderboard/ # Leaderboard
│ ├── profile/ # User profile
│ ├── admin/ # Admin panel
│ └── activity/ # Activity feed
├── components/ # Reusable UI components
└── lib/ # Utilities, types, program interaction
| Instruction | Description | SOL Movement |
|---|---|---|
initialize_user |
Create user PDA account | Rent only |
create_poll |
Create poll + treasury PDA with SOL investment | Creator → Treasury |
edit_poll |
Edit poll metadata (creator-only, 0 votes, active) | None |
delete_poll |
Delete poll and refund SOL from treasury | Treasury → Creator |
cast_vote |
Buy option-coins with SOL | Voter → Treasury |
settle_poll |
Determine winner + send creator reward | Treasury → Creator |
claim_reward |
Winners claim proportional SOL from pool | Treasury → Winner |
sweep_dust |
Sweep remaining platform fees + rounding dust | Treasury → Creator |
| Account | Seeds | Description |
|---|---|---|
UserAccount |
["user", authority] |
User profile & cumulative stats |
PollAccount |
["poll", creator, poll_id] |
Poll data, options, vote counts |
Treasury |
["treasury", poll_account] |
SOL vault for each poll |
VoteAccount |
["vote", poll_account, voter] |
Per-user vote record on a poll |
J9AqrLZWDXaQfDwtFpC2GG9hBb7SAPxRwVpGs753EgWV
Deployed to Solana devnet on 2026-03-01.
┌─────────────────────────────────────────────────┐
│ POLL ECONOMICS EXAMPLE │
│ │
│ Creator Investment: 1.0 SOL │
│ ├── Platform Fee (1%): -0.01 SOL │
│ ├── Creator Reward (1%): -0.01 SOL │
│ └── Initial Pool (98%): 0.98 SOL │
│ │
│ + Voter A buys 50 "Yes" coins: +0.50 SOL │
│ + Voter B buys 30 "No" coins: +0.30 SOL │
│ + Voter C buys 20 "Yes" coins: +0.20 SOL │
│ │
│ Total Pool: 1.98 SOL │
│ │
│ Result: "Yes" wins (70 vs 30 votes) │
│ │
│ Voter A reward: (50/70) × 1.98 = 1.414 SOL │
│ Voter C reward: (20/70) × 1.98 = 0.566 SOL │
│ Voter B reward: 0 SOL │
│ Creator reward (on settle): 0.01 SOL │
└─────────────────────────────────────────────────┘
Reward formula:
user_reward = (user_winning_votes / total_winning_votes) × total_pool
| Concern | Mitigation |
|---|---|
| Fund safety | Real SOL transfers via system_program::transfer CPI — not internal accounting |
| Treasury control | PDAs hold all funds; only the program can sign withdrawals |
| Self-voting | Creator cannot vote on their own poll (enforced on-chain) |
| Double settlement | Status flag prevents settling a poll more than once |
| Double claiming | claimed: bool on VoteAccount prevents re-claims |
| Overflow | Proportional rewards computed with u128 math |
| Refunds | Full SOL returned on poll deletion if no votes cast |
| Account validation | Anchor constraints (has_one, seeds, bump) enforce PDA ownership |
| Permissionless settlement | Anyone can trigger after end time — no single point of failure |
| Phase | Feature | Description |
|---|---|---|
| ✅ Implemented — all transactions use real SOL | ||
| v1.2 | Token Extensions | Token-2022 vote receipt NFTs for proof of participation |
| v1.3 | Oracle Integration | Pyth/Switchboard for auto-settlement of price predictions |
| v2.0 | DAO Governance | Token holders vote on platform parameters |
| v2.1 | Tournament Mode | Multi-round prediction tournaments |
| v2.2 | Mobile App | React Native with Phantom mobile deep-linking |
| v3.0 | Cross-Chain | Bridge to Ethereum/Polygon |
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for details.