VRF Theory
Understanding the mathematics and security properties of Verifiable Random Functions.
What is a VRF?
A Verifiable Random Function (VRF) is a cryptographic primitive that combines:
- Pseudo-random function - Deterministic but unpredictable output
- Digital signature - Proof that the output was correctly computed
VRF: (secret_key, input) → (output, proof)
Mathematical Definition
A VRF consists of three algorithms:
Key Generation
Generates a secret key and corresponding public key .
Evaluation
Given secret key and input , produces:
- Output - the pseudo-random value
- Proof - proves was correctly computed
Verification
Returns 1 (true) if the proof is valid, 0 (false) otherwise.
Security Properties
Uniqueness
For any input and public key , there exists exactly one valid output .
For all inputs and public keys , there exists a unique output such that .
This prevents the prover from choosing among multiple outputs.
Pseudo-randomness
Without the secret key, the output is computationally indistinguishable from random:
Even an adversary who:
- Knows the public key
- Can query the VRF on other inputs
- Sees proofs for other inputs
Cannot predict the output for a new input better than random guessing.
Verifiability
Anyone with the public key can verify the output was correctly computed.
IETF VRF Construction
The IETF VRF (RFC 9381) uses elliptic curves:
Setup
- Generator point on elliptic curve
- Secret key - random scalar
- Public key
Evaluation
- Hash to curve:
- Compute output point:
- Generate proof (Schnorr-like):
- Nonce (deterministically derived)
- ,
- Challenge
- Response
- Output: ,
Verification
- Recompute
- Compute
- Compute
- Verify
- Output
VRF vs Other Primitives
VRF vs Digital Signature
| Property | Digital Signature | VRF |
|---|---|---|
| Output | Arbitrary | Pseudo-random |
| Uniqueness | ❌ Multiple valid signatures | ✅ Exactly one output |
| Deterministic | ❌ Often randomized | ✅ Deterministic |
VRF vs PRF
| Property | PRF | VRF |
|---|---|---|
| Verifiable | ❌ No | ✅ Yes |
| Public Key | ❌ No | ✅ Yes |
VRF vs Commitment
| Property | Commitment | VRF |
|---|---|---|
| Binding | ✅ Yes | ✅ Yes (uniqueness) |
| Hiding | ✅ Yes | ✅ Yes (pseudo-randomness) |
| Verifiable Randomness | ❌ No | ✅ Yes |
Applications
Randomness Beacons
VRFs generate publicly verifiable random numbers:
beacon_output = VRF(sk, round_number)
Anyone can verify the randomness without trusting the generator.
Lottery Systems
Fair, transparent winner selection:
ticket_value = VRF(sk, ticket_id)
winner = argmin(ticket_values)
Blockchain Consensus
Leader election in proof-of-stake:
leader_score = VRF(validator_sk, slot_number)
if leader_score < threshold:
produce_block()
Private Information Retrieval
Query databases without revealing what you're looking for.
Security Assumptions
IETF VRF security relies on:
- Discrete Logarithm Problem (DLP) - Hard to compute from
- Computational Diffie-Hellman (CDH) - Hard to compute from and
- Random Oracle Model - Hash functions behave as random oracles