Documentation
¶
Overview ¶
Package builder provides genesis byte generation for Lux networks. This package depends on node types and is responsible for building the actual genesis state from genesis config.
Index ¶
- Variables
- func Aliases(genesisBytes []byte) (map[string][]string, map[ids.ID][]string, error)
- func ForDevMode(cfg DevModeConfig, stakingCfg *StakingConfig) ([]byte, ids.ID, error)
- func FromConfig(config *genesiscfg.Config) ([]byte, ids.ID, error)
- func FromDatabase(networkID uint32, dbPath string, dbType string, stakingCfg *StakingConfig) ([]byte, ids.ID, error)
- func FromFile(networkID uint32, filepath string, stakingCfg *StakingConfig, ...) ([]byte, ids.ID, error)
- func FromFlag(networkID uint32, genesisContent string, stakingCfg *StakingConfig, ...) ([]byte, ids.ID, error)
- func GetConfig(networkID uint32) *genesiscfg.Config
- func VMGenesis(genesisBytes []byte, vmID ids.ID) (*pchaintxs.Tx, error)
- func XAssetID(xvmGenesisBytes []byte) (ids.ID, error)
- type Bootstrapper
- type DevModeConfig
- type StakingConfig
- type TxFeeConfig
Constants ¶
This section is empty.
Variables ¶
var ( // PChainAliases are the default aliases for the P-Chain PChainAliases = []string{"P", "platform"} // XChainAliases are the default aliases for the X-Chain XChainAliases = []string{"X", "xvm"} // CChainAliases are the default aliases for the C-Chain CChainAliases = []string{"C", "evm"} // DChainAliases are the default aliases for the D-Chain (DEX) DChainAliases = []string{"D", "dex", "dexvm"} // QChainAliases are the default aliases for the Q-Chain (Quantum) QChainAliases = []string{"Q", "quantum", "quantumvm", "pq"} // AChainAliases are the default aliases for the A-Chain (Attestation/AI) AChainAliases = []string{"A", "attest", "ai", "aivm"} // BChainAliases are the default aliases for the B-Chain (Bridge) BChainAliases = []string{"B", "bridge", "bridgevm"} // TChainAliases are the default aliases for the T-Chain (Threshold) TChainAliases = []string{"T", "threshold", "thresholdvm", "mpc"} // ZChainAliases are the default aliases for the Z-Chain (ZK) ZChainAliases = []string{"Z", "zk", "zkvm"} // GChainAliases are the default aliases for the G-Chain (Graph) GChainAliases = []string{"G", "graph", "graphvm", "dgraph"} // KChainAliases are the default aliases for the K-Chain (KMS) KChainAliases = []string{"K", "kms", "kmsvm"} // VMAliases are the default aliases for VMs VMAliases = map[ids.ID][]string{ constants.PlatformVMID: {"platform"}, constants.XVMID: {"xvm"}, constants.EVMID: {"evm"}, constants.DexVMID: {"dexvm", "dex"}, constants.QuantumVMID: {"quantumvm", "quantum", "pq"}, constants.AIVMID: {"aivm", "attest", "ai"}, constants.BridgeVMID: {"bridgevm", "bridge"}, constants.ThresholdVMID: {"thresholdvm", "threshold", "mpc"}, constants.ZKVMID: {"zkvm", "zk"}, constants.GraphVMID: {"graphvm", "graph", "dgraph"}, constants.KMSVMID: {"kmsvm", "kms"}, secp256k1fx.ID: {"secp256k1fx"}, nftfx.ID: {"nftfx"}, propertyfx.ID: {"propertyfx"}, } )
var ( MainnetDynamicFeeConfig = gas.Config{ Weights: gas.Dimensions{ gas.Bandwidth: 1, gas.DBRead: 1, gas.DBWrite: 1, gas.Compute: 1, }, MaxCapacity: 1_000_000, MaxPerSecond: 100_000, TargetPerSecond: 50_000, MinPrice: 1, ExcessConversionConstant: 5_000, } TestnetDynamicFeeConfig = gas.Config{ Weights: gas.Dimensions{ gas.Bandwidth: 1, gas.DBRead: 1, gas.DBWrite: 1, gas.Compute: 1, }, MaxCapacity: 1_000_000, MaxPerSecond: 100_000, TargetPerSecond: 50_000, MinPrice: 1, ExcessConversionConstant: 5_000, } LocalDynamicFeeConfig = gas.Config{ Weights: gas.Dimensions{ gas.Bandwidth: 1, gas.DBRead: 1, gas.DBWrite: 1, gas.Compute: 1, }, MaxCapacity: 1_000_000, MaxPerSecond: 100_000, TargetPerSecond: 50_000, MinPrice: 1, ExcessConversionConstant: 5_000, } MainnetValidatorFeeConfig = fee.Config{ Capacity: 20_000, Target: 10_000, MinPrice: 512, ExcessConversionConstant: 1_587, } TestnetValidatorFeeConfig = fee.Config{ Capacity: 20_000, Target: 10_000, MinPrice: 512, ExcessConversionConstant: 1_587, } LocalValidatorFeeConfig = fee.Config{ Capacity: 20_000, Target: 10_000, MinPrice: 512, ExcessConversionConstant: 1_587, } )
Default dynamic fee parameters
Functions ¶
func ForDevMode ¶ added in v1.22.67
func ForDevMode(cfg DevModeConfig, stakingCfg *StakingConfig) ([]byte, ids.ID, error)
ForDevMode creates a genesis configuration suitable for single-node development mode. It creates a single validator with far-future stake time and funds the treasury address.
func FromConfig ¶
FromConfig builds genesis bytes from a config
func FromDatabase ¶
func FromDatabase(networkID uint32, dbPath string, dbType string, stakingCfg *StakingConfig) ([]byte, ids.ID, error)
FromDatabase returns genesis data for database replay mode
func FromFile ¶
func FromFile(networkID uint32, filepath string, stakingCfg *StakingConfig, allowCustomGenesis bool) ([]byte, ids.ID, error)
FromFile loads genesis config from file and builds genesis bytes
func FromFlag ¶
func FromFlag(networkID uint32, genesisContent string, stakingCfg *StakingConfig, allowCustomGenesis bool) ([]byte, ids.ID, error)
FromFlag parses base64-encoded genesis content and builds genesis bytes
func GetConfig ¶
func GetConfig(networkID uint32) *genesiscfg.Config
GetConfig returns the genesis config for the given network ID
Types ¶
type Bootstrapper ¶
Bootstrapper represents a network bootstrap node with parsed types
func GetBootstrappers ¶
func GetBootstrappers(networkID uint32) ([]Bootstrapper, error)
GetBootstrappers returns parsed bootstrappers for the network
func ParseBootstrapper ¶
func ParseBootstrapper(b genesiscfg.Bootstrapper) (Bootstrapper, error)
ParseBootstrapper converts a genesis config bootstrapper to a parsed Bootstrapper
func SampleBootstrappers ¶
func SampleBootstrappers(networkID uint32, count int) ([]Bootstrapper, error)
SampleBootstrappers returns a random sample of bootstrappers for the network
type DevModeConfig ¶ added in v1.22.67
type DevModeConfig struct {
NodeID ids.NodeID // The validator node ID
BLSPublicKey string // BLS public key hex
BLSPopProof string // BLS proof of possession hex
RewardAddress ids.ShortID // Reward/allocation address
CChainGenesis string // C-Chain genesis JSON
StartTime uint64 // Genesis start time (if 0, uses time.Now())
}
DevModeConfig holds configuration for dev mode genesis
type StakingConfig ¶
type StakingConfig struct {
UptimeRequirement float64
MinValidatorStake uint64
MaxValidatorStake uint64
MinDelegatorStake uint64
MinDelegationFee uint32
MinStakeDuration time.Duration
MaxStakeDuration time.Duration
RewardConfig reward.Config
// BLS key information for genesis replay
NodeID string `json:"nodeID"`
BLSPublicKey []byte `json:"blsPublicKey"`
BLSProofOfPossession []byte `json:"blsProofOfPossession"`
}
StakingConfig is the staking configuration with time.Duration types
func GetStakingConfig ¶
func GetStakingConfig(networkID uint32) StakingConfig
GetStakingConfig returns the staking config with time.Duration types
type TxFeeConfig ¶
type TxFeeConfig struct {
TxFee uint64 `json:"txFee"`
CreateAssetTxFee uint64 `json:"createAssetTxFee"`
DynamicFeeConfig gas.Config `json:"dynamicFeeConfig"`
ValidatorFeeConfig fee.Config `json:"validatorFeeConfig"`
}
TxFeeConfig contains transaction fee configuration This includes the basic fee config from genesis plus dynamic/validator fees
func GetTxFeeConfig ¶
func GetTxFeeConfig(networkID uint32) TxFeeConfig
GetTxFeeConfig returns the tx fee config