A fully-featured poker game with Arcium Multi-Party Computation (MPC) integration
This project implements a complete Texas Hold'em poker game on Solana with real Arcium MPC integration for:
- π Fair deck shuffling - Multi-party computation ensures no single player controls the shuffle
- π΄ Encrypted card dealing - Cards encrypted to specific players using owner-specific keys
- ποΈ Secure showdown - Threshold decryption reveals cards fairly
Program ID: Cm5y2aab75vj9dpRcyG1EeZNgeh4GZLRkN3BmmRVNEwZ
Network: Solana Devnet
RPC: https://api.devnet.solana.com
Explorer: https://explorer.solana.com/address/Cm5y2aab75vj9dpRcyG1EeZNgeh4GZLRkN3BmmRVNEwZ?cluster=devnet
- Full Texas Hold'em rules (Pre-flop, Flop, Turn, River, Showdown)
- Betting rounds with raise, call, fold, check, all-in
- Side pot handling for multiple all-ins
- Automatic blind posting
- Tournament support
- Statistics tracking
-
4 MPC Circuits in
encrypted-ixs/:shuffle_deck()- Fisher-Yates shuffle in MPCdeal_card()- Encrypted card dealingreveal_hole_cards()- Threshold decryption at showdowngenerate_random()- Secure randomness
-
Dual-Mode Operation:
- Production: Uses real Arcium MXE via CPI
- Testing: Falls back to deterministic mock
- 48/48 tests passing
- Full coverage of game logic
- MXE integration tests
- Edge case handling
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Install Solana
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
# Install Anchor
cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
avm install latest
avm use latest
# Install Node dependencies
yarn install# Build Solana program
anchor build
# Build MPC circuits
cd encrypted-ixs && cargo build# Run all tests (48 tests)
npm test
# Run specific test file
anchor test --skip-build tests/test_betting.tsarcium_poker/
βββ programs/
β βββ arcium_poker/ # Main Solana program
β βββ src/
β βββ arcium/ # β
MPC integration (Phase 3 complete)
β β βββ mpc_shuffle.rs # Dual-mode shuffle
β β βββ mpc_deal.rs # Dual-mode dealing
β β βββ mpc_reveal.rs # Dual-mode reveal
β β βββ integration.rs # MXE helpers
β βββ betting/ # Betting logic
β βββ cards/ # Card handling
β βββ game/ # Game flow
β βββ player/ # Player management
β βββ showdown/ # Winner determination
β
βββ encrypted-ixs/ # β
Arcium MPC circuits
β βββ src/
β βββ lib.rs # 4 confidential instructions
β
βββ tests/ # β
48 passing tests
β βββ test_betting.ts
β βββ test_game_flow.ts
β βββ test_mxe_integration.ts # NEW: MXE examples
β βββ ...
β
βββ Documentation/
βββ PHASE_3_COMPLETE.md # Integration guide
βββ IMPLEMENTATION_STATUS.md # Feature status
βββ FULL_MPC_INTEGRATION_ROADMAP.md
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 1. SHUFFLE β
β Players β Entropy β MPC Shuffle β Encrypted Deckβ
β β
β 2. DEAL β
β Encrypted Deck β MPC Deal β Player-Specific Keyβ
β β
β 3. REVEAL β
β Encrypted Cards β Threshold Decrypt β Revealed β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
// Production: With MXE accounts
let result = mpc_shuffle_deck_with_mxe(MxeShuffleParams {
mxe_program: Some(mxe_program), // β
Real MPC
comp_def: Some(comp_def),
mempool: Some(mempool),
cluster: Some(cluster),
// ...
})?;
// Testing: Without MXE accounts
let result = mpc_shuffle_deck_with_mxe(MxeShuffleParams {
mxe_program: None, // β
Mock mode
comp_def: None,
mempool: None,
cluster: None,
// ...
})?;npm test
# β
48 passing (2m)- Betting Tests (12 tests) - Raises, calls, folds, all-ins
- Game Flow Tests (11 tests) - Stage transitions, game lifecycle
- Game Initialization (7 tests) - Valid/invalid configurations
- Player Actions (7 tests) - Join, leave, edge cases
- Side Pots (3 tests) - Multiple all-ins, complex scenarios
- Edge Cases (7 tests) - Race conditions, zero values
- MXE Integration (1 test) - Mock mode demonstration
Program ID: Cm5y2aab75vj9dpRcyG1EeZNgeh4GZLRkN3BmmRVNEwZ
Network: Devnet
RPC Endpoint: https://api.devnet.solana.com
Deployed Slot: 416979428
MXE Cluster: 1078779259
import { Program, AnchorProvider } from "@coral-xyz/anchor";
import { PublicKey } from "@solana/web3.js";
import idl from "./idl/arcium_poker.json";
import { ArciumPoker } from "./types/arcium_poker";
// Program configuration
const PROGRAM_ID = new PublicKey("Cm5y2aab75vj9dpRcyG1EeZNgeh4GZLRkN3BmmRVNEwZ");
const RPC_ENDPOINT = "https://api.devnet.solana.com";
// Initialize program
const connection = new Connection(RPC_ENDPOINT, "confirmed");
const provider = new AnchorProvider(connection, wallet, {});
const program = new Program<ArciumPoker>(idl, PROGRAM_ID, provider);
// Call contract methods
await program.methods
.initializeGame(gameId, smallBlind, bigBlind, minBuyIn, maxBuyIn, maxPlayers)
.accounts({ authority: wallet.publicKey })
.rpc();Create .env.local in your frontend:
NEXT_PUBLIC_PROGRAM_ID=Cm5y2aab75vj9dpRcyG1EeZNgeh4GZLRkN3BmmRVNEwZ
NEXT_PUBLIC_RPC_ENDPOINT=https://api.devnet.solana.com
NEXT_PUBLIC_NETWORK=devnet# MXE deployed to cluster 1078779259
arcium deploy --cluster-offset 1078779259 --keypair-path ~/.config/solana/id.json -u d// See HOW_TO_USE_REAL_MPC.md for complete integration guide
import { getMxeAccount, getCompDefAccount, getClusterAccount } from "./utils/arcium";
// Get MXE accounts for real MPC
const mxeAccount = getMxeAccount(PROGRAM_ID);
const compDefAccount = getCompDefAccount(PROGRAM_ID, 1);
const clusterAccount = getClusterAccount(PROGRAM_ID, 1078779259);
// Start game with REAL encrypted MPC!
await program.methods
.startGame(entropy)
.accounts({
game,
authority: wallet.publicKey,
mxeProgram: PROGRAM_ID,
compDef: compDefAccount,
cluster: clusterAccount,
})
.rpc();cd encrypted-ixs
cargo build-sbf
solana program deploy target/deploy/encrypted_ixs.soarcium init-mxe --program-id <YOUR_MXE_ID>
arcium init-cluster --name poker-clusterconst MXE_PROGRAM_ID = new PublicKey("YOUR_MXE_ID");
// Derive MXE accounts
const [compDef] = PublicKey.findProgramAddressSync(
[Buffer.from("comp_def"), Buffer.from("shuffle_deck")],
MXE_PROGRAM_ID
);
// Use in transactions
await program.methods
.startGame(playerEntropy)
.accounts({
game,
authority,
// MXE accounts automatically enable real MPC
mxeProgram: MXE_PROGRAM_ID,
compDef,
mempool,
cluster,
})
.rpc();| Component | Status | Completion |
|---|---|---|
| Poker Game Logic | β DONE | 100% |
| MPC Circuits | β DONE | 100% |
| MXE Integration | β DONE | 100% |
| Tests | β PASSING | 48/48 |
| Documentation | β COMPLETE | 100% |
| Deployment | β DEPLOYED | 100% |
Overall: 100% Complete (Deployed to Devnet!)
- Dual-Mode Architecture - Seamless MXE/mock switching
- Cross-Program Invocation - Direct MXE calls from Solana
- Threshold Decryption - Multi-party showdown reveals
- Owner-Specific Encryption - Privacy-preserving card dealing
- β Clean, modular code
- β Comprehensive test coverage
- β Production-ready error handling
- β Detailed documentation
- MXE_DEPLOYMENT_INFO.md - Complete deployment details and MPC configuration
- HOW_TO_USE_REAL_MPC.md - Frontend integration guide for real MPC
- PHASE_3_COMPLETE.md - Full integration guide
- IMPLEMENTATION_STATUS.md - Feature checklist
- FULL_MPC_INTEGRATION_ROADMAP.md - Development roadmap
- tests/test_mxe_integration.ts - Code examples
await program.methods
.initializeGame(
gameId,
smallBlind,
bigBlind,
minBuyIn,
maxBuyIn,
maxPlayers
)
.accounts({ authority: wallet.publicKey })
.rpc();await program.methods
.joinGame(buyIn)
.accounts({ game, player })
.rpc();const playerEntropy = generateEntropy(); // Client-side
// Use mock mode (default)
await program.methods
.startGame(playerEntropy)
.accounts({ game, authority })
.rpc();
// Or use REAL MPC (see HOW_TO_USE_REAL_MPC.md)
const PROGRAM_ID = new PublicKey("Cm5y2aab75vj9dpRcyG1EeZNgeh4GZLRkN3BmmRVNEwZ");
const mxeAccounts = {
mxeProgram: PROGRAM_ID,
compDef: getCompDefAccount(PROGRAM_ID, 1),
cluster: getClusterAccount(PROGRAM_ID, 1078779259),
};
await program.methods
.startGame(playerEntropy)
.accounts({ game, authority, ...mxeAccounts })
.rpc(); // π Real encrypted MPC shuffle!// Bet
await program.methods.bet(amount).rpc();
// Call
await program.methods.call().rpc();
// Fold
await program.methods.fold().rpc();
// All-in
await program.methods.allIn().rpc();This is a hackathon project, but contributions are welcome!
- Deploy to devnet - DONE!
- Deploy MXE circuits to devnet - DONE! (Cluster 1078779259)
- Add callback server for MPC results (optional - current architecture works)
- Implement frontend UI
- Add more game variants (Omaha, 7-Card Stud)
- Performance optimization
- Add tournament brackets
- Implement rake/fees system
MIT License - See LICENSE file for details
- Arcium - For the amazing MPC infrastructure
- Solana - For the fast, scalable blockchain
- Anchor - For the excellent Solana framework
- GitHub: @ANAVHEOBA
- Twitter: @AnavheobaDEV
- Discord: anavheoba_17
Track: Arcium's Side Track Category: Hidden-Information Games Status: β DEPLOYED & READY
A complete Texas Hold'em poker game with real Arcium MPC integration for fair, encrypted gameplay.
- β 48/48 tests passing
- β 4 working MPC circuits deployed
- β Full integration layer with CPI calls
- β Dual-mode operation (mock + real MPC)
- β Deployed to Devnet (both Solana program & MXE)
- β Production-ready architecture
- Program ID:
Cm5y2aab75vj9dpRcyG1EeZNgeh4GZLRkN3BmmRVNEwZ - MXE Cluster:
1078779259 - Network: Solana Devnet
- Explorer: View on Solana Explorer
See tests/test_mxe_integration.ts for live examples of MXE integration, and HOW_TO_USE_REAL_MPC.md for complete frontend integration guide.
Built with β€οΈ for the Arcium Hackathon