Blockchain & Cryptocurrency Glossary

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

  • search-icon Clear Definitions
  • search-icon Practical
  • search-icon Technical
  • search-icon Related Terms

Verifiable Random Function (VRF)

5 min read
Pronunciation
[ver-uh-fahy-uh-buhl ran-duhm fuhngk-shuh n]
Analogy
Imagine a special, sealed lottery drum that only one designated official (the key holder with the secret key) can operate. For each lottery draw (a specific input, like the date of the draw), this official uses their unique key to crank the drum, which then dispenses a single, unique winning number (the pseudorandom output). Alongside the number, the drum also issues a tamper-proof, signed certificate (the cryptographic proof) which explicitly states: 'For the draw of [input_date], using my official drum key, the number generated is [output_number], and this is authentic.' Anyone can look at this certificate and the generated number and be absolutely sure that: 1) it was the official drum that produced it, 2) it was for that specific draw, and 3) the number is legitimate and wasn't tampered with. However, no one could have predicted the number before the official cranked the drum, and no one else could create a valid certificate for a different number for that same draw.
Definition
A Verifiable Random Function (VRF) is a cryptographic primitive that allows a party (the prover, holding a secret key) to compute a pseudorandom output based on an input value, and simultaneously generate a publicly verifiable proof demonstrating that the output was correctly and uniquely generated using their specific secret key for that given input. Anyone possessing the prover's corresponding public key can verify the proof, confirming the output's authenticity and correct computation, but they cannot predict the output beforehand without the secret key, nor can anyone else (without the secret key) produce a valid proof for the same input leading to a different output (or the same output for that matter). The output appears random to observers who do not know the secret key.
Key Points Intro
Verifiable Random Functions (VRFs) are a powerful cryptographic tool that provides a source of publicly provable pseudorandomness, essential for applications in decentralized systems requiring unbiased, unpredictable, yet verifiable selection, sampling, or ordering.
Key Points

Generates Pseudorandom Output with Proof: Produces a random-looking output value based on a secret key and an input, along with a cryptographic proof of correct computation.

Publicly Verifiable Correctness: Anyone with the corresponding public key can verify that the output was legitimately generated by the holder of the secret key for the specific input, without needing to know the secret key.

Unpredictable and Non-Forgeable: The output is computationally indistinguishable from random for those without the secret key, and it's computationally infeasible for anyone without the secret key to produce a valid proof for an arbitrary output or for the same input.

Key Blockchain Applications: Widely used in Proof-of-Stake (PoS) consensus for leader election (determining who gets to propose the next block), for random assignment of duties in decentralized protocols, generating unbiased random numbers for on-chain games or lotteries, and for auditable data sampling.

Example
In several Proof-of-Stake blockchain protocols like Algorand or Cardano (with Ouroboros Praos/Genesis), VRFs are used for fair and unpredictable block proposer (leader) election. Each eligible validator (potential block producer) possesses a VRF secret key. For a given round or slot, they use their secret key and a publicly known seed (often derived from previous block data) as input to their VRF. They compute the VRF output and proof. If their VRF output value falls below a certain threshold (which can be weighted by their stake), they are selected as the leader for that slot. They then propose a block, including their VRF output and proof. All other nodes on the network can use the validator's public key and the public seed to verify the VRF proof, confirming that the validator was legitimately chosen and didn't cheat to assign themselves as leader.
Technical Deep Dive
A Verifiable Random Function (VRF) scheme typically consists of three core algorithms: 1. `VRF_KeyGen()`: A key generation algorithm that outputs a pair of keys: a secret key (SK) and a corresponding public key (PK). 2. `VRF_Compute(SK, input)` (or `VRF_Prove`): An algorithm that takes the secret key SK and an input value `alpha`. It produces a pseudorandom output value `y` (the VRF hash) and a proof `pi` that `y` is the correct output for `alpha` under SK. 3. `VRF_Verify(PK, input, y, pi)`: An algorithm that takes the public key PK, the input value `alpha`, the purported output `y`, and the proof `pi`. It outputs 'accept' (or true) if the proof `pi` is valid for the output `y` and input `alpha` with respect to PK, and 'reject' (or false) otherwise. Essential cryptographic properties of a VRF include: * **Pseudorandomness (of output y)**: For any given input `alpha`, the output `y` should be computationally indistinguishable from a truly random value to anyone who does not possess the secret key SK. * **Uniqueness (of output y for a given SK, input)**: For a fixed secret key SK and input `alpha`, the output `y` must be uniquely determined (or, in some relaxed definitions, any two outputs must be equal with overwhelming probability). This means an adversary cannot generate multiple valid `y` values for the same SK and input. * **Verifiability**: Anyone with PK can verify that `y` is the correctly computed output associated with `alpha` by the owner of SK. VRF constructions are often based on advanced cryptographic primitives such as elliptic curve cryptography (ECC), pairing-based cryptography, or RSA. Implementations like the IETF RFC 9381 standard for VRFs using Edwards Curves (EdDSA) provide concrete specifications. Services like Chainlink VRF provide verifiable randomness as a service to smart contracts by having oracle nodes compute VRF outputs off-chain and submit them with their proofs to the blockchain.
Security Warning
The fundamental security of a VRF relies on the absolute secrecy of the secret key (SK). If SK is compromised, an attacker can predict future VRF outputs for chosen inputs, potentially manipulate processes that depend on VRF-generated randomness (e.g., bias leader elections, win on-chain games unfairly), or forge proofs. The cryptographic implementation of the VRF algorithms must be sound and free from vulnerabilities. Additionally, the security of applications using VRFs also depends on how the VRF inputs (seeds) are chosen; if an attacker can influence or predict the input, they might be able to influence the VRF output, even without knowing SK.
Caveat
Generating truly unbiased and unpredictable randomness that is also publicly verifiable directly on a deterministic public blockchain (the 'on-chain randomness problem') is inherently challenging. VRFs are a powerful cryptographic tool that significantly addresses this by allowing for the computation of randomness (often off-chain by a trusted party or in a decentralized way by protocol participants) whose legitimacy can then be efficiently verified on-chain. However, the overall security and fairness of any system employing VRFs depend critically on the robust design of the entire protocol that uses the VRF output, including secure generation and agreement on VRF inputs (seeds), and how the VRF outputs are consumed and interpreted by smart contracts or other applications.

Verifiable Random Function (VRF) - Related Articles

No related articles for this term.