β Master Verifiable Randomness
Understand VRF, commit-reveal, and Chainlink integration
Generate provably fair random numbers on-chain
Your Progress
0 / 5 completedKey Takeaways
You've learned how verifiable randomness enables provably fair applications on blockchain through cryptographic guarantees. Let's review the key concepts before testing your knowledge.
π² The Randomness Challenge
Blockchains are deterministic by designβevery node must compute identical results. This makes true randomness impossible without external sources.
- β’blockhash(): Vulnerable to miner manipulation (can withhold unfavorable blocks)
- β’Oracles: Introduce trust assumptions (centralization risk)
- β’VRF/VDF: Cryptographically provable randomness without trust
π VRF (Verifiable Random Functions)
VRF generates pseudo-random outputs with cryptographic proofs. Oracle uses private key to compute randomness + proof; anyone verifies using public key.
- β’Chainlink VRF: Industry standard, $10B+ secured, 12+ chains, ~$5-10 per request
- β’API3 QRNG: Quantum randomness (ANU source), free to use, 5+ chains
- β’Process: Request β Oracle generates (output, proof) β On-chain verification β Callback delivery
- β’Security: Unpredictable, verifiable, unique, collision-resistant
π Commit-Reveal Schemes
Two-phase protocol: participants commit to hashed values, then reveal actual values. Prevents changing choices after seeing others' inputs.
- β’Phase 1: Submit H(value + salt) β commitment locks in choice
- β’Phase 2: Reveal value + salt β contract verifies hash matches
- β’Use cases: Gaming (poker, RPS), voting (private ballots), auctions (sealed bids), RANDAO (Ethereum)
- β’Security: Require deposits to penalize non-reveals, enforce strict deadlines, use strong salts
β‘ Implementation Choices
Choose implementation based on security requirements, cost constraints, and latency tolerance:
- β’Chainlink VRF: Best for most projects (medium complexity, high security, ~200k gas + $5-10 fee)
- β’Commit-Reveal: Low-cost applications (only gas fees ~50k, requires multiple participants)
- β’VDF: Maximum security scenarios (time-locked computation, high gas ~500k, slow)
π Real-World Applications
Verifiable randomness powers billions in blockchain value across multiple sectors:
- β’Gaming & Lotteries: $1B+ market, provably fair outcomes (Axie Infinity, PoolTogether)
- β’NFT Minting: Fair launches, random traits (Azuki, Moonbirds used Chainlink VRF)
- β’Validator Selection: Ethereum beacon chain RANDAO, unbiased rotation
- β’DeFi Protocols: Liquidation order randomization, sampling mechanisms