A provably fair, on-chain casino game built on Solana. Navigate through tiles, avoid death traps, and cash out your winnings. Inspired by death.fun.
Players deposit SOL and navigate a randomly generated tile board. Each row contains one hidden "death tile" - hit it and you lose everything. Successfully navigate rows to multiply your stake. Cash out anytime or risk it all for higher multipliers.
The game is provably fair: death tile positions are determined by a server seed that's committed (hashed) before you play. After each round, you can verify that outcomes weren't manipulated.
- On-chain deposits & withdrawals - SOL moves directly through Solana smart contracts
- Provably fair - SHA-256 commit-reveal scheme, verify any game session
- Real-time caching - Redis-backed game state for seamless gameplay
- Leaderboard - Track top earners
| Network | Address |
|---|---|
| Casino Program (Devnet) | 7eoY2tr9vaZEEjX1q64q3ovND5Erg9ZjK8CfujxDfh8p |
| Casino PDA | HbiPVZB2aUPxEz4V3GLy52jTfB3ChmBAj8hmjZun641t |
| Authority | CUcTGB5CyRhfh9jvVDZB734DG38XfZFX1a3L86FosSBu |
├── fe/ # Next.js frontend
│ ├── components/ # React components (tileboard, leaderboard, etc.)
│ ├── store/ # Zustand game state
│ └── services/ # API + on-chain interactions
│
├── BE/ # Express.js backend
│ ├── routes/ # deposit, withdraw, payouts, cache
│ ├── servicies/ # Redis caching layer
│ └── Db/ # MongoDB schemas
│
└── contract/ # Anchor smart contract (Solana program)
└── programs/ # deposit, withdraw, payout instructions
- Node.js 18+
- Rust + Solana CLI (for contract development)
- MongoDB
- Redis
cd BE
npm install
cp .env.example .env # Configure your environment
npm run devRequired env vars:
SOLANA_RPC_URL- Devnet RPC endpointCASINO_PROGRAM_ID- Deployed program IDSOLANA_AUTHORITY_PRIVATE_KEY- Authority keypair (JSON array format)MONGO_DB_URL- MongoDB connection stringREDIS_URL- Redis connection string
cd fe
npm install
npm run devFrontend runs on localhost:3000, backend on localhost:8001.
cd contract
anchor build
anchor deploy --provider.cluster devnet- Deposit - Send SOL to casino PDA, credited to your user account
- Play - Click tiles row by row, avoiding death tiles
- Multipliers - Each successful row increases your potential payout (starts ~1.10x, grows ~1.18x per row)
- Cash out - Withdraw anytime to lock in winnings
- Death tile - Hit it and lose your stake + accumulated earnings
Each game session:
- Server generates a random seed
SHA-256(seed)is committed before gameplay- Death tiles derived from
SHA-256(seed + "-row" + rowIndex) - After round ends, seed is revealed - verify the commit matches
Visit /verify?sessionId=<id> to verify any session.
- Frontend: Next.js 14, Tailwind CSS, Zustand, Solana Wallet Adapter
- Backend: Express.js, MongoDB, Redis
- Blockchain: Solana, Anchor Framework
- Deployment: Render (backend), Vercel-compatible (frontend)
| Endpoint | Description |
|---|---|
POST /api/depositFunds/dp |
Process deposit transaction |
POST /api/withdrawFunds/wd |
Process withdrawal |
POST /api/payouts/ |
Payout winnings |
POST /api/cache/tile |
Cache tile selection |
GET /api/leaderboard/ |
Fetch leaderboard |
Built for 100x Solana Hackathon