Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssetIDFromGenesisBytes ¶ added in v1.4.7
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
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".
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 ¶
GenesisHolder describes how much asset is owned by an address
type GenesisOwners ¶
GenesisOwners describes who can perform an action