genesis

package
v1.0.0-beta.10 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ChainIDFlag = "chain_id"

Variables

View Source
var ErrGenesisExists = fmt.Errorf("genesis file already exists")

Functions

func CreateGenesis

func CreateGenesis(homePath string, chainID string, initialHeight uint64, proposerAddress []byte) error

CreateGenesis creates and saves a genesis file with the given app state. If the genesis file already exists, it skips the creation and returns ErrGenesisExists. The genesis file is saved in the config directory of the specified home path. It should only be used when the application is NOT handling the genesis creation.

func GenesisPath

func GenesisPath(homePath string) string

GenesisPath returns the genesis file path from a home directory.

Types

type Genesis

type Genesis struct {
	ChainID         string    `json:"chain_id"`
	StartTime       time.Time `json:"start_time"`
	InitialHeight   uint64    `json:"initial_height"`
	ProposerAddress []byte    `json:"proposer_address"`
	DAStartHeight   uint64    `json:"da_start_height"`
}

Genesis represents the genesis state of the blockchain. This genesis struct only contains the fields required by evolve. The app state or other fields are not included here.

func LoadGenesis

func LoadGenesis(genesisPath string) (Genesis, error)

LoadGenesis loads the genesis state from the specified file path.

func NewGenesis

func NewGenesis(
	chainID string,
	initialHeight uint64,
	startTime time.Time,
	proposerAddress []byte,
) Genesis

NewGenesis creates a new Genesis instance.

func (Genesis) Save

func (g Genesis) Save(genesisPath string) error

Save saves the genesis state to the specified file path.

func (Genesis) Validate

func (g Genesis) Validate() error

Validate checks if the Genesis object is valid.

Jump to

Keyboard shortcuts

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