iotex-core: Index | Files

package genesis

import ""


Package Files



var Default = defaultConfig()

Default contains the default genesis config

type Account Uses

type Account struct {
    // InitBalanceMap is the address and initial balance mapping before the first block.
    InitBalanceMap map[string]string `yaml:"initBalances"`

Account contains the configs for account protocol

func (*Account) InitBalances Uses

func (a *Account) InitBalances() ([]address.Address, []*big.Int)

InitBalances returns the address that have initial balances and the corresponding amounts. The i-th amount is the i-th address' balance.

type Blockchain Uses

type Blockchain struct {
    // Timestamp is the timestamp of the genesis block
    Timestamp int64
    // BlockGasLimit is the total gas limit could be consumed in a block
    BlockGasLimit uint64 `yaml:"blockGasLimit"`
    // ActionGasLimit is the per action gas limit cap
    ActionGasLimit uint64 `yaml:"actionGasLimit"`
    // BlockInterval is the interval between two blocks
    BlockInterval time.Duration `yaml:"blockInterval"`
    // NumSubEpochs is the number of sub epochs in one epoch of block production
    NumSubEpochs uint64 `yaml:"numSubEpochs"`
    // DardanellesNumSubEpochs is the number of sub epochs starts from dardanelles height in one epoch of block production
    DardanellesNumSubEpochs uint64 `yaml:"dardanellesNumSubEpochs"`
    // NumDelegates is the number of delegates that participate into one epoch of block production
    NumDelegates uint64 `yaml:"numDelegates"`
    // NumCandidateDelegates is the number of candidate delegates, who may be selected as a delegate via roll dpos
    NumCandidateDelegates uint64 `yaml:"numCandidateDelegates"`
    // TimeBasedRotation is the flag to enable rotating delegates' time slots on a block height
    TimeBasedRotation bool `yaml:"timeBasedRotation"`
    // PacificBlockHeight is the start height of using the logic of Pacific version
    // TODO: PacificBlockHeight is not added into protobuf definition for backward compatibility
    PacificBlockHeight uint64 `yaml:"pacificHeight"`
    // AleutianBlockHeight is the start height of adding bloom filter of all events into block header
    AleutianBlockHeight uint64 `yaml:"aleutianHeight"`
    // BeringBlockHeight is the start height of evm upgrade
    BeringBlockHeight uint64 `yaml:"beringHeight"`
    // CookBlockHeight is the start height of native staking
    CookBlockHeight uint64 `yaml:"cookHeight"`
    // DardanellesBlockHeight is the start height of 5s block internal
    DardanellesBlockHeight uint64 `yaml:"dardanellesHeight"`
    // DaytonaBlockHeight is the height to fix low gas for read native staking contract
    DaytonaBlockHeight uint64 `yaml:"daytonaBlockHeight"`
    // EasterBlockHeight is the start height of probation for slashing
    EasterBlockHeight uint64 `yaml:"easterHeight"`
    // FairbankBlockHeight is the start height to switch to native staking V2
    FairbankBlockHeight uint64 `yaml:"fairbankHeight"`

Blockchain contains blockchain level configs

type BootstrapCandidate Uses

type BootstrapCandidate struct {
    OwnerAddress      string `yaml:"ownerAddress"`
    OperatorAddress   string `yaml:"operatorAddress"`
    RewardAddress     string `yaml:"rewardAddress"`
    Name              string `yaml:"name"`
    SelfStakingTokens string `yaml:"selfStakingTokens"`

BootstrapCandidate is the candidate data need to be provided to bootstrap candidate.

type Delegate Uses

type Delegate struct {
    // OperatorAddrStr is the address who will operate the node
    OperatorAddrStr string `yaml:"operatorAddr"`
    // RewardAddrStr is the address who will get the reward when operator produces blocks
    RewardAddrStr string `yaml:"rewardAddr"`
    // VotesStr is the score for the operator to rank and weight for rewardee to split epoch reward
    VotesStr string `yaml:"votes"`

Delegate defines a delegate with address and votes

func (*Delegate) OperatorAddr Uses

func (d *Delegate) OperatorAddr() address.Address

OperatorAddr is the address of operator

func (*Delegate) RewardAddr Uses

func (d *Delegate) RewardAddr() address.Address

RewardAddr is the address of rewardee, which is allowed to be nil

func (*Delegate) Votes Uses

func (d *Delegate) Votes() *big.Int

Votes returns the votes

type Genesis Uses

type Genesis struct {
    Blockchain `yaml:"blockchain"`
    Account    `yaml:"account"`
    Poll       `yaml:"poll"`
    Rewarding  `yaml:"rewarding"`
    Staking    `yaml:"staking"`

Genesis is the root level of genesis config. Genesis config is the network-wide blockchain config. All the nodes participating into the same network should use EXACTLY SAME genesis config.

func New Uses

func New() (Genesis, error)

New constructs a genesis config. It loads the default values, and could be overwritten by values defined in the yaml config files

func (*Genesis) Hash Uses

func (g *Genesis) Hash() hash.Hash256

Hash is the hash of genesis config

type Poll Uses

type Poll struct {
    // PollMode is different based on chain type or poll input data source
    PollMode string `yaml:"pollMode"`
    // EnableGravityChainVoting is a flag whether read voting from gravity chain
    EnableGravityChainVoting bool `yaml:"enableGravityChainVoting"`
    // GravityChainStartHeight is the height in gravity chain where the init poll result stored
    GravityChainStartHeight uint64 `yaml:"gravityChainStartHeight"`
    // GravityChainHeightInterval the height interval on gravity chain to pull delegate information
    GravityChainHeightInterval uint64 `yaml:"gravityChainHeightInterval"`
    // RegisterContractAddress is the address of register contract
    RegisterContractAddress string `yaml:"registerContractAddress"`
    // StakingContractAddress is the address of staking contract
    StakingContractAddress string `yaml:"stakingContractAddress"`
    // NativeStakingContractAddress is the address of native staking contract
    NativeStakingContractAddress string `yaml:"nativeStakingContractAddress"`
    // NativeStakingContractCode is the code of native staking contract
    NativeStakingContractCode string `yaml:"nativeStakingContractCode"`
    // ConsortiumCommitteeCode is the code of consortiumCommittee contract
    ConsortiumCommitteeContractCode string `yaml:"consortiumCommitteeContractCode"`
    // VoteThreshold is the vote threshold amount in decimal string format
    VoteThreshold string `yaml:"voteThreshold"`
    // ScoreThreshold is the score threshold amount in decimal string format
    ScoreThreshold string `yaml:"scoreThreshold"`
    // SelfStakingThreshold is self-staking vote threshold amount in decimal string format
    SelfStakingThreshold string `yaml:"selfStakingThreshold"`
    // Delegates is a list of delegates with votes
    Delegates []Delegate `yaml:"delegates"`
    // ProbationEpochPeriod is a duration of probation after delegate's productivity is lower than threshold
    ProbationEpochPeriod uint64 `yaml:"probationEpochPeriod"`
    // ProbationIntensityRate is a intensity rate of probation range from [0, 100], where 100 is hard-probation
    ProbationIntensityRate uint32 `yaml:"probationIntensityRate"`
    // UnproductiveDelegateMaxCacheSize is a max cache size of upd which is stored into state DB (probationEpochPeriod <= UnproductiveDelegateMaxCacheSize)
    UnproductiveDelegateMaxCacheSize uint64 `yaml:unproductiveDelegateMaxCacheSize`

Poll contains the configs for poll protocol

type RegistrationConsts Uses

type RegistrationConsts struct {
    Fee          string `yaml:"fee"`
    MinSelfStake string `yaml:"minSelfStake"`

RegistrationConsts contains the configs for candidate registration

type Rewarding Uses

type Rewarding struct {
    // InitBalanceStr is the initial balance of the rewarding protocol in decimal string format
    InitBalanceStr string `yaml:"initBalance"`
    // BlockReward is the block reward amount in decimal string format
    BlockRewardStr string `yaml:"blockReward"`
    // DardanellesBlockReward is the block reward amount starts from dardanelles height in decimal string format
    DardanellesBlockRewardStr string `yaml:"dardanellesBlockReward"`
    // EpochReward is the epoch reward amount in decimal string format
    EpochRewardStr string `yaml:"epochReward"`
    // AleutianEpochRewardStr is the epoch reward amount in decimal string format after aleutian fork
    AleutianEpochRewardStr string `yaml:"aleutianEpochReward"`
    // NumDelegatesForEpochReward is the number of top candidates that will share a epoch reward
    NumDelegatesForEpochReward uint64 `yaml:"numDelegatesForEpochReward"`
    // ExemptAddrStrsFromEpochReward is the list of addresses in encoded string format that exempt from epoch reward
    ExemptAddrStrsFromEpochReward []string `yaml:"exemptAddrsFromEpochReward"`
    // FoundationBonusStr is the bootstrap bonus in decimal string format
    FoundationBonusStr string `yaml:"foundationBonus"`
    // NumDelegatesForFoundationBonus is the number of top candidate that will get the bootstrap bonus
    NumDelegatesForFoundationBonus uint64 `yaml:"numDelegatesForFoundationBonus"`
    // FoundationBonusLastEpoch is the last epoch number that bootstrap bonus will be granted
    FoundationBonusLastEpoch uint64 `yaml:"foundationBonusLastEpoch"`
    // ProductivityThreshold is the percentage number that a delegate's productivity needs to reach to get the
    // epoch reward
    ProductivityThreshold uint64 `yaml:"productivityThreshold"`

Rewarding contains the configs for rewarding protocol

func (*Rewarding) AleutianEpochReward Uses

func (r *Rewarding) AleutianEpochReward() *big.Int

AleutianEpochReward returns the epoch reward amount after Aleutian fork

func (*Rewarding) BlockReward Uses

func (r *Rewarding) BlockReward() *big.Int

BlockReward returns the block reward amount

func (*Rewarding) DardanellesBlockReward Uses

func (r *Rewarding) DardanellesBlockReward() *big.Int

DardanellesBlockReward returns the block reward amount after dardanelles fork

func (*Rewarding) EpochReward Uses

func (r *Rewarding) EpochReward() *big.Int

EpochReward returns the epoch reward amount

func (*Rewarding) ExemptAddrsFromEpochReward Uses

func (r *Rewarding) ExemptAddrsFromEpochReward() []address.Address

ExemptAddrsFromEpochReward returns the list of addresses that exempt from epoch reward

func (*Rewarding) FoundationBonus Uses

func (r *Rewarding) FoundationBonus() *big.Int

FoundationBonus returns the bootstrap bonus amount rewarded per epoch

func (*Rewarding) InitBalance Uses

func (r *Rewarding) InitBalance() *big.Int

InitBalance returns the init balance of the rewarding fund

type Staking Uses

type Staking struct {
    VoteWeightCalConsts   VoteWeightCalConsts  `yaml:"voteWeightCalConsts"`
    RegistrationConsts    RegistrationConsts   `yaml:"registrationConsts"`
    WithdrawWaitingPeriod time.Duration        `yaml:"withdrawWaitingPeriod"`
    MinStakeAmount        string               `yaml:"minStakeAmount"`
    BootstrapCandidates   []BootstrapCandidate `yaml:"bootstrapCandidates"`

Staking contains the configs for staking protocol

type VoteWeightCalConsts Uses

type VoteWeightCalConsts struct {
    DurationLg float64 `yaml:"durationLg"`
    AutoStake  float64 `yaml:"autoStake"`
    SelfStake  float64 `yaml:"selfStake"`

VoteWeightCalConsts contains the configs for calculating vote weight

Package genesis imports 14 packages (graph) and is imported by 8 packages. Updated 2020-03-30. Refresh now. Tools for package owners.