Web3 Risk-Based Gaming with Verifiable Randomness
Monorepo for TruDelník, a decentralized gambling game where players stake cryptocurrency, progress through risk-based steps with exponentially rising multipliers, and cash out anytime or lose it all. Built with verifiable blockchain randomness and complete transparency.
Built for ETHGlobal Prague 2024 🇨🇿
TruDelník is a high-stakes, step-based gambling game where:
- 🎯 Stake & Risk: Players stake ETH/BERA and choose difficulty levels
- 📈 Rising Multipliers: Each successful step increases potential winnings exponentially
- 💰 Cash Out Anytime: Players can exit with current winnings before the next step
- 💥 All or Nothing: One failed step loses the entire stake
- 🔐 Provably Fair: Blockchain-verified randomness ensures complete transparency
| Difficulty | Success Rate | Max Steps | Max Multiplier |
|---|---|---|---|
| 🟢 Easy | 90% | 24 | 24.5x |
| 🟡 Medium | 85% | 22 | 2,254x |
| 🔴 Hard | 70% | 20 | 52,067x |
| ⚫ Hardcore | 55% | 15 | 3,203,384x |
trdelnik-game/
├── 🏛️ contracts/ # Solidity smart contracts
│ ├── Game.sol # Flare Network version (TrdelnikGame)
│ └── BerachainGame.sol # Berachain version with Pyth Entropy
├── 🎨 frontend/ # React/TypeScript interface
│ ├── Multi-chain support
│ ├── Merits integration
│ └── Akave storage
└── 📚 Documentation & deployment scripts
- Implementation:
RandomNumberV2InterfaceinGame.sol - Network: Coston2 Testnet (Chain ID: 114)
- Status: ✅ Fully Functional
- Features:
- Synchronous random number generation
- Built-in randomness verification
- Production-ready deployment
- Implementation:
IEntropyandIEntropyConsumerinBerachainGame.sol - Network: Berachain Mainnet (Chain ID: 80094)
- Status: 🔄 Under Development (transactions succeed but events not emitted)
- Features:
- Asynchronous randomness with callbacks
- User-provided entropy mixing
- Fee-based randomness requests
- Implementation: Merit-based leaderboard system
- Features:
- 1 Merit awarded per game played
- Leaderboard rankings based on Merit balance
- Feature gating: Advanced difficulties require Merit thresholds
- Transaction explorer integration for game verification
- Implementation: Proof-of-play storage system
- Features:
- Game history stored on decentralized storage
- Randomness transparency - all random seeds recorded
- Immutable records of wins, losses, and payouts
- CORS-configured for seamless frontend integration
| Network | Contract Type | Randomness Provider | Status |
|---|---|---|---|
| 🔥 Coston2 | TrdelnikGame | Flare Randomness | ✅ Live |
| 🐻 Berachain | BerachainGame | Pyth Entropy | 🔄 Testing |
- Automatic detection of connected wallet network
- Seamless switching between supported chains
- Chain-specific contract interactions and fee handling
- Blockchain-verified random number generation
- Transparent randomness sources (Flare/Pyth)
- Immutable game state and history
- Earn Merits for every game played
- Unlock features with Merit requirements
- Leaderboard competition with other players
- All game data stored on Akave
- Transaction hashes for every action
- Randomness proofs publicly verifiable
- Responsive design with Tailwind CSS
- Real-time updates and animations
- Multi-chain wallet integration
- Solidity ^0.8.0 with OpenZeppelin security
- Hardhat development environment
- Multi-network deployment automation
- React 18 with TypeScript
- Vite for fast development
- Tailwind CSS for styling
- ethers.js for blockchain interaction
- MetaMask wallet connection
- Multi-chain support (Flare, Berachain)
- Automatic network switching
- ✅ Flare Network deployment - fully functional
- ✅ Multi-chain frontend with chain detection
- ✅ Merit system integration
- ✅ Akave storage for game history
- ✅ Complete UI/UX for all game functions
- 🔄 Pyth Entropy integration - debugging event emission issue
- 🔄 Berachain optimization - improving gas efficiency
- 🔄 Advanced features unlocked by Merit thresholds
This project showcases the integration of cutting-edge blockchain technologies:
- 🔐 Verifiable Randomness from multiple sources
- 📊 Decentralized Data Storage with Protocol Labs
- 🏆 Merit-based Gamification with Blockscout
- 🌍 Multi-chain Architecture for broader accessibility
TruDelník demonstrates how Web3 gaming can achieve:
- Complete transparency in random number generation
- Immutable game records stored decentrally
- Cross-chain user experiences
- Community-driven progression systems
# Clone the repository
git clone https://github.com/yourusername/trdelnik-game
cd trdelnik-game
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
# Deploy contracts
cd contracts && npm run deploy:coston2
# Start frontend
cd ../frontend && npm run dev- 🎮 Live Demo: trudelnik.netlify.app
- 🔍 Explorer: Coston2 Blockscout
- 📊 Merits: Blockscout Merits
Built with ❤️ for ETHGlobal Prague 2024 🇨🇿