A decentralized question and answer platform built on Solana that enables direct monetary incentives for expert knowledge through on-chain bounties and trustless escrow.
Overview • Key Features • Architecture • Getting Started • Documentation
BountyStack is a Web3-native Q&A platform that fundamentally reimagines how knowledge exchange is incentivized. By leveraging Solana smart contracts, the platform enables users to attach SOL bounties to questions, with funds held in trustless escrow and automatically distributed to experts who provide accepted answers.
- Trustless Escrow: SOL bounties are locked in smart contract-controlled Program Derived Addresses, eliminating counterparty risk
- Instant Settlement: Automated fund distribution through atomic on-chain transactions
- Transparent Marketplace: Open competition where experts can browse and compete for active bounties
- Low Transaction Costs: Built on Solana for fast, affordable blockchain interactions
- Wallet Integration: Seamless connection with popular Solana wallets
- Reputation System: Track expertise and build credibility through answered bounties
- Real-time Updates: Live notifications for new questions, answers, and bounty awards
Traditional Q&A platforms rely on reputation systems and voluntary contributions, which often fail to incentivize responses for:
- Complex, specialized technical problems
- Time-sensitive business-critical questions
- Niche domains with limited expert availability
- High-value consulting-level expertise
These platforms lack native mechanisms for offering and guaranteeing financial compensation for high-quality answers, creating friction in knowledge markets where expertise has tangible value.
BountyStack addresses these limitations through:
- On-chain escrow: SOL bounties are locked in smart contract-controlled Program Derived Addresses (PDAs), eliminating counterparty risk
- Trustless settlement: Automated fund distribution based on verifiable on-chain actions
- Direct incentives: Market-driven pricing for knowledge that reflects its true value
- Transparent competition: Open marketplace where experts compete on answer quality
- Immutable records: All transactions and awards permanently recorded on Solana blockchain
The platform consists of three core components working in harmony:
Next.js-based frontend application providing:
- Wallet integration via Solana Wallet Adapter
- Real-time question and bounty browsing
- Answer submission and bounty award interfaces
- State management with Zustand and data fetching via SWR
- Responsive design with TailwindCSS
Express.js API server handling:
- User authentication and profiles
- Question and answer metadata storage
- MongoDB integration for off-chain data
- Input validation with Zod schemas
- RESTful API endpoints for CRUD operations
Solana programs built with Anchor framework:
- Escrow account creation and management
- Bounty locking and distribution logic
- Authority verification for payouts
- Program deployment and testing infrastructure
- Security-audited Rust implementations
| Layer | Technologies |
|---|---|
| Frontend | Next.js, React, TailwindCSS, TypeScript |
| State Management | Zustand, SWR |
| Backend | Node.js, Express, MongoDB |
| Validation | Zod |
| Blockchain | Solana, Anchor, Rust |
| Web3 Integration | Solana Wallet Adapter, web3.js |
| Development | ESLint, Prettier, Nodemon |
User posts a question and specifies a SOL bounty amount. Upon submission, funds are transferred from their wallet to a newly created escrow PDA unique to that question. The escrow account is deterministically derived and cannot be tampered with.
Experts browse active bounties filtered by category, bounty amount, and recency. They submit detailed answers, which are stored off-chain with cryptographic references to the on-chain bounty for verification.
Question author reviews submitted answers and selects the best response. This triggers a smart contract instruction that:
- Validates the author's signing authority
- Verifies the answer recipient's wallet address
- Transfers the full bounty from escrow to the winner
- Closes the escrow account and returns rent to the question author
- Emits an event log for indexing and notifications
All operations occur atomically, ensuring either complete success or complete rollback.
Ensure you have the following installed:
- Node.js 18+ and npm/pnpm
- Rust 1.70+ and Cargo
- Anchor CLI 0.28+
- Solana CLI 1.16+
- MongoDB 6.0+
- Git
Clone the repository:
git clone https://github.com/ANAS727189/Bounty-Stack.git
cd Bounty-Stackcd client
npm install
cp .env.example .envConfigure your .env file:
NEXT_PUBLIC_SOLANA_NETWORK=devnet
NEXT_PUBLIC_API_URL=http://localhost:3001
NEXT_PUBLIC_PROGRAM_ID=your_program_idStart the development server:
npm run devThe frontend will be available at http://localhost:3000
cd server
pnpm install
cp .env.example .envConfigure your .env file:
MONGODB_URI=mongodb://localhost:27017/bountystack
PORT=3001
JWT_SECRET=your_jwt_secret
SOLANA_RPC_URL=https://api.devnet.solana.comStart the API server:
pnpm devThe API will be available at http://localhost:3001
cd web3
npm installBuild the program:
anchor buildRun tests:
anchor testDeploy to devnet:
anchor deploy --provider.cluster devnetUpdate the program ID in your frontend and backend configurations.
The REST API exposes the following endpoints:
POST /api/users/register- Create new user accountPOST /api/users/login- Authenticate userGET /api/questions- List all questions with paginationPOST /api/questions- Create new questionGET /api/questions/:id- Get question detailsPOST /api/answers- Submit answer to questionGET /api/answers/:questionId- Get all answers for question
Key program instructions:
initialize_bounty- Create escrow and lock SOLsubmit_answer- Register answer submissionaward_bounty- Transfer funds to winnercancel_bounty- Return funds to asker (if no valid answers)
Refer to /web3/programs/bountystack/src/lib.rs for complete IDL.
Bounty-Stack/
├── client/ # Next.js frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Next.js pages
│ │ ├── hooks/ # Custom React hooks
│ │ ├── store/ # Zustand state management
│ │ └── utils/ # Utility functions
│ └── public/ # Static assets
├── server/ # Express backend
│ ├── src/
│ │ ├── controllers/ # Route controllers
│ │ ├── models/ # MongoDB schemas
│ │ ├── routes/ # API routes
│ │ ├── middleware/ # Express middleware
│ │ └── utils/ # Helper functions
│ └── tests/ # API tests
└── web3/ # Solana programs
├── programs/ # Anchor programs
├── tests/ # Program tests
└── migrations/ # Deployment scripts
Frontend:
cd client
npm testBackend:
cd server
pnpm testSmart Contracts:
cd web3
anchor testWe use ESLint and Prettier for code formatting:
npm run lint
npm run formatFrontend:
cd client
npm run build
npm startBackend:
cd server
pnpm build
pnpm startvercel --prodConfigure environment variables and deploy using your preferred platform.
anchor deploy --provider.cluster mainnetNote: Ensure thorough testing and security audits before mainnet deployment.
- GitHub Discussions: Ask questions and share ideas
- Issue Tracker: Report bugs
This project is licensed under the MIT License. See the LICENSE file for details.
Built with support from the Solana developer community and inspired by the need for trustless knowledge markets in Web3.
Made with ⚡ on Solana
Star this repository if you find it helpful!