A decentralized blackjack game built on Solana that leverages Zero Knowledge Proofs (ZKP) for proving game results and is deployed on the Gorbagana testnet blockchain.
ZK Blackjack is a fully decentralized blackjack game that combines the excitement of traditional blackjack with the security and transparency of blockchain technology. The game features:
- Single Player Mode: Play against the house with automated dealer logic
- Multiplayer Mode: Join or create games with other players
- Zero Knowledge Proofs: Cryptographic proofs ensure fair play without revealing private information
- On-Chain Verification: All game results are verifiable on the blockchain
- Real-time Gameplay: Live updates through WebSocket connections
- Deck Management: Standard 52-card deck with proper shuffling algorithms
- Betting System: Place bets using GOR tokens (Gorbagana's native token)
- Game State Management: Persistent game states stored on-chain
- Wallet Integration: Seamless integration with Solana wallets
- Explorer Integration: View all transactions and game states on the Gorbagana explorer
This project is fully integrated with the Gorbagana blockchain, a Solana-compatible network that offers enhanced performance and lower fees.
- Network Name: Gorbagana Testnet
- RPC Endpoint:
https://rpc.gorbagana.wtf/ - Explorer:
https://explorer.gorbagana.wtf/ - Native Token: GOR
- Program ID:
5q7FiaffAC5nAFCnwy9PedhEjuL7vhjCQwuSsPVz9kny
✅ SUCCESSFULLY DEPLOYED - The blackjack program is live on Gorbagana testnet with:
- 4 verified successful on-chain transactions
- Full explorer integration
- Complete testing infrastructure
- Production-ready smart contracts
The smart contract architecture includes:
blackjack/
├── GlobalState (PDA: ["global_state"])
│ ├── authority: Pubkey
│ └── next_game_id: u64
├── Game (PDA: ["game", game_id])
│ ├── game_id: u64
│ ├── player_one: Pubkey
│ ├── player_two: Option<Pubkey>
│ ├── bet_amount: u64
│ ├── is_game_active: bool
│ └── is_single_player: bool
└── Player (PDA: ["player", player_pubkey, game_id])
├── game_id: u64
└── bet: u64
- initialize: Set up global game state
- start_single_player_game: Create solo blackjack games
- start_multiplayer_game: Create multiplayer games
- join_game: Join existing multiplayer games
- end_game: Finalize games and distribute winnings
- withdraw_bet: Withdraw winnings from completed games
Before running the application, ensure you have:
- Node.js (v16 or higher)
- npm or yarn package manager
- Rust and Solana CLI (for smart contract development)
- Anchor CLI (for Solana program development)
- A Solana wallet (Phantom, Solflare, etc.)
- GOR tokens for testing (available from Gorbagana testnet faucet)
-
Navigate to the UI directory
cd zkblackjack-ui -
Install dependencies
npm install # or yarn install -
Start the development server
npm run dev # or yarn dev -
Open your browser Navigate to
http://localhost:3000
-
Install Solana CLI
sh -c "$(curl -sSfL https://release.solana.com/v1.16.0/install)" -
Install Anchor CLI
npm install -g @coral-xyz/anchor-cli
-
Build the program
anchor build
-
Deploy to testnet
anchor deploy --provider.cluster gorbagana-testnet
The live demo is deployed on Vercel and automatically connected to the Gorbagana testnet:
- Live Demo: [Coming Soon - Deploy to Vercel]
- Network: Automatically configured for Gorbagana testnet
- Wallet: Connect any Solana-compatible wallet
- Tokens: You'll need GOR tokens to play
- Connect Wallet: Connect your Solana wallet to the application
- Switch Network: Ensure you're connected to the Gorbagana testnet
- Get Tokens: Acquire GOR tokens from the testnet faucet
- Start Game: Choose single-player or multiplayer mode
- Place Bet: Enter your desired bet amount
- Play: Use hit/stand actions to play your hand
- Win/Lose: Results are automatically processed on-chain
- Withdraw: Claim your winnings from successful games
The project includes comprehensive testing infrastructure:
# Run integration tests
npm run test
# Run simple connectivity tests
npm run test:simple
# Run full test suite
npm run test:integrationFrontend
- Next.js 13+ (React framework)
- TypeScript
- Tailwind CSS
- Socket.io (real-time communication)
Blockchain
- Solana/Anchor framework
- Gorbagana testnet
- @solana/wallet-adapter
- @coral-xyz/anchor
Zero Knowledge Proofs
- Circom (circuit definition)
- snarkjs (proof generation)
- Custom ZK circuits for game verification
Testing
- Mocha/Chai test framework
- Custom RPC integration tests
- Explorer verification tools
sol-blackjack/
├── programs/blackjack/ # Solana smart contracts
├── zkblackjack-ui/ # Frontend React application
├── tests/ # Integration tests
├── circuits/ # Zero Knowledge circuits
├── build-circuit/ # Compiled ZK circuits
└── migrations/ # Deployment scripts
For developers interested in contributing:
# Clone the repository
git clone <repository-url>
cd sol-blackjack
# Install dependencies
npm install
# Build smart contracts
anchor build
# Run tests
npm test
# Start frontend development
cd zkblackjack-ui && npm run dev- DEPLOYMENT.md: Detailed deployment instructions
- TESTING.md: Testing procedures and examples
- PROGRESS_REPORT.md: Complete deployment history and verification
For issues, questions, or contributions:
- Check the existing issues in the repository
- Create a new issue with detailed description
- Join the Gorbagana community for network-specific help
- Refer to the testing documentation for troubleshooting
This project is open source and available under the [MIT License].
Note: This is a testnet application. Do not use real funds. All transactions are on the Gorbagana testnet using test tokens only.
The program has been successfully tested with real transactions on Gorbagana testnet:
- Initialize: View Transaction
- Start Game: View Transaction
- End Game: View Transaction
- Withdraw: View Transaction