RPS Arena
On-chain Rock-Paper-Scissors battles with Pyth randomness & PYUSD betting
Problem Statement
RPS Arena is a decentralized Rock-Paper-Scissors battle game built on Ethereum that combines verifiable randomness with instant payouts. Players see a battlefield scenario with Rock/Paper/Scissors units, predict the winner, place their bet in PYUSD or ETH, and watch the epic battle unfold with on-chain randomness from Pyth Network.The game features: Instant gameplay: Players place bets and get results immediately using Pyth's verifiable randomness Multi-token support: Bet with ETH or PYUSD with configurable minimums Fair randomness: Uses Pyth Entropy V2 for provably fair game outcomes Battle animations: Canvas-based visual battles with real-time results Solvency protection: Smart contract reserves funds to guarantee payouts Commission system: Built-in house edge with withdrawable profits
Solution
Built on scaffold-eth framework with Hardhat 3 for smart contract development and Next.js for the frontend. The project leverages several cutting-edge technologies:Smart Contract Architecture: Pyth Entropy V2 integration for verifiable randomness with customizable gas limits Multi-token support with ERC20 token management and fee-on-transfer handling Solvency protection with real-time liability tracking and maximum bet calculations Reentrancy guards and comprehensive error handling for securityFrontend Stack: Next.js 14 with App Router for modern React development Wagmi + RainbowKit for seamless wallet integration Canvas API for battle animations and visual effects TypeScript throughout for type safetyKey Technical Innovations: Entropy callback system: Asynchronous randomness generation with sequence number tracking Dynamic solvency: Real-time calculation of maximum bet amounts based on contract balance Token abstraction: Unified interface for ETH and ERC20 tokens with different decimal handling Gas optimization: Custom entropy gas limits and efficient state management Notable hacks: Fee-on-transfer token support: Measures actual received amounts vs. requested amounts Sequence number mapping: Bidirectional mapping between entropy requests and game IDs Timeout mechanism: Admin can expire stuck games and refund players Commission separation: Tracks house profits separately from player funds The project demonstrates advanced smart contract patterns while maintaining a simple, engaging user experience that makes blockchain gaming accessible to mainstream users.
Hackathon
ETHOnline 2025
2025
Contributors
- technophile-04
143 contributions
- carletex
106 contributions
- rin-st
67 contributions
- sverps
26 contributions
- damianmarti
18 contributions
- DimaKush
18 contributions
- Pabl0cks
17 contributions
- edakturk14
11 contributions
- portdeveloper
9 contributions
- KcPele
7 contributions
- Naim-Bijapure
6 contributions
- austintgriffith
5 contributions
- kevinjoshi46b
4 contributions
- FilipHarald
4 contributions
- JacobHomanics
4 contributions
- kmjones1979
3 contributions
- simplemachine92
2 contributions
- ShravanSunder
2 contributions
- AzimovS
2 contributions
- MukulKolpe
2 contributions
- ChangoMan
2 contributions
- GigaHierz
2 contributions
- camdengrieh
2 contributions
- ByteAtATime
2 contributions
- nathan-websculpt
1 contributions
- iPaulPro
1 contributions
- bpierre
1 contributions
- metalboyrick
1 contributions
- schmidsi
1 contributions
- tjayrush
1 contributions