genesis

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2024 License: LGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// BABEAuthoritiesKeyHex is the hex encoding of:
	// Twox128Hash("Babe") + Twox128Hash("Authorities")
	BABEAuthoritiesKeyHex = babePrefixHex + "5e0621c4869aa60c02be9adcc98a0d1d"
	// BABERandomnessKeyHex is the hex encoding of:
	// Twox128Hash("Babe") + Twox128Hash("Randomness")
	BABERandomnessKeyHex = babePrefixHex + "7a414cb008e0e61e46722aa60abdd672"

	// GrandpaAuthoritiesKeyHex is the hex encoding of the key to the GRANDPA
	// authority data in the storage trie.
	GrandpaAuthoritiesKeyHex = "0x3a6772616e6470615f617574686f726974696573"
)

Variables

This section is empty.

Functions

func BuildFromMap added in v0.2.0

func BuildFromMap(m map[string][]byte, gen *Genesis) error

BuildFromMap builds genesis fields data from map

Types

type Data

type Data struct {
	Name               string
	ID                 string
	ChainType          string
	Bootnodes          [][]byte
	TelemetryEndpoints []*TelemetryEndpoint
	ProtocolID         string
	Properties         map[string]interface{}
	ForkBlocks         []string
	BadBlocks          []string
	ConsensusEngine    string
	CodeSubstitutes    map[string]string
}

Data defines the genesis file data formatted for trie storage

type Fields

type Fields struct {
	Raw     map[string]map[string]string `json:"raw,omitempty"`
	Runtime *Runtime                     `json:"runtime,omitempty"`
}

Fields stores genesis raw data, and human readable runtime data

type Genesis

type Genesis struct {
	Name               string                 `json:"name"`
	ID                 string                 `json:"id"`
	ChainType          string                 `json:"chainType"`
	Bootnodes          []string               `json:"bootNodes"`
	TelemetryEndpoints []interface{}          `json:"telemetryEndpoints"`
	ProtocolID         string                 `json:"protocolId"`
	Genesis            Fields                 `json:"genesis"`
	Properties         map[string]interface{} `json:"properties"`
	ForkBlocks         []string               `json:"forkBlocks"`
	BadBlocks          []string               `json:"badBlocks"`
	ConsensusEngine    string                 `json:"consensusEngine"`
	CodeSubstitutes    map[string]string      `json:"codeSubstitutes"`
}

Genesis stores the data parsed from the genesis configuration file

func NewGenesisFromJSON

func NewGenesisFromJSON(file string, authCount int) (*Genesis, error)

NewGenesisFromJSON parses Human Readable JSON formatted genesis file.Name. If authCount > 0, then it keeps only `authCount` number of authorities for babe and grandpa.

func NewGenesisFromJSONRaw added in v0.2.0

func NewGenesisFromJSONRaw(file string) (*Genesis, error)

NewGenesisFromJSONRaw parses a JSON formatted genesis file

func NewGenesisSpecFromJSON added in v0.4.0

func NewGenesisSpecFromJSON(file string) (*Genesis, error)

NewGenesisSpecFromJSON returns a new Genesis (without raw fields) from a human-readable genesis file

func (*Genesis) GenesisData

func (g *Genesis) GenesisData() *Data

GenesisData formats genesis for trie storage

func (*Genesis) GenesisFields

func (g *Genesis) GenesisFields() Fields

GenesisFields returns the genesis fields including genesis raw data

func (*Genesis) IsRaw added in v0.4.0

func (g *Genesis) IsRaw() bool

IsRaw returns whether the genesis is raw or not

func (*Genesis) ToRaw added in v0.4.0

func (g *Genesis) ToRaw() error

ToRaw converts a non-raw genesis to a raw genesis

type Runtime added in v0.8.0

type Runtime struct {
	System             *System             `json:"system,omitempty"`
	Babe               *babe               `json:"babe,omitempty"`
	Grandpa            *grandpa            `json:"grandpa,omitempty"`
	Balances           *balances           `json:"balances,omitempty"`
	Sudo               *sudo               `json:"sudo,omitempty"`
	Session            *session            `json:"session,omitempty"`
	Staking            *staking            `json:"staking,omitempty"`
	Indices            *indices            `json:"indices,omitempty"`
	ImOnline           *imOnline           `json:"imOnline,omitempty"`
	AuthorityDiscovery *authorityDiscovery `json:"authorityDiscovery,omitempty"`
	Vesting            *vesting            `json:"vesting"`
	NominationPools    *nominationPools    `json:"nominationPools,omitempty"`
	Configuration      *configuration      `json:"configuration,omitempty"`
	Paras              *paras              `json:"paras"`
	Hrmp               *hrmp               `json:"hrmp"`
	Registrar          *registrar          `json:"registrar,omitempty"`
	XcmPallet          *xcmPallet          `json:"xcmPallet,omitempty"`
}

Runtime is the structure of the genesis runtime field.

type System added in v0.8.0

type System struct {
	Code string `json:"code,omitempty"`
}

System is the system structure inside the runtime field for the genesis.

type TelemetryEndpoint added in v0.4.1

type TelemetryEndpoint struct {
	Endpoint  string `mapstructure:",squash"`
	Verbosity int    `mapstructure:",squash"`
}

TelemetryEndpoint struct to hold telemetry endpoint information

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL