Guides

Verifiable random functions on blockchains, explained

Quip Network
·3 min read

A verifiable random function (VRF) takes a secret key and an input, then returns a random-looking output along with a proof, and anyone holding the matching public key can check that proof. Blockchains use VRFs in consensus, to pick block proposers in secret, and in randomness services, to hand smart contracts random numbers with a check attached.

How a VRF works

Silvio Micali, Michael Rabin and Salil Vadhan published the VRF in 1999, according to Chainlink's VRF explainer. The working reference for implementers is RFC 9381, an Informational IETF document from August 2023. In its terms, a VRF runs in three steps:

  1. The key holder passes an input, called alpha, and the secret key to the prove function, and gets back a proof called pi.
  2. Anyone hashes pi into the output, called beta.
  3. A verifier passes alpha, pi and the public key to the verify function, and gets back a yes or a no.

RFC 9381 defines the guarantees by name:

  • Uniqueness. Finding valid proofs for two different outputs from the same key and input is infeasible, so the key holder has no second draw to pick from.
  • Pseudorandomness. Without the secret key, the output looks random.
  • Collision resistance. Finding two inputs with the same output is infeasible.

VRFs inside consensus

Proof-of-stake chains run a VRF as a private lottery among validators. Algorand's consensus documentation describes its VRF as working "similar to a lottery": each account evaluates it to learn whether it proposes the next block or serves on a voting committee, and other nodes validate the selection with the VRF proof. In Polkadot's BABE protocol, validators enter a lottery for every slot, and a primary block comes from a "VRF-selected validator", per the Polkadot wiki. Chainlink's explainer also lists Cardano and the Internet Computer among chains using VRFs to select block producers.

VRFs for smart contracts

Contracts use VRF output for NFT traits, game outcomes and lotteries, as the Chainlink explainer describes. Contracts take a VRF value from one of these sources:

  • Verify the proof on chain directly. Sui offers a Move function, sui::ecvrf::ecvrf_verify, for checking an ECVRF proof against an input and a public key. Its documentation follows version 15 of the CFRG VRF draft, using the Ristretto255 group with SHA-512.
  • Call a randomness service. An operator holds the key, computes the value and proof off chain, and delivers both to the contract. The 2024 paper VRaaS: Verifiable Randomness as a Service on Blockchains by Gorman et al. gives a formal model for these services, and its generic VRF-based design covers Chainlink VRF and Supra dVRF.

For the non-VRF methods, such as block values, commit-reveal and randomness beacons, see on-chain randomness.

Proof and output sizes by ciphersuite

RFC 9381 sets the proof length at ptLen + cLen + qLen bytes and the output length at hLen bytes, then lists the parameter values for each elliptic-curve ciphersuite in Section 5.5. Adding them up gives the byte counts a verifier receives per request:

Ciphersuite Curve Hash Proof size Output size
ECVRF-P256-SHA256-TAI NIST P-256 SHA-256 33 + 16 + 32 = 81 bytes 32 bytes
ECVRF-P256-SHA256-SSWU NIST P-256 SHA-256 81 bytes 32 bytes
ECVRF-EDWARDS25519-SHA512-TAI edwards25519 SHA-512 32 + 16 + 32 = 80 bytes 64 bytes
ECVRF-EDWARDS25519-SHA512-ELL2 edwards25519 SHA-512 80 bytes 64 bytes
Sui ecvrf (CFRG draft 15) Ristretto255 SHA-512 80 bytes in Sui's example 64 bytes in Sui's example

Each P-256 pair, and each edwards25519 pair, has identical parameters. The RFC separates them by suite string and by the method for mapping the input onto the curve.

QVRF works differently

Quip's QVRF documentation states that QVRF, despite its name, is not a VRF in the cryptographic sense, and reviewers should leave the standard VRF security definitions aside when assessing it. QVRF takes its numbers from measurements on a quantum computer and pairs them with a verification record:

  1. Quip publishes a commitment to the generated values on chain before handing any out.
  2. A delivered value has to match that commitment, so the operator can refuse to deliver but cannot substitute different numbers without detection.
  3. Verifiers check a sample of the measurements by classical simulation after delivery, so the full verification record arrives later than the value.

The first version is centralized: Quip operates both the generator and the delivery service, and the quantum checks run off chain after delivery. The request interface and fee model are still being finalized, and integration documentation with packages and code examples will follow once they settle.

Next step

Read the QVRF concepts page for the full trust model, or visit quip.network/qvrf to follow the service.

Share
Filed underGuides
Newsletter

Don't miss an update

Get new posts and project updates delivered to your inbox. No spam, unsubscribe anytime.