chainspec

package
v0.0.0-...-c7fb743 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bootnode

type Bootnode struct {
	Original string   // original string
	Name     string   // 53 chars: 'e' + base32(pubkey)
	PubKey   [32]byte // decoded Ed25519 public key
	IP       net.IP   // IPv4 or IPv6 address
	Port     uint16   // port number
}

Bootnode is a parsed bootnode entry <name>@<ip>:<port>.

func ParseBootnode

func ParseBootnode(s string) (*Bootnode, error)

ParseBootnode parses "<name>@<ip>:<port>". - name must be 53 chars, starts with 'e', rest is base32(pubkey) without padding. - ip must be a literal IPv4 or IPv6 address (IPv6 may be in [] or not).

type ChainSpec

type ChainSpec struct {
	ID                string            `json:"id"`
	Bootnodes         []string          `json:"bootnodes,omitempty"`
	GenesisHeader     string            `json:"genesis_header"`
	GenesisState      map[string]string `json:"genesis_state"`
	ProtocolParamsHex string            `json:"protocol_parameters,omitempty"`
}

ChainSpec matches JIP-4 JSON schema.

func LoadFromBytes

func LoadFromBytes(b []byte) (*ChainSpec, error)

func (*ChainSpec) GenesisHeaderBytes

func (cs *ChainSpec) GenesisHeaderBytes() ([]byte, error)

func (*ChainSpec) GenesisStateKeyVals

func (cs *ChainSpec) GenesisStateKeyVals() (types.StateKeyVals, error)

func (*ChainSpec) ParseProtocolParameters

func (cs *ChainSpec) ParseProtocolParameters() (types.ProtocolParameters, error)

func (*ChainSpec) ProtocolParametersBytes

func (cs *ChainSpec) ProtocolParametersBytes() ([]byte, error)

func (*ChainSpec) Validate

func (cs *ChainSpec) Validate() error

Jump to

Keyboard shortcuts

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