A course-specific, blockchain-powered Q&A platform for Nigerian university students. AnswerChain fixes unstructured peer learning on WhatsApp/Telegram and the lack of syllabus-aligned help on global forums by adding curriculum context, stake-based incentives, and verifiable on-chain rewards.
AnswerChain introduces ANSWRβa native utility token that fuels the ecosystem.
- New users receive a starter bundle of ANSWR on registration.
- Posting a question reserves a small token fee as a reward pool.
- Students answer and upvote; top answers share the reward pool.
- Optional bounties attract higher-quality solutions.
- Earned tokens can be redeemed via Solana Pay or exchanged for platform merchandise.
- The result: a learn-to-earn loop that is academically impactful and financially rewarding.
-
Onboarding
Register with university email, link a Solana wallet, receive welcome ANSWR tokens. -
Ask a Question
Fill Title, Details, Category (e.g., Mathematics, CS), and up to 5 tags.
A small posting fee (in ANSWR) is reserved as the reward pool. -
Answer & Upvote
Peers submit answers (comments). Community upvotes surface the best responses. -
Reward Distribution
When the asker accepts the best answer (or after a timeout), the smart contract splits tokens based on upvote weights. -
Bounties (Optional)
The asker can attach extra ANSWR to a question; bounty is locked and paid to the accepted answer. -
Redemption
Redeem earned ANSWR to SOL via Solana Pay (or swap partners), or claim exclusive merch.
-
Token Initialization
Each new user receives a fixed welcome amount (configurable, anti-sybil checks apply). -
Question Posting
A posting fee (configurable) is escrowed in a reward pool smart contract. -
Answer Evaluation
Upvotes are weighted (e.g., by reputation, course level, or staking).
Off-chain scoring (reputation calc) + on-chain settlement (token split). -
Reward Payouts
On acceptance or timeout: distribute ANSWR pro-rata using upvote weights; transfer bounty to accepted answerer. -
Bounty Layer
Optional bounty locked on chain; released only to the accepted answer or back to asker on dispute/timeout. -
Scalability
Tokenomics can power competitions, inter-university leagues, and sponsored challenges with programmatically verifiable results.
- Frontend: React + TypeScript (Vite), Tailwind (optional)
- Backend API: Node.js + Express + TypeScript
- Database: MongoDB + Mongoose (questions, comments, profiles, reputation)
- Blockchain: Solana (Rust programs / Anchor optional)
- ANSWR: SPL token (mint, escrow vaults, distribution)
- Solana Pay for redemptions
- Validation & DX: Zod, ESLint, Prettier
- CI/CD (optional): GitHub Actions, Docker
answer-chain/
ββ apps/
β ββ web/ # React + TS frontend
β ββ api/ # Express + TS backend
ββ onchain/
β ββ programs/ # Rust/Anchor Solana programs
β ββ scripts/ # IDLs, deployment helpers
ββ packages/
β ββ ui/ # shared UI (optional)
β ββ types/ # shared TypeScript types
ββ docs/
ββ README.md # this file
Base URL (local):
http://localhost:3000/api
-
POST /questionsβ Create a question
Body{ "title": "How do I solve this differential equation with boundary conditions?", "details": "What I've tried... Equations... Expected outcome...", "category": "Mathematics", "tags": ["calculus", "ode"], "bounty": 100 } -
GET /questionsβ List (query params:q,category,tags,sort,page,limit) -
GET /questions/:idβ Get one (includescommentsCount) -
PATCH /questions/:idβ Update (title/details/category/tags/bounty/status) -
DELETE /questions/:idβ Delete (and cascade delete comments) -
POST /questions/:id/bountyβ Set/Increase bounty
Body{ "bounty": 250 } -
PATCH /questions/:id/accept/:commentIdβ Accept a comment as the answer (closes question)
POST /questions/:id/commentsβ Add comment
Body{ "content": "Separate variables: du/u = k dx ...", "parentCommentId": "optional-parent-comment-id" }GET /questions/:id/commentsβ List comments (flat; useparentCommentIdfor threads)PATCH /comments/:commentIdβ Update comment
Body{ "content": "Small correction..." }DELETE /comments/:commentIdβ Delete comment
Categories (exact strings):
Mathematics,Physics,Computer Science,Chemistry,Biology,Engineering,Medicine,Social Sciences.
{
_id: ObjectId,
title: string, // max 200
details: string, // max 20k
category: "Mathematics" | ...,
tags: string[], // up to 5
bounty: number, // >= 0
createdBy: ObjectId, // User
acceptedCommentId?: ObjectId,
status: "open" | "closed",
createdAt: Date,
updatedAt: Date
}{
_id: ObjectId,
question: ObjectId, // Question
content: string, // max 20k
createdBy: ObjectId, // User
parentCommentId?: ObjectId, // for threads
createdAt: Date,
updatedAt: Date
}- Welcome Grant:
WELCOME_TOKENSper verified student. - Posting Fee:
POST_COST_TOKENSescrowed to reward pool. - Upvote Weights:
weight = base + rep_factor(reputation) + course_factor(level) + stake_factor(stakedANSWR) - Payout Split: Pro-rata by upvote weight; bounty 100% to accepted answerer.
- Redemption: Solana Pay (convert ANSWRβSOL) or merch claims.
On-chain: SPL mint for ANSWR, escrow PDAs for per-question pools, distribution instruction invoked by backend oracle or client after acceptance/timeout.
- Programs
- ANSWR Mint: SPL token (existing mint address).
- Escrow Program:
create_pool(question_id, poster_pubkey, amount)fund_bounty(question_id, asker_pubkey, amount)settle(question_id, accounts[], split[])(verifies signatures; distributes)refund_if_timeout(question_id)(optional governance)
- PDAs
RewardPoolPDA(question_id)holds escrowed ANSWR.
- Guards
- University email verification β wallet gate
- Anti-sybil rate limits (per IP/semester)
- Program checks: signer, question status, distribution sum = pool + bounty
- Node.js 18+, pnpm/npm
- MongoDB (local or Atlas)
- Solana CLI + local validator (optional for on-chain testing)
- Rust + Anchor (if using Anchor)
cd apps/api
cp .env.example .env
# Edit .env: MONGODB_URI, PORT=3000, SOLANA_RPC_URL, ANSWR_MINT, etc.
pnpm install
pnpm dev # runs nodemon on http://localhost:3000Environment (.env)
PORT=3000
MONGODB_URI=mongodb://localhost:27017/answerchain
SOLANA_RPC_URL=https://api.devnet.solana.com
ANSWR_MINT=YourSplMintAddress
WELCOME_TOKENS=100
POST_COST_TOKENS=5
JWT_SECRET=dev-only-use-real-secret
cd apps/web
cp .env.example .env
# VITE_API_BASE_URL should match API: http://localhost:3000/api
pnpm install
pnpm dev # http://localhost:5173 (default Vite port)Frontend env (.env)
VITE_API_BASE_URL=http://localhost:3000/api
Base: http://localhost:3000/api
- Create question
POST /questions
{
"title": "Big-O of nested loops with varying ranges?",
"details": "I tried amortized analysis... need clarity on inner loop bounds.",
"category": "Computer Science",
"tags": ["algorithms","big-o"],
"bounty": 50
}- Add comment
POST /questions/:id/comments
{
"content": "Outer loop N, inner averages to N/2 β O(N^2)."
}-
Accept answer
PATCH /questions/:id/accept/:commentId -
List questions
GET /questions?category=Computer%20Science&sort=bounty&page=1&limit=10
- Auth: JWT/session recommended; rate limit writes (questions, comments, upvotes).
- Validation: All payloads validated with Zod on the server.
- Abuse Mitigation:
- University email domain whitelisting
- Device/browser fingerprint (light)
- Treasury/bounty timelocks + allowlist programs for settlement
- Secrets: Never commit private keys; use KMS or key managers for settlement oracles (if any).
- MVP: Q&A + bounties + Solana payouts
- Reputation: Per-course reputation affecting upvote weight
- Courses/Faculties: Per-school/department gating, course codes (e.g., MAT 201)
- Events: Inter-university contests, sponsored challenges
- Moderation: Flagging, plagiarism detection, LLM-assisted triage
- Mobile: PWA first; native app later
- DAO/Grants: Governance for token parameters and sponsorship pools
- Fork & create a feature branch.
- Follow coding standards (ESLint/Prettier;
pnpm lint). - Write minimal tests for business logic.
- Open a PR with a clear description and screenshots (if UI).
Why Solana?
Low fees, high throughput, mature SPL ecosystem, Solana Pay support.
Is ANSWR transferrable?
Yes (SPL token). Transfers may be restricted per compliance during alpha.
How do payouts work?
On acceptance/timeout, the program splits ANSWR; students redeem to SOL via Solana Pay or exchange merch credits.
Can I use it without tokens?
Read-only browsing is free; posting/answering uses small token amounts (to curb spam and reward quality).
MIT β see LICENSE for details.
AnswerChain turns everyday coursework into a verifiable, rewarding, and collaborative learning economyβbuilt in Nigeria, for Nigerian students, on Solana.