RPS Arena

On-chain Rock-Paper-Scissors battles with Pyth randomness & PYUSD betting

Visit Repo
RPS Arena banner

About

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

How it's made

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 security

Frontend 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 safety

Key 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.

From the public ETHGlobal showcase page. Votes, swipes and the judge score are hackfeed's own.

AI judge

Not judged yet. A free model reads this page, compares it with similar projects and this event's winners, then scores it and says what would make it win.

Still being built?

Not checked yet.

Swipe stats

0upvotes
0skips
0saves

Discussion 0

No comments yet. Ask the team something, or say what you'd use it for.

Posting as a guest. Plain text, 1,000 characters max.

Already built nearby

Closest projects by meaning and shared words. Similar isn't the same as copied: read them.

RPS Battle arean

The ultimate AI-powered celebrity showdown where you bet on AI-generated Rock Paper Scissors battles between virtual stars. Watch, wager, and win as legendary icons face off in high-stakes game

Flip or Flop

Blockchain card battle game powered by live Pyth price feeds and provably fair randomness