genesis

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 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 corresponds to the height at which the first DA header/data has been published.
	// This value is meant to be updated after genesis and shared to all syncing nodes for speeding up syncing via DA.
	DAStartHeight uint64 `json:"da_start_height"`
	// DaEpochForcedInclusion corresponds to the amount of DA blocks are considered an epoch
	// When forced inclusion is enabled, the epoch size determines at what frequency the forced included transactions are executed by the application.
	DAEpochForcedInclusion uint64 `json:"da_epoch_forced_inclusion"`
}

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