Documentation ¶
Index ¶
- Variables
- func Aliases(genesisBytes []byte) (map[string][]string, map[ids.ID][]string, error)
- func DJTXAssetID(avmGenesisBytes []byte) (ids.ID, error)
- func FromConfig(config *Config) ([]byte, ids.ID, error)
- func Genesis(networkID uint32, filepath string) ([]byte, ids.ID, error)
- func GetCChainAliases() []string
- func GetVMAliases() map[ids.ID][]string
- func GetXChainAliases() []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 UnparsedAllocation
- type UnparsedConfig
- type UnparsedStaker
Constants ¶
This section is empty.
Variables ¶
var ( // FujiParams are the params used for the fuji testnet FujiParams = Params{ TxFee: units.MilliDjtx, CreationTxFee: 10 * units.MilliDjtx, UptimeRequirement: .6, MinValidatorStake: 1 * units.Djtx, MaxValidatorStake: 3 * units.MegaDjtx, MinDelegatorStake: 1 * units.Djtx, MinDelegationFee: 20000, MinStakeDuration: 24 * time.Hour, MaxStakeDuration: 365 * 24 * time.Hour, StakeMintingPeriod: 365 * 24 * time.Hour, EpochFirstTransition: time.Unix(1607626800, 0), EpochDuration: 6 * time.Hour, } )
var ( // LocalParams are the params used for local networks LocalParams = Params{ TxFee: units.MilliDjtx, CreationTxFee: 10 * units.MilliDjtx, UptimeRequirement: .6, MinValidatorStake: 1 * units.Djtx, MaxValidatorStake: 3 * units.MegaDjtx, MinDelegatorStake: 1 * units.Djtx, MinDelegationFee: 20000, MinStakeDuration: 24 * time.Hour, MaxStakeDuration: 365 * 24 * time.Hour, StakeMintingPeriod: 365 * 24 * time.Hour, EpochFirstTransition: time.Unix(1607626800, 0), EpochDuration: 5 * time.Minute, } )
var ( // MainnetParams are the params used for mainnet MainnetParams = Params{ TxFee: units.MilliDjtx, CreationTxFee: 10 * units.MilliDjtx, UptimeRequirement: .6, MinValidatorStake: 2 * units.KiloDjtx, MaxValidatorStake: 3 * units.MegaDjtx, MinDelegatorStake: 25 * units.Djtx, MinDelegationFee: 20000, MinStakeDuration: 2 * 7 * 24 * time.Hour, MaxStakeDuration: 365 * 24 * time.Hour, StakeMintingPeriod: 365 * 24 * time.Hour, EpochFirstTransition: time.Unix(1655861006, 0), EpochDuration: 6 * time.Hour, } )
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 DJTX
func Genesis ¶
Genesis 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.
Genesis 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, loads the network genesis state from predefined configs. If filepath is non-empty and networkID isn't Mainnet, Testnet, or Local, loads the network genesis data from the config at filepath.
Genesis returns:
- The byte representation of the genesis state of the platform chain (ie the genesis state of the network)
- The asset ID of DJTX
func GetCChainAliases ¶
func GetCChainAliases() []string
func GetVMAliases ¶
func GetXChainAliases ¶
func GetXChainAliases() []string
func SampleBeacons ¶
SampleBeacons returns the some beacons this node should connect to
Types ¶
type Allocation ¶
type Allocation struct { ETHAddr ids.ShortID `json:"ethAddr"` DJTXAddr ids.ShortID `json:"djtxAddr"` 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"` 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 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 { // Transaction fee TxFee uint64 // Transaction fee for transactions that create new state CreationTxFee uint64 // Staking uptime requirements UptimeRequirement float64 // Minimum stake, in nDJTX, required to validate the primary network MinValidatorStake uint64 // Maximum stake, in nDJTX, allowed to be placed on a single validator in // the primary network MaxValidatorStake uint64 // Minimum stake, in nDJTX, that can be delegated on the primary network MinDelegatorStake uint64 // Minimum delegation fee, in the range [0, 1000000], that can be charged // for delegation on the primary network. MinDelegationFee uint32 // MinStakeDuration is the minimum amount of time a validator can validate // for in a single period. MinStakeDuration time.Duration // MaxStakeDuration is the maximum amount of time a validator can validate // for in a single period. MaxStakeDuration time.Duration // StakeMintingPeriod is the amount of time for a consumption period. StakeMintingPeriod time.Duration // EpochFirstTransition is the time that the transition from epoch 0 to 1 // should occur. EpochFirstTransition time.Time // EpochDuration is the amount of time that an epoch runs for. EpochDuration time.Duration }
type Staker ¶
type UnparsedAllocation ¶
type UnparsedAllocation struct { ETHAddr string `json:"ethAddr"` DJTXAddr string `json:"djtxAddr"` 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"` CChainGenesis string `json:"cChainGenesis"` Message string `json:"message"` }
UnparsedConfig contains the genesis addresses used to construct a genesis
func (UnparsedConfig) Parse ¶
func (uc UnparsedConfig) Parse() (Config, error)
type UnparsedStaker ¶
type UnparsedStaker struct { NodeID string `json:"nodeID"` RewardAddress string `json:"rewardAddress"` DelegationFee uint32 `json:"delegationFee"` }
func (UnparsedStaker) Parse ¶
func (us UnparsedStaker) Parse() (Staker, error)