High-throughput, non-custodial Web3 skill gaming on Stellar. Stake XLM or USDC, test your knowledge in 10 fast-paced trivia questions, and claim progressive payouts directly from a Soroban smart contract. Zero custody, sub-5-second finality, and negligible fees.
โ ๏ธ Security & Testnet Notice: Quiza is currently deployed on the Stellar Testnet for testing, evaluation, and demonstration purposes only. The smart contracts are unaudited. Do not risk real mainnet funds. Public contract IDs only are published below; no private keys or secrets (S...) are ever stored or committed to this repository.
Quiza is an open-source decentralized trivia platform engineered for fast, mobile-friendly competitive gaming on the Stellar blockchain. Players stake native XLM or USDC across categories including Mathematics, Geography, History, and General Knowledge. Achieving 7 or more correct answers unlocks payouts up to 2.0x funded from an automated house liquidity pool managed entirely by a Soroban smart contract.
- ๐ 100% Non-Custodial & Session Signing: Player secret keys (
S...) are never requested or stored. All transactions and session challenges are signed directly inside the player's Freighter wallet extension using SEP-53 message signing with single-use nonces and 15-minute expiring session tokens (no repetitive popups for answering questions). - ๐พ Dual Database Engine: Fastify API in
apps/apiruns on PGlite locally (in-process WASM PostgreSQL with zero configuration or Docker required) and connects to PostgreSQL viaDATABASE_URLin production. - ๐ Soroban Smart Contract: Written in Rust in
contracts/quiza, enforcing strict liquidity accounting invariants and mathematical payout bounds. - ๐ Strict Liquidity Accounting Invariant: Real token balances in the contract are mathematically bounded at all times:
$$\text{Contract Balance} == \text{pool} + \text{locked} + \text{owed}$$ - ๐ก๏ธ Guaranteed Timeout Refund: If a round remains unresolved after 2 hours (7,200 seconds), players can call
claim_timeoutdirectly on-chain to reclaim 100% of their stake without backend assistance. - ๐ต๏ธ Anti-Cheat Off-Chain Scoring: Trivia question answer keys never leave the server. Player answer selections are evaluated by the backend verifier, which signs and submits the on-chain settlement.
- โก Sub-5-Second Settlement: Native Stellar consensus ensures near-instant settlement without block reorgs.
| Game Mode | Mechanics | Target Audience |
|---|---|---|
| Stake & Win | Choose token (XLM / USDC), category, and stake amount. 10 timed questions. | Competitive players seeking crypto payouts |
| Daily Challenge | 10 synchronized daily questions. Global daily leaderboard competition. | Daily active users & community ranking |
| Practice Mode | Free-play mode without wallet popups or signatures. | Newcomers exploring gameplay |
| Final Score (out of 10) | Payout Multiplier | Net Profit |
|---|---|---|
| 10 / 10 (Perfect) | 2.0x | +100% (Double your stake) |
| 8 โ 9 / 10 | 1.5x | +50% |
| 7 / 10 | 1.2x | +20% |
| 0 โ 6 / 10 | 0.0x | Stake retained in house liquidity pool |
sequenceDiagram
autonumber
actor Player as ๐ง Player (Freighter Wallet)
participant UI as ๐ฅ๏ธ Vite Frontend (React 19)
participant API as โก Fastify Backend (Port 3001)
participant DB as ๐พ Database (PGlite / PostgreSQL)
participant Contract as ๐ QuizaContract (Soroban Testnet)
Note over Player,UI: 1. Authentication & Staking
Player->>Contract: stake(player, token, amount) [Signed in Freighter]
Contract-->>Player: RoundOpened (round_id)
Player->>API: GET /api/challenge?address=G...
API-->>Player: Challenge Nonce
Player->>Player: Sign nonce via Freighter SEP-53
Player->>API: POST /api/session (address, nonce, signature)
API-->>Player: 15-min HMAC Session Token
Note over Player,API: 2. Gameplay & Off-Chain Scoring
Player->>API: POST /api/round-questions [Bearer Token]
API->>DB: Fetch 10 questions (answers hidden)
API-->>Player: Deliver 10 questions
Player->>API: POST /api/verify-round [Bearer Token]
API->>API: Score answers against source-of-truth bank
Note over API,Contract: 3. Settlement & Payout
API->>Contract: resolve(round_id, won, score) [Signed by Verifier]
Contract->>Contract: Update Invariant (locked -= stake, owed += payout)
Contract-->>API: RoundResolved Event
API-->>Player: Final Score, Payout Status & Tx URL
Note over Player,Contract: 4. Non-Custodial Withdrawal
Player->>Contract: withdraw(player, token) [Signed in Freighter]
Contract->>Player: Transfer token payout to player wallet
quiza/
โโโ apps/
โ โโโ api/ # Fastify + TypeScript backend API (PGlite locally, PostgreSQL in prod)
โ โโโ src/ # Routes, challenge auth, worker queue, retry sweeper
โ โโโ test/ # Vitest API integration & security test suite
โ โโโ Dockerfile # Production container definition for Render / Railway
โโโ contracts/
โ โโโ quiza/ # Soroban Rust smart contract (contracts/quiza)
โ โโโ src/lib.rs # Staking, accounting invariant, timeout, withdrawal
โ โโโ src/test.rs # Comprehensive Soroban SDK test suite
โ โโโ Cargo.toml # Contract dependencies & compiler flags
โโโ docs/ # Technical documentation & architecture guides
โ โโโ deploying.md # Production deployment guide (Vercel + Render / PostgreSQL)
โ โโโ contract-interface.md # Detailed Soroban contract specifications & error codes
โ โโโ architecture.md # Deep dive into system components & data flows
โ โโโ smart-contracts.md # Soroban contract API, storage layout & invariants
โ โโโ api.md # REST API endpoints, schemas & authentication
โ โโโ mobile.md # Responsive layout & Freighter mobile roadmap
โ โโโ development.md # Local development setup & dev-runner guide
โ โโโ testing.md # Vitest, Cargo, and mock testing guides
โ โโโ troubleshooting.md # Common error diagnostics & solutions
โ โโโ coding-standards.md # Style guides, linting, and error handling
โ โโโ design-decisions.md # Architecture Decision Records (ADRs)
โ โโโ known-limits.md # Documented protocol constraints
โโโ src/ # Vite + React 19 frontend application
โ โโโ components/ # UI components (StakeModal, ShareModal, Navbar)
โ โโโ lib/quizaContract.js # Soroban RPC client, Freighter bridge, timeout recovery
โ โโโ pages/ # Views (Home, Quiz, Results, Profile, Leaderboard)
โโโ scripts/ # Development orchestrator & deployment scripts
โ โโโ dev-runner.js # Concurrent Fastify + Vite process runner
โโโ .github/ # CI/CD workflows, issue templates, community files
โโโ CONTRIBUTING.md # Contributor onboarding & PR conventions
โโโ CODE_OF_CONDUCT.md # Contributor Covenant v2.1
โโโ SECURITY.md # Security policy & coordinated disclosure process
โโโ GOVERNANCE.md # Project governance & RFC lifecycle
โโโ CHANGELOG.md # Keep a Changelog version history
โโโ ROADMAP.md # Technical milestones & future phases
โโโ SUPPORT.md # Support channels & community guidelines
โโโ FAQ.md # Comprehensive player and developer FAQ
โโโ LICENSE # MIT License
โโโ package.json # Root scripts and workspace dependencies
| Tool | Version Requirement | Purpose |
|---|---|---|
| Node.js | >= 20.0.0 (LTS) |
Frontend and Backend runtime |
| npm | >= 10.0.0 |
Package manager |
| Freighter Wallet | Browser extension | Stellar Testnet non-custodial wallet |
| Rust & Cargo | Stable (1.80+) (Optional) | Building Soroban contract in contracts/quiza |
| Stellar CLI | >= 22.0.0 (Optional) |
Testing and deploying Soroban contract |
๐ก Zero Database Setup Locally:
apps/apiautomatically initializes an embedded PGlite (in-process WASM PostgreSQL) instance in development. You do not need Docker or an external PostgreSQL database running locally. In production, configureDATABASE_URLpointing to PostgreSQL.
# Clone the repository
git clone https://github.com/jotel-dev/Quiza.git
cd Quiza
# Install root dependencies and API dependencies
npm install
npm --prefix apps/api installCopy the example configuration to .env:
Windows (PowerShell):
Copy-Item .env.example .envmacOS / Linux:
cp .env.example .envRun both the Fastify backend and Vite frontend concurrently via the unified runner:
Windows (PowerShell) / Cross-Platform:
npm run dev- Frontend Web UI: http://localhost:5173
- Backend Fastify API: http://localhost:3001
- Health Check: http://localhost:3001/health
Quiza enforces automated testing across all layers:
# 1. Run Root Frontend & Client Recovery Tests (Vitest)
npm test
# 2. Run Backend API Integration & Security Tests (Vitest)
npm --prefix apps/api test
# 3. Run Frontend Production Build & Oxlint Linter
npm run lint
npm run build
# 4. Run Soroban Smart Contract Tests (Cargo)
cd contracts/quiza ; cargo test ; cd ../..
# 5. Run Soroban Clippy Linter
cd contracts/quiza ; cargo clippy -- -D warnings ; cd ../..
โ ๏ธ Testnet-Only & Unaudited: Quiza is deployed strictly on the Stellar Testnet for evaluation and demonstration purposes. Smart contracts are unaudited. Public contract IDs only are listed belowโno private keys or secrets are ever stored in this repository.
| Network | Contract Identifier | Explorer |
|---|---|---|
| Stellar Testnet (Quiza) | CBD7PCUZDB22HJV7LHO4QHRIEZXSWED5OHJ256623PVLT46XGSKSC7IV |
Stellar Expert (Testnet) โ |
| Native XLM (SAC) | CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC |
Stellar Expert (Testnet) โ |
| USDC (SAC) | CBIELTK6YBZJU5UP2WWQEUCYKLPU6AUNZ2BQ4WWFEIE3USCIHMXQDAMA |
Stellar Expert (Testnet) โ |
- Contract Specification: Detailed interface methods, accounting invariant, and refund mechanics are documented in docs/contract-interface.md.
- Deployment Guide: Production deployment on Vercel and Render/PostgreSQL is documented in docs/deploying.md.
We welcome contributions from open-source developers worldwide! Please review our Contributing Guide and Code of Conduct before submitting pull requests.
- Telegram Community: https://t.me/nullifiersystem/1
- GitHub Discussions: Ask questions & discuss RFCs
- Support & Triage: See SUPPORT.md
- Security Inquiries: Email
security@quiza.app(See SECURITY.md)
This project is licensed under the MIT License.