Documentation
¶
Index ¶
- Constants
- Variables
- func ByteSliceIsEVMGenesis(bytes []byte) bool
- func DefaultValidatorKeyPath() string
- func FormatAddress(hrp string, addr ids.ShortID) string
- func FormatChainAddress(chainID string, hrp string, shortID ids.ShortID) (string, error)
- func GenerateAllocationsMapForNetrunner(keys []ValidatorKeyInfo, hrp string, amountPerKey uint64) ([]map[string]interface{}, error)
- func GenerateCChainAlloc(keys []ValidatorKeyInfo, amount uint64) map[string]Balance
- func GenerateCChainAllocMap(keys []ValidatorKeyInfo, amount uint64) map[string]map[string]string
- func GetAPIContext() (context.Context, context.CancelFunc)
- func GetBlockchainIDFromAlias(endpoint string, alias string) (ids.ID, error)
- func GetChainID(genesisData []byte) (*big.Int, error)
- func GetDefaultBlockchainAirdropKeyName(blockchainName string) string
- func GetKeyNames(keyDir string, includeEwoq bool) ([]string, error)
- func IsKnownPublicMnemonic(mnemonic string) bool
- func IsLightMnemonic(mnemonic string) bool
- func IsProductionNetwork(networkID uint32) bool
- func NetworkIDFromGenesis(genesis []byte) (uint32, error)
- func ParseAddress(addrStr string) (ids.ShortID, error)
- func ParseEVMAddress(addrStr string) (ids.ShortID, error)
- func ParseNodeID(nodeIDStr string) (ids.NodeID, error)
- func RefuseLightMnemonicOnProduction(networkID uint32) error
- type Account
- type AllChainAllocations
- type Allocation
- type AllocationJSON
- type Balance
- type Bootstrapper
- type CChainConfig
- type CChainParams
- type ChainAllocations
- func (a *ChainAllocations) All() (*AllChainAllocations, error)
- func (a *ChainAllocations) CChain() map[string]Balance
- func (a *ChainAllocations) CChainMap() map[string]map[string]string
- func (a *ChainAllocations) PChain() ([]AllocationJSON, error)
- func (a *ChainAllocations) PChainMap() ([]map[string]interface{}, error)
- func (a *ChainAllocations) WithAmount(amount uint64) *ChainAllocations
- func (a *ChainAllocations) WithVesting(config *VestingConfig) *ChainAllocations
- func (a *ChainAllocations) XChain() ([]AllocationJSON, error)
- type ChainConfig
- type ChainEntry
- type ChainIDHistory
- type ChainMapping
- func (m *ChainMapping) ApplyMigration(currentHeight uint64) error
- func (m *ChainMapping) GetChainByID(chainID ids.ID) (*ChainConfig, ChainRole, error)
- func (m *ChainMapping) GetChainByRole(role ChainRole) (*ChainConfig, error)
- func (m *ChainMapping) MarshalJSON() ([]byte, error)
- func (m *ChainMapping) ProposeMigration(role ChainRole, newChainID ids.ID, activationHeight uint64, proposalID ids.ID) error
- func (m *ChainMapping) RegisterChain(role ChainRole, config *ChainConfig) error
- func (m *ChainMapping) UnmarshalJSON(data []byte) error
- type ChainMigration
- type ChainPrefix
- type ChainRole
- type Config
- func BuildConfigFromEnv(networkID uint32, numValidators int, allocationPerKey uint64) (*Config, error)
- func BuildConfigFromKeys(networkID uint32, keysDir string, allocationPerKey uint64) (*Config, error)
- func GetConfig(networkID uint32) *Config
- func GetConfigFile(filepath string) (*Config, error)
- func GetConfigFromDir(dir string) (*Config, error)
- func GetConfigFromEnv() (*Config, error)
- func ParseConfigOutput(output *ConfigOutput, networkID uint32) (*Config, error)
- type ConfigOutput
- type EVMGenesis
- type FeeConfig
- type KeyInfo
- func LoadBIP44WalletKeysFromMnemonic(mnemonic string, numAccounts int) ([]KeyInfo, error)
- func LoadKeyFromEnv() (*KeyInfo, error)
- func LoadKeysFromDir(keysDir string) ([]KeyInfo, error)
- func LoadKeysFromMnemonic(mnemonic string, numAccounts int) ([]KeyInfo, error)
- func LoadKeysFromMnemonicEnv(numAccounts int) ([]KeyInfo, error)
- func LoadKeysFromMnemonicEnvForNetwork(networkID uint32, numAccounts int) ([]KeyInfo, error)
- type LockedAmount
- type NetworkConfig
- type PChainConfig
- type PQIdentity
- type Params
- type ProofOfPossession
- type RewardConfig
- type SecurityProfile
- type Staker
- type StakerJSON
- type StakingConfig
- type TxFeeConfig
- type UnparsedConfig
- type ValidatorKeyInfo
- type VestingConfig
- type WarpConfig
Constants ¶
const ( // DefaultAllocationPerAccount is 50M LUX per account per chain (P and X). // 1000 accounts × 50M × 2 chains = 100B LUX of UTXOs in genesis (well // under the 2T LUX SupplyCap on every network). // X-Chain: 50M free (immediately spendable from genesis). // P-Chain: 50M free at genesis (no vesting); the long-tail unlock // schedule below adds a separate 50M per account that vests 1%/year // over 100 years from Jan 1 2020 — i.e. each address sees 50M // spendable on X, 50M spendable on P + 50M vesting on P. // // Address scheme — Bitcoin-UTXO-style (more quantum-resistant): // P-Chain / X-Chain addresses are bech32(ripemd160(sha256(pubkey))). // The public key is *hidden behind two hash layers* until the // address is first spent. Until first spend, even a future // quantum adversary cannot recover the private key — Shor's // algorithm works against the secp256k1 pubkey, but not against // sha256+ripemd160. Contrast with C-Chain (Ethereum) addresses, // which are keccakBytes(pubkey)[12:] and effectively expose the // pubkey on every signature (recovery in ECDSA). Long-term holds // should sit on P/X, not C, for this reason. DefaultAllocationPerAccount = 50_000_000 * Lux // DefaultAllocationPerValidator is kept for backward compatibility DefaultAllocationPerValidator = DefaultAllocationPerAccount // DefaultNumAccounts is the default number of mnemonic-derived accounts // Funds 1000 wallet keys at canonical BIP44 m/44'/9000'/0'/0/i so that // any wallet that derives at this path against the SAME mnemonic sees // a fundable address on both P and X. DefaultNumAccounts = 1000 // StakingStartTime is Jan 1, 2020 00:00:00 UTC StakingStartTime = 1577836800 // UnlockInterval is 1 year in seconds UnlockInterval = 365 * 24 * 60 * 60 // TreasuryAddress is the C-Chain treasury with 2T LUX TreasuryAddress = "0x9011E888251AB053B7bD1cdB598Db4f9DEd94714" // TreasuryAmount is 2 trillion LUX in microLUX (2T * 10^6) TreasuryAmount = 2_000_000_000_000 * Lux // PChainFeeReserve is 10,000 LUX per validator for P-Chain fees PChainFeeReserve = 10_000 * Lux // LightMnemonic is the well-known dev mnemonic for local networks (network-id >= 1337). // NEVER use on public networks (mainnet, testnet, devnet). LightMnemonic = "light light light light light light light light light light light energy" )
const ( MicroLux uint64 = 1 // Base unit (6 decimals) - 0.000001 LUX MilliLux uint64 = 1_000 // 0.001 LUX Lux uint64 = 1_000_000 // 1 LUX = 10^6 microLUX KiloLux uint64 = 1_000_000_000 // 1,000 LUX MegaLux uint64 = 1_000_000_000_000 // 1,000,000 LUX (1M) GigaLux uint64 = 1_000_000_000_000_000 // 1 billion LUX (1B) TeraLux uint64 = 1_000_000_000_000_000_000 // 1 trillion LUX (1T) // TotalSupply is the maximum supply of LUX (2 trillion) TotalSupply uint64 = 2 * TeraLux // 2T LUX )
P-chain/X-chain units (6 decimals)
const ( // OneBillionLUX is 1B LUX - each mainnet validator gets this amount OneBillionLUX uint64 = 1_000_000_000 * Lux // 10^15 microLUX // OneHundredMillionLUX is 100M LUX - smaller allocation for testing OneHundredMillionLUX uint64 = 100_000_000 * Lux // 10^14 microLUX // DefaultValidatorAllocation is 1B LUX per validator DefaultValidatorAllocation uint64 = OneBillionLUX // VestingPeriods is 100 years (1% unlocks per year) VestingPeriods = 100 )
Common allocation amounts
const (
// CChainDecimalShift is 10^12 to convert from microLux (6 dec) to wei (18 dec)
CChainDecimalShift = 1_000_000_000_000
)
C-chain decimal conversion factor
Variables ¶
var ( MainnetStakingConfig = StakingConfig{ UptimeRequirement: 0.8, MinValidatorStake: 2000 * Lux, MaxValidatorStake: 5 * GigaLux, MinDelegatorStake: 25 * Lux, MinDelegationFee: 20000, MinStakeDuration: 2 * 7 * 24 * 60 * 60, MaxStakeDuration: 365 * 24 * 60 * 60, RewardConfig: RewardConfig{ MaxConsumptionRate: 120000, MinConsumptionRate: 100000, MintingPeriod: 365 * 24 * 60 * 60, SupplyCap: 2 * TeraLux, }, } TestnetStakingConfig = StakingConfig{ UptimeRequirement: 0.8, MinValidatorStake: 1_000_000 * Lux, MaxValidatorStake: 3000000 * Lux, MinDelegatorStake: 1 * Lux, MinDelegationFee: 20000, MinStakeDuration: 24 * 60 * 60, MaxStakeDuration: 365 * 24 * 60 * 60, RewardConfig: RewardConfig{ MaxConsumptionRate: 120000, MinConsumptionRate: 100000, MintingPeriod: 365 * 24 * 60 * 60, SupplyCap: 2 * TeraLux, }, } LocalStakingConfig = StakingConfig{ UptimeRequirement: 0.2, MinValidatorStake: 1_000_000 * Lux, MaxValidatorStake: 3000000 * Lux, MinDelegatorStake: 1 * Lux, MinDelegationFee: 20000, MinStakeDuration: 60, MaxStakeDuration: 365 * 24 * 60 * 60, RewardConfig: RewardConfig{ MaxConsumptionRate: 120000, MinConsumptionRate: 100000, MintingPeriod: 365 * 24 * 60 * 60, SupplyCap: 2 * TeraLux, }, } )
Default staking configs per network
var ( MainnetTxFeeConfig = TxFeeConfig{ TxFee: MilliLux, CreateAssetTxFee: 10 * MilliLux, } TestnetTxFeeConfig = TxFeeConfig{ TxFee: MilliLux, CreateAssetTxFee: 10 * MilliLux, } LocalTxFeeConfig = TxFeeConfig{ TxFee: MilliLux, CreateAssetTxFee: 10 * MilliLux, } )
Default tx fee configs per network
var ( ErrSecurityProfileMissing = errors.New("genesis: security profile pin is absent on a profile-required genesis") ErrSecurityProfileInvalidID = errors.New("genesis: SecurityProfile.ProfileID is not a known consensus profile") ErrSecurityProfileInvalidHashHex = errors.New("genesis: SecurityProfile.ProfileHashHex is not 48 bytes of hex") ErrSecurityProfileValidateFailed = errors.New("genesis: canonical profile failed Validate() at boot") ErrSecurityProfileHashMismatch = errors.New("genesis: live ComputeHash() does not match genesis-pinned ProfileHashHex") ErrSecurityProfileComputeHashFail = errors.New("genesis: canonical profile ComputeHash() returned error") )
SecurityProfileLoadErr is returned by Resolve when the pin fails to resolve to a known canonical profile or its content hash mismatches.
var LocalParams = Params{ TxFee: MilliLux, CreateAssetTxFee: 10 * MilliLux, UptimeRequirement: 0.2, MinValidatorStake: 1_000_000 * Lux, MaxValidatorStake: 3000000 * Lux, MinDelegatorStake: 1 * Lux, MinDelegationFee: 20000, MinStakeDuration: 60, MaxStakeDuration: 365 * 24 * 60 * 60, RewardConfig: RewardConfig{ MaxConsumptionRate: 120000, MinConsumptionRate: 100000, MintingPeriod: 365 * 24 * 60 * 60, SupplyCap: 2 * TeraLux, }, }
LocalParams contains default parameters for local networks
var MainnetParams = Params{ TxFee: MilliLux, CreateAssetTxFee: 10 * MilliLux, UptimeRequirement: 0.8, MinValidatorStake: 2000 * Lux, MaxValidatorStake: 5 * GigaLux, MinDelegatorStake: 25 * Lux, MinDelegationFee: 20000, MinStakeDuration: 2 * 7 * 24 * 60 * 60, MaxStakeDuration: 365 * 24 * 60 * 60, RewardConfig: RewardConfig{ MaxConsumptionRate: 120000, MinConsumptionRate: 100000, MintingPeriod: 365 * 24 * 60 * 60, SupplyCap: 2 * TeraLux, }, }
MainnetParams contains default parameters for mainnet
var TestnetParams = Params{ TxFee: MilliLux, CreateAssetTxFee: 10 * MilliLux, UptimeRequirement: 0.8, MinValidatorStake: 1_000_000 * Lux, MaxValidatorStake: 3000000 * Lux, MinDelegatorStake: 1 * Lux, MinDelegationFee: 20000, MinStakeDuration: 24 * 60 * 60, MaxStakeDuration: 365 * 24 * 60 * 60, RewardConfig: RewardConfig{ MaxConsumptionRate: 120000, MinConsumptionRate: 100000, MintingPeriod: 365 * 24 * 60 * 60, SupplyCap: 2 * TeraLux, }, }
TestnetParams contains default parameters for testnet
Functions ¶
func ByteSliceIsEVMGenesis ¶
ByteSliceIsEVMGenesis checks if a byte slice is a EVM genesis
func DefaultValidatorKeyPath ¶
func DefaultValidatorKeyPath() string
DefaultValidatorKeyPath returns the default path for validator keys
func FormatAddress ¶
FormatAddress formats a ShortID as bech32 address
func FormatChainAddress ¶
FormatChainAddress formats a ShortID as an X or P chain address with the given HRP
func GenerateAllocationsMapForNetrunner ¶
func GenerateAllocationsMapForNetrunner(keys []ValidatorKeyInfo, hrp string, amountPerKey uint64) ([]map[string]interface{}, error)
GenerateAllocationsMapForNetrunner creates allocations in the format netrunner expects. This is a convenience function for backwards compatibility.
func GenerateCChainAlloc ¶
func GenerateCChainAlloc(keys []ValidatorKeyInfo, amount uint64) map[string]Balance
GenerateCChainAlloc creates C-chain genesis allocations for validator keys.
func GenerateCChainAllocMap ¶
func GenerateCChainAllocMap(keys []ValidatorKeyInfo, amount uint64) map[string]map[string]string
GenerateCChainAllocMap creates C-chain genesis allocations as a simple map for netrunner.
func GetAPIContext ¶
func GetAPIContext() (context.Context, context.CancelFunc)
GetAPIContext returns a context with a default timeout for API calls.
func GetBlockchainIDFromAlias ¶
GetBlockchainIDFromAlias gets a blockchain ID from its alias on the network.
func GetChainID ¶
GetChainID extracts the chain ID from genesis data
func GetDefaultBlockchainAirdropKeyName ¶
GetDefaultBlockchainAirdropKeyName returns the default key name for blockchain airdrops
func GetKeyNames ¶
GetKeyNames returns a list of key names from the given directory.
func IsKnownPublicMnemonic ¶ added in v1.9.6
IsKnownPublicMnemonic reports whether the given mnemonic appears in any well-known public list (LIGHT_MNEMONIC, BIP-39 test vectors, Hardhat default, hardware-wallet demos, etc.). Compared in constant time per entry so a timing attacker can't probe which entry matched.
Production deployments MUST refuse any mnemonic for which this returns true. A real production seed comes from a hardware RNG and lives in KMS — never from a publicly-known list.
func IsLightMnemonic ¶ added in v1.9.6
IsLightMnemonic reports whether the given mnemonic is exactly the well-known LIGHT_MNEMONIC dev seed. Compared in constant time so a timing attacker can't probe the running config from outside.
func IsProductionNetwork ¶ added in v1.9.6
IsProductionNetwork reports whether the given numeric network ID is on the list of *production* Lux networks. Local / primary-local meshes (network IDs >= 1337, including constants.LocalID = 1337) deliberately allow LIGHT_MNEMONIC; mainnet, testnet and any other reserved low-ID network refuse it.
Network ID convention (mirrors lux/constants):
- 1 mainnet (production)
- 2 testnet (production-grade staging — refuses LIGHT_MNEMONIC)
- 1337 LocalID (free-form local dev, allows LIGHT_MNEMONIC)
- >= 1337 any tenant local / dev mesh (allows LIGHT_MNEMONIC)
- 3..1336 reserved; treated as production by default
func NetworkIDFromGenesis ¶
NetworkIDFromGenesis returns the network ID in the given genesis
func ParseAddress ¶
ParseAddress parses a bech32 address string to ShortID. Supports formats: P-lux1xxx, X-lux1xxx, lux1xxx, local1xxx. The HRP must be one of the canonical Lux HRPs (lux/test/dev/local).
func ParseEVMAddress ¶ added in v1.12.8
ParseEVMAddress parses an Ethereum hex address to ShortID
func ParseNodeID ¶
ParseNodeID parses a node ID string
func RefuseLightMnemonicOnProduction ¶ added in v1.9.6
RefuseLightMnemonicOnProduction returns a non-nil error iff the running process is configured with any publicly-known mnemonic (LIGHT_MNEMONIC, BIP-39 test vectors, Hardhat / Trezor demos, …) AND the supplied networkID is a production network. Runtime guard required by HIP-0077 §"Mnemonic exposure" / "Auto-funded blast radius".
**Headline contract (HIP-0077 red-review F30):** every public callable that turns environment state into derived keys MUST invoke this guard itself. Callers may NOT rely on operator discipline to remember the call — `LoadKeysFromMnemonicEnv` and `BuildConfigFromEnv` invoke this directly so a misconfigured production deployment fails closed at the derivation point, never silently produces public-mnemonic-derived signing keys.
The guard widens beyond LIGHT_MNEMONIC to cover the broader public-mnemonic blacklist (HIP-0077 red-review F31): BIP-39 abandon vector, Hardhat default, Trezor demo, etc. See knownPublicMnemonics.
Types ¶
type Account ¶
type Account struct {
Balance interface{} `json:"balance"` // Can be string (hex) or number
Code interface{} `json:"code,omitempty"` // Can be string (hex) or []byte
Storage map[string]string `json:"storage,omitempty"`
Nonce interface{} `json:"nonce,omitempty"` // Can be string (hex) or uint64
}
Account represents an account in the genesis allocation
func (*Account) GetBalance ¶
GetBalance returns the balance as a big.Int
func (*Account) UnmarshalJSON ¶
UnmarshalJSON custom unmarshaler for Account to handle hex string balances
type AllChainAllocations ¶
type AllChainAllocations struct {
PChain []AllocationJSON
CChain map[string]Balance
XChain []AllocationJSON
}
AllChainAllocations contains allocations for all chains.
func MainnetAllocations ¶
func MainnetAllocations(keys []ValidatorKeyInfo, hrp string) (*AllChainAllocations, error)
MainnetAllocations creates allocations with standard mainnet vesting (1B LUX, 100 years).
func QuickAllocations ¶
func QuickAllocations(keys []ValidatorKeyInfo, hrp string, amount uint64) (*AllChainAllocations, error)
QuickAllocations creates immediate allocations (no vesting) for all chains. This is the simplest way to set up a local/test network.
func TestnetAllocations ¶
func TestnetAllocations(keys []ValidatorKeyInfo, hrp string) (*AllChainAllocations, error)
TestnetAllocations creates allocations suitable for testnet (100M LUX, no vesting).
type Allocation ¶
type Allocation struct {
EVMAddr ids.ShortID `json:"evmAddr"`
UTXOAddr ids.ShortID `json:"utxoAddr"`
InitialAmount uint64 `json:"initialAmount"`
UnlockSchedule []LockedAmount `json:"unlockSchedule"`
}
Allocation represents a genesis allocation.
EVMAddr is the 20-byte H160 EVM address (C-Chain and other EVM chains). UTXOAddr is the 20-byte ShortID used by both P-Chain and X-Chain UTXOs
(same bytes; bech32 prefix differentiates the chain).
func BuildBIP44WalletAllocations ¶ added in v1.9.7
func BuildBIP44WalletAllocations(networkID uint32, numKeys int, amountPerKey uint64) ([]Allocation, error)
BuildBIP44WalletAllocations derives wallet keys on the canonical BIP44 path m/44'/9000'/0'/0/i (purpose-44' / coin-9000' / account-0' hardened; change-0 / index-i NON-hardened). 9000 is the SLIP-0044 coin type Lux inherits from its upstream lineage; any BIP44-conformant wallet using that coin type derives the same key set. Returns free (no vesting) spending allocations for each key.
Use this instead of BuildWalletAllocations when the receiving consumer (e.g. a subnet-bootstrap CLI) expects classical BIP44 web-wallet addresses. BuildWalletAllocations uses a Lux-internal hardened layout (m/44'/9000'/nid'/1'/i') and will not match the web wallet.
The networkID parameter is preserved for symmetry with BuildWalletAllocations but is unused — canonical BIP44 is a single tree shared across networks (the same seed produces the same addresses regardless of chain).
type AllocationJSON ¶
type AllocationJSON struct {
EVMAddr string `json:"evmAddr"`
UTXOAddr string `json:"utxoAddr"`
InitialAmount uint64 `json:"initialAmount"`
UnlockSchedule []LockedAmount `json:"unlockSchedule"`
}
AllocationJSON is the JSON representation of an allocation.
Address fields use the canonical UTXO/ETH split:
- utxoAddr (bech32, P-/X- prefix interchangeable) — P-Chain + X-Chain UTXO owner
- evmAddr (0x H160) — C-Chain and other EVM chain owner
func GeneratePChainAllocations ¶
func GeneratePChainAllocations(keys []ValidatorKeyInfo, hrp string, amountPerKey uint64) ([]AllocationJSON, error)
GeneratePChainAllocations creates P-chain genesis allocations for validator keys. Each key gets the specified amount immediately available (locktime=0) for spending.
func GeneratePChainAllocationsWithVesting ¶
func GeneratePChainAllocationsWithVesting(keys []ValidatorKeyInfo, hrp string, amountPerKey uint64, startTime uint64, interval uint64, periods int) ([]AllocationJSON, error)
GeneratePChainAllocationsWithVesting creates P-chain allocations with a vesting schedule. Each key gets the specified amount vested over the given number of periods.
type Balance ¶
type Balance struct {
Balance string `json:"balance"`
}
Balance represents an EVM account balance
type Bootstrapper ¶
Bootstrapper represents a bootstrap node
func GetBootstrappers ¶
func GetBootstrappers(networkID uint32) []Bootstrapper
GetBootstrappers loads bootstrappers dynamically from config or keys
func GetBootstrappersFromKeys ¶
func GetBootstrappersFromKeys(keysDir string) ([]Bootstrapper, error)
GetBootstrappersFromKeys loads bootstrapper info from node keys directory
type CChainConfig ¶
type CChainConfig struct {
Config CChainParams `json:"config"`
Nonce string `json:"nonce"`
Timestamp string `json:"timestamp"`
ExtraData string `json:"extraData"`
GasLimit string `json:"gasLimit"`
Difficulty string `json:"difficulty"`
MixHash string `json:"mixHash"`
Coinbase string `json:"coinbase"`
Alloc map[string]Balance `json:"alloc"`
Number string `json:"number"`
GasUsed string `json:"gasUsed"`
ParentHash string `json:"parentHash"`
}
CChainConfig is the C-Chain genesis configuration
type CChainParams ¶
type CChainParams struct {
ChainID uint64 `json:"chainId"`
HomesteadBlock uint64 `json:"homesteadBlock"`
EIP150Block uint64 `json:"eip150Block"`
EIP155Block uint64 `json:"eip155Block"`
EIP158Block uint64 `json:"eip158Block"`
ByzantiumBlock uint64 `json:"byzantiumBlock"`
ConstantinopleBlock uint64 `json:"constantinopleBlock"`
PetersburgBlock uint64 `json:"petersburgBlock"`
IstanbulBlock uint64 `json:"istanbulBlock"`
MuirGlacierBlock uint64 `json:"muirGlacierBlock"`
BerlinBlock uint64 `json:"berlinBlock"`
LondonBlock uint64 `json:"londonBlock"`
ArrowGlacierBlock uint64 `json:"arrowGlacierBlock,omitempty"`
GrayGlacierBlock uint64 `json:"grayGlacierBlock,omitempty"`
MergeNetsplitBlock uint64 `json:"mergeNetsplitBlock,omitempty"`
ShanghaiTime uint64 `json:"shanghaiTime,omitempty"`
CancunTime uint64 `json:"cancunTime,omitempty"`
TerminalTotalDifficulty uint64 `json:"terminalTotalDifficulty,omitempty"`
EVMTimestamp uint64 `json:"evmTimestamp,omitempty"`
DurangoTimestamp uint64 `json:"durangoTimestamp,omitempty"`
EtnaTimestamp uint64 `json:"etnaTimestamp,omitempty"`
FeeConfig FeeConfig `json:"feeConfig"`
WarpConfig *WarpConfig `json:"warpConfig,omitempty"`
}
CChainParams contains C-Chain config parameters
type ChainAllocations ¶
type ChainAllocations struct {
// contains filtered or unexported fields
}
ChainAllocations holds genesis allocations for all chains. Use NewAllocations() or AllocationBuilder to create.
func NewAllocations ¶
func NewAllocations(keys []ValidatorKeyInfo, hrp string) *ChainAllocations
NewAllocations creates a ChainAllocations for the given validator keys. Default amount is 100M LUX per key, no vesting.
func (*ChainAllocations) All ¶
func (a *ChainAllocations) All() (*AllChainAllocations, error)
All returns allocations for all chains in a combined struct.
func (*ChainAllocations) CChain ¶
func (a *ChainAllocations) CChain() map[string]Balance
CChain returns C-chain allocations as a Balance map. C-chain uses 18 decimals (wei), P-chain uses 6 decimals (microLux). This converts the P-chain amount to C-chain wei automatically.
func (*ChainAllocations) CChainMap ¶
func (a *ChainAllocations) CChainMap() map[string]map[string]string
CChainMap returns C-chain allocations as a simple string map (for netrunner compatibility). C-chain uses 18 decimals (wei), P-chain uses 6 decimals (microLux).
func (*ChainAllocations) PChain ¶
func (a *ChainAllocations) PChain() ([]AllocationJSON, error)
PChain returns P-chain allocations in the standard AllocationJSON format.
func (*ChainAllocations) PChainMap ¶
func (a *ChainAllocations) PChainMap() ([]map[string]interface{}, error)
PChainMap returns P-chain allocations as interface maps (for netrunner compatibility).
func (*ChainAllocations) WithAmount ¶
func (a *ChainAllocations) WithAmount(amount uint64) *ChainAllocations
WithAmount sets the allocation amount per key.
func (*ChainAllocations) WithVesting ¶
func (a *ChainAllocations) WithVesting(config *VestingConfig) *ChainAllocations
WithVesting enables vesting with the specified config. Use DefaultVesting() for standard 100-year vesting from Jan 1 2020.
func (*ChainAllocations) XChain ¶
func (a *ChainAllocations) XChain() ([]AllocationJSON, error)
XChain returns X-chain allocations (same format as P-chain for cross-chain compatibility).
type ChainConfig ¶
type ChainConfig struct {
// ChainID is the current active chain ID (can change via migration)
ChainID ids.ID `json:"chainID"`
// VMID identifies which VM runs this chain
VMID ids.ID `json:"vmID"`
// Role indicates the chain's purpose (P/X/C/Q/etc.)
Role ChainRole `json:"role"`
// Name is the human-readable chain name
Name string `json:"name"`
// Aliases for RPC/API routing
Aliases []string `json:"aliases,omitempty"`
// EVMChainID is the EVM chain ID (only for EVM chains)
EVMChainID uint64 `json:"evmChainID,omitempty"`
// Genesis is the chain-specific genesis data
Genesis json.RawMessage `json:"genesis,omitempty"`
// PreviousChainIDs tracks historical chain IDs for migration
PreviousChainIDs []ChainIDHistory `json:"previousChainIDs,omitempty"`
}
ChainConfig represents a single chain's configuration
type ChainEntry ¶ added in v1.8.0
type ChainEntry struct {
VMID string `json:"vmID"` // VM ID (base58 encoded)
Name string `json:"name"` // Human-readable chain name
GenesisData string `json:"genesisData"` // Genesis JSON (string-encoded)
}
ChainEntry defines an additional chain to create at genesis. Used for embedding L1/L2 chains directly in the P-Chain genesis.
type ChainIDHistory ¶
type ChainIDHistory struct {
ChainID ids.ID `json:"chainID"`
StartTime uint64 `json:"startTime"`
EndTime uint64 `json:"endTime"`
}
ChainIDHistory records a historical chain ID and when it was active
type ChainMapping ¶
type ChainMapping struct {
// Version of the chain mapping schema
Version uint32 `json:"version"`
// Chains maps role -> chain config
Chains map[ChainRole]*ChainConfig `json:"chains"`
// MigrationPending indicates if a migration is in progress
MigrationPending *ChainMigration `json:"migrationPending,omitempty"`
}
ChainMapping maps chain roles to their configurations This allows dynamic chain ID assignment and migration
func DefaultMainnetMapping ¶
func DefaultMainnetMapping() *ChainMapping
DefaultMainnetMapping returns the default chain mapping for mainnet
func NewChainMapping ¶
func NewChainMapping(networkID uint32) *ChainMapping
NewChainMapping creates a default chain mapping for a network
func (*ChainMapping) ApplyMigration ¶
func (m *ChainMapping) ApplyMigration(currentHeight uint64) error
ApplyMigration applies a pending migration at the given height
func (*ChainMapping) GetChainByID ¶
func (m *ChainMapping) GetChainByID(chainID ids.ID) (*ChainConfig, ChainRole, error)
GetChainByID returns the chain config with the given chain ID
func (*ChainMapping) GetChainByRole ¶
func (m *ChainMapping) GetChainByRole(role ChainRole) (*ChainConfig, error)
GetChainByRole returns the chain config for a given role
func (*ChainMapping) MarshalJSON ¶
func (m *ChainMapping) MarshalJSON() ([]byte, error)
MarshalJSON implements custom JSON marshaling
func (*ChainMapping) ProposeMigration ¶
func (m *ChainMapping) ProposeMigration(role ChainRole, newChainID ids.ID, activationHeight uint64, proposalID ids.ID) error
ProposeMigration initiates a chain ID migration
func (*ChainMapping) RegisterChain ¶
func (m *ChainMapping) RegisterChain(role ChainRole, config *ChainConfig) error
RegisterChain adds or updates a chain in the mapping
func (*ChainMapping) UnmarshalJSON ¶
func (m *ChainMapping) UnmarshalJSON(data []byte) error
UnmarshalJSON implements custom JSON unmarshaling
type ChainMigration ¶
type ChainMigration struct {
// Role being migrated
Role ChainRole `json:"role"`
// OldChainID is the current chain ID
OldChainID ids.ID `json:"oldChainID"`
// NewChainID is the target chain ID
NewChainID ids.ID `json:"newChainID"`
// ActivationHeight is when the migration becomes active
ActivationHeight uint64 `json:"activationHeight"`
// ProposalID links to governance proposal
ProposalID ids.ID `json:"proposalID,omitempty"`
}
ChainMigration represents a pending chain ID migration
type ChainPrefix ¶ added in v1.11.9
type ChainPrefix string
ChainPrefix is the bech32 chain prefix that prefixes the HRP-encoded portion of a chain-scoped address. P-Chain UTXOs use "P", X-Chain UTXOs use "X". They are orthogonal to the per-network HRP (lux/test/dev/local): a prefix identifies the chain, an HRP identifies the network.
Decomplects chain identity from network parameter at the type level — callers compose the two by method invocation rather than threading a magic string through formatter call sites.
const ( PChainPrefix ChainPrefix = "P" XChainPrefix ChainPrefix = "X" )
Canonical chain prefixes. The X-Chain (UTXO Exchange) and P-Chain (ProtocolVM) share the same 20-byte ShortID space; only the prefix distinguishes which chain the address binds to.
func (ChainPrefix) Format ¶ added in v1.11.9
func (cp ChainPrefix) Format(hrp string, addr []byte) (string, error)
Format builds a chain-scoped bech32 address of the form "<prefix>-<hrp>1<data><checksum>". The bech32 checksum is computed over the HRP and address bytes only — the chain prefix is a textual tag joined with "-" after encoding (see luxfi/address.Format).
type ChainRole ¶
type ChainRole string
ChainRole represents the role/purpose of a chain in the network
const ( RoleProtocol ChainRole = "P" // Protocol chain — validator set, chain registry, ordering RoleExchange ChainRole = "X" // Exchange/asset transfer chain RoleContract ChainRole = "C" // Contract/EVM chain RoleQuantum ChainRole = "Q" // Quantum-resistant chain RoleAttest ChainRole = "A" // Attestation chain RoleBridge ChainRole = "B" // Bridge chain RoleThreshold ChainRole = "T" // Threshold/MPC chain RoleZK ChainRole = "Z" // Zero-knowledge chain RoleGraph ChainRole = "G" // Graph/data chain (future) RoleIdentity ChainRole = "I" // Identity chain (future) RoleKMS ChainRole = "K" // KMS chain (future) )
type Config ¶
type Config struct {
NetworkID uint32 `json:"networkID"`
Allocations []Allocation `json:"allocations"`
StartTime uint64 `json:"startTime"`
InitialStakeDuration uint64 `json:"initialStakeDuration"`
InitialStakeDurationOffset uint64 `json:"initialStakeDurationOffset"`
InitialStakedFunds []ids.ShortID `json:"initialStakedFunds"`
InitialStakers []Staker `json:"initialStakers"`
XChainGenesis string `json:"xChainGenesis,omitempty"` // X-Chain: UTXO Exchange VM (small JSON: {"symbol":"LUX","name":"Lux","denomination":9}); empty → skip X-Chain
CChainGenesis string `json:"cChainGenesis"`
DChainGenesis string `json:"dChainGenesis,omitempty"` // D-Chain: DEX VM genesis
QChainGenesis string `json:"qChainGenesis,omitempty"` // Q-Chain: Quantum VM genesis
AChainGenesis string `json:"aChainGenesis,omitempty"` // A-Chain: Attestation/AI VM genesis
BChainGenesis string `json:"bChainGenesis,omitempty"` // B-Chain: Bridge VM genesis
TChainGenesis string `json:"tChainGenesis,omitempty"` // T-Chain: Threshold VM genesis
ZChainGenesis string `json:"zChainGenesis,omitempty"` // Z-Chain: ZK VM genesis
GChainGenesis string `json:"gChainGenesis,omitempty"` // G-Chain: Graph VM genesis
KChainGenesis string `json:"kChainGenesis,omitempty"` // K-Chain: KMS VM genesis
Message string `json:"message"`
// Chains defines additional chains to include in genesis beyond the
// built-in alphabet chains (C, D, Q, B, T, Z, G, K). Each entry becomes
// a CreateChainTx in the P-Chain genesis. This allows L1/L2
// chains to be embedded directly for automatic bootstrap.
Chains []ChainEntry `json:"chains,omitempty"`
// ChainMapping provides dynamic chain ID configuration per network.
// This allows chains (P/X/C/Q/etc.) to have network-specific IDs that
// can be migrated/upgraded over time via governance.
ChainMapping *ChainMapping `json:"chainMapping,omitempty"`
// SecurityProfile is the genesis-level pin for this chain's locked
// ChainSecurityProfile (consensus/config). Carries the ProfileID
// byte plus the SHA3-384 content hash of the canonical profile.
// luxfi/node loads this at startup and refuses to boot if the live
// canonical profile content doesn't match the pinned hash.
//
// Optional in JSON so legacy genesis files keep parsing; node
// bootstrap warns + refuses strict-PQ features when absent.
// Closes red-team finding F102.
SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"`
}
Config is the top-level genesis configuration
func BuildConfigFromEnv ¶
func BuildConfigFromEnv(networkID uint32, numValidators int, allocationPerKey uint64) (*Config, error)
BuildConfigFromEnv builds genesis config from environment variables Checks in order: KEYS_DIR, mnemonic (MNEMONIC/LIGHT_MNEMONIC), PRIVATE_KEY
Architecture:
- X-Chain: 100 accounts × 500M LUX each, FREE
- P-Chain: 100 accounts × 500M LUX each, vesting 1%/year from 2020-01-01
- C-Chain: treasury 0x9011...4714 gets 2T LUX
func BuildConfigFromKeys ¶
func BuildConfigFromKeys(networkID uint32, keysDir string, allocationPerKey uint64) (*Config, error)
BuildConfigFromKeys creates a genesis config from local keys Validators get fee reserve on P-Chain, all keys get X-Chain allocation with vesting
func GetConfigFile ¶
GetConfigFile loads genesis config from a single JSON file The JSON file should be in ConfigOutput format (string-encoded addresses) which is the standard serialization format for genesis files.
func GetConfigFromDir ¶
GetConfigFromDir builds genesis config from component files in a directory Expects: network.json, pchain.json, cchain.json
func GetConfigFromEnv ¶
GetConfigFromEnv builds genesis config using environment variables Environment variables:
- NETWORK_ID: network ID (default: custom)
- GENESIS_DIR: directory containing genesis files
- KEYS_DIR: directory containing node keys (default: ~/.lux/keys)
func ParseConfigOutput ¶ added in v1.8.2
func ParseConfigOutput(output *ConfigOutput, networkID uint32) (*Config, error)
ParseConfigOutput converts a ConfigOutput (JSON-friendly string addresses) to a Config (binary addresses). This is the inverse of Config.ToJSON().
func (*Config) MarshalJSON ¶
MarshalJSON implements json.Marshaler for Config
func (*Config) ToJSON ¶
func (c *Config) ToJSON(hrp string) *ConfigOutput
ToJSON converts Config to ConfigOutput for JSON marshaling
type ConfigOutput ¶
type ConfigOutput struct {
NetworkID uint32 `json:"networkID"`
Allocations []AllocationJSON `json:"allocations"`
StartTime uint64 `json:"startTime"`
InitialStakeDuration uint64 `json:"initialStakeDuration"`
InitialStakeDurationOffset uint64 `json:"initialStakeDurationOffset"`
InitialStakedFunds []string `json:"initialStakedFunds"`
InitialStakers []StakerJSON `json:"initialStakers"`
XChainGenesis string `json:"xChainGenesis,omitempty"` // X-Chain: UTXO Exchange VM (small JSON: {"symbol":"LUX","name":"Lux","denomination":9}); empty → skip X-Chain
CChainGenesis string `json:"cChainGenesis"`
DChainGenesis string `json:"dChainGenesis,omitempty"` // D-Chain: DEX VM genesis
QChainGenesis string `json:"qChainGenesis,omitempty"` // Q-Chain: Quantum VM genesis
AChainGenesis string `json:"aChainGenesis,omitempty"` // A-Chain: Attestation/AI VM genesis
BChainGenesis string `json:"bChainGenesis,omitempty"` // B-Chain: Bridge VM genesis
TChainGenesis string `json:"tChainGenesis,omitempty"` // T-Chain: Threshold VM genesis
ZChainGenesis string `json:"zChainGenesis,omitempty"` // Z-Chain: ZK VM genesis
GChainGenesis string `json:"gChainGenesis,omitempty"` // G-Chain: Graph VM genesis
KChainGenesis string `json:"kChainGenesis,omitempty"` // K-Chain: KMS VM genesis
Chains []ChainEntry `json:"chains,omitempty"` // Additional genesis chains
SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"`
Message string `json:"message"`
}
ConfigOutput is the JSON output format for genesis configuration This matches what luxd expects for primary network genesis
type EVMGenesis ¶
type EVMGenesis struct {
Config map[string]interface{} `json:"config"`
Alloc map[string]Account `json:"alloc"`
Timestamp interface{} `json:"timestamp,omitempty"` // Can be string (hex) or uint64
GasLimit interface{} `json:"gasLimit"` // Can be string (hex) or uint64
Difficulty string `json:"difficulty,omitempty"`
MixHash string `json:"mixHash,omitempty"`
Coinbase string `json:"coinbase,omitempty"`
Number string `json:"number,omitempty"`
GasUsed string `json:"gasUsed,omitempty"`
ParentHash string `json:"parentHash,omitempty"`
Nonce string `json:"nonce,omitempty"`
ExtraData string `json:"extraData,omitempty"`
}
EVMGenesis represents a EVM genesis configuration
func ByteSliceToEVMGenesis ¶
func ByteSliceToEVMGenesis(bytes []byte) (*EVMGenesis, error)
ByteSliceToEVMGenesis converts a byte slice to a EVM genesis
func (*EVMGenesis) UnmarshalJSON ¶
func (g *EVMGenesis) UnmarshalJSON(data []byte) error
UnmarshalJSON custom unmarshaler to handle hex string or numeric values
type FeeConfig ¶
type FeeConfig struct {
GasLimit uint64 `json:"gasLimit"`
TargetBlockRate uint64 `json:"targetBlockRate"`
MinBaseFee uint64 `json:"minBaseFee"`
TargetGas uint64 `json:"targetGas"`
BaseFeeChangeDenominator uint64 `json:"baseFeeChangeDenominator"`
MinBlockGasCost uint64 `json:"minBlockGasCost"`
MaxBlockGasCost uint64 `json:"maxBlockGasCost"`
BlockGasCostStep uint64 `json:"blockGasCostStep"`
}
FeeConfig contains EVM fee parameters
type KeyInfo ¶
type KeyInfo struct {
NodeID ids.NodeID
StakerKey []byte
BLSPublicKey []byte
BLSProofOfPossession []byte
MLDSAPublicKey []byte // ML-DSA post-quantum public key (FIPS 204)
CoronaPublicKey []byte // Corona ring signature public key
StakingAddr ids.ShortID // P-chain address derived from staker key
EVMAddr ids.ShortID // C-chain (and other EVM chain) H160 address
}
KeyInfo contains parsed key information for a node
func LoadBIP44WalletKeysFromMnemonic ¶ added in v1.9.9
LoadBIP44WalletKeysFromMnemonic derives N spending keys from a BIP39 mnemonic on the canonical BIP44 path m/44'/9000'/0'/0/i (purpose 44' / coin 9000' / account 0' hardened; change 0 / index i non-hardened). Returns KeyInfo entries with NodeID, StakingAddr (P/X bech32 base), and EVMAddr populated; no BLS/MLDSA — these are user spending keys, not validator node identities.
This is the same derivation that BuildBIP44WalletAllocations uses, reshaped to return KeyInfo so callers (e.g. BuildConfigFromEnv) can flow these straight into buildConfigFromKeyInfos as account holders.
func LoadKeyFromEnv ¶
LoadKeyFromEnv loads a single key from environment variables Env vars: PRIVATE_KEY (hex), NODE_ID
func LoadKeysFromDir ¶
LoadKeysFromDir loads all node keys from a directory Expected structure: keysDir/{node1,node2,...}/staker.key, staker.crt, signer.key
func LoadKeysFromMnemonic ¶
LoadKeysFromMnemonic derives keys from a BIP39 mnemonic using the canonical Avalanche/Lux BIP44 path m/44'/9000'/0'/0/i. The same mnemonic produces the same keys across every Lux network — addresses are stable in MetaMask, Core Wallet, AvalancheJS, and `lux key derive`. Per-network isolation comes from using a different mnemonic per environment, not from path divergence.
func LoadKeysFromMnemonicEnv ¶
LoadKeysFromMnemonicEnv loads keys from mnemonic env vars (MNEMONIC > LIGHT_MNEMONIC). Callers that already know the network id MUST use LoadKeysFromMnemonicEnvForNetwork instead — it adds the production-safe public-mnemonic guard around this entry point.
func LoadKeysFromMnemonicEnvForNetwork ¶ added in v1.9.6
LoadKeysFromMnemonicEnvForNetwork is the production-safe variant of LoadKeysFromMnemonicEnv: it invokes the public-mnemonic guard before any derivation. This is the function every node-start path SHOULD call instead of LoadKeysFromMnemonicEnv directly.
Closes HIP-0077 red-review F30 (the prior LoadKeysFromMnemonicEnv was guard-free and operators could silently derive on production from LIGHT_MNEMONIC).
type LockedAmount ¶
LockedAmount represents a time-locked amount
type NetworkConfig ¶
type NetworkConfig struct {
NetworkID uint32 `json:"networkID"`
StartTime uint64 `json:"startTime"`
Message string `json:"message"`
}
NetworkConfig contains network-level configuration (network.json)
type PChainConfig ¶
type PChainConfig struct {
Allocations []AllocationJSON `json:"allocations"`
InitialStakeDuration uint64 `json:"initialStakeDuration"`
InitialStakeDurationOffset uint64 `json:"initialStakeDurationOffset"`
InitialStakedFunds []string `json:"initialStakedFunds"`
InitialStakers []StakerJSON `json:"initialStakers"`
}
PChainConfig contains P-Chain specific configuration (pchain.json)
type PQIdentity ¶ added in v1.8.0
type PQIdentity struct {
// ML-DSA public key (FIPS 204, Dilithium — 1952 bytes hex-encoded)
MLDSAPublicKey string `json:"mldsaPublicKey"`
// ML-DSA signature over the BLS public key — proves BLS key belongs to this ML-DSA identity
BLSCertificate string `json:"blsCertificate"`
// Corona public key for ring signatures (33 bytes hex-encoded)
CoronaPublicKey string `json:"coronaPublicKey,omitempty"`
// ML-DSA signature over the Corona public key
CoronaCertificate string `json:"coronaCertificate,omitempty"`
}
PQIdentity binds post-quantum keys to a validator's BLS consensus identity. ML-DSA certificates prove BLS/Corona key ownership — if BLS is broken by a quantum computer, the ML-DSA certificates still prove validator identity.
type Params ¶
type Params struct {
TxFee uint64
CreateAssetTxFee uint64
UptimeRequirement float64
MinValidatorStake uint64
MaxValidatorStake uint64
MinDelegatorStake uint64
MinDelegationFee uint32
MinStakeDuration uint64
MaxStakeDuration uint64
RewardConfig RewardConfig
}
Params combines staking and fee parameters for a network
type ProofOfPossession ¶
type ProofOfPossession struct {
PublicKey string `json:"publicKey"`
ProofOfPossession string `json:"proofOfPossession"`
}
ProofOfPossession contains BLS signature data
type RewardConfig ¶
type RewardConfig struct {
MaxConsumptionRate uint64 `json:"maxConsumptionRate"`
MinConsumptionRate uint64 `json:"minConsumptionRate"`
MintingPeriod uint64 `json:"mintingPeriod"` // seconds
SupplyCap uint64 `json:"supplyCap"`
}
RewardConfig contains reward parameters
type SecurityProfile ¶ added in v1.9.6
type SecurityProfile struct {
// ProfileID is the wire byte that names the canonical profile.
// 0x01 = StrictPQ, 0x02 = Permissive, 0x03 = FIPS.
// 0x80+ is reserved for downstream / white-label profiles (which
// must register with the consensus team to obtain a byte).
ProfileID uint8 `json:"profileID"`
// ProfileHashHex is the SHA3-384 ComputeHash of the canonical
// ChainSecurityProfile at the time genesis was sealed, hex-encoded
// (96 hex chars, no 0x prefix). The genesis loader rejects a
// startup whose live ComputeHash does not match.
ProfileHashHex string `json:"profileHashHex"`
}
SecurityProfile is the genesis-level pin for a chain's locked ChainSecurityProfile. ProfileID identifies the canonical row in the consensusconfig registry; ProfileHashHex pins the expected content hash. Both fields are mandatory on a profile-bound genesis.
func (*SecurityProfile) Resolve ¶ added in v1.9.6
func (s *SecurityProfile) Resolve() (*consensusconfig.ChainSecurityProfile, error)
Resolve loads the canonical ChainSecurityProfile named by ProfileID, validates it, computes its hash, and confirms the hash matches the genesis pin. Returns the canonical profile on success.
This is the single load-and-verify entry point. Every consumer of the locked profile (node bootstrap, signer registration, peer-cert gate, mempool, validator registry, bridge oracle) calls Resolve once at startup and threads the returned *ChainSecurityProfile through the rest of the process — no re-resolution per request.
The constant-time hash comparison is intentional: a runtime mutation of the canonical profile that produces a different hash MUST fail the genesis pin, and we don't want to leak which byte of the hash matched via an early-exit byte loop. (Hash comparisons are not secrets, but consistency with the rest of the security gate is worth more than the four-line shortcut.)
type Staker ¶
type Staker struct {
NodeID ids.NodeID `json:"nodeID"`
RewardAddress ids.ShortID `json:"rewardAddress"`
DelegationFee uint32 `json:"delegationFee"`
Signer *ProofOfPossession `json:"signer,omitempty"`
PQIdentity *PQIdentity `json:"pqIdentity,omitempty"`
// Weight is the explicit validator stake weight (optional, derived from allocations if not set)
Weight uint64 `json:"weight,omitempty"`
// StartTime is the Unix timestamp when staking begins (optional)
StartTime uint64 `json:"startTime,omitempty"`
// EndTime is the Unix timestamp when staking ends (optional)
EndTime uint64 `json:"endTime,omitempty"`
}
Staker represents an initial validator
type StakerJSON ¶
type StakerJSON struct {
NodeID string `json:"nodeID"`
RewardAddress string `json:"rewardAddress"`
DelegationFee uint32 `json:"delegationFee"`
Signer *ProofOfPossession `json:"signer,omitempty"`
PQIdentity *PQIdentity `json:"pqIdentity,omitempty"`
// Weight is the explicit validator stake weight (optional)
Weight uint64 `json:"weight,omitempty"`
// StartTime is the Unix timestamp when staking begins (optional)
StartTime uint64 `json:"startTime,omitempty"`
// EndTime is the Unix timestamp when staking ends (optional)
EndTime uint64 `json:"endTime,omitempty"`
}
StakerJSON is the JSON representation of a staker
type StakingConfig ¶
type StakingConfig struct {
UptimeRequirement float64 `json:"uptimeRequirement"`
MinValidatorStake uint64 `json:"minValidatorStake"`
MaxValidatorStake uint64 `json:"maxValidatorStake"`
MinDelegatorStake uint64 `json:"minDelegatorStake"`
MinDelegationFee uint32 `json:"minDelegationFee"`
MinStakeDuration uint64 `json:"minStakeDuration"` // seconds
MaxStakeDuration uint64 `json:"maxStakeDuration"` // seconds
RewardConfig RewardConfig `json:"rewardConfig"`
}
StakingConfig contains staking parameters
func GetStakingConfig ¶
func GetStakingConfig(networkID uint32) StakingConfig
GetStakingConfig returns staking config for a network
type TxFeeConfig ¶
type TxFeeConfig struct {
TxFee uint64 `json:"txFee"`
CreateAssetTxFee uint64 `json:"createAssetTxFee"`
}
TxFeeConfig contains transaction fee parameters
func GetTxFeeConfig ¶
func GetTxFeeConfig(networkID uint32) TxFeeConfig
GetTxFeeConfig returns tx fee config for a network
type UnparsedConfig ¶
type UnparsedConfig = ConfigOutput
UnparsedConfig is an alias for ConfigOutput (for backward compatibility)
type ValidatorKeyInfo ¶
type ValidatorKeyInfo struct {
PrivKeyHex string // Hex-encoded private key
EVMAddr string // C-chain EVM address (H160 hex) (0x...)
ShortID ids.ShortID // P/X chain address as ShortID
}
ValidatorKeyInfo contains computed addresses from a validator's private key
func ComputeValidatorKeyInfo ¶
func ComputeValidatorKeyInfo(privKeyHex string) (ValidatorKeyInfo, error)
ComputeValidatorKeyInfo derives addresses from a hex-encoded private key
func LoadOrGenerateValidatorKeys ¶
func LoadOrGenerateValidatorKeys(keyPath string, count int) ([]ValidatorKeyInfo, error)
LoadOrGenerateValidatorKeys loads validator keys from the specified path or generates new ones if missing. Keys are stored as hex-encoded private keys in files named validator_XXX.pk
type VestingConfig ¶
type VestingConfig struct {
StartTime uint64 // Unix timestamp when vesting starts
Interval uint64 // Seconds between each unlock
Periods int // Number of unlock periods
}
VestingConfig defines the vesting schedule parameters.
func DefaultVesting ¶
func DefaultVesting() *VestingConfig
DefaultVesting returns the standard vesting config: - Start: Jan 1, 2020 - 1% unlocks per year for 100 years
type WarpConfig ¶
type WarpConfig struct {
BlockTimestamp uint64 `json:"blockTimestamp"`
QuorumNumerator uint64 `json:"quorumNumerator"`
RequirePrimaryNetworkSigners bool `json:"requirePrimaryNetworkSigners"`
}
WarpConfig contains warp messaging configuration