What if every correct answer in a quiz rewarded you with crypto?
I decided to test this idea and built Solana Quiz - a decentralized app where users answer daily quiz questions generated by OpenAI and earn Solana tokens for correct answers.
Yes, it really works. And yes - we even mint our own token ๐.
๐ The Idea
Iโve long wanted to combine AI, Rust, and blockchain into a single project where each piece actually works, not just โfor show.โ
The result:
- OpenAI generates fresh questions daily.
- Node.js checks answers and handles the business logic.
- Rust mints tokens on Solana.
- Kafka ties all the services together in a clean event-driven system.
The outcome? A smart, fair, and transparent quiz where rewards donโt land in your email - they land in your Phantom Wallet.
๐ก How It Works
1๏ธโฃ Solana Wallet Authentication
Users connect their Phantom Wallet and sign a message. Node.js verifies the signature and confirms wallet ownership.
No passwords, tokens, or logins - just pure blockchain authentication.
Currently, only Phantom Wallet is supported, but adding more wallets is possible.
2๏ธโฃ Questions Powered by OpenAI
Every morning, Node.js queries the OpenAI API (gpt-4.1-nano
) to get a new set of questions.
OPEN_AI_API_KEY=your_openai_api_key_here
OPEN_AI_MODEL=gpt-4.1-nano
OPEN_AI_LANGUAGE=English
๐ก You need an OpenAI account and API key. Without it, the quiz stays silent ๐ค
The questions are varied: from blockchain history to logic puzzles.
3๏ธโฃ Checking Answers & Rewards
Once the quiz is submitted, Node.js publishes an event to Kafka, and the Rust worker listens for it. It then connects to Solana RPC andโฆ ๐ธ sends tokens straight to your wallet.
Every correct answer instantly becomes real crypto on the blockchain.
๐ Architecture
Service | Technologies | Description |
---|---|---|
Frontend | Next.js, React, TailwindCSS | User interface and wallet integration |
Backend | Node.js, Express, Prisma, KafkaJS, OpenAI API | Quiz logic, question generation, API |
Rust Worker | Rust, Solana SDK, rdkafka | Token minting and Solana transactions |
Database | PostgreSQL | User data and quiz results storage |
Infra | Docker Compose | Service orchestration |
๐ช Creating Your Own Token
The heart of the quiz is a custom SPL token on Solana. This isnโt just a demo coin - it powers the whole quiz economy and makes the reward system transparent and decentralized.
โ ๏ธ Before running the Rust commands, make sure your .env file is ready:
SOLANA_NETWORK=devnet
SOLANA_RPC_ENDPOINT=https://api.devnet.solana.com
SOLANA_AUTHORITY_KEYPAIR_PATH=./secret/authority.json
SOLANA_MINT_KEYPAIR_PATH=./secret/mint.json
SOLANA_TOKEN_NAME="Solana Quiz Token"
SOLANA_TOKEN_SYMBOL="SQT"
SOLANA_TOKEN_METADATA_URI="https://raw.githubusercontent.com/di-zed/internal-storage/refs/heads/main/solana-quiz-token/metadata.json"
๐ก Important: You can change the token name, symbol, description, and metadata - itโs your token, your universe.
๐ Step-by-step: Minting your own Solana token
Let's go through the full process โ from building the binary to minting your first million tokens ๐ช
# ๐ฆ Enter the Rust container
docker-compose exec rust /bin/bash
# โ๏ธ Build the release binary
cargo build --release
# ๐ง Request some SOL for your authority account
./target/release/solana request-airdrop --sol-amount 5
# ๐ช Create a new token mint
./target/release/solana create-mint
# ๐ผ Create a token account to store your tokens
./target/release/solana create-token-account
# ๐ฐ Mint 1,000,000 tokens
./target/release/solana mint-tokens --amount 1000000
๐ก These tokens are your reward bank โ
every time someone answers correctly in the quiz, the Rust worker distributes tokens from this pool.
To make your token display nicely in Phantom Wallet and Solana Explorer, add metadata such as:
๐ง Why Rust
Rust is perfect for working with the Solana SDK - safe, async-friendly, and memory-safe.
Even if you were a bit intimidated by Rust before, this project will make it your new crypto buddy ๐ฆ.
๐ Use Cases
- ๐ EdTech: tokenize learning - correct answers = real rewards.
- ๐ข Corporate quizzes: motivate employees with tokens.
- ๐ Crypto communities: daily activities and rewards on Solana.
- ๐ฐ Loyalty & gamification: on-chain incentives for engagement.
๐งญ Roadmap
- ๐ NFT rewards - issue NFTs for streaks of correct answers.
- ๐ Solana Program - store quiz history and auto-distribute NFTs.
- ๐ Mainnet-beta migration.
The Solana program will eventually track quiz history on-chain and automatically reward users who maintain a streak (e.g., 7 days in a row).
NFTs can be created manually via Metaplex - your collection, your designs, your rewards ๐จ
๐งฉ A Bit of Technical Info
I didnโt dive into setup commands in this article - we want it to be easy to read ๐
If you want to actually run the project, mint your own token, connect OpenAI, and see Solana deliver real rewards - check the README on GitHub.
It has step-by-step instructions, .env
examples, and Docker, Rust, and Node.js commands - everything you need to dig deeper.
๐งฑ Bottom Line
Solana Quiz isnโt a demo or experiment. Itโs a live app where AI, Rust, and blockchain work together:
- OpenAI generates content
- Node.js manages logic
- Kafka connects everything
- Rust handles real transactions
The result? A fair reward system where knowledge brings you crypto, not just points.
โ๏ธ The project runs entirely via Docker - clone the repo, follow the README, and youโre good to go. Everything is covered, including key generation and OpenAI/Solana setup.
๐ฆ GitHub: github.com/di-zed/solana-quiz
๐ License: MIT
โ๏ธ Author: @di-zed
Top comments (0)