Multiplayer snake game with blockchain staking, provably fair randomness, and on-chain leaderboards



0xSlither is a real-time multiplayer snake game where every bite has real stakes. Players connect their wallets and stake SSS tokens to enter matches, then compete in a familiar but intensified arena where eliminating opponents means claiming their entire stake. The game solves a fundamental problem in competitive Web3 gaming: trust. Using Pyth Entropy on Base Sepolia, every match's spawn positions, pellet layouts, and snake colors are derived from cryptographically verifiable randomness, making server manipulation impossible. The entropy seed is bridged cross-chain to Saga Chainlet where the game economy lives, creating a transparent paper trail anyone can audit. Players can "tap out" anytime to safely withdraw their current stake, or go all-in trying to eliminate others and collect their bounties. Every kill, every stake transfer, and every leaderboard update is recorded permanently on-chain. The game runs on Fluence CPU for decentralized compute, ensuring no single entity controls the game server. With smooth 60 FPS gameplay, authoritative 20 TPS server updates, and a complete on-chain economy, 0xSlither proves that Web3 games can be both technically sophisticated and genuinely fun to play. It's live at 0xslither.vercel.app with real players (me, friends, and maybe you?? lol) competing for real stakes right now.
0xSlither is built on a multi-chain architecture that leverages the strengths of different networks. The game economy, and most of the project, lives on Saga Chainlet, a dedicated EVM L1 with recycled gas fees that makes frequent staking transactions economically viable. For randomness, we integrated Pyth Entropy deployed on Base Sepolia, creating a cross-chain bridge where our game server requests entropy, waits for the oracle's reveal, then commits the seed hash to Saga before using it deterministically to generate all match-critical random values. This makes every match reproducible and verifiable. The game server runs on Fluence CPU, providing decentralized compute that eliminates single points of failure. We built a real-time authoritative server in TypeScript running at 20 TPS with WebSocket communication, while the client renders at 60 FPS using Canvas 2D with advanced interpolation for butter-smooth movement despite network latency. The smart contracts use OpenZeppelin libraries and handle complex state like per-player-per-match stake balances, real-time loot transfers when snakes eat each other, and a dynamic on-chain leaderboard that updates best scores automatically. One particularly hacky solution was implementing deterministic RNG using chained keccak256 hashes from a single entropy seed—we derive spawn positions with retry logic to prevent overlaps, generate unique snake colors, and create entire 500-pellet fields, all reproducibly from one verifiable seed. The frontend auto-configures MetaMask with Saga Chainlet's network parameters, eliminating the usual Web3 onboarding friction. We deployed the frontend to Vercel with environment-based configuration that seamlessly switches between local dev and production with the live Fluence server. The entire stack is TypeScript with shared types between client, server, and contracts, making the codebase maintainable despite the architectural complexity.

