VDF
warning
These docs are for V1 of Eat The Pie, which is now deprecated. For the latest documentation for V2 on World Chain, please visit docs.eatthepie.xyz.
Github Link: https://github.com/eatthepie/contracts/blob/main/src/VDFPietrzak.sol
The VDF contract implements the VDF Pietzrak Library.
Contract Structure
Dependencies
PietrzakLibrary: Library implementing the core VDF calculationsBigNumbers: Library for handling large number operations
Constants
Below are the parameters used for our implementation in the lottery:
| Parameter | Value | Description |
|---|---|---|
| N | c7970ce...cc7e5 | The RSA-2048 challenge number used as the modulus. This massive 2048-bit number has no known prime factors, making it ideal for cryptographic security. (Learn more about RSA-2048) |
| nBitLength | 2048 | The bit length of our RSA modulus |
| delta | 10 | Number of iterations to skip during verification, optimizing the trade-off between prover and verifier computation time |
| T | 67108864 (2²⁶) | Total number of sequential iterations required for the VDF computation. This parameter is set to create a ~5 hour delay on modern hardware |
Core Functionality
VDF Verification
function verifyPietrzak(
BigNumber[] memory v,
BigNumber memory x,
BigNumber memory y
) external view returns (bool)
Parameters
v: Array of intermediate values in the VDF computationx: Initial input to the VDF (RANDAO value)y: Purported output of the VDF
Returns
bool: True if the proof is valid, false otherwise
Process
- Creates BigNumber representation of RSA modulus
- Delegates verification to PietrzakLibrary
- Performs efficient proof verification
Technical Details
VDF Properties
-
Fast Verification
- Uses skip parameter (delta) for efficient verification
- Verification time logarithmic in total iterations
- Much faster than computation time
-
Security Guarantees
- Based on time-lock puzzles
- Uses trusted RSA modulus
- Provably secure under standard assumptions