Expand description
Verifiable Delay Functions (VDF) for time-based proofs.
This module provides a VDF implementation based on sequential hashing. VDFs are functions that require a specified number of sequential steps to compute, but can be verified quickly. They’re useful for generating unbiased randomness and proving that a certain amount of time has elapsed.
§Features
- Sequential computation with adjustable delay
- Fast verification
- Deterministic output given input and delay
- Hash-based construction using BLAKE3
§Use Cases in CHIE Protocol
- Fair leader election without bias
- Randomness beacons
- Proof of elapsed time
- Anti-spam mechanisms with computational costs
§Example
use chie_crypto::vdf_delay::{VdfParams, vdf_compute, vdf_verify};
// Create VDF parameters with 10000 iterations
let params = VdfParams::new(10000);
// Compute VDF on input
let input = b"random_seed_12345";
let (output, proof) = vdf_compute(¶ms, input);
// Verify the proof (much faster than computation)
assert!(vdf_verify(¶ms, input, &output, &proof).is_ok());Structs§
Enums§
- VdfError
- VDF-specific errors.
Functions§
- vdf_
compute - Compute VDF on given input.
- vdf_
randomness_ beacon - Compute VDF for randomness beacon.
- vdf_
verify - Verify a VDF proof.