01 — Overview
Crate: kyn-vdf Stage: 6 of 10 Reading time: ~5 minutes Depends on: kinetic-vdf (conceptually)
What Is This?
kyn-vdf is Kinetic’s pure-Rust implementation of Verifiable Delay Functions. It implements Imaginary Quadratic Class Groups, Shanks’ composition algorithms, and Wesolowski verification entirely from scratch in safe Rust.
Warning
(Note: While the core math is pure-Rust, the crate lacks the
#![no_std]attribute and relies onthiserror, which inherently pulls instd).
Why Kinetic Needs This
In Stage 5 (kinetic-vdf), you saw that generating a VDF proof requires the heavy C++ chiavdf library. However, a major goal of Kinetic is to allow web browsers, mobile phones, and IoT devices to connect to the network as light clients without installing C++ toolchains. By writing the verification logic in pure Rust, kyn-vdf can be compiled directly to WebAssembly (WASM). This allows any web page to instantly verify 30 days of CPU time cryptographically, ensuring light clients do not have to blindly trust central servers.
How It Works
At its core, this crate performs math on large numbers (1024-bit integers).
- It deterministically derives a prime number (the Discriminant $D$) using SHA-256 and Miller-Rabin tests.
- It parses a compressed 100-byte BQFC network payload into a Quadratic Form $(a, b, c)$.
- It performs sub-quadratic Euclidean exponentiation using Shanks’ NUCOMP and NUDUPL algorithms.
- It checks the Wesolowski equation $\pi^B \cdot x^r = y$ to guarantee the proof is valid.
Key Pieces (Topic File Breakdown)
This crate is composed of ~1,480 total lines of code, broken down into the following dense mathematical topics:
02_math_core.md— Defines theFormstruct and the Gauss reduction algorithms to keep numbers canonical.03_math_comp.md— The complex Shanks’ NUCOMP and NUDUPL algorithms for fast algebraic composition.04_chia_prime.md— HashPrime and Discriminant derivation via the Miller-Rabin primality test.05_chia_bqfc.md— Binary Quadratic Form Compression (BQFC) to squish 130 bytes of data into exactly 100 bytes for optimal network MTU routing.06_verify.md— The Wesolowski verification equation that makes the entire time-lock system possible.
How This Connects to the Rest of Kinetic
- FORWARD DEPENDENCY: The network daemon (
kinetic-daemon) will embed this crate to verify every single transaction. - CROSS-CRATE: The C++ wrapper from Stage 5 (
kinetic-vdf) uses this crate to perform continuous differential fuzzing to ensure the C++ and Rust engines never fork.
Quick Reference
- Total Lines: 1,480
- Math Type: Imaginary Quadratic Class Groups
- Primary Dependency:
num-bigint - WASM Compatible: Yes (though restricted by
stdusage viathiserror)