Documentation ¶
Index ¶
- Constants
- Variables
- func Aliases(genesisBytes []byte) (map[string][]string, map[ids.ID][]string, error)
- func DIONEAssetID(alphaGenesisBytes []byte) (ids.ID, error)
- func FromConfig(config *Config) ([]byte, ids.ID, time.Time, error)
- func FromFile(networkID uint32, filepath string, stakingCfg *StakingConfig) ([]byte, ids.ID, time.Time, error)
- func FromFlag(networkID uint32, genesisContent string, stakingCfg *StakingConfig) ([]byte, ids.ID, time.Time, error)
- func GetAChainAliases() []string
- func GetDChainAliases() []string
- func GetVMAliases() map[ids.ID][]string
- func VMGenesis(genesisBytes []byte, vmID ids.ID) (*ochaintxs.Tx, error)
- type Allocation
- type Bootstrapper
- type Config
- type LockedAmount
- type Params
- type Staker
- type StakingConfig
- type TxFeeConfig
- type UnparsedAllocation
- type UnparsedConfig
- type UnparsedStaker
Constants ¶
const ( VMRQKeyStr = "vmRQiZeXEXYMyJhEiqdC2z5JhuDbxL8ix9UVvjgMu2Er1NepE" VMRQKeyFormattedStr = secp256k1.PrivateKeyPrefix + VMRQKeyStr EWOQKeyStr = "ewoqjP7PxY4yr3iLTpLisriqt94hdyDFNgchSxGGztUrTXtNN" EWOQKeyFormattedStr = secp256k1.PrivateKeyPrefix + EWOQKeyStr )
Variables ¶
var ( VMRQKey *secp256k1.PrivateKey EWOQKey *secp256k1.PrivateKey // LocalParams are the params used for local networks LocalParams = Params{ TxFeeConfig: TxFeeConfig{ TxFee: units.MilliDione, CreateAssetTxFee: units.MilliDione, CreateSubnetTxFee: 100 * units.MilliDione, TransformSubnetTxFee: 100 * units.MilliDione, CreateBlockchainTxFee: 100 * units.MilliDione, AddPrimaryNetworkValidatorFee: 0, AddPrimaryNetworkDelegatorFee: 0, AddSubnetValidatorFee: units.MilliDione, AddSubnetDelegatorFee: units.MilliDione, }, StakingConfig: StakingConfig{ UptimeRequirement: .8, MinValidatorStake: 2 * units.KiloDione, MinDelegatorStake: 25 * units.Dione, MaxValidatorStake: 3 * units.MegaDione, MinDelegationFee: 20000, MinValidatorStakeDuration: 24 * time.Hour, MaxValidatorStakeDuration: 365 * 24 * time.Hour, MinDelegatorStakeDuration: 24 * time.Hour, MaxDelegatorStakeDuration: 365 * 24 * time.Hour, RewardConfig: reward.Config{ MaxConsumptionRate: .12 * reward.PercentDenominator, MinConsumptionRate: .10 * reward.PercentDenominator, MintingPeriod: 365 * 24 * time.Hour, SupplyCap: 720 * units.MegaDione, }, MintConfig: reward.MintConfig{ MintingPeriod: 365 * 24 * time.Hour, MaxMintAmount: 500 * units.MegaDione, MintRate: 40_000, }, }, } )
var ( // MainnetParams are the params used for mainnet MainnetParams = Params{ TxFeeConfig: TxFeeConfig{ TxFee: 5 * units.Dione, CreateAssetTxFee: 10 * units.Dione, CreateSubnetTxFee: 300 * units.Dione, TransformSubnetTxFee: 5 * units.Dione, CreateBlockchainTxFee: 300 * units.Dione, AddPrimaryNetworkValidatorFee: 0, AddPrimaryNetworkDelegatorFee: 0, AddSubnetValidatorFee: 5 * units.Dione, AddSubnetDelegatorFee: 5 * units.Dione, }, StakingConfig: StakingConfig{ UptimeRequirement: .8, MinValidatorStake: 500 * units.KiloDione, MinDelegatorStake: 500 * units.Dione, MaxValidatorStake: 60 * units.MegaDione, MinDelegationFee: 20000, MinValidatorStakeDuration: 365 * 24 * time.Hour, MaxValidatorStakeDuration: 6 * 365 * 24 * time.Hour, MinDelegatorStakeDuration: 30 * 24 * time.Hour, MaxDelegatorStakeDuration: 6 * 365 * 24 * time.Hour, RewardConfig: reward.Config{ MaxConsumptionRate: .12 * reward.PercentDenominator, MinConsumptionRate: .10 * reward.PercentDenominator, MintingPeriod: 365 * 24 * time.Hour, SupplyCap: 720 * units.MegaDione, }, MintConfig: reward.MintConfig{ MintingPeriod: 365 * 24 * time.Hour, MaxMintAmount: 500 * units.MegaDione, MintRate: 40_000, }, }, } )
var ( // TestnetParams are the params used for the testnet testnet TestnetParams = Params{ TxFeeConfig: TxFeeConfig{ TxFee: 50 * units.MilliDione, CreateAssetTxFee: 100 * units.MilliDione, CreateSubnetTxFee: 1 * units.Dione, TransformSubnetTxFee: 10 * units.Dione, CreateBlockchainTxFee: 10 * units.Dione, AddPrimaryNetworkValidatorFee: 0, AddPrimaryNetworkDelegatorFee: 0, AddSubnetValidatorFee: units.MilliDione, AddSubnetDelegatorFee: units.MilliDione, }, StakingConfig: StakingConfig{ UptimeRequirement: .8, MinValidatorStake: 1 * units.Dione, MaxValidatorStake: 3 * units.MegaDione, MinDelegatorStake: 1 * units.Dione, MinDelegationFee: 20000, MinValidatorStakeDuration: 24 * time.Hour, MaxValidatorStakeDuration: 365 * 24 * time.Hour, MinDelegatorStakeDuration: 24 * time.Hour, MaxDelegatorStakeDuration: 365 * 24 * time.Hour, RewardConfig: reward.Config{ MaxConsumptionRate: .12 * reward.PercentDenominator, MinConsumptionRate: .10 * reward.PercentDenominator, MintingPeriod: 365 * 24 * time.Hour, SupplyCap: 720 * units.MegaDione, }, MintConfig: reward.MintConfig{ MintingPeriod: 365 * 24 * time.Hour, MaxMintAmount: 500 * units.MegaDione, MintRate: 40_000, }, }, } )
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
- The genesis time
func FromFile ¶
func FromFile(networkID uint32, filepath string, stakingCfg *StakingConfig) ([]byte, ids.ID, time.Time, error)
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
- The genesis time
func FromFlag ¶
func FromFlag(networkID uint32, genesisContent string, stakingCfg *StakingConfig) ([]byte, ids.ID, time.Time, error)
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
- The genesis time
func GetAChainAliases ¶
func GetAChainAliases() []string
func GetDChainAliases ¶
func GetDChainAliases() []string
func GetVMAliases ¶
Types ¶
type Allocation ¶
type Allocation struct { ETHAddr ids.ShortID `json:"ethAddr"` DIONEAddr ids.ShortID `json:"dioneAddr"` InitialAmount uint64 `json:"initialAmount"` UnlockSchedule []LockedAmount `json:"unlockSchedule"` }
func (Allocation) Less ¶
func (a Allocation) Less(other Allocation) bool
func (Allocation) Unparse ¶
func (a Allocation) Unparse(networkID uint32) (UnparsedAllocation, error)
type Bootstrapper ¶
Represents the relationship between the nodeID and the nodeIP. The bootstrapper is sometimes called "anchor" or "beacon" node.
func SampleBootstrappers ¶
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"` DChainGenesis string `json:"dChainGenesis"` 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 // TestnetConfig is the config that should be used to generate the testnet // genesis. TestnetConfig 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 nDIONE, required to validate the primary network MinValidatorStake uint64 `json:"minValidatorStake"` // Maximum stake, in nDIONE, allowed to be placed on a single validator in // the primary network MaxValidatorStake uint64 `json:"maxValidatorStake"` // Minimum stake, in nDIONE, 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"` // MinValidatorStakeDuration is the minimum amount of time a validator can validate // for in a single period. MinValidatorStakeDuration time.Duration `json:"minValidatorStakeDuration"` // MaxValidatorStakeDuration is the maximum amount of time a validator can validate // for in a single period. MaxValidatorStakeDuration time.Duration `json:"maxValidatorStakeDuration"` // MinDelegatorStakeDuration is the minimum amount of time a delegator can delegate // for in a single period. MinDelegatorStakeDuration time.Duration `json:"minDelekatorStakeDuration"` // MaxDelegatorStakeDuration is the maximum amount of time a delegator can delegate // for in a single period. MaxDelegatorStakeDuration time.Duration `json:"maxDelegatorStakeDuration"` // RewardConfig is the config for the reward function. RewardConfig reward.Config `json:"rewardConfig"` // Config for the minting function MintConfig reward.MintConfig `json:"mintConfig"` }
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 subnet transactions CreateSubnetTxFee uint64 `json:"createSubnetTxFee"` // Transaction fee for transform subnet transactions TransformSubnetTxFee uint64 `json:"transformSubnetTxFee"` // Transaction fee for create blockchain transactions CreateBlockchainTxFee uint64 `json:"createBlockchainTxFee"` // Transaction fee for adding a primary network validator AddPrimaryNetworkValidatorFee uint64 `json:"addPrimaryNetworkValidatorFee"` // Transaction fee for adding a primary network delegator AddPrimaryNetworkDelegatorFee uint64 `json:"addPrimaryNetworkDelegatorFee"` // Transaction fee for adding a subnet validator AddSubnetValidatorFee uint64 `json:"addSubnetValidatorFee"` // Transaction fee for adding a subnet delegator AddSubnetDelegatorFee uint64 `json:"addSubnetDelegatorFee"` }
func GetTxFeeConfig ¶
func GetTxFeeConfig(networkID uint32) TxFeeConfig
type UnparsedAllocation ¶
type UnparsedAllocation struct { ETHAddr string `json:"ethAddr"` DIONEAddr string `json:"dioneAddr"` 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"` DChainGenesis string `json:"dChainGenesis"` Message string `json:"message"` }
UnparsedConfig contains the genesis addresses used to construct a genesis
func (UnparsedConfig) Parse ¶
func (uc UnparsedConfig) Parse() (Config, error)