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
1
Play Blackjack

Bet against the House Pool using provably fair randomness.

2
Drain the Pool

Win enough hands to drive the House Pool balance to zero.

3
Flip the House

When the pool hits zero, you inherit the House NFT and become the new House.

Protocol Stats (Simulated)
House Pool
$0
Your Balance
$0
Hands Played
0
Volume
$0
House Flips
0
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.

Your Balance: $0
House Pool: $0
Min / Max Bet: $0 / $0
Dealer
?
0
You
Place Your Bet
Min Bet: $0 Max Bet: $0
Provably Fair (Simulated): In production, cards are drawn using Chainlink VRF. Here we simulate a multi-deck shoe with no repeated cards. House edge: 2.5%. If the pool hits $0, the current winning player becomes the new House NFT owner.
Game Stats (Local Session)
Player Address
Not Connected
Hands
0
Volume
$0
House Flips
0
๐Ÿ† You are the current House NFT owner. Set bet limits and manage risk from the Marketplace tab.
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)
House NFT Marketplace (Simulated)
๐Ÿ†
Token ID
#1
Current Owner
0x...

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.

Pool Balance
$0
Daily Revenue (Sim)
$847
Listed Price $0
Platform fee: 2.5% (simulated)
Risk Warning: This is a high-risk ownership position. If players drain the pool, you lose your NFT automatically. Never commit more than you can afford to lose.
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
Liquidity Management & Settlement
Core
Responsibilities
  • 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
Key Functions
depositLiquidity(uint256 amount)
withdrawLiquidity(uint256 amount)
setBetLimits(uint256 min, uint256 max)
handleHandResult(address player, int256 amount, uint256 houseEdge)
triggerLiquidation(address winner)
Access Control
  • onlyHouseOwner: deposit, withdraw, setBetLimits
  • onlyGameEngine: handleHandResult
BlackjackGameEngine.sol
Game Logic & VRF
Core
Responsibilities
  • 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)
Key Functions
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
Access Control
  • onlyPlayer: hit, stand (for own hand)
  • onlyVRFCoordinator: fulfillRandomWords
  • public: startHand (with bet validation)
HouseNFT.sol
Single Ownership Token
Core
Responsibilities
  • ERC-721 representing House ownership
  • Single token (tokenId = 1) in MVP
  • Minted to initial House owner
  • Transferable via marketplace or liquidation
Key Functions
mint(address initialOwner)
transferOnLiquidation(address newOwner) // called by HousePool
ownerOf(uint256 tokenId) returns (address)
tokenURI(uint256 tokenId) returns (string)
Access Control
  • onlyHousePool: transferOnLiquidation
  • onlyOwner (deployer): mint (one-time)
HouseMarketplace.sol
NFT Trading & Fees
Peripheral
Responsibilities
  • Fixed-price listings for House NFT
  • Facilitates ownership transfers
  • Collects protocol fee (e.g., 2.5%)
  • Routes proceeds to seller
  • Allows listing cancellation
Key Functions
listHouse(uint256 price)
updatePrice(uint256 newPrice)
cancelListing()
buyHouse() payable
setProtocolFee(uint256 basisPoints) onlyOwner
Access Control
  • 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.

1
House Owner Deposits Liquidity
Actor: House Owner  โ€ข  Contract: HousePool
depositLiquidity(10_000 USDC)
The House owner seeds the pool with capital, becoming eligible to earn the house edge.
2
House Sets Bet Limits
Actor: House Owner  โ€ข  Contract: HousePool
setBetLimits(min: 10, max: 500)
The protocol enforces these limits for every hand started via BlackjackGameEngine.
3
Player Starts a Hand
Actor: Player  โ€ข  Contract: BlackjackGameEngine
startHand(100 USDC)
The contract validates the bet against HousePool limits and requests randomness via Chainlink VRF.
4
VRF Returns Randomness
Actor: Chainlink VRF  โ€ข  Contract: BlackjackGameEngine
fulfillRandomWords(requestId, [randomWords...])
Cards are dealt to player and dealer based on VRF output, ensuring fairness.
5
Player Makes Decisions
Actor: Player  โ€ข  Contract: BlackjackGameEngine
hit(handId) / stand(handId)
The player can draw additional cards or stand; then the dealer auto-plays to 17+.
6
Hand Settles
Actor: BlackjackGameEngine  โ€ข  Contract: HousePool
handleHandResult(player, +150, 2.5)
Payouts are computed, house edge captured, and the pool balance is updated accordingly.
7
Pool Depleted (Liquidation)
Actor: Multiple Players  โ€ข  Contract: HousePool
// Pool reaches 0 through a series of winning hands
Once balance reaches zero, HousePool triggers liquidation logic and identifies the winner.
8
House Flips (Ownership Transfer)
Actor: HousePool  โ€ข  Contract: HouseNFT
transferOnLiquidation(winningPlayer)
The House NFT is transferred to the winning player, who now becomes the new House owner and can list the NFT on the marketplace.

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
Requesting VRF...
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
Win Chance: 50% โ€” Payout: 1.98x
Roll Result
โ€”
Latest Random Value

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
1.00x
๐Ÿ”’

House Owner Access Required

Only the current House NFT owner can access the dashboard controls.

Current Owner: 0x0000...0000

๐Ÿ  House Dashboard

Owner Access

Manage 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.

Available to withdraw: $0
๐ŸŽฏ Bet Limits Configuration

Set minimum and maximum bet amounts within protocol bounds. Lower max bets reduce variance and liquidation risk.

Protocol min: $1
Recommended max: $0
โšก Quick Actions
Pool Overview
Current Balance
$0
Lifetime PnL
+$0
Hands Dealt
0
Avg Bet Size
$0
Liquidation Risk
Low Medium High Critical
Low Risk
Pool Health
Status: Healthy
80% of capacity
โš ๏ธ Liquidation Risk!

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.

Pool Balance
$0
Max Payout Multiplier
2.5ร—
Max Safe Bet
$0
๐Ÿงฎ Scenario Calculator

Adjust the pool balance to see how it affects betting limits and liquidation risk.

$1,000 $500,000
Max Safe Bet
$0
Conservative Max
$0
Hands to Liquidate*
0
Safety Reserve
$0

*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
Current Pool $0
Current Max Bet $0
Worst Case Exposure $0
Pool After Max Loss $0
Solvency Status Solvent
Threshold Definitions
Healthy > 60% capacity
Pool is well-capitalized. All bet sizes safe.
Warning 40-60% capacity
Consider lowering max bets or adding liquidity.
Danger 20-40% capacity
High risk. Lower bet limits immediately.
Critical < 20% capacity
Liquidation imminent. Emergency action needed.
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
Your Balance:
0 $CASINO
Token Price:
$0.00
Token Supply
Total Supply
0
Circulating Supply
0
Backed By House Pool
$0

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