add 0xslither: Pyth Entropy @ ETHGlobal BA 2025 #87
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pyth Examples Contribution
Type of Contribution
Project Information
Project/Example Name: 0xSlither
Pyth Product Used:
Blockchain/Platform:
Description
What does this contribution do?
0xSlither is a real-time multiplayer snake game with a complete on-chain economy and provably fair randomness. Players stake tokens to enter matches, compete in real-time gameplay, and winners collect the stakes of players they eliminate. The game features smooth 60 FPS rendering, authoritative server architecture running on decentralized compute (Fluence CPU), and all game outcomes are stored permanently on-chain.
Key Features:
How does it integrate with Pyth?
0xSlither uses Pyth Entropy in a cross-chain architecture to provide cryptographically secure, verifiable randomness for all match-critical random values:
Cross-Chain Architecture:
EntropyOracle.solcontractStakeArena.sol) with dedicated EVM L1 for game economyIntegration Flow:
Key Implementation:
EntropyBridgeService.ts: Handles cross-chain entropy requests and pollingEntropyOracle.sol: Consumes Pyth Entropy on Base Sepolia and stores seeds per matchDeterministicRNG.ts: Converts the entropy seed into reproducible random valuesStakeArena.sol: Stores entropy seed hash for on-chain verificationVerification:
StakeArena.entropySeedByMatch[matchId]EntropyOracle.entropyRequestIdByMatch[matchId]What problem does it solve or demonstrate?
Problems Solved:
Fair Randomness in Competitive Gaming: Traditional online games use server-side RNG that players must trust. 0xSlither demonstrates how Pyth Entropy provides cryptographically verifiable randomness, ensuring no player has an unfair spawn position or advantage.
Cross-Chain Randomness Architecture: Shows how to bridge Pyth Entropy between chains - requesting entropy on Base Sepolia (where Pyth is available) and using it on Saga Chainlet (the game chain), demonstrating real-world multi-chain integration patterns.
Deterministic Game Replay: By using a single verifiable seed, all game-critical random elements can be reproduced, enabling match replay, dispute resolution, and tournament verification.
On-Chain Gaming Economy with Verifiable Fairness: Combines real-time gameplay with blockchain-based staking economy, where fairness is provable through Pyth Entropy - crucial for games involving real value.
Use Cases Demonstrated:
Directory Structure (for new examples)
Testing & Verification
How to Test This Contribution
This project is fully deployed and live in production. You can test it immediately or run it locally.
Option 1: Test Live Deployment (Recommended)
No setup required! Just visit the live game:
🎮 https://0xslither.vercel.app
To test with staking:
Option 2: Run Locally
Prerequisites
Setup & Run Instructions
Test Multiplayer
Open multiple browser tabs to http://localhost:3000 (or the live URL) - each tab runs as a separate player!
Deployment Information (if applicable)
Production Deployment:
0x662371163C3797b66ab80dCB592761718537F492Networks:
Base Sepolia (Entropy Chain)
https://sepolia.base.org845320x662371163C3797b66ab80dCB592761718537F492Saga Chainlet (Game Chain)
https://slither-2763767854157000-1.jsonrpc.sagarpc.io2763767854157000Contract Addresses:
0x662371163C3797b66ab80dCB592761718537F492Demo URL: https://0xslither.vercel.app
Checklist
Code Quality
Testing
Documentation
Pyth Integration Specifics
Additional Context
Built for ETHGlobal Buenos Aires 2025 🇦🇷
This project was built as part of ETHGlobal Buenos Aires hackathon, demonstrating innovative use of Pyth Entropy for gaming applications.
Key Technical Achievements
Architecture Highlights
Why Cross-Chain?
Performance:
Related Issues
Part of Pyth Entropy adoption effort for gaming use cases.
Screenshots/Demo
Live Demo: https://0xslither.vercel.app
On-Chain Verification:
In-Game Features:
Notes for Reviewers
Live & Testable: The entire project is deployed and running at 0xslither.vercel.app - you can test it immediately without any setup!
Pyth Entropy Focus: The key integration is in:
server/src/EntropyBridgeService.ts- Cross-chain entropy bridgecontracts/contracts/EntropyOracle.sol- Pyth Entropy consumerserver/src/DeterministicRNG.ts- Seed-based RNGserver/src/GameServer.ts- Integration with game loopFallback Behavior: The game works without Pyth Entropy (uses crypto.randomBytes) but displays verification badge when Pyth is used, demonstrating production-ready error handling.
Cross-Chain Pattern: This demonstrates a reusable pattern for bringing Pyth Entropy to chains that don't have direct integration yet.
Complete Stack: This is a full production application, not just a proof-of-concept - includes frontend, backend, contracts, and deployment infrastructure.
Tech Stack
Frontend:
Backend:
Blockchain:
Future Enhancements
Links & Resources
Thank you for considering 0xSlither for Pyth Examples!
This project demonstrates real-world Pyth Entropy integration in a production gaming environment, showcasing cross-chain architecture, deterministic randomness, and verifiable fairness.