Play classic card and dice games with blockchain-verified randomness. No wallet needed, no signup required, completely free.
Live Demo: provably-fair-games.vercel.app
Classic single-player solitaire with standard Klondike rules.
- Move cards between tableau columns (opposite color, descending rank)
- Build foundations from Ace to King by suit
- Auto-complete triggers when all cards are revealed
- Submit scores to the global leaderboard
Two-player card game against AI opponent.
- Fill positions 1-10 with matching cards
- Jacks are wild, Queens/Kings end your turn
- First to complete all positions wins
Classic dice game with blockchain-verified randomness.
- 13 scoring categories across upper and lower sections
- Three rolls per turn to achieve combinations
- Strategic scoring for straights, full houses, and Yahtzee
- Compete for high scores on the global leaderboard
Classic card game against the dealer.
- Place bets and aim for 21 without busting
- Dealer follows standard house rules (hits on 16, stands on 17)
- Track your chip balance across rounds
- Strategic gameplay with card counting elements
Ancient board game with doubling cube.
- Move checkers based on dice rolls
- Strategic bearing off and blocking
- Doubling cube for high-stakes games
- AI opponent with adjustable difficulty (Easy, Normal, Hard)
Tile-merging puzzle game.
- Combine numbered tiles to reach 2048
- Strategic moves to maximize score
- Blockchain-verified randomness for tile spawning
- Compete for highest scores and largest tiles
- Blockchain-Verified RNG - Card shuffles and dice rolls use Ergo block hashes + transaction data as seeds
- Anti-Spoofing Protection - 5 independent inputs (blockHash + txHash + timestamp + gameId + txIndex)
- Server-Side Validation - Comprehensive validation prevents score manipulation (see below)
- Global Leaderboard - Compete for high scores with provably fair verification
- Admin Dashboard - Review flagged submissions and manage fraud detection
- No Wallet Required - Read-only blockchain access, no transactions
- Fully Verifiable - Anyone can independently verify any game's randomness
- Database Fallback - Verification works even without localStorage data
All game submissions undergo comprehensive server-side validation to prevent score manipulation:
Multi-Layer Validation:
- β Game-Specific Logic - Full move/roll/round replay validation
- β Blockchain Verification - Validates Ergo block data and seed generation
- β Fraud Detection - Statistical analysis with risk scoring (0-100)
- β Rate Limiting - Prevents spam submissions (default: 10 per minute)
Game Validators:
- Yahtzee: Full history replay with scorecard verification (most comprehensive)
- Backgammon: Score calculation validation (winType Γ cube Γ difficulty)
- Blackjack: Round-by-round chip balance tracking
- 2048: Score/tile/move correlation checks
- Solitaire: Score/move/time validation
- Garbage: Score/round validation
Validation Levels:
BASIC- Format and range checks onlyLOGIC- Game-specific validationBLOCKCHAIN- Includes blockchain verificationFULL- All validations + fraud detection (default)
See API_INTEGRATION_GUIDE.md for technical details.
Access the admin dashboard to review flagged submissions and manage the platform.
Features:
- π View submissions flagged by fraud detection
- β Approve or reject suspicious scores
- π View validation statistics and trends
- π― Analyze fraud patterns by game
Access:
- Navigate to
/admin - Enter admin password
- Review flagged submissions
- Approve legitimate scores or reject fraudulent ones
See ADMIN_DASHBOARD_GUIDE.md for detailed usage instructions.
- Fetch Block Data - Get latest Ergo block header + transaction data
- Generate Seed - Combine 5 inputs:
blockHash + txHash + timestamp + gameId + txIndex - Deterministic Shuffle - Fisher-Yates shuffle produces the deck order
- Anyone Can Verify - Same inputs = same shuffle, always
The block data is determined by Ergo miners and cannot be predicted or manipulated.
| Technology | Purpose |
|---|---|
| React 18 | UI framework |
| react-router-dom | Page navigation |
| Supabase | Leaderboard database |
| Vercel | Hosting & serverless functions |
| Ergo Blockchain | Verifiable randomness source |
# Clone and install
git clone https://github.com/cannonQ/provably-fair-games.git
cd provably-fair-games
npm install
# Start development server
npm startOpen http://localhost:3000.
For full functionality, set these in your .env.local file or Vercel dashboard:
# Required for all features
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
# Validation configuration (optional - defaults shown)
VALIDATION_LEVEL=FULL # BASIC | LOGIC | BLOCKCHAIN | FULL
ENABLE_RATE_LIMITING=true # Enable rate limiting (default: true)
ENABLE_FRAUD_DETECTION=true # Enable fraud detection (default: true)Note: Admin dashboard uses hardcoded password in source code. For production, consider moving to environment variable for easier rotation.
- Push code to GitHub
- Import project in Vercel Dashboard
- Add environment variables in Settings > Environment Variables
- Deploy
Create a LeaderBoard table with this schema:
CREATE TABLE "LeaderBoard" (
id SERIAL PRIMARY KEY,
game TEXT NOT NULL,
game_id TEXT UNIQUE NOT NULL,
player_name TEXT DEFAULT 'Anonymous',
score INTEGER NOT NULL,
time_seconds INTEGER NOT NULL,
moves INTEGER NOT NULL,
block_height INTEGER,
block_hash TEXT,
tx_hash TEXT,
block_timestamp BIGINT,
created_at TIMESTAMPTZ DEFAULT NOW()
);
-- Enable Row Level Security
ALTER TABLE "LeaderBoard" ENABLE ROW LEVEL SECURITY;
-- Allow public reads and inserts
CREATE POLICY "Allow public reads" ON "LeaderBoard" FOR SELECT TO anon USING (true);
CREATE POLICY "Allow public inserts" ON "LeaderBoard" FOR INSERT TO anon WITH CHECK (true);provably-fair-games/
βββ api/ # Vercel serverless functions
β βββ submit-score.js # POST /api/submit-score (with validation)
β βββ leaderboard.js # GET /api/leaderboard
β βββ admin.js # Admin API (flagged submissions, stats)
β βββ game/[gameId].js # GET /api/game/:gameId (verification data)
β βββ cron/ # Scheduled jobs
β βββ daily-leaderboard.js # Posts top scores to blockchain
βββ lib/ # Server-side utilities
β βββ validation/ # Server-side validation framework
β βββ index.js # Master validator dispatcher
β βββ shared/ # Blockchain utils, fraud detection
β βββ games/ # Game-specific validators (all 6 games)
βββ src/
β βββ blockchain/ # Ergo API + shuffle algorithm
β βββ games/ # All 6 game implementations
β β βββ solitaire/ # Solitaire game + verification
β β βββ garbage/ # Garbage game + AI
β β βββ yahtzee/ # Yahtzee game + verification
β β βββ blackjack/ # Blackjack game + verification
β β βββ backgammon/ # Backgammon game + AI + verification
β β βββ 2048/ # 2048 game + verification
β βββ components/ # Shared UI components
β β βββ AdminDashboard.jsx # Admin dashboard component
β β βββ Leaderboard.jsx # Leaderboard display
β β βββ Verification.jsx # Verification UI
β βββ pages/ # Page components
β β βββ Admin.jsx # Admin page with password protection
β β βββ Home.jsx # Landing page
β β βββ LeaderboardPage.jsx
β βββ services/ # Leaderboard API client
β βββ lib/ # Supabase client + blockchain transactions
βββ public/
| Endpoint | Method | Description |
|---|---|---|
/api/submit-score |
POST | Submit score with comprehensive validation |
/api/leaderboard?game={game} |
GET | Get top scores for a game (all 6 games supported) |
/api/game/:gameId |
GET | Get game data for verification |
/api/admin?action={action} |
GET/POST | Admin endpoints (requires authentication) |
/api/cron/daily-leaderboard |
POST | Daily cron job - posts top 3 scores per game to blockchain |
Admin Actions:
flagged-submissions- Get flagged submissions (GET)review-submission- Approve/reject submissions (POST)validation-stats- Get validation statistics (GET)
Every game can be independently verified:
- Click "Verify" on any leaderboard entry or in-game
- View blockchain proof: block hash, TX hash, timestamp
- See the regenerated shuffle matches the original
- Click explorer links to verify on-chain
Verification works from:
- localStorage (same browser) - full verification with stored seed
- Database (any device) - verification via leaderboard data
Scores are ranked by:
- Cards to Foundation (primary) - 0-52
- Time (secondary) - faster is better
- Moves (tertiary) - fewer is better
Both wins (52/52) and partial games can be submitted.
Scores are ranked by:
- Score (primary) - 0-375 max
- Time (secondary) - faster is better
Scores are ranked by:
- Score (primary)
- Time (secondary)
- Moves (tertiary)
Want to add a new game to the platform? See the comprehensive Game Integration Guide which includes:
- β Minimum required files checklist
- β Step-by-step integration process
- β Database schema documentation
- β Testing procedures
- β Common patterns and best practices
- β Example implementation
The guide walks through exactly what files to create and update when adding games like Solitaire, Garbage, or Yahtzee.
Contributions are welcome! Feel free to:
- Report bugs or issues
- Suggest new games
- Improve existing games
- Enhance documentation
MIT License - use freely, play fairly.