← Back to home

Casino-on-chain

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

Problem Statement

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 channelsPlay instant, gas-free games against other playersWin/lose chips off-chain with zero feesCash out anytime with on-chain settlementWhy 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 + MetaMaskBackend: Node.js + WebSocket serverBlockchain: Yellow Network (ERC-7824) + Ethereum + USDCThe 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.

Solution

Architecture:React frontend connects to MetaMask for wallet integrationyellowService.js handles Yellow Network state channel operations (authentication, balance queries, channel management)WebSocket server coordinates real-time multiplayer gameplay and game state synchronizationPlayers sign once to open Yellow channels, then play unlimited games gas-freeKey Technologies:Yellow Network SDK - State channel protocol implementationWebSocket (ws library) - Real-time bidirectional communication for game lobby and movesReact + Vite - Fast development and smooth UIMetaMask - Wallet connection and transaction signingChallenges & Solutions:Challenge: React closure issues with chip calculations Solution: Used useRef to avoid stale state in async callbacksChallenge: Real-time game synchronization across browsers Solution: WebSocket pub-sub pattern for instant game state updatesChallenge: Yellow Network app session API still in development Solution: Simulated game sessions locally while maintaining real authentication and balance queriesThe project demonstrates production-ready architecture for state channel gaming, with authentication and balance management fully integrated with Yellow Network's ClearNode.

Hackathon

ETHOnline 2025

2025

Contributors