Skip to content

Conversation

@fchambi
Copy link

@fchambi fchambi commented Nov 23, 2025

🎰 Crypto Roulette & Daily Lottery

Pyth Entropy Submission - ETH Global Buenos Aires 2025

A dual gaming system demonstrating innovative use of Pyth Entropy V2 for verifiable on-chain randomness.


🎯 Project Overview

Crypto Roulette & Daily Lottery creates an interconnected gaming ecosystem where:

  1. Players spin a crypto roulette (guess BTC/ETH/SOL/AVAX/DOGE)
  2. Winners automatically qualify for a daily lottery
  3. All ticket prices accumulate in a daily prize pool
  4. One lucky winner takes the entire pool each day

Both games powered by Pyth Entropy V2 for provably fair randomness.


🔮 Innovation: Dual Randomness Patterns

Unlike typical single-game implementations, this project showcases TWO distinct use cases for Pyth Entropy in one ecosystem:

Pattern 1: High-Frequency Randomness (CryptoRoulette)

  • Continuous, player-initiated randomness requests
  • Real-time gameplay with instant results
  • Each spin independent and verifiable
  • Demonstrates Pyth Entropy for gaming applications

Pattern 2: Periodic Randomness (DailyLottery)

  • Scheduled, admin-triggered randomness
  • High-stakes winner selection from whitelist
  • Fair distribution mechanism
  • Demonstrates Pyth Entropy for lottery/raffle systems

This dual-pattern approach highlights Pyth Entropy's versatility across different gaming mechanics within a single interconnected economy.


✨ Key Features

  • Two contracts consuming Pyth Entropy V2
  • Interconnected economy: Roulette funds lottery, winners enter lottery
  • Production-ready: Deployed and verified on Optimism Sepolia
  • Comprehensive docs: Complete README and deployment guide
  • Real-world mechanics: Winner-takes-all, whitelist-based, emergency functions

🚀 Deployed Contracts (Optimism Sepolia)

Contract Address Explorer
CryptoRoulette 0x19aab2239911164c9051ccaed184102a10d7121f View
DailyLottery 0x5149cc9f6c3a4b60cfa84125161e96b0cf677eb4 View

Network: Optimism Sepolia (Chain ID: 11155420)
Deployed Block: 36038675
Status: ✅ Verified and Functional


🛠️ Tech Stack

  • Solidity 0.8.13
  • Pyth Entropy SDK V2
  • Foundry (development & deployment)
  • Scaffold-ETH 2 (full-stack dApp)
  • Next.js + RainbowKit + Wagmi

📊 Technical Implementation

CryptoRoulette.sol

// Request random number
uint64 sequenceNumber = entropy.requestV2{ value: entropyFee }();

// Callback with result
function entropyCallback(uint64 sequenceNumber, address, bytes32 randomNumber) {
uint256 randomIndex = uint256(randomNumber) % 5;
Asset resultAsset = Asset(randomIndex);
// Determine winner and add to lottery if won
}### DailyLottery.sol
// Trigger daily draw
uint64 sequenceNumber = entropy.requestV2{ value: entropyFee }();

// Callback selects winner
function entropyCallback(uint64 sequenceNumber, address, bytes32 randomNumber) {
uint256 winnerIndex = uint256(randomNumber) % whitelist.length;
address winner = whitelist[winnerIndex];
// Transfer prize to winner
}---

📁 Submission Contents

entropy-sdk-solidity/examples/crypto-roulette-lottery/
├── README.md (Comprehensive documentation)
├── DEPLOYMENT.md (Step-by-step deployment guide)
├── contracts/
│ ├── CryptoRoulette.sol (Roulette game contract)
│ ├── DailyLottery.sol (Lottery contract)
│ └── interfaces/
│ └── IDailyLottery.sol (Interface)
└── script/
└── DeployCryptoRoulette.s.sol (Deployment script)
🏆 Built For
ETH Global Buenos Aires Hackathon 2025
Track: DeFi / Gaming
Prize: Pyth Entropy Pool Prize
Qualification Requirements Met:
✅ Uses Pyth Entropy to generate random numbers on-chain
✅ Consumes random numbers in smart contracts via callbacks
✅ Demonstrates innovative use (dual patterns in one ecosystem)
✅ Production-ready deployment with verification
✅ Comprehensive documentation

This project goes beyond basic Pyth Entropy integration by:
Innovation: Demonstrates TWO distinct randomness patterns in a single ecosystem
Complexity: Cross-contract integration with shared state
Production-Ready: Fully deployed, verified, and functional
Documentation: Comprehensive README and deployment guide
Real-World Use: Practical gaming mechanics that users can actually play
The dual-pattern approach showcases Pyth Entropy's versatility: it's not just for one type of randomness, but can power different gaming mechanics working together in harmony.

…tropy V2

This submission demonstrates innovative use of Pyth Entropy V2 for verifiable
on-chain randomness in a dual gaming ecosystem.

Features:
- Two contracts consuming Pyth Entropy (CryptoRoulette & DailyLottery)
- Dual randomness patterns: high-frequency (roulette) + periodic (lottery)
- Interconnected game economy with shared prize pool
- Deployed and verified on Optimism Sepolia
- Complete deployment scripts and comprehensive documentation

Innovation:
Uses Pyth Entropy for both continuous player-initiated spins and scheduled
admin-triggered lottery draws, showcasing the protocol's versatility across
different gaming mechanics within a single ecosystem.

Technical Highlights:
- Implements IEntropyConsumer interface in both contracts
- Secure two-step randomness pattern (request + callback)
- Cross-contract integration (roulette feeds lottery)
- Winner-takes-all lottery mechanism
- Emergency functions for edge cases

Deployed Contracts:
- CryptoRoulette: 0x19aab2239911164c9051ccaed184102a10d7121f
- DailyLottery: 0x5149cc9f6c3a4b60cfa84125161e96b0cf677eb4
- Network: Optimism Sepolia (Chain ID: 11155420)

Built for ETH Global Buenos Aires Hackathon
Qualifying for Pyth Entropy Pool Prize (,000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant