TruDelnik
TruDelník: stake crypto, face escalating odds, cash out anytime or lose all—provably fair on-chain.
Problem Statement
🎲 TruDelník GameWeb3 Risk-Based Gaming with Verifiable RandomnessMonorepo 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 transparencyDifficulty Levels:🟢 EasySuccess Rate : 90%Max Steps : 24Max Multiplier : 24.5x🟡 MediumSuccess Rate : 85%Max Steps : 22Max Multiplier : 2,254x🔴 HardSuccess Rate : 70%Max Steps : 20Max Multiplier : 52,067x⚫ HardcoreSuccess Rate : 55%Max Steps : 15Max 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 RandomnessImplementation: RandomNumberV2Interface in Game.solNetwork: Coston2 Testnet (Chain ID: 114)Status: ✅ Fully FunctionalFeatures:Synchronous random number generationBuilt-in randomness verificationProduction-ready deployment⚡ Pyth Network - Entropy ProtocolImplementation: IEntropy and IEntropyConsumer in BerachainGame.solNetwork: Berachain Mainnet (Chain ID: 80094)Status: 🔄 Under Development (transactions succeed but events not emitted)Features:Asynchronous randomness with callbacksUser-provided entropy mixingFee-based randomness requests🔍 Blockscout - Merits, Explorer & SDK IntegrationImplementation: Merit-based leaderboard system + Blockscout SDK (https://docs.blockscout.com/devs/blockscout-sdk) integrationStatus: ✅ 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 StorageImplementation: Proof-of-play storage systemStatus: ✅ Fully FunctionalFeatures:Game history stored on decentralized storageRandomness transparency - all game infos recordedImmutable records of wins, losses, and payoutsCORS-configured for seamless frontend integration🌐 Multi-Chain Support:🔥 Coston2Contract Type : TrdelnikGameRandomness Provider : Flare RandomnessStatus : ✅ Live🐻 BerachainContract Type : BerachainGameRandomness Provider : Pyth EntropyStatus : 🔄 TestingChain Selector:Automatic detection of connected wallet networkSeamless switching between supported chainsChain-specific contract interactions and fee handling🚀 Key Features:🎲 Provably Fair GamingBlockchain-verified random number generationTransparent randomness sources (Flare/Pyth)Immutable game state and history💎 Merit SystemEarn Merits for every game playedUnlock features with Merit requirementsLeaderboard competition with other players📊 Complete TransparencyAll game data stored on AkaveTransaction hashes for every actionRandomness proofs publicly verifiable🎨 Modern UI/UXResponsive design with Tailwind CSSReal-time updates and animationsMulti-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 ContractsSolidity ^0.8.0 with OpenZeppelin securityHardhat development environmentMulti-network deployment automationFrontendReact 18 with TypeScriptVite for fast developmentTailwind CSS for stylingethers.js for blockchain interaction@blockscout/app-sdk (https://www.npmjs.com/package/@blockscout/app-sdk) for transaction notifications and historyBlockchain IntegrationMetaMask wallet connectionMulti-chain support (Flare, Berachain)Automatic network switchingReal-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 accessibilityTruDelník demonstrates how Web3 gaming can achieve:Complete transparency in random number generationImmutable game records stored decentrallyCross-chain user experiencesCommunity-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 interfaceTransaction history popup for game verificationEnhanced UX with mobile-responsive design🚀 Quick Start:Clone the repositorygit clone https://github.com/yourusername/trdelnik-game cd trdelnik-gameInstall dependencies - both FE and SCnpm installSet up environment variables - both FE and SCcp .env.example .envDeploy contractscd contracts && npm run deploy:coston2Start frontendcd ../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 🇨🇿
Solution
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 networksHow 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.
Hackathon
ETHGlobal Prague
2025
Prizes
- 🏆
MAIN TRACK: use protocols on Flare blockchain3rd place
Flare Network
- 🏆
Build Fair Data Economy with Filecoin x Akave3rd place
Protocol Labs
- 🏆
Best Blockscout Merits (points) Use Case
Blockscout
Contributors
- slavni96
24 contributions
- luca-franzesi
2 contributions