Documentation ¶
Index ¶
- Constants
- Variables
- func Aliases(genesisBytes []byte) (map[string][]string, map[ids.ID][]string, error)
- func FromConfig(config *Config) ([]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 GetCheckpoints(networkID uint32, chainID ids.ID) set.Set[ids.ID]
- func GetTxFeeConfig(networkID uint32) fee.StaticConfig
- func GetValidators(networkID uint32) set.Set[ids.NodeID]
- func LUXAssetID(avmGenesisBytes []byte) (ids.ID, error)
- func VMGenesis(genesisBytes []byte, vmID ids.ID) (*pchaintxs.Tx, error)
- type Allocation
- type Bootstrapper
- type Config
- type LockedAmount
- type Params
- type Staker
- type StakingConfig
- type UnparsedAllocation
- type UnparsedConfig
- type UnparsedStaker
Constants ¶
const ( VMRQKeyStr = "vmRQiZeXEXYMyJhEiqdC2z5JhuDbxL8ix9UVvjgMu2Er1NepE" VMRQKeyFormattedStr = secp256k1.PrivateKeyPrefix + VMRQKeyStr EWOQKeyStr = "ewoqjP7PxY4yr3iLTpLisriqt94hdyDFNgchSxGGztUrTXtNN" EWOQKeyFormattedStr = secp256k1.PrivateKeyPrefix + EWOQKeyStr )
Variables ¶
var ( PChainAliases = []string{"P", "platform"} XChainAliases = []string{"X", "avm"} CChainAliases = []string{"C", "evm"} VMAliases = map[ids.ID][]string{ constants.PlatformVMID: {"platform"}, constants.AVMID: {"avm"}, constants.EVMID: {"evm"}, secp256k1fx.ID: {"secp256k1fx"}, nftfx.ID: {"nftfx"}, propertyfx.ID: {"propertyfx"}, } )
var ( VMRQKey *secp256k1.PrivateKey EWOQKey *secp256k1.PrivateKey // LocalParams are the params used for local networks LocalParams = Params{ StaticConfig: fee.StaticConfig{ TxFee: units.MilliLux, CreateAssetTxFee: units.MilliLux, CreateSubnetTxFee: 100 * units.MilliLux, TransformSubnetTxFee: 100 * units.MilliLux, CreateBlockchainTxFee: 100 * units.MilliLux, AddPrimaryNetworkValidatorFee: 0, AddPrimaryNetworkDelegatorFee: 0, AddSubnetValidatorFee: units.MilliLux, AddSubnetDelegatorFee: units.MilliLux, }, StakingConfig: StakingConfig{ UptimeRequirement: .8, MinValidatorStake: 2 * units.KiloLux, MaxValidatorStake: 3 * units.MegaLux, MinDelegatorStake: 25 * units.Lux, MinDelegationFee: 20000, MinStakeDuration: 24 * time.Hour, MaxStakeDuration: 365 * 24 * time.Hour, RewardConfig: reward.Config{ MaxConsumptionRate: .12 * reward.PercentDenominator, MinConsumptionRate: .10 * reward.PercentDenominator, MintingPeriod: 365 * 24 * time.Hour, SupplyCap: 720 * units.MegaLux, }, }, } )
var ( // FujiParams are the params used for the fuji testnet FujiParams = Params{ StaticConfig: fee.StaticConfig{ TxFee: units.MilliLux, CreateAssetTxFee: 10 * units.MilliLux, CreateSubnetTxFee: 100 * units.MilliLux, TransformSubnetTxFee: 1 * units.Lux, CreateBlockchainTxFee: 100 * units.MilliLux, AddPrimaryNetworkValidatorFee: 0, AddPrimaryNetworkDelegatorFee: 0, AddSubnetValidatorFee: units.MilliLux, AddSubnetDelegatorFee: units.MilliLux, }, StakingConfig: StakingConfig{ UptimeRequirement: .8, MinValidatorStake: 1 * units.Lux, MaxValidatorStake: 3 * units.MegaLux, MinDelegatorStake: 1 * units.Lux, MinDelegationFee: 20000, MinStakeDuration: 24 * time.Hour, MaxStakeDuration: 365 * 24 * time.Hour, RewardConfig: reward.Config{ MaxConsumptionRate: .12 * reward.PercentDenominator, MinConsumptionRate: .10 * reward.PercentDenominator, MintingPeriod: 365 * 24 * time.Hour, SupplyCap: 720 * units.MegaLux, }, }, } )
var ( // MainnetParams are the params used for mainnet MainnetParams = Params{ StaticConfig: fee.StaticConfig{ TxFee: units.MilliLux, CreateAssetTxFee: 10 * units.MilliLux, CreateSubnetTxFee: 1 * units.Lux, TransformSubnetTxFee: 10 * units.Lux, CreateBlockchainTxFee: 1 * units.Lux, AddPrimaryNetworkValidatorFee: 0, AddPrimaryNetworkDelegatorFee: 0, AddSubnetValidatorFee: units.MilliLux, AddSubnetDelegatorFee: units.MilliLux, }, StakingConfig: StakingConfig{ UptimeRequirement: .8, MinValidatorStake: 2 * units.KiloLux, MaxValidatorStake: 3 * units.MegaLux, MinDelegatorStake: 25 * units.Lux, MinDelegationFee: 20000, MinStakeDuration: 2 * 7 * 24 * time.Hour, MaxStakeDuration: 365 * 24 * time.Hour, RewardConfig: reward.Config{ MaxConsumptionRate: .12 * reward.PercentDenominator, MinConsumptionRate: .10 * reward.PercentDenominator, MintingPeriod: 365 * 24 * time.Hour, SupplyCap: 720 * units.MegaLux, }, }, } )
var ( // TestnetParams are the params used for the testnet testnet TestnetParams = Params{ TxFeeConfig: TxFeeConfig{ TxFee: units.MilliLux, CreateAssetTxFee: 10 * units.MilliLux, CreateSubnetTxFee: 100 * units.MilliLux, TransformSubnetTxFee: 1 * units.Lux, CreateBlockchainTxFee: 100 * units.MilliLux, AddPrimaryNetworkValidatorFee: 0, AddPrimaryNetworkDelegatorFee: 0, AddSubnetValidatorFee: units.MilliLux, AddSubnetDelegatorFee: units.MilliLux, }, StakingConfig: StakingConfig{ UptimeRequirement: .8, MinValidatorStake: 1 * units.Lux, MaxValidatorStake: 3 * units.MegaLux, MinDelegatorStake: 1 * units.Lux, MinDelegationFee: 20000, MinStakeDuration: 24 * time.Hour, MaxStakeDuration: 365 * 24 * time.Hour, RewardConfig: reward.Config{ MaxConsumptionRate: .12 * reward.PercentDenominator, MinConsumptionRate: .10 * reward.PercentDenominator, MintingPeriod: 365 * 24 * time.Hour, SupplyCap: 720 * units.MegaLux, }, }, } )
Functions ¶
func FromConfig ¶
FromConfig returns:
- The byte representation of the genesis state of the platform chain (ie the genesis state of the network)
- The asset ID of LUX
func FromFile ¶ added in v1.11.10
FromFile returns the genesis data of the Platform Chain.
Since an Lux network has exactly one Platform Chain, and the Platform Chain defines the genesis state of the network (who is staking, which chains exist, etc.), defining the genesis state of the Platform Chain is the same as defining the genesis state of the network.
FromFile accepts: 1) The ID of the new network. [networkID] 2) The location of a custom genesis config to load. filepath
If filepath is empty or the given network ID is Mainnet, Testnet, or Local, returns error. If filepath is non-empty and networkID isn't Mainnet, Testnet, or Local, loads the network genesis data from the config at filepath.
FromFile returns:
- The byte representation of the genesis state of the platform chain (ie the genesis state of the network)
- The asset ID of LUX
func FromFlag ¶ added in v1.11.10
func FromFlag(networkID uint32, genesisContent string, stakingCfg *StakingConfig) ([]byte, ids.ID, error)
FromFlag returns the genesis data of the Platform Chain.
Since an Lux network has exactly one Platform Chain, and the Platform Chain defines the genesis state of the network (who is staking, which chains exist, etc.), defining the genesis state of the Platform Chain is the same as defining the genesis state of the network.
FromFlag accepts: 1) The ID of the new network. [networkID] 2) The content of a custom genesis config to load. [genesisContent]
If [genesisContent] is empty or the given network ID is Mainnet, Testnet, or Local, returns error. If [genesisContent] is non-empty and networkID isn't Mainnet, Testnet, or Local, loads the network genesis data from [genesisContent].
FromFlag returns:
- The byte representation of the genesis state of the platform chain (ie the genesis state of the network)
- The asset ID of LUX
func GetCheckpoints ¶ added in v1.11.10
GetCheckpoints returns all known checkpoints for the chain on the requested network.
func GetTxFeeConfig ¶ added in v1.11.10
func GetTxFeeConfig(networkID uint32) fee.StaticConfig
func GetValidators ¶ added in v1.11.10
GetValidators returns recent validators for the requested network.
Types ¶
type Allocation ¶ added in v1.11.10
type Allocation struct { ETHAddr ids.ShortID `json:"ethAddr"` LUXAddr ids.ShortID `json:"luxAddr"` InitialAmount uint64 `json:"initialAmount"` UnlockSchedule []LockedAmount `json:"unlockSchedule"` }
func (Allocation) Compare ¶ added in v1.11.10
func (a Allocation) Compare(other Allocation) int
func (Allocation) Unparse ¶ added in v1.11.10
func (a Allocation) Unparse(networkID uint32) (UnparsedAllocation, error)
type Bootstrapper ¶ added in v1.11.10
Represents the relationship between the nodeID and the nodeIP. The bootstrapper is sometimes called "anchor" or "beacon" node.
func GetBootstrappers ¶ added in v1.11.10
func GetBootstrappers(networkID uint32) []Bootstrapper
GetBootstrappers returns all default bootstrappers for the provided network.
func SampleBootstrappers ¶ added in v1.11.10
func SampleBootstrappers(networkID uint32, count int) []Bootstrapper
SampleBootstrappers returns the some beacons this node should connect to
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"` CChainGenesis string `json:"cChainGenesis"` Message string `json:"message"` }
Config contains the genesis addresses used to construct a genesis
var ( // MainnetConfig is the config that should be used to generate the mainnet // genesis. MainnetConfig Config // FujiConfig is the config that should be used to generate the fuji // genesis. FujiConfig Config // LocalConfig is the config that should be used to generate a local // genesis. LocalConfig Config )
func GetConfigContent ¶ added in v1.11.10
GetConfigContent loads a *Config from a provided environment variable
func GetConfigFile ¶ added in v1.11.10
GetConfigFile loads a *Config from a provided filepath.
func (*Config) InitialSupply ¶ added in v1.11.10
func (Config) Unparse ¶ added in v1.11.10
func (c Config) Unparse() (UnparsedConfig, error)
type LockedAmount ¶ added in v1.11.10
type Params ¶ added in v1.11.10
type Params struct { StakingConfig fee.StaticConfig }
type Staker ¶ added in v1.11.10
type StakingConfig ¶ added in v1.11.10
type StakingConfig struct { // Staking uptime requirements UptimeRequirement float64 `json:"uptimeRequirement"` // Minimum stake, in nLUX, required to validate the primary network MinValidatorStake uint64 `json:"minValidatorStake"` // Maximum stake, in nLUX, allowed to be placed on a single validator in // the primary network MaxValidatorStake uint64 `json:"maxValidatorStake"` // Minimum stake, in nLUX, that can be delegated on the primary network MinDelegatorStake uint64 `json:"minDelegatorStake"` // Minimum delegation fee, in the range [0, 1000000], that can be charged // for delegation on the primary network. MinDelegationFee uint32 `json:"minDelegationFee"` // MinStakeDuration is the minimum amount of time a validator can validate // for in a single period. MinStakeDuration time.Duration `json:"minStakeDuration"` // MaxStakeDuration is the maximum amount of time a validator can validate // for in a single period. MaxStakeDuration time.Duration `json:"maxStakeDuration"` // RewardConfig is the config for the reward function. RewardConfig reward.Config `json:"rewardConfig"` }
func GetStakingConfig ¶ added in v1.11.10
func GetStakingConfig(networkID uint32) StakingConfig
type UnparsedAllocation ¶ added in v1.11.10
type UnparsedAllocation struct { ETHAddr string `json:"ethAddr"` LUXAddr string `json:"luxAddr"` InitialAmount uint64 `json:"initialAmount"` UnlockSchedule []LockedAmount `json:"unlockSchedule"` }
func (UnparsedAllocation) Parse ¶ added in v1.11.10
func (ua UnparsedAllocation) Parse() (Allocation, error)
type UnparsedConfig ¶ added in v1.11.10
type UnparsedConfig struct { NetworkID uint32 `json:"networkID"` Allocations []UnparsedAllocation `json:"allocations"` StartTime uint64 `json:"startTime"` InitialStakeDuration uint64 `json:"initialStakeDuration"` InitialStakeDurationOffset uint64 `json:"initialStakeDurationOffset"` InitialStakedFunds []string `json:"initialStakedFunds"` InitialStakers []UnparsedStaker `json:"initialStakers"` CChainGenesis string `json:"cChainGenesis"` Message string `json:"message"` }
UnparsedConfig contains the genesis addresses used to construct a genesis
func (UnparsedConfig) Parse ¶ added in v1.11.10
func (uc UnparsedConfig) Parse() (Config, error)
type UnparsedStaker ¶ added in v1.11.10
type UnparsedStaker struct { NodeID ids.NodeID `json:"nodeID"` RewardAddress string `json:"rewardAddress"` DelegationFee uint32 `json:"delegationFee"` Signer *signer.ProofOfPossession `json:"signer,omitempty"` }
func (UnparsedStaker) Parse ¶ added in v1.11.10
func (us UnparsedStaker) Parse() (Staker, error)