Time you can prove.
Verification anyone can run.

A Verifiable Delay Function forces sequential computation to produce an output—then proves it in milliseconds. Built for Node.js and browsers in TypeScript.

npm version License Node 18+

What is a Verifiable Delay Function?

A VDF is a function y = f(x) that takes a chosen wall-clock time to compute (even with many CPUs), but where anyone can check y from a compact proof in a fraction of a second. That gap between slow evaluation and fast verification is the whole point.

Sequential delay

Each step depends on the last. Throwing more cores at it does not shorten the delay.

Compact proof

The prover outputs a proof π that encodes the delayed computation without redoing all the work.

Public verify

Validators, smart contracts, or clients confirm correctness quickly—no trust in the prover’s hardware.

Why “verifiable delay”?

Evaluation time is a tunable parameter (difficulty). Verification stays cheap.

Relative cost (log scale, illustrative) solve seconds–minutes verify milliseconds cost
Solve — intentional bottleneck Verify — efficient check

Parallel machines still wait

Ideal for fairness: no one can “buy” a shorter delay with more GPUs alone.

1 CPU vs many CPUs (same VDF chain) 1 core T delay N cores still one sequential chain → same T ✓ same minimum delay

Where VDFs are used

Protocols need time to pass—or randomness no one could have predicted early. VDFs anchor that logic in cryptography instead of trusted timers.

Randomness beacon (simplified)

Everyone agrees on output only after the delay elapses—late entrants cannot bias earlier rounds.

Round input block hash + seed VDF delay public solve race Proof π Fast verify Random output

Randomness beacons

Unbiasable public randomness for lotteries, leader election, and consensus protocols after a public delay.

Blockchain & consensus

Proof-of-time and delay in leader selection—reducing advantage from hashrate alone in some designs.

Time-lock puzzles

Encrypt or commit to data that only becomes usable after a verifiable wait—useful for escrows and timed release.

Anti front-running

Order or reveal transactions only after a delay so participants cannot rush ahead of a committed schedule.

Live demo — real crypto-vdf code

This runs the same browser bundle published on npm. Watch each step: a public challenge goes in, solve() burns time on your CPU, then verify() checks the proof instantly.

What happens step by step

  1. 1
    Challenge

    Parse your hex string into Uint8Array.

  2. 2
    Setup

    Pick scheme + load precomputed discriminant.

  3. 3
    solve()

    Sequential work — cannot be shortened with more cores.

  4. 4
    Proof π

    Compact certificate of the computation.

  5. 5
    verify()

    Anyone validates π without repeating the delay.

  6. 6
    Done

    Output is trustworthy — the delay really elapsed.

Activity log

This library

TypeScript implementations of Pietrzak and Wesolowski VDFs with precomputed discriminants (256–2048 bit), Node.js ESM/CJS, and a browser bundle.

Wesolowski (recommended)

Any positive difficulty, smaller proofs, fast verify. Default choice for production.

Pietrzak

Even difficulty ≥ 66, max 7000 in this JS port. Compact proofs at lower difficulties.

Precomputed D

Discriminants from Rust GMP—do not generate in pure JS for production workloads.

Production: Use DISCRIMINANT_* constants and Wesolowski unless you have a specific reason for Pietrzak.

Quick start

npm install crypto-vdf
import { WesolowskiVDFParams, DISCRIMINANT_256 } from 'crypto-vdf';

const vdf = new WesolowskiVDFParams(256).new();
const challenge = new Uint8Array([0xaa, 0xbb, 0xcc]);

const proof = await vdf.solve(challenge, 100, DISCRIMINANT_256);
vdf.verify(challenge, 100, proof, DISCRIMINANT_256);