Provably fair casino powered by Oasis ROFL - where even the house can't cheat. Luck meets proof.
QuantumBet: Where Luck Meets Proof
QuantumBet is a provably fair casino platform that solves the fundamental trust problem in online gambling: how can players verify that game outcomes are truly random and not manipulated by the house?
The Problem:
Traditional online casinos require players to trust that the house isn't rigging results. Even blockchain-based casinos struggle with randomness - oracles can be manipulated, and on-chain randomness is often predictable or expensive.
Our Solution:
We use Oasis ROFL (Runtime Off-chain Logic) running in Intel TDX - a Trusted Execution Environment - to generate cryptographically secure randomness that even we, the developers, cannot access or manipulate.
How It Works:
Players place bets through our Sapphire smart contracts Contracts emit events detected by our ROFL app running in the TEE ROFL generates random results using hardware-level isolation Results are signed with private keys that exist ONLY inside the TEE Smart contracts verify the TEE signature and pay out winners
Three Security Guarantees:
Secure Randomness: Generated in Intel TDX hardware isolation Provably Fair: Every result cryptographically signed and verifiable on-chain No Cheating: Even developers cannot manipulate outcomes - the randomness exists in hardware we can't access
Games:
Coin Flip: 50/50 odds with heads/tails selection Dice Roll: Adjustable multipliers (2x-10x) with corresponding win probabilities Mystery Box: Procedurally generated NFTs with six rarity tiers
QuantumBet demonstrates how trusted execution environments can enable truly trustless gaming where results are cryptographically verifiable and tamper-proof.
Building QuantumBet: A Deep Dive Smart Contract Development: I started by writing three Solidity contracts on Oasis Sapphire - GameManager (core game logic), LuckToken (ERC20 rewards), and MysteryBoxNFT (ERC721 with on-chain metadata). The contracts use Sapphire's confidential computing features to keep bet amounts private. Deployment was straightforward using Hardhat with custom Sapphire network configurations pointing to their testnet RPC. ROFL Implementation (The Challenging Part): The ROFL app was the most technically complex component. I built it in Python, creating a resolver that:
Monitors Sapphire for GameCreated events using web3.py Generates cryptographic randomness using Python's secrets module inside the TEE Signs results with TEE-backed private keys using eth_account Submits signed results back to the smart contract
The ROFL app runs in a Docker container with compose.yaml orchestration. I registered it on-chain successfully (App ID: rofl1ayhp...) and published the container to Docker Hub as bellynap/casino-resolver. The Big Blocker: Final deployment hit a segmentation fault in the Oasis CLI v48.10.10 at line 347 of their ROFL manifest parser - a null pointer dereference in their tooling. I spent hours debugging, thinking it was my configuration, before confirming it's a verified CLI bug. The implementation is complete and ready - it's purely a tooling issue preventing the final deployment step. Frontend Development: Built with Next.js 14 and React, implementing custom CSS animations for each game. The coin flip uses 3D rotateY transforms, dice roll has scaling animations, and mystery boxes shake with keyframe animations. I created a procedural NFT generation system that combines:
6 emoji sets (basic, rare, epic, legendary, mythic, divine) 20 adjectives and 20 nouns for unique names Random hex colors for backgrounds Rarity weights (50% common down to 1% divine)
This generates thousands of unique NFT combinations client-side before minting. Particularly Hacky Bits:
Client-side result simulation: Since ROFL isn't deployed, I added setTimeout-based result generation in the frontend to demonstrate the UX flow. The animations trigger immediately while the blockchain transaction would normally wait for ROFL's signed response. Procedural NFT generation: Instead of storing metadata off-chain or using IPFS, everything is generated on-the-fly and stored directly in the ERC721 contract's tokenURI as base64-encoded JSON. This makes the NFTs fully on-chain with zero external dependencies. MetaMask integration quirks: Sapphire Testnet isn't in MetaMask's default networks, so I implemented automatic network detection and prompts to add the custom RPC configuration programmatically.
What I'd Do Differently: If I had more time, I'd implement a fallback randomness mechanism using Chainlink VRF as a backup when ROFL is unavailable. I'd also add persistent leaderboards using Sapphire's confidential state to track top winners without revealing exact amounts.
Partner Technologies:
Oasis Sapphire: The confidential EVM was crucial for keeping bet amounts private. Regular EVMs expose all transaction data, but Sapphire's TEE-backed confidentiality means competitors can't analyze betting patterns. Oasis ROFL: Enabled trustless randomness without expensive on-chain computation or external oracle dependencies. The TEE attestation means results are cryptographically verifiable.
Development Timeline 24 hours:
Smart contracts + Hardhat deployment ROFL app implementation + Docker containerization Frontend with animations + MetaMask integration Debugging CLI issues + procedural NFT system + documentation

