The World's First
Player-Owned Crypto Casino
Play Blackjack against the on-chain House Pool. If you bankrupt the House, you inherit the House NFT and become the new owner โ earning the edge on every future bet.
How It Works
Play Blackjack
Bet against the House Pool using provably fair randomness.
Drain the Pool
Win enough hands to drive the House Pool balance to zero.
Flip the House
When the pool hits zero, you inherit the House NFT and become the new House.
Protocol Stats (Simulated)
Current House Owner
Address
0x0000...0000
Listed Price (Simulated)
$0
You can inspect the smart contract architecture, game flow, and data structures via the tabs above.
Place Your Bet
Game Stats (Local Session)
Rule Summary
- Single-hand Blackjack per round
- Dealer hits on 16, stands on 17+
- Standard win: 1:1 payout
- Natural Blackjack (21 in 2 cards): 3:2 payout
- Ties result in a push (bet returned)
21Flip House NFT
This NFT represents ownership of the 21Flip Blackjack House Pool. The holder earns the house edge on every bet and controls bet limits. If the pool is liquidated to zero by players, the NFT automatically transfers to the winning player.
House Liquidation & Ownership History
House Owner Tools (Simulated)
If your connected address is the House owner, youโll see controls to update the listing price and cancel listings. All actions here are simulated UI behaviors only (no real chain).
Smart Contract Architecture
This section summarizes the four core contracts and how they interact: HousePool, BlackjackGameEngine, HouseNFT, and HouseMarketplace.
HousePool.sol
- Stores all game liquidity in settlement asset (USDC/WETH)
- Enforces min/max bet limits set by House owner
- Routes winnings/losses from BlackjackGameEngine
- Triggers liquidation when balance reaches zero
- Manages House NFT transfer on liquidation
depositLiquidity(uint256 amount) withdrawLiquidity(uint256 amount) setBetLimits(uint256 min, uint256 max) handleHandResult(address player, int256 amount, uint256 houseEdge) triggerLiquidation(address winner)
- onlyHouseOwner: deposit, withdraw, setBetLimits
- onlyGameEngine: handleHandResult
BlackjackGameEngine.sol
- Implements Blackjack rules (dealer hits 16, stands 17+)
- Manages hand state per player
- Integrates Chainlink VRF for card draws
- Validates bets against HousePool limits
- Computes outcomes (win/lose/push, Blackjack 3:2)
startHand(uint256 betAmount) returns (uint256 handId) hit(uint256 handId) stand(uint256 handId) fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) computeHandValue(uint8[] memory cards) returns (uint8) settleHand(uint256 handId) internal
- onlyPlayer: hit, stand (for own hand)
- onlyVRFCoordinator: fulfillRandomWords
- public: startHand (with bet validation)
HouseNFT.sol
- ERC-721 representing House ownership
- Single token (tokenId = 1) in MVP
- Minted to initial House owner
- Transferable via marketplace or liquidation
mint(address initialOwner) transferOnLiquidation(address newOwner) // called by HousePool ownerOf(uint256 tokenId) returns (address) tokenURI(uint256 tokenId) returns (string)
- onlyHousePool: transferOnLiquidation
- onlyOwner (deployer): mint (one-time)
HouseMarketplace.sol
- Fixed-price listings for House NFT
- Facilitates ownership transfers
- Collects protocol fee (e.g., 2.5%)
- Routes proceeds to seller
- Allows listing cancellation
listHouse(uint256 price) updatePrice(uint256 newPrice) cancelListing() buyHouse() payable setProtocolFee(uint256 basisPoints) onlyOwner
- onlyHouseOwner: listHouse, updatePrice, cancelListing
- public: buyHouse
- onlyOwner (protocol): setProtocolFee
End-to-End Game & Ownership Flow
This sequence shows how liquidity is deposited, bets are placed, randomness is drawn, results are settled, and eventually how the House can be liquidated and transferred to a new owner.
House Owner Deposits Liquidity
House Sets Bet Limits
Player Starts a Hand
VRF Returns Randomness
Player Makes Decisions
Hand Settles
Pool Depleted (Liquidation)
House Flips (Ownership Transfer)
Key Data Structures
The following structs illustrate how core protocol state is organized in the HousePool and BlackjackGameEngine contracts.
HousePool.sol
// Configuration for the House Pool
struct PoolConfig {
address assetToken; // USDC or WETH
uint256 minBet; // Minimum bet (e.g., 10 USDC)
uint256 maxBet; // Maximum bet (e.g., 500 USDC)
address houseNFTContract; // HouseNFT address
uint256 houseTokenId; // Always 1 in MVP
address gameEngine; // BlackjackGameEngine
}
// Mutable pool state
struct PoolState {
uint256 totalDeposited;
uint256 totalWithdrawn;
uint256 currentBalance;
uint256 lifetimeVolume;
uint256 lifetimeHandsPlayed;
uint256 totalHouseEdgeEarned;
}
BlackjackGameEngine.sol
enum HandStatus { Active, Completed }
enum HandOutcome { Pending, PlayerWin, DealerWin, Push, PlayerBlackjack }
struct Hand {
address player;
uint256 betAmount;
uint8[] playerCards;
uint8[] dealerCards;
HandStatus status;
HandOutcome outcome;
int256 payout;
uint256 timestamp;
}
struct VRFRequest {
uint256 handId;
address player;
uint256 betAmount;
bool fulfilled;
}
Security Considerations (Summary)
- Use ReentrancyGuard on all functions that move funds.
- Strict access control modifiers on privileged functions.
- Rely on Solidity 0.8+ for checked arithmetic to avoid overflows.
- Restrict VRF fulfillment to the official coordinator address.
- Enforce pool solvency: reject bets that could lead to underflow on payouts.
- Use VRF randomness + internal state to prevent front-running of card draws.
Chainlink VRF Simulation
This panel demonstrates how Chainlink VRF randomness would be requested and fulfilled on-chain. All randomness here is simulated using secure JavaScript PRNG for demo purposes.
VRF Request
VRF Response
No VRF requests yet.
CasinoFi Dice Game (Provably Fair)
Roll a number from 1 to 100. If the roll is above your prediction, you win! All randomness is simulated via VRF module for this demo.
Place Your Bet
Roll Result
Crash Game (Live Multiplier)
Bet on a multiplier. The line will rise until it crashes randomly. Cash out before the crash to win! Crash point is simulated using VRF-style randomness.
Place Your Bet
Multiplier
House Owner Access Required
Only the current House NFT owner can access the dashboard controls.
Current Owner: 0x0000...0000
๐ House Dashboard
Owner AccessManage your House Pool liquidity, set bet limits, and monitor risk exposure.
๐ฐ Liquidity Management
Deposit Liquidity
Add funds to increase pool capacity and reduce liquidation risk.
Withdraw Profits
Withdraw available profits while maintaining safety reserves.
๐ฏ Bet Limits Configuration
Set minimum and maximum bet amounts within protocol bounds. Lower max bets reduce variance and liquidation risk.
โก Quick Actions
Pool Overview
Liquidation Risk
Pool Health
Your pool balance is critically low. A single large win could trigger liquidation and transfer your House NFT to the winning player.
Recommendation: Deposit more liquidity or lower max bet limits immediately.
๐ Liquidation Math Model
This model calculates pool solvency, maximum safe bets, and liquidation thresholds. The House must always be able to cover the worst-case payout scenario.
Core Solvency Formula
Max Safe Bet = Pool Balance รท Max Payout Multiplier
For Blackjack with 3:2 natural payouts, the worst case is a player winning $2.50 for every $1 bet.
๐งฎ Scenario Calculator
Adjust the pool balance to see how it affects betting limits and liquidation risk.
*Assuming max bets and consistent player wins (worst case scenario)
๐ Bet Size โ Exposure Table
This table shows the maximum potential payout (exposure) for different bet sizes.
| Bet Size | Standard Win (1:1) | Blackjack Win (3:2) | Pool After BJ Loss | Status |
|---|
Live Pool Metrics
Threshold Definitions
Protocol Safety Parameters
| Min Pool for Operations | $1,000 |
| Safety Reserve % | 20% |
| Max Bet Cap (Protocol) | $10,000 |
| Liquidation Threshold | $0 |
| House Edge | 2.5% |
$CASINO Token Economy
$CASINO is the in-game currency powering all 21Flip games. Use it for Blackjack, Crash, Dice, and marketplace transactions.
Your Wallet
Token Supply
Usage
- Bet using $CASINO instead of USD
- Marketplace prices can be shown in both USD and $CASINO
- House flips increase token sink (burn)
- Crash, Blackjack, Dice all deduct from $CASINO balance