On-chain randomness cover drand operators and a VDF delay ring around a dice cube

Isai Alexei

On-Chain Randomness Moves From Block Data to drand Beacons and Verifiable Delay Functions

drand randomness, RANDAO manipulation, threshold

On-chain randomness stays one of the weakest inputs in smart contract design, because every validator re-executes each transaction against the same public state. Lotteries, NFT mints, and validator selection need values no participant can predict or bias.

Two cryptographic tools address the gap: drand randomness beacons combine signature shares from independent operators, and verifiable delay functions (VDFs) force a minimum amount of sequential computation before an output exists.

Why Block Data Fails as On-Chain Randomness

Ethereum executes deterministically, so every value a contract reads is public before inclusion. Developers who hash block.timestamp, blockhash, or block.number to build on-chain randomness get predictable output. A block producer can shift a timestamp by a few seconds and see the block accepted, and an attacker contract can compute the identical hash inside the transaction which places a bet.

Never build on-chain randomness from block data

block.timestamp, blockhash, and block.number are public before inclusion. An attacker contract can compute the identical hash inside the transaction that places a bet and act only when the result wins, while a block producer can shift a timestamp by a few seconds. The Smart Contract Weakness Classification registers the pattern as SWC-120.

The Smart Contract Weakness Classification registers the pattern as SWC-120. A 2026 benchmark analyzed 17,466 contracts and labeled 1,752 as vulnerable to weak randomness sources.

Ethereum’s PREVRANDAO opcode, introduced through EIP-4399 as a protocol-level source of on-chain randomness, replaced proof-of-work difficulty with the beacon chain’s RANDAO output and reached Solidity as block.prevrandao in version 0.8.18.

EIP-4399 describes the value as a source with different properties from blockhash, and auditors at Sigma Prime warn validators can predict and bias it to a limited degree.

RANDAO and the Last-Revealer Problem

Each Ethereum proposer signs the epoch number with its BLS key and mixes the signature into the RANDAO accumulator through XOR. The proposer of the final slot in an epoch sees the accumulated value before deciding whether to publish a block. The last-slot proposer chooses between two outcomes: reveal and collect the block reward, or withhold and accept the missed slot.

RANDAO last-revealer diagram showing a slot 32 proposer choosing between reveal and withhold
Figure 2. A last-slot proposer sees the accumulated RANDAO value and chooses between revealing and withholding

Control of the final two slots expands the choice to four possible values. For RANDAO-based on-chain randomness, Princeton researchers Kaya Alpturer and S. Matthew Weinberg modeled RANDAO manipulation as a Markov decision process and computed strategies for an adversary holding less than the full stake.

EIP-4399 recommends a lookahead, in which applications sample the value several epochs after the commitment; a four-epoch gap equals about 25 minutes. A lookahead narrows the information an attacker holds at commitment time, and the output still originates with validators.

How drand Produces Distributed On-Chain Randomness

drand takes a different route: independent operators run nodes holding shares of a single group key created through distributed key generation, and in each round every node signs a message derived from the round number. Any observer who collects a threshold of partial signatures reconstructs one threshold BLS signature on the BLS12-381 curve.

BLS signatures are deterministic, so the output of a round stays fixed once the threshold exists, and hashing the signature yields the random value. Colluding operators cannot select among outputs; they can only withhold publication.

drand threshold BLS flow producing on-chain randomness from operator signature shares
Figure 3. drand combines partial BLS signatures from independent operators into one verifiable random value

The League of Entropy began running a public source of on-chain randomness in 2019 through drand with Cloudflare, Protocol Labs, Kudelski Security, the University of Chile, and EPFL. Members seed the network with local physical entropy: Cloudflare’s LavaRand samples lava lamp footage, the University of Chile’s node uses seismic measurements, and Cloudflare later added double pendulums in London and suspended mobiles in Austin.

The quicknet network signs a new round every three seconds with unchained randomness: each message depends only on the round number, so a verifier checks any round without fetching its predecessor.

MegaETH ships a preinstalled BLS12-381 verifier for quicknet, which lets a contract consuming on-chain randomness check a 48-byte signature on-chain. Security assumes fewer malicious operators than the signing threshold, and liveness needs a threshold of operators online.

Verifiable Delay Functions Add Sequential CPU Time

Dan Boneh, Joseph Bonneau, Benedikt Bünz, and Ben Fisch formalized the verifiable delay function at CRYPTO 2018 as three algorithms: Setup, Eval, and Verify. Eval requires T sequential steps even for an adversary with many processors, and Verify checks a short proof in time polylogarithmic in T.

Pietrzak and Wesolowski published practical constructions in 2018, and both compute x^(2^T) by repeated squaring in a group of unknown order. Parallel hardware cannot shorten the chain because each squaring needs the previous result.

Wesolowski’s proof consists of one group element computed against a challenge prime. Pietrzak’s proof contains log T elements and relies on a weaker security assumption.

In a beacon producing on-chain randomness, the VDF runs after entropy extraction: participants commit to contributions, the protocol combines them, and the delay pushes the final value past the reveal deadline, so a last revealer cannot compute the result before choosing to reveal. Trail of Bits observes VDF-based leader selection needs one honest participant instead of an honest majority.

A 2025 Eurocrypt paper by Bonneau, Bünz, Christ, and Efron shows coin-flipping without an honest majority requires a delay function. Boneh and coauthors illustrate the design with a lottery seeded by stock prices: a delay of one hour lets markets close and prices finalize before an attacker finishes simulating manipulation strategies.

The group of unknown order takes two forms: RSA groups need a modulus whose factorization nobody knows, which calls for a multi-party ceremony, while class groups of imaginary quadratic fields remove the trusted setup.

Chia uses a 1,024-bit discriminant with Wesolowski proofs, and its timelords run squaring on the fastest single core available. Class groups have received less cryptanalysis than RSA.

Hardware Speed Sets the Security Margin of a VDF

A VDF protecting on-chain randomness ties its delay to wall-clock time only when no attacker evaluates it far faster than honest nodes. Supranational’s documentation sets a target of no more than ten times the speed of public hardware.

The Ethereum Foundation and Protocol Labs announced a VDF research collaboration in April 2019, and the VDF Alliance built CPU and FPGA implementations which solved a 20-year-old MIT timelock puzzle in two months.

Open-source ASIC designs for low-latency modular squaring aim to publish a speed baseline for calibrating the delay parameter. Ethereum has not placed a VDF inside RANDAO, and quantum computers would break the RSA and class group assumptions behind widely deployed constructions.

17,466 contracts

Analyzed in a 2026 benchmark.

4 epochs ≈ 25 minutes

The lookahead EIP-4399 recommends for RANDAO.

48 bytes

Size of the BLS signature a contract checks on-chain.

Integration Choices for Smart Contract Developers

Chainlink VRF returns a random value with a proof the contract verifies, and VRF v2.5 replaced v1 and v2 on November 29, 2024. Chainlink’s documentation warns an adversary who steals the VRF key and builds blocks on the target chain could bias results.

drand verification places trust in a threshold of public operators and adds a BLS check on-chain. VDF-based schemes drop majority-honesty assumptions, yet the delay parameter needs calibration against attacker hardware.

On-chain randomness sources compared: block data, PREVRANDAO, Chainlink VRF, drand, and VDF beacons
Figure 1. Comparison of randomness sources by who can bias the output, trust assumption, and on-chain verification

Every pattern benefits from one design rule: the contract fixes the target round or commitment at request time, before the beacon publishes the value, so nobody waits for a favorable output. Pre-committed rounds and a minimum lookahead keep on-chain randomness resistant to manipulation by validators, sequencers, and users.

FAQ

Why do block.timestamp and blockhash fail as randomness sources?

Ethereum executes deterministically and exposes block data to every contract, so an attacker contract computes the same value inside the same transaction and acts only when the result wins. Block producers also shift timestamps by a few seconds and choose which blocks to publish. The SWC registry classifies the pattern as SWC-120 and points developers to oracle-based sources like Chainlink VRF.

What does the RANDAO last-revealer attack allow?

The proposer of the last slot in an epoch sees the accumulated RANDAO value and chooses between publishing a block or skipping the slot, which yields two possible outcomes. Control of the final two slots yields four. The cost is a forfeited block reward, and a 2024 AFT paper by Alpturer and Weinberg models the strategy for adversaries with partial stake.

How does a smart contract verify a drand value?

Developers hardcode the group public key of the drand network in the contract and check the BLS12-381 signature for a given round against it. Unchained networks like quicknet sign a message derived only from the round number, so the contract verifies any round without earlier rounds. Chains like MegaETH ship a preinstalled verifier, while other chains need a pairing check in contract code.

What does a VDF add to a threshold randomness beacon?

A threshold beacon stays unbiased while fewer operators than the threshold collude, and it needs a threshold of operators online. A VDF binds the output to sequential computation, so a participant who sees the inputs cannot learn the result before the reveal deadline. Trail of Bits observes VDF-based selection needs one honest participant. The cost is hardware risk: an attacker with a much faster evaluator shortens the delay.

Can drand output serve as a password or private key seed?

No. drand publishes every value openly over HTTP, so anyone reads it the moment it appears. Contracts use the output for public draws where verifiability matters. Private keys and passwords need secret entropy from a local cryptographic generator.