api

package
v0.2401.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: Apache-2.0 Imports: 16 Imported by: 11

Documentation

Overview

Package api defines the Oasis genesis block.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document struct {
	// Height is the block height at which the document was generated.
	Height int64 `json:"height"`
	// Time is the time the genesis block was constructed.
	Time time.Time `json:"genesis_time"`
	// ChainID is the ID of the chain.
	ChainID string `json:"chain_id"`
	// Registry is the registry genesis state.
	Registry registry.Genesis `json:"registry"`
	// RootHash is the roothash genesis state.
	RootHash roothash.Genesis `json:"roothash"`
	// Staking is the staking genesis state.
	Staking staking.Genesis `json:"staking"`
	// KeyManager is the key manager genesis state.
	KeyManager keymanager.Genesis `json:"keymanager"`
	// Scheduler is the scheduler genesis state.
	Scheduler scheduler.Genesis `json:"scheduler"`
	// Beacon is the beacon genesis state.
	Beacon beacon.Genesis `json:"beacon"`
	// Governance is the governance genesis state.
	Governance governance.Genesis `json:"governance"`
	// Vault is the optional vault genesis state.
	Vault *vault.Genesis `json:"vault,omitempty"`
	// Consensus is the consensus genesis state.
	Consensus consensus.Genesis `json:"consensus"`
	// Extra data is arbitrary extra data that is part of the
	// genesis block but is otherwise ignored by the protocol.
	ExtraData map[string][]byte `json:"extra_data"`
	// contains filtered or unexported fields
}

Document is a genesis document.

func (*Document) CanonicalJSON added in v0.2012.5

func (d *Document) CanonicalJSON() ([]byte, error)

CanonicalJSON returns the canonical form of the genesis document serialized into a file.

This is a pretty-printed JSON file with 2-space indents following Go encoding/json package's JSON marshalling rules with a newline at the end.

func (*Document) ChainContext

func (d *Document) ChainContext() string

ChainContext returns a string that can be used as a chain domain separation context. Changing this (or any data it is derived from) invalidates all signatures that use chain domain separation.

Currently this uses the hex-encoded cryptographic hash of the encoded genesis document.

func (*Document) Hash

func (d *Document) Hash() hash.Hash

Hash returns the cryptographic hash of the encoded genesis document.

Calling this method will cause the computed hash to be cached so make sure that the document is not modified later.

func (*Document) SanityCheck

func (d *Document) SanityCheck() error

SanityCheck does basic sanity checking on the contents of the genesis document.

func (*Document) SetChainContext

func (d *Document) SetChainContext()

SetChainContext configures the global chain domain separation context.

This method can only be called once during the application's lifetime and will panic otherwise.

func (*Document) WriteFileJSON

func (d *Document) WriteFileJSON(filename string) error

WriteFileJSON writes the canonical form of genesis document into a file.

type Provider

type Provider interface {
	// GetGenesisDocument returns the genesis document.
	GetGenesisDocument() (*Document, error)
}

Provider is a genesis document provider.

Jump to

Keyboard shortcuts

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