
TruDelnik
TruDelník: stake crypto, face escalating odds, cash out anytime or lose all—provably fair on-chain.
Demo
About
🎲 TruDelník Game 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 2025 🇨🇿 You can find a live demo here: https://trudelnik.netlify.app 🎮 Game Concept: 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 Levels: 🟢 Easy - Success Rate : 90% - Max Steps : 24 - Max Multiplier : 24.5x 🟡 Medium - Success Rate : 85% - Max Steps : 22 - Max Multiplier : 2,254x 🔴 Hard - Success Rate : 70% - Max Steps : 20 - Max Multiplier : 52,067x ⚫ Hardcore - Success Rate : 55% - Max Steps : 15 - Max Multiplier : 3,203,384x 🏗️ Architecture: trdelnik-game/ ├── 🏛️ contracts/ # Solidity smart contracts │ ├── Game.sol # Flare Network version │ └── BerachainGame.sol # Berachain version with Pyth Entropy ├── 🎨 frontend/ # React/TypeScript interface │ ├── Multi-chain support │ ├── Merits integration │ └── Akave storage └── 📚 Documentation & deployment scripts 🤝 Partner Integrations: 🔥 Flare Network - Secure Randomness - Implementation: RandomNumberV2Interface in Game.sol - Network: Coston2 Testnet (Chain ID: 114) - Status: ✅ Fully Functional - Features: - Synchronous random number generation - Built-in randomness verification - Production-ready deployment ⚡ Pyth Network - Entropy Protocol - Implementation: IEntropy and IEntropyConsumer in BerachainGame.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 🔍 Blockscout - Merits, Explorer & SDK Integration - Implementation: Merit-based leaderboard system + Blockscout SDK (https://docs.blockscout.com/devs/blockscout-sdk) integration - Status: ✅ Fully Functional + 🎯 ETHGlobal Bounty Target ($3,000 for best SDK usage) - Features: - 🏆 Merit System: 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 - 🔔 Real-time Notifications: Transaction toast notifications with pending/success/error states - 📝 Transaction History: Popup with recent transactions for addresses or entire chains - 📱 Mobile-responsive: Optimized SDK integration for all devices - 🔗 Deep Integration: Transaction interpretation and detailed summaries 📦 Protocol Labs (Akave) - Decentralized Storage - Implementation: Proof-of-play storage system - Status: ✅ Fully Functional - Features: - Game history stored on decentralized storage - Randomness transparency - all game infos recorded - Immutable records of wins, losses, and payouts - CORS-configured for seamless frontend integration 🌐 Multi-Chain Support: 🔥 Coston2 - Contract Type : TrdelnikGame - Randomness Provider : Flare Randomness - Status : ✅ Live 🐻 Berachain - Contract Type : BerachainGame - Randomness Provider : Pyth Entropy - Status : 🔄 Testing Chain Selector: - Automatic detection of connected wallet network - Seamless switching between supported chains - Chain-specific contract interactions and fee handling 🚀 Key Features: 🎲 Provably Fair Gaming - Blockchain-verified random number generation - Transparent randomness sources (Flare/Pyth) - Immutable game state and history 💎 Merit System - Earn Merits for every game played - Unlock features with Merit requirements - Leaderboard competition with other players 📊 Complete Transparency - All game data stored on Akave - Transaction hashes for every action - Randomness proofs publicly verifiable 🎨 Modern UI/UX - Responsive design with Tailwind CSS - Real-time updates and animations - Multi-chain wallet integration - 🔔 Transaction Notifications: Real-time toast notifications for all game actions - 📜 Transaction History: Instant access to transaction history with Blockscout SDK - 📱 Mobile-optimized: Seamless experience across all devices 🛠️ Technical Stack: Smart Contracts - Solidity ^0.8.0 with OpenZeppelin security - Hardhat development environment - Multi-network deployment automation Frontend - React 18 with TypeScript - Vite for fast development - Tailwind CSS for styling - ethers.js for blockchain interaction - @blockscout/app-sdk (https://www.npmjs.com/package/@blockscout/app-sdk) for transaction notifications and history Blockchain Integration - MetaMask wallet connection - Multi-chain support (Flare, Berachain) - Automatic network switching - Real-time transaction tracking with Blockscout SDK integration 🚦 Current Status: ✅ Working Features - ✅ 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 🔄 In Development - 🔄 Pyth Entropy integration - debugging event emission issue 🎯 ETHGlobal Prague 2025: 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 🎯 ETHGlobal Bounties Targeted - 🔍 Blockscout SDK Integration: $3,000 bounty for best SDK usage (https://docs.blockscout.com/devs/blockscout-sdk) - Real-time transaction notifications in gaming interface - Transaction history popup for game verification - Enhanced UX with mobile-responsive design --- 🚀 Quick Start: # Clone the repository git clone https://github.com/yourusername/trdelnik-game cd trdelnik-game # Install dependencies - both FE and SC npm install # Set up environment variables - both FE and SC cp .env.example .env # Deploy contracts cd contracts && npm run deploy:coston2 # Start frontend cd ../frontend && npm run dev 🔗 Links: - 🎮 Live Demo: https://trudelnik.netlify.app - 🔍 Explorer: (Coston2 Blockscout) https://coston2-explorer.flare.network/ - 📊 Merits: (Blockscout Merits) https://merits-staging.blockscout.com/ --- Built with ❤️ for ETHGlobal Prague 2025 🇨🇿
How it's made
TruDelník lives or dies on provably fair randomness, so we wired that layer before anything else. On Flare (Coston2) we call RandomNumberV2Interface and get a value back in the same transaction—no waiting, no polling, instant UX. On Berachain we lean on Pyth Entropy, an asynchronous oracle that emits a callback once the randomness is ready. Every game round stores the request-ID, so when the oracle fires we stitch the answer to the right player and step. The result: one codebase, two randomness modes, both publicly verifiable and signed by their respective networks How the rest comes together • Smart contracts — Solidity 0.8.25, zero upgradeability for transparency. Two concrete contracts share a common library: one speaks Flare’s sync API, the other implements IEntropyConsumer.receiveEntropy. We pack game state into a four-field struct and push full play history to IPFS via Akave so the chain stays lean. • Front-end — React 18 + Vite + Tailwind. State lives in a lightweight Zustand store; an useRandomness hook transparently handles the “sync vs async” dance and shows either an instant multiplier or a spinner that resolves on callback. • Blockscout App SDK : we show tx hashes, stream status updates into toast notifications, and fetch decoded receipts for a popup history panel. The same SDK surfaces “Merits” balances that gate harder difficulty levels. • Akave storage — after each round the contract fires GameEnded(cid); the UI grabs the CID, pins the JSON off-chain, and anyone can audit stake, steps, final multiplier, and the oracle proof forever. • CI/CD — Hardhat for local and GitHub Actions for fuzzing with Foundry, deploying to Flare, and publishing a Netlify preview on every pull request.