package tezos-protocol-020-PsParisC

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Tezos Protocol Implementation - Random number generation

This is not expected to be a good cryptographic random number generator. In particular this is supposed to be used in situations where the seed is a globally known information.

The only expected property is: It should be difficult to find a seed such that the generated sequence is a given one.

Random Generation

type seed

A random seed, to derive random sequences from

val compare_vdf_solution : vdf_solution -> vdf_solution -> int

Compare only the first element of two vdf_solution, that are of Vdf.result.

val generate_vdf_setup : seed_discriminant:seed -> seed_challenge:seed -> vdf_setup
val vdf_to_seed : seed -> vdf_solution -> seed

Entropy

type nonce

A nonce for adding entropy to the generator

val update_seed : seed -> nonce -> seed

Add entropy to the seed generator

Use a byte sequence as a nonce

val hash : nonce -> Nonce_hash.t

Compute the hash of a nonce

val check_hash : nonce -> Nonce_hash.t -> bool

check_hash nonce hash is true if the nonce correspond to the hash

val nonce_hash_key_part : Nonce_hash.t -> string list -> string list

For using nonce hashes as keys in the hierarchical database

val deterministic_seed : seed -> seed

Returns a new seed by hashing the one passed with a constant.

val initial_seeds : ?initial_seed:State_hash.t -> int -> seed list

initial_seeds n generates the first n seeds for which there are no nonces. The first seed is a constant value. The kth seed is the hash of seed (k-1) concatenated with a constant. If an initial_seed is provided, the first seed is created using it as the first one.

Serializers

type seed_status =
  1. | RANDAO_seed
  2. | VDF_seed
OCaml

Innovation. Community. Security.