Skip to content

Latest commit

 

History

History
83 lines (58 loc) · 2.66 KB

genesis.md

File metadata and controls

83 lines (58 loc) · 2.66 KB

Genesis Document

The genesis document contains a set of parameters that outline the initial state of the consensus layer and its services.

For more details about the actual genesis document's API, see genesis API documentation.

Chain Domain Separation

The genesis document is also used for chain domain separation.

The last part of domain separation context is computed as:

Base16(SHA512-256(CBOR(<genesis-document>)))

where:

  • Base16() represents the hex encoding function,
  • SHA512-256() represents the SHA-512/256 hash function as described in Cryptography documentation,
  • CBOR() represents the canonical CBOR encoding function as described in Serialization documentation, and
  • <genesis-document> represents a given genesis document.

Genesis File

A genesis file is a JSON document corresponding to a serialized genesis document.

{% hint style="info" %} For a high-level overview of the genesis file, its various sections and parameters and the parameter values that will be used for Oasis Network Mainnet launch, see: Genesis File Overview. {% endhint %}

Canonical Form

The canonical form of a genesis file is the pretty-printed JSON file with 2-space indents, where:

  • Struct fields are encoded in the order in which they are defined in the corresponding struct definitions.

    The genesis document is defined by the genesis/api.Document struct which contains pointers to other structs defining the genesis state of all consensus layer services.

  • Maps have their keys converted to strings which are then encoded in lexicographical order.

    This is Go's default behavior. For more details, see encoding/json.Marshal()'s documentation.

{% hint style="info" %} This should not be confused with the canonical CBOR encoding of the genesis document that is used to derive the domain separation context as described in the Chain Domain Separation section. {% endhint %}

This form is used to enable simple diffing/patching with the standard Unix tools (i.e. diff/patch).