vdf-rs — Verifiable Delay Function (VDF) in Rust
Maintained fork of poanetwork/vdf. The original
vdf crate on crates.io is unmaintained; this project
publishes the library as vdf-rs.
What is a VDF?
A Verifiable Delay Function (VDF) is a function that requires substantial time to evaluate (even with a polynomial number of parallel processors) but can be very quickly verified as correct. VDFs can be used to construct randomness beacons with multiple applications in a distributed network environment. By introducing a time delay during evaluation, VDFs prevent malicious actors from influencing output. The output cannot be differentiated from a random number until the final result is computed. See https://eprint.iacr.org/2018/712.pdf for more details.
Description
This VDF implementation is written in Rust. The GMP library is used for arithmetic and greatest common divisor (GCD) calculations. We use class groups to implement the approaches described in the following papers:
- Simple Verifiable Delay Functions. Pietrzak, 2018
- Efficient Verifiable Delay Functions. Wesolowski, 2018
The chosen generator is (2, 1, c), where c is calculated from the provided discriminant. A form is represented internally (a, b, c), with the discriminant not being used in most computations. This implementation performs reduction after every multiplication and squaring, as not doing so did not give any gains in our benchmarks.
Crates
| Crate | crates.io | Purpose |
|---|---|---|
vdf-rs |
yes | VDF trait and Pietrzak / Wesolowski implementations |
vdf-classgroup |
yes | Class group arithmetic (GMP-backed) |
vdf-cli |
no | Command-line tool |
vdf-competition |
no | Competition helper binary |
Requirements
On Debian/Ubuntu:
On macOS (Homebrew):
Usage
Command-line interface
For Pietrzak proofs, pass -tpietrzak. Run vdf-cli --help for details.
Library
Add to Cargo.toml:
= "0.2"
use ;
Development
License
Copyright 2018 Chia Network Inc and POA Networks Ltd.
Licensed under the Apache License, Version 2.0. See LICENSE and NOTICE.