What a blockchain lottery is
A blockchain lottery runs its ticketing, draw logic, and payouts with smart contracts on a public ledger. The aim is to replace opaque back-office systems with code you can inspect, verifiable randomness for winner selection, and on-chain payouts you can audit in block explorers. Popular building blocks include verifiable randomness oracles (e.g., Chainlink VRF) and public randomness beacons (e.g., drand or NIST’s beacon).
There are also “no-loss” prize-linked savings models such as PoolTogether, where deposits earn yield and that yield funds periodic prizes; principal can be withdrawn at any time. While the UX feels lottery-like, it’s structured as a savings protocol with prize draws powered by verifiable randomness. Always assess legal classification in your jurisdiction.
How on-chain lotteries work, step by step
- Users buy entries by sending a transaction to the lottery smart contract.
- At draw time, the contract requests a random value. Secure designs use verifiable randomness or a public beacon rather than insecure on-chain tricks.
- The contract selects winners deterministically from the set of entries using the random value and then triggers on-chain payouts.
- Anyone can verify the inputs, the randomness proof or beacon round, and the payout transactions in an explorer.
Developers should avoid pseudo-randomness based on blockhash
, timestamps, or prevrandao
; these can be influenced by block producers and are not safe for gambling. Use a VRF, a commit-reveal with safeguards, or a recognized beacon.
Randomness: the heart of a fair draw
Verifiable Random Functions (VRFs)
A VRF delivers a random number plus a cryptographic proof that the number was generated correctly from an unseen seed; the proof is verified on-chain before use. Chainlink VRF is the most widely used implementation across EVM chains for lotteries, raffles, and game drops.
Public randomness beacons
Beacons output signed, time-stamped random values at fixed intervals. The drand network (League of Entropy) produces publicly verifiable, bias-resistant randomness used by multiple Web3 systems; NIST’s Interoperable Randomness Beacons project publishes similar, auditable pulses suitable for transparency use cases. Beacons reduce single-operator control over entropy and make audits easier.
Why not just use blockhash
?
Block producers can sometimes bias or cherry-pick outcomes if the prize exceeds the cost of manipulating a block; multiple security write-ups and forum guidance warn against relying on block data for randomness in lotteries.
Fees and scale after Ethereum’s Dencun upgrade
In March 2024, Ethereum activated Dencun, which introduced EIP-4844 “blobs”—a cheaper data lane for L2 rollups. By lowering data costs for rollups, frequent small actions like buying tickets and settling prize payouts became significantly cheaper on L2s, making micro-lotteries and frequent draws more practical.
Benefits vs. trade-offs
Key benefits
- Transparency and auditability: code, draw requests, proofs, and payouts are visible on-chain and can be verified independently. VRF proofs and beacon signatures are public.
- Faster, programmatic payouts: winners can be paid automatically without manual processing, reducing operational risk.
- Composability: protocols can plug into prize-linked savings models like PoolTogether or build white-label front-ends atop shared, audited contracts.
- Lower costs on L2: post-Dencun rollups make small-ticket participation more feasible.
Trade-offs and risks
- Smart-contract risk: bugs or flawed randomness integrations can endanger funds; insist on audits and open documentation.
- Oracle or beacon dependencies: if the randomness source is down or mis-integrated, draws may fail or be delayed.
- Legal classification varies: many jurisdictions restrict who can run a lottery; some prize-linked savings products may be treated differently from gambling, but you must verify locally. See compliance notes below.
Compliance notes and consumer protection
Lottery and gambling rules are jurisdiction-specific and often stricter than for other games. In Great Britain, society lotteries must be licensed or registered and can only be run for good causes, not private profit; operators must disclose how winners are determined and the chances of winning. The UK Gambling Commission also flags cryptoassets and blockchain as higher-risk for AML, with explicit guidance for licensees.
In the United States, lotteries are state-run and governed at the state level; private lotteries are generally prohibited, and sweepstakes/contests are tightly defined to avoid being illegal lotteries. If you’re building or promoting anything lottery-like, get legal counsel and confirm status with your state regulator.
This article is educational, not legal advice.
How to choose a trustworthy platform
- Read the docs and contracts. Check which randomness source is used (VRF or beacon) and how proofs are verified on-chain. Prefer audited contracts.
- Verify transparency pages. Legitimate projects explain prize mechanics, selection process, and odds before purchase; this disclosure is mandated for licensed remote lotteries in GB and is a good practice everywhere.
- Check costs and chain. L2 networks post-Dencun typically offer cheaper participation and settlement.
- Distinguish product types. A prize-linked savings protocol such as PoolTogether is economically different from a classic pay-in lottery; evaluate risk, custody, and withdrawal rights.
- Confirm legality where you live. Use your regulator’s registers or guidance pages to verify status before you spend.
FAQs
What makes a blockchain lottery “provably fair”?
When the draw uses a VRF or public randomness beacon, the random value comes with a proof or signature that anyone can verify. The smart contract refuses to finalize the draw unless the proof verifies on-chain, and you can audit the entire process in a block explorer.
Are block-based tricks like blockhash
ever okay?
They are inappropriate for lotteries and gambling because miners/validators can sometimes bias outcomes. Use a VRF or beacon instead.
Why are L2s popular for lotteries now?
After Dencun (EIP-4844), rollups can put data in “blobs,” reducing costs and enabling frequent, small-value participation and payouts.
Is PoolTogether a lottery?
It’s a prize-linked savings protocol: deposits earn yield; yield funds prizes; you can withdraw principal. It feels lottery-like but is built for savings incentives—check local rules to understand its classification in your region.