Documentation
¶
Overview ¶
Package genesis builds X-Chain (XVM) genesis bytes from a small, caller-supplied descriptor. It exists so callers (e.g. the node's primary-network genesis builder) do not have to import the xvm package directly to construct primary-asset genesis blobs — the asset shape lives here, in the same module tree as the codec that serializes it.
The package is intentionally narrow: it owns the AssetDescriptor + Holder + BuildBytes contract, and nothing else. Bech32 formatting, allocation sorting, memo composition, and the "is X-Chain opt-in for this network?" policy all stay in the caller — those are network-level concerns, not XVM concerns.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildBytes ¶
func BuildBytes( networkID uint32, asset AssetDescriptor, holders []Holder, memo []byte, ) ([]byte, error)
BuildBytes constructs the canonical XVM genesis bytes for a network whose primary asset is `asset`, with the supplied initial fixed-cap holders and an optional opaque memo. The asset is registered in the genesis under `asset.Symbol` (the same key callers use today).
The returned bytes are stable across calls with identical inputs because xvm.NewGenesis sorts both the asset set and each asset's states deterministically.
Types ¶
type AssetDescriptor ¶
type AssetDescriptor struct {
Name string `json:"name"`
Symbol string `json:"symbol"`
Denomination byte `json:"denomination"`
}
AssetDescriptor is the JSON-shaped primary-asset descriptor that callers carry on their network config (e.g. genesiscfg.XChainGenesis). The JSON tags mirror the existing on-disk xChainGenesis shard shape:
{"symbol":"LUX","name":"Lux","denomination":9}