Documentation
¶
Overview ¶
Package configs provides genesis configuration loading for Lux networks. This package is used by CLI, netrunner, and node to obtain genesis JSON for different network IDs.
Dynamic P-Chain Allocations: P-Chain allocations can be specified dynamically at runtime via:
- PCHAIN_ALLOCS: JSON string of allocations
- PCHAIN_ALLOCS_FILE: Path to allocations JSON file
- ~/.lux/genesis/{network}/pchain.json: Standard override location
The C-Chain genesis remains embedded and immutable.
Index ¶
- Constants
- func GetCanonicalGenesisBytes(networkID uint32) ([]byte, error)
- func GetConfig(networkID uint32) (*genesis.Config, error)
- func GetGenesis(networkID uint32) ([]byte, error)
- func GetGenesisWithAllocations(networkID uint32, allocations []genesis.AllocationJSON) ([]byte, error)
- func IsCustom(networkID uint32) bool
Constants ¶
const ( // Network IDs (P-Chain). These identify the PRIMARY network. MainnetID = 1 TestnetID = 2 DevnetID = 3 // LocalID is the canonical local single/multi-node dev network. // Pair with LocalChainID = 31337 on the C-Chain (Anvil convention). LocalID = 1337 // CustomID is the sentinel for any network ID outside the well-known // {1, 2, 3, 1337} set — i.e. genuinely user-defined networks. It is // deliberately NOT 1337 so callers can distinguish "this is the local // dev network" (LocalID) from "this is some other custom network the // caller will configure via --genesis-file" (CustomID). CustomID uint32 = 0 // LocalnetID is a deprecated alias for LocalID; existing callers // should migrate to LocalID. Kept here so older code keeps building // during the rollout. LocalnetID = LocalID // Chain ID constants (C-Chain EVM). MainnetChainID = 96369 TestnetChainID = 96368 DevnetChainID = 96370 // LocalChainID is the canonical local C-Chain EVM ID (Anvil convention). LocalChainID = 31337 // CustomChainID is the sentinel C-Chain EVM ID for any chain outside // the well-known {96369, 96368, 96370, 31337} set. Mirrors CustomID // at the network-ID layer; the two should always be paired (a peer // presenting CustomID at the network layer also presents // CustomChainID at the EVM layer unless overridden via genesis-file). CustomChainID uint32 = 0 // LocalnetChainID is a deprecated alias for LocalChainID. LocalnetChainID = LocalChainID )
Network ID constants (P-Chain) mainnet, testnet, devnet: proper public networks localnet: local development with LIGHT mnemonic (networkID=1337, EVM chainID=31337) anything else is custom (override via --genesis-file)
Variables ¶
This section is empty.
Functions ¶
func GetCanonicalGenesisBytes ¶
GetCanonicalGenesisBytes returns the canonical genesis bytes for a network. This function builds the genesis from split files (network.json, pchain.json, cchain.json) to ensure cChainGenesis is properly serialized as a JSON string.
CRITICAL: The embedded genesis.json stores cChainGenesis as an object for easy editing, but luxd requires it to be a JSON-encoded string. This function handles the conversion.
func GetGenesis ¶
GetGenesis returns the genesis JSON bytes for a network ID. It supports dynamic P-Chain allocations via environment variables or files:
- PCHAIN_ALLOCS: JSON string of allocations
- PCHAIN_ALLOCS_FILE: Path to allocations JSON file
- ~/.lux/genesis/{network}/pchain.json: Standard override location
C-Chain genesis remains embedded and immutable.
func GetGenesisWithAllocations ¶
func GetGenesisWithAllocations(networkID uint32, allocations []genesis.AllocationJSON) ([]byte, error)
GetGenesisWithAllocations returns genesis with custom P-Chain allocations. This allows booting networks with custom validator allocations.
func IsCustom ¶ added in v1.9.2
IsCustom reports whether the networkID is a user-defined network outside the well-known {Mainnet, Testnet, Devnet, Local + their C-Chain aliases} set. Mirrors luxfi/constants.IsCustom; both the genesis layer and the constants layer agree on the classification so a network can be classified consistently end-to-end.
Types ¶
This section is empty.