genesis

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssetIDFromGenesisBytes added in v1.4.7

func AssetIDFromGenesisBytes(genesisBytes []byte) (ids.ID, error)

AssetIDFromGenesisBytes returns the first genesis asset's runtime asset ID — the ID vm.initGenesis assigns to genesis.Txs[0]. This is the X-Chain native fee asset by convention (the same asset the platform-vm reports via platform.getStakingAssetID and the wallet builder context's UTXOAssetID).

Returns an error when genesisBytes is malformed or contains zero assets — both are unrecoverable on a primary-network bootstrap.

Types

type AssetInitialState

type AssetInitialState struct {
	FixedCap    []GenesisHolder
	VariableCap []GenesisOwners
}

AssetInitialState describes the initial state of an asset

type Genesis

type Genesis struct {
	Txs []*GenesisAsset `serialize:"true"`
}

Genesis represents the genesis state of the XVM

func NewGenesis

func NewGenesis(
	networkID uint32,
	genesisData map[string]GenesisAssetDefinition,
) (*Genesis, error)

NewGenesis creates a new Genesis from genesis data

func ParseGenesisBytes added in v1.4.7

func ParseGenesisBytes(genesisBytes []byte) (*Genesis, error)

ParseGenesisBytes decodes the canonical XVM genesis bytes produced by (*Genesis).Bytes() back into a *Genesis with each GenesisAsset's embedded CreateAssetTx initialised against the genesis codec. After Initialize, each tx's deterministic ID (tx.ID()) is the runtime asset ID of that genesis-minted asset — i.e. the same value vm.initGenesis computes when bootstrapping the X-Chain.

Callers (genesis/builder, config/getGenesisData) use this to derive the X-Chain native asset ID from genesis content rather than the network-id-keyed constants.UTXOAssetIDFor(networkID). On sovereign L1s those two values DIFFER — the wallet builder context's UTXOAssetID must be the genesis-derived one or every fee-paying tx fails with "insufficient funds, needs N more nLUX".

func (*Genesis) Bytes

func (g *Genesis) Bytes() ([]byte, error)

Bytes serializes the Genesis to its canonical native-ZAP bytes.

type GenesisAsset

type GenesisAsset struct {
	Alias             string `serialize:"true"`
	txs.CreateAssetTx `serialize:"true"`
}

GenesisAsset represents an asset in the genesis block

func (*GenesisAsset) Compare

func (g *GenesisAsset) Compare(other *GenesisAsset) int

Compare implements ordering.Sortable for GenesisAsset

type GenesisAssetDefinition

type GenesisAssetDefinition struct {
	Name         string
	Symbol       string
	Denomination byte
	InitialState AssetInitialState
	Memo         []byte
}

GenesisAssetDefinition describes a genesis asset and its initial state

type GenesisHolder

type GenesisHolder struct {
	Amount  uint64
	Address string
}

GenesisHolder describes how much asset is owned by an address

type GenesisOwners

type GenesisOwners struct {
	Threshold uint32
	Minters   []string
}

GenesisOwners describes who can perform an action

Jump to

Keyboard shortcuts

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