Live Project Link: https://shield-poker.vercel.app/
Shield Poker is a decentralized, P2P Texas Hold'em game built on Solana. It solves the "on-chain leakage" problem using MagicBlock's Ephemeral Rollups (TEE) for private gameplay and Tapestry Protocol for a persistent, decentralized social layer.
- Zero-Leaking Hands: Player hole cards are processed within a Trusted Execution Environment (TEE) using Intel TDX. Cards are never visible on L1 Explorers.
- Lightning Speed: Experience ~50ms execution for betting, checking, and folding—eliminating L1 latency.
- Trustless Settlement: Funds are held in an L1 Vault and only dispersed after the TEE securely settles the game outcome.
- Persistent Player Profiles: Every player has a unique Tapestry identity with a username, bio, and avatar.
- Career Stats Tracking: Performance is recorded on-chain. Profiles keep a permanent record of
total_games_played,games_won, andgames_lost, updated automatically upon game resolution. - Decentralized In-Game Chat: A real-time chat system built on Tapestry's social graph. Each game creates a "Content" thread where player messages are pushed as "Comments," ensuring a censorship-resistant table banter.
1. Poker HomePage
Browse live games and completed games.
2. Private Gameplay & Chat
Joined players can chat and take actions such as fold, check, call or bet amount.
3. Game Result/Showdown Phase
See which player won and how much
4. Player Profile Page
View your tapestry Player Profile Stats
5. Create Player Profile Modal
Create a Player Profile first to host or play a poker game
On standard blockchains, all state is public. For games like Poker, this is a non-starter:
- Card Privacy: If your hand is on-chain, anyone can see it.
- Latency: Waiting 400ms - 2s for every bet kills the game flow.
- Cost: Transaction fees for every "Check" or "Small Bet" add up quickly.
Shield Poker moves the sensitive game logic into a hardware-secured Trusted Execution Environment (TEE) using Intel TDX.
The game logic runs within a TEE validator. This ensures that even the validator operator cannot peek at the memory where player hands are processed. We use the #[ephemeral] attribute to mark accounts that should exist primarily in the TEE for speed.
Instead of just client-side encryption, Shield Poker uses MagicBlock's Permission Program (ACL):
- Public Accounts: The
Gameaccount (pot, community cards) has a public ACL. - Private Accounts: Each
PlayerState(holding the hole cards) is protected by a restricted ACL. Only the specific player holding the corresponding TEE authorization token can read their own state.
By delegating accounts to the TEE, we achieve ~50ms execution. Once the "Showdown" occurs, the commit_game instruction triggers a state settlement:
- Final winner is determined in the TEE.
- The state is "committed" and "undelegated" back to Solana L1.
- Funds are distributed from the L1 Vault.
Shield Poker uses the #[ephemeral] attribute to mark sensitive game accounts.
- Access Control: Each
PlayerStateis protected by a restricted ACL. Only the authorized player can read their own hole cards within the TEE. - Two-Phase Commit:
- TEE Phase: Cards are dealt, and betting occurs at high speed.
- L1 Phase: Once the game concludes, the TEE settles the state back to Solana L1 for fund distribution.
sequenceDiagram
participant P1 as Player 1 (Dealer)
participant P2 as Player 2
participant TEE as MagicBlock TEE (Intel TDX)
participant L1 as Solana L1
P1->>L1: Initialize Game & Vault
P2->>L1: Join Game
Note over P1, P2: Setup Delegation & ACLs
P1->>TEE: Shuffle & Deal (Private)
Note right of TEE: Cards stay in TEE memory
P1->>TEE: Action: Bet (50ms)
P2->>TEE: Action: Call (50ms)
Note over TEE: Phase Advance (Flop/Turn/River)
TEE->>L1: #[commit] Settle Final State
L1->>P1/P2: Distribute Pot
- Idempotent Stats: Game results are pushed to Tapestry using a secure RESTful API, ensuring career stats are updated exactly once per game resolution.
- Chat Workaround: Tapestry "Content" represents the Game Table, and "Comments" represent the real-time messages, creating a fully on-chain chatroom without a dedicated chat protocol.
- Solana CLI & Anchor 0.32.1
- MagicBlock TEE Authorized Wallet
- Tapestry API Credentials
- Clone the repo
- Setup Program:
anchor build anchor deploy
- Frontend Configuration:
Create a
.env.localinapp/:NEXT_PUBLIC_TAPESTRY_API_KEY=your_key NEXT_PUBLIC_TAPESTRY_API_URL=https://api.tapestry.com RPC_URL=your_rpc
- Launch:
cd app npm install npm run dev
This project is submitted for the following tracks:
- MagicBlock Track: For pioneering TEE-based private gaming on Solana.
- Tapestry Track: For building a comprehensive on-chain social layer including profiles, career stats, and decentralized chat.
- The "Invisible" Hand: First poker game where cards are cryptographically hidden but execution is instant.
- Persistent Professionalism: Tapestry integration ensures players carry their reputation from table to table.
- Consolidated UX: A unified workflow that handles TEE authorization and game mechanics in a single, intuitive interface.
MIT © 2026 Shield Poker Team