Documentation ¶
Index ¶
- Constants
- Variables
- func AVAXAssetID(avmGenesisBytes []byte) (ids.ID, error)
- 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) ([]byte, ids.ID, error)
- func FromFlag(networkID uint32, genesisContent string) ([]byte, ids.ID, error)
- func GetCChainAliases() []string
- func GetTxFeeUpgrades(networkID uint32) (pchainconfig.TxFeeUpgrades, xchainconfig.TxFees)
- func GetVMAliases() map[ids.ID][]string
- func GetXChainAliases() []string
- func SampleBeacons(networkID uint32, count int) ([]string, []string)
- func VMGenesis(genesisBytes []byte, vmID ids.ID) (*pchaintxs.Tx, error)
- type Allocation
- type Config
- type LockedAmount
- type Params
- type Staker
- type StakingConfig
- type UnparsedAllocation
- type UnparsedConfig
- type UnparsedStaker
Constants ¶
const ( VMRQKeyStr = "vmRQiZeXEXYMyJhEiqdC2z5JhuDbxL8ix9UVvjgMu2Er1NepE" VMRQKeyFormattedStr = crypto.PrivateKeyPrefix + VMRQKeyStr EWOQKeyStr = "ewoqjP7PxY4yr3iLTpLisriqt94hdyDFNgchSxGGztUrTXtNN" EWOQKeyFormattedStr = crypto.PrivateKeyPrefix + EWOQKeyStr )
Variables ¶
var ( VMRQKey *crypto.PrivateKeySECP256K1R EWOQKey *crypto.PrivateKeySECP256K1R // LocalPChainTxFees are the fees for P-chain transactions on the local // network LocalPChainTxFees = pchainconfig.TxFees{ AddPrimaryNetworkValidator: 0, AddPrimaryNetworkDelegator: 0, AddPOASubnetValidator: units.MilliAvax, AddPOSSubnetValidator: units.MilliAvax, AddPOSSubnetDelegator: units.MilliAvax, RemovePOASubnetValidator: units.MilliAvax, CreateSubnet: 100 * units.MilliAvax, CreateChain: 100 * units.MilliAvax, TransformSubnet: 100 * units.MilliAvax, Import: units.MilliAvax, Export: units.MilliAvax, } // LocalParams are the params used for local networks LocalParams = Params{ PChainTxFees: pchainconfig.TxFeeUpgrades{ Initial: LocalPChainTxFees, ApricotPhase3: LocalPChainTxFees, Blueberry: LocalPChainTxFees, }, XChainTxFees: xchainconfig.TxFees{ Base: units.MilliAvax, CreateAsset: units.MilliAvax, Operation: units.MilliAvax, Import: units.MilliAvax, Export: units.MilliAvax, }, StakingConfig: StakingConfig{ UptimeRequirement: .8, MinValidatorStake: 2 * units.KiloAvax, MaxValidatorStake: 3 * units.MegaAvax, MinDelegatorStake: 25 * units.Avax, 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.MegaAvax, }, }, } )
var ( // FujiParams are the params used for the fuji testnet FujiParams = Params{ PChainTxFees: pchainconfig.TxFeeUpgrades{ Initial: pchainconfig.TxFees{ AddPrimaryNetworkValidator: 0, AddPrimaryNetworkDelegator: 0, AddPOASubnetValidator: units.MilliAvax, AddPOSSubnetValidator: units.MilliAvax, AddPOSSubnetDelegator: units.MilliAvax, RemovePOASubnetValidator: units.MilliAvax, CreateSubnet: 10 * units.MilliAvax, CreateChain: 10 * units.MilliAvax, TransformSubnet: 10 * units.MilliAvax, Import: units.MilliAvax, Export: units.MilliAvax, }, ApricotPhase3: pchainconfig.TxFees{ AddPrimaryNetworkValidator: 0, AddPrimaryNetworkDelegator: 0, AddPOASubnetValidator: units.MilliAvax, AddPOSSubnetValidator: units.MilliAvax, AddPOSSubnetDelegator: units.MilliAvax, RemovePOASubnetValidator: units.MilliAvax, CreateSubnet: 100 * units.MilliAvax, CreateChain: 100 * units.MilliAvax, TransformSubnet: 100 * units.MilliAvax, Import: units.MilliAvax, Export: units.MilliAvax, }, Blueberry: pchainconfig.TxFees{ AddPrimaryNetworkValidator: 0, AddPrimaryNetworkDelegator: 0, AddPOASubnetValidator: units.MilliAvax, AddPOSSubnetValidator: units.MilliAvax, AddPOSSubnetDelegator: units.MilliAvax, RemovePOASubnetValidator: units.MilliAvax, CreateSubnet: 100 * units.MilliAvax, CreateChain: 100 * units.MilliAvax, TransformSubnet: 100 * units.MilliAvax, Import: units.MilliAvax, Export: units.MilliAvax, }, }, XChainTxFees: xchainconfig.TxFees{ Base: units.MilliAvax, CreateAsset: 10 * units.MilliAvax, Operation: units.MilliAvax, Import: units.MilliAvax, Export: units.MilliAvax, }, StakingConfig: StakingConfig{ UptimeRequirement: .8, MinValidatorStake: 1 * units.Avax, MaxValidatorStake: 3 * units.MegaAvax, MinDelegatorStake: 1 * units.Avax, 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.MegaAvax, }, }, } )
var ( // MainnetParams are the params used for mainnet MainnetParams = Params{ PChainTxFees: pchainconfig.TxFeeUpgrades{ Initial: pchainconfig.TxFees{ AddPrimaryNetworkValidator: 0, AddPrimaryNetworkDelegator: 0, AddPOASubnetValidator: units.MilliAvax, AddPOSSubnetValidator: units.MilliAvax, AddPOSSubnetDelegator: units.MilliAvax, RemovePOASubnetValidator: units.MilliAvax, CreateSubnet: 10 * units.MilliAvax, CreateChain: 10 * units.MilliAvax, TransformSubnet: 10 * units.MilliAvax, Import: units.MilliAvax, Export: units.MilliAvax, }, ApricotPhase3: pchainconfig.TxFees{ AddPrimaryNetworkValidator: 0, AddPrimaryNetworkDelegator: 0, AddPOASubnetValidator: units.MilliAvax, AddPOSSubnetValidator: units.MilliAvax, AddPOSSubnetDelegator: units.MilliAvax, RemovePOASubnetValidator: units.MilliAvax, CreateSubnet: units.Avax, CreateChain: units.Avax, TransformSubnet: units.Avax, Import: units.MilliAvax, Export: units.MilliAvax, }, Blueberry: pchainconfig.TxFees{ AddPrimaryNetworkValidator: 0, AddPrimaryNetworkDelegator: 0, AddPOASubnetValidator: 100 * units.MilliAvax, AddPOSSubnetValidator: 150 * units.MilliAvax, AddPOSSubnetDelegator: 150 * units.MilliAvax, RemovePOASubnetValidator: 50 * units.MilliAvax, CreateSubnet: 10 * units.Avax, CreateChain: 5 * units.Avax, TransformSubnet: 100 * units.Avax, Import: 10 * units.MilliAvax, Export: 10 * units.MilliAvax, }, }, XChainTxFees: xchainconfig.TxFees{ Base: units.MilliAvax, CreateAsset: 10 * units.MilliAvax, Operation: units.MilliAvax, Import: units.MilliAvax, Export: units.MilliAvax, }, StakingConfig: StakingConfig{ UptimeRequirement: .8, MinValidatorStake: 2 * units.KiloAvax, MaxValidatorStake: 3 * units.MegaAvax, MinDelegatorStake: 25 * units.Avax, 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.MegaAvax, }, }, } )
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 AVAX
func FromFile ¶ added in v1.7.2
FromFile returns the genesis data of the Platform Chain.
Since an Avalanche 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 AVAX
func FromFlag ¶ added in v1.7.2
FromFlag returns the genesis data of the Platform Chain.
Since an Avalanche 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 AVAX
func GetCChainAliases ¶ added in v1.4.8
func GetCChainAliases() []string
func GetTxFeeUpgrades ¶
func GetTxFeeUpgrades(networkID uint32) (pchainconfig.TxFeeUpgrades, xchainconfig.TxFees)
func GetVMAliases ¶ added in v1.4.11
func GetXChainAliases ¶ added in v1.4.8
func GetXChainAliases() []string
func SampleBeacons ¶ added in v1.0.0
SampleBeacons returns the some beacons this node should connect to
Types ¶
type Allocation ¶ added in v1.0.0
type Allocation struct { ETHAddr ids.ShortID `json:"ethAddr"` AVAXAddr ids.ShortID `json:"avaxAddr"` InitialAmount uint64 `json:"initialAmount"` UnlockSchedule []LockedAmount `json:"unlockSchedule"` }
func (Allocation) Unparse ¶ added in v1.0.0
func (a Allocation) Unparse(networkID uint32) (UnparsedAllocation, error)
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.7.2
GetConfigContent loads a *Config from a provided environment variable
func GetConfigFile ¶ added in v1.1.4
GetConfigFile loads a *Config from a provided filepath.
func (*Config) InitialSupply ¶ added in v1.0.0
func (Config) Unparse ¶ added in v1.0.0
func (c Config) Unparse() (UnparsedConfig, error)
type LockedAmount ¶ added in v1.0.0
type Params ¶ added in v1.0.0
type Params struct { StakingConfig PChainTxFees pchainconfig.TxFeeUpgrades XChainTxFees xchainconfig.TxFees }
type Staker ¶ added in v1.0.0
type StakingConfig ¶ added in v1.5.0
type StakingConfig struct { // Staking uptime requirements UptimeRequirement float64 `json:"uptimeRequirement"` // Minimum stake, in nAVAX, required to validate the primary network MinValidatorStake uint64 `json:"minValidatorStake"` // Maximum stake, in nAVAX, allowed to be placed on a single validator in // the primary network MaxValidatorStake uint64 `json:"maxValidatorStake"` // Minimum stake, in nAVAX, 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.5.0
func GetStakingConfig(networkID uint32) StakingConfig
type UnparsedAllocation ¶ added in v1.0.0
type UnparsedAllocation struct { ETHAddr string `json:"ethAddr"` AVAXAddr string `json:"avaxAddr"` InitialAmount uint64 `json:"initialAmount"` UnlockSchedule []LockedAmount `json:"unlockSchedule"` }
func (UnparsedAllocation) Parse ¶ added in v1.0.0
func (ua UnparsedAllocation) Parse() (Allocation, error)
type UnparsedConfig ¶ added in v1.0.0
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.0.0
func (uc UnparsedConfig) Parse() (Config, error)