Casino-on-chain

Real-time multiplayer casino platform built on Yellow Network's state channels (ERC-7824)

Casino-on-chain

Created At

ETHOnline 2025

Project Description

Casino-on-Chain is a real-time multiplayer casino platform built on Yellow Network's state channels (ERC-7824).

Our MVP features a coin flip game where players:

  • Deposit USDC into Yellow Network channels
  • Play instant, gas-free games against other players
  • Win/lose chips off-chain with zero fees
  • Cash out anytime with on-chain settlement

Why State Channels? Traditional on-chain gaming suffers from high gas fees ($10-50/tx) and slow confirmations. State channels enable thousands of games per second with instant settlements and zero gas fees during gameplay.

Tech Stack:

  • Frontend: React + Vite + MetaMask
  • Backend: Node.js + WebSocket server
  • Blockchain: Yellow Network (ERC-7824) + Ethereum + USDC

The game demonstrates how state channels can power real-time multiplayer gaming while maintaining blockchain security. Future plans include Blackjack, Poker, Roulette, and a universal chip system across all games.

How it's Made

Architecture:

  • React frontend connects to MetaMask for wallet integration
  • yellowService.js handles Yellow Network state channel operations (authentication, balance queries, channel management)
  • WebSocket server coordinates real-time multiplayer gameplay and game state synchronization
  • Players sign once to open Yellow channels, then play unlimited games gas-free

Key Technologies:

  1. Yellow Network SDK - State channel protocol implementation
  2. WebSocket (ws library) - Real-time bidirectional communication for game lobby and moves
  3. React + Vite - Fast development and smooth UI
  4. MetaMask - Wallet connection and transaction signing

Challenges & Solutions:

  • Challenge: React closure issues with chip calculations Solution: Used useRef to avoid stale state in async callbacks

  • Challenge: Real-time game synchronization across browsers Solution: WebSocket pub-sub pattern for instant game state updates

  • Challenge: Yellow Network app session API still in development Solution: Simulated game sessions locally while maintaining real authentication and balance queries

The project demonstrates production-ready architecture for state channel gaming, with authentication and balance management fully integrated with Yellow Network's ClearNode.

background image mobile

Join the mailing list

Get the latest news and updates