Documentation ¶
Index ¶
- Constants
- Variables
- func AXCAssetID(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 GetAXChainAliases() []string
- func GetSwapChainAliases() []string
- func GetVMAliases() map[ids.ID][]string
- func SampleBeacons(networkID uint32, count int) ([]string, []string)
- func VMGenesis(genesisBytes []byte, vmID ids.ID) (*platformvm.Tx, error)
- type Allocation
- type Config
- type LockedAmount
- type Params
- type Staker
- type StakingConfig
- type TxFeeConfig
- 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 // LocalParams are the params used for local networks LocalParams = Params{ TxFeeConfig: TxFeeConfig{ TxFee: units.MilliAxc, CreateAssetTxFee: units.MilliAxc, CreateAllychainTxFee: 100 * units.MilliAxc, CreateBlockchainTxFee: 100 * units.MilliAxc, }, StakingConfig: StakingConfig{ UptimeRequirement: .8, MinValidatorStake: 2 * units.KiloAxc, MaxValidatorStake: 3 * units.MegaAxc, MinNominatorStake: 25 * units.Axc, 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.MegaAxc, }, }, } )
var ( // MainnetParams are the params used for mainnet MainnetParams = Params{ TxFeeConfig: TxFeeConfig{ TxFee: units.MilliAxc, CreateAssetTxFee: 10 * units.MilliAxc, CreateAllychainTxFee: 1 * units.Axc, CreateBlockchainTxFee: 1 * units.Axc, }, StakingConfig: StakingConfig{ UptimeRequirement: .8, MinValidatorStake: 2 * units.KiloAxc, MaxValidatorStake: 3 * units.MegaAxc, MinNominatorStake: 25 * units.Axc, 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.MegaAxc, }, }, } )
var ( // TestParams are the params used for the test testnet TestParams = Params{ TxFeeConfig: TxFeeConfig{ TxFee: units.MilliAxc, CreateAssetTxFee: 10 * units.MilliAxc, CreateAllychainTxFee: 100 * units.MilliAxc, CreateBlockchainTxFee: 100 * units.MilliAxc, }, StakingConfig: StakingConfig{ UptimeRequirement: .8, MinValidatorStake: 1 * units.Axc, MaxValidatorStake: 3 * units.MegaAxc, MinNominatorStake: 1 * units.Axc, 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.MegaAxc, }, }, } )
Functions ¶
func FromConfig ¶
FromConfig returns:
- The byte representation of the genesis state of the core chain (ie the genesis state of the network)
- The asset ID of AXC
func FromFile ¶
FromFile returns the genesis data of the Core Chain.
Since an Axia network has exactly one Core 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 Core 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 core chain (ie the genesis state of the network)
- The asset ID of AXC
func FromFlag ¶
FromFlag returns the genesis data of the Core Chain.
Since an Axia network has exactly one Core 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 Core 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 core chain (ie the genesis state of the network)
- The asset ID of AXC
func GetAXChainAliases ¶ added in v0.1.9
func GetAXChainAliases() []string
func GetSwapChainAliases ¶ added in v0.1.9
func GetSwapChainAliases() []string
func GetVMAliases ¶
func SampleBeacons ¶
SampleBeacons returns the some beacons this node should connect to
Types ¶
type Allocation ¶
type Allocation struct { ETHAddr ids.ShortID `json:"ethAddr"` AXCAddr ids.ShortID `json:"axcAddr"` InitialAmount uint64 `json:"initialAmount"` UnlockSchedule []LockedAmount `json:"unlockSchedule"` }
func (Allocation) Unparse ¶
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"` AXChainGenesis string `json:"axChainGenesis"` 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 // TestConfig is the config that should be used to generate the test // genesis. TestConfig Config // LocalConfig is the config that should be used to generate a local // genesis. LocalConfig Config )
func GetConfigContent ¶
GetConfigContent loads a *Config from a provided environment variable
func GetConfigFile ¶
GetConfigFile loads a *Config from a provided filepath.
func (*Config) InitialSupply ¶
func (Config) Unparse ¶
func (c Config) Unparse() (UnparsedConfig, error)
type LockedAmount ¶
type Params ¶
type Params struct { StakingConfig TxFeeConfig }
type Staker ¶
type StakingConfig ¶
type StakingConfig struct { // Staking uptime requirements UptimeRequirement float64 `json:"uptimeRequirement"` // Minimum stake, in nAXC, required to validate the primary network MinValidatorStake uint64 `json:"minValidatorStake"` // Maximum stake, in nAXC, allowed to be placed on a single validator in // the primary network MaxValidatorStake uint64 `json:"maxValidatorStake"` // Minimum stake, in nAXC, that can be delegated on the primary network MinNominatorStake uint64 `json:"minNominatorStake"` // 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 ¶
func GetStakingConfig(networkID uint32) StakingConfig
type TxFeeConfig ¶
type TxFeeConfig struct { // Transaction fee TxFee uint64 `json:"txFee"` // Transaction fee for create asset transactions CreateAssetTxFee uint64 `json:"createAssetTxFee"` // Transaction fee for create allychain transactions CreateAllychainTxFee uint64 `json:"createAllychainTxFee"` // Transaction fee for create blockchain transactions CreateBlockchainTxFee uint64 `json:"createBlockchainTxFee"` }
func GetTxFeeConfig ¶
func GetTxFeeConfig(networkID uint32) TxFeeConfig
type UnparsedAllocation ¶
type UnparsedAllocation struct { ETHAddr string `json:"ethAddr"` AXCAddr string `json:"axcAddr"` InitialAmount uint64 `json:"initialAmount"` UnlockSchedule []LockedAmount `json:"unlockSchedule"` }
func (UnparsedAllocation) Parse ¶
func (ua UnparsedAllocation) Parse() (Allocation, error)
type UnparsedConfig ¶
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"` AXChainGenesis string `json:"axChainGenesis"` Message string `json:"message"` }
UnparsedConfig contains the genesis addresses used to construct a genesis
func (UnparsedConfig) Parse ¶
func (uc UnparsedConfig) Parse() (Config, error)