Interface VDF

A Verifiable Delay Function (VDF).

VDFs are problems that require a certain amount of time to solve, even on a parallel machine, but can be validated much more easily.

interface VDF {
    solve(challenge: Uint8Array, difficulty: number, discriminant?: bigint): Promise<Uint8Array>;
    checkDifficulty(difficulty: number): void;
    verify(challenge: Uint8Array, difficulty: number, allegedSolution: Uint8Array, discriminant?: bigint): void;
}

Implemented by

Methods

  • Solve an instance of this VDF, with challenge challenge and difficulty difficulty.

    Parameters

    • challenge: Uint8Array

      An opaque byte string of arbitrary length

    • difficulty: number

      The number of iterations (difficulty level)

    • Optionaldiscriminant: bigint

    Returns Promise<Uint8Array>

    The proof as a Uint8Array

    If the difficulty is invalid

  • Check that the difficulty is valid.

    Parameters

    • difficulty: number

      The number of iterations to validate

    Returns void

    If the difficulty is invalid

  • Verifies an alleged solution of this VDF.

    Parameters

    • challenge: Uint8Array

      The challenge used to generate the proof

    • difficulty: number

      The number of iterations used

    • allegedSolution: Uint8Array

      The proof to verify

    • Optionaldiscriminant: bigint

    Returns void

    If the proof is invalid