genesis

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2024 License: GPL-3.0, GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Second = 1
	Minute = 60 * Second
	Hour   = 60 * Minute
	Day    = 24 * Hour
	Week   = 7 * Day
	Year   = 365 * Day
)

durations in seconds

Variables

View Source
var AdminAddr common.Address
View Source
var ValidatorsAT []AccoutInfo

Functions

func GenerateGenesis

func GenerateGenesis(_ *cli.Context, accounts *env.AccountsConfig, cfg *Config, contractsBuildPath string) (*chain.Genesis, error)

GenerateGenesis will create a new genesis block with full atlas blockchain already configured

func UnmarshalMarkerConfig

func UnmarshalMarkerConfig(ctx *cli.Context)

Types

type AccoutInfo

type AccoutInfo struct {
	Address              string
	SignerAddress        string
	ECDSASignature       string
	PublicKeyHex         string
	BLSPubKey            string
	BLSG1PubKey          string
	BLSProofOfPossession string
}

From markerConfig.json used for validators and election contract

func (*AccoutInfo) BLSG1PublicKey

func (a *AccoutInfo) BLSG1PublicKey() (blscrypto.SerializedG1PublicKey, error)

BLSPublicKey returns the bls public key

func (*AccoutInfo) BLSProofOfPossession_

func (a *AccoutInfo) BLSProofOfPossession_() ([]byte, error)

BLSProofOfPossession generates bls proof of possession

func (*AccoutInfo) BLSPublicKey

func (a *AccoutInfo) BLSPublicKey() (blscrypto.SerializedPublicKey, error)

BLSPublicKey returns the bls public key

func (*AccoutInfo) ECDSASignature_

func (a *AccoutInfo) ECDSASignature_() (v uint8, r common.Hash, s common.Hash)

func (*AccoutInfo) MustBLSProofOfPossession

func (a *AccoutInfo) MustBLSProofOfPossession() []byte

MustBLSProofOfPossession variant of BLSProofOfPossession that panics on error

func (*AccoutInfo) PublicKey

func (a *AccoutInfo) PublicKey() []byte

PublicKeyHex hex representation of the public key

func (*AccoutInfo) SignerAddress_

func (a *AccoutInfo) SignerAddress_() common.Address

type Balance

type Balance struct {
	Account common.Address `json:"account"`
	Amount  *big.Int       `json:"amount"`
}

Balance represents an account and it's initial balance in wei

type BalanceList

type BalanceList []Balance

BalanceList list of balances

func (BalanceList) Accounts

func (bl BalanceList) Accounts() []common.Address

Accounts returns all the addresses

func (BalanceList) Amounts

func (bl BalanceList) Amounts() []*big.Int

Amounts returns all the amounts

type BalanceMarshaling

type BalanceMarshaling struct {
	Amount *bigintstr.BigIntStr `json:"amount"`
}

type BlockchainParameters

type BlockchainParameters struct {
	Version                 Version `json:"version"`
	GasForNonGoldCurrencies uint64  `json:"gasForNonGoldCurrencies"`
	BlockGasLimit           uint64  `json:"blockGasLimit"`
}

BlockchainParameters are the initial configuration parameters for Blockchain

type Config

type Config struct {
	ChainID          *big.Int              `json:"chainId"` // chainId identifies the current chain and is used for replay protection
	Istanbul         params.IstanbulConfig `json:"istanbul"`
	Hardforks        HardforkConfig        `json:"hardforks"`
	GenesisTimestamp uint64                `json:"genesisTimestamp"`

	LockedGold           LockedGoldParameters
	GoldToken            GoldTokenParameters
	Validators           ValidatorsParameters
	Election             ElectionParameters
	EpochRewards         EpochRewardsParameters
	Blockchain           BlockchainParameters
	Random               RandomParameters
	DoubleSigningSlasher DoubleSigningSlasherParameters
	DowntimeSlasher      DowntimeSlasherParameters
}

Config represent all atlas-blockchain configuration options for the genesis block

func BaseConfig

func BaseConfig() *Config

BaseConfig creates base parameters for atlas Callers must complete missing pieces

func CreateCommonGenesisConfig

func CreateCommonGenesisConfig() *Config

CreateCommonGenesisConfig generates a config starting point which templates can then customize further

func (*Config) ChainConfig

func (cfg *Config) ChainConfig() *params.ChainConfig

ChainConfig returns the chain config objt for the blockchain

func (*Config) Save

func (cfg *Config) Save(filepath string) error

Save will write config into a json file

type DoubleSigningSlasherParameters

type DoubleSigningSlasherParameters struct {
	Penalty *big.Int `json:"penalty"`
	Reward  *big.Int `json:"reward"`
}

DoubleSigningSlasherParameters are the initial configuration parameters for DoubleSigningSlasher

type DoubleSigningSlasherParametersMarshaling

type DoubleSigningSlasherParametersMarshaling struct {
	Penalty *bigintstr.BigIntStr `json:"penalty"`
	Reward  *bigintstr.BigIntStr `json:"reward"`
}

type DowntimeSlasherParameters

type DowntimeSlasherParameters struct {
	Penalty           *big.Int `json:"penalty"`
	Reward            *big.Int `json:"reward"`
	SlashableDowntime uint64   `json:"slashableDowntime"`
}

DowntimeSlasherParameters are the initial configuration parameters for DowntimeSlasher

type DowntimeSlasherParametersMarshaling

type DowntimeSlasherParametersMarshaling struct {
	Penalty *bigintstr.BigIntStr `json:"penalty"`
	Reward  *bigintstr.BigIntStr `json:"reward"`
}

type ElectionParameters

type ElectionParameters struct {
	MinElectableValidators uint64       `json:"minElectableValidators"`
	MaxElectableValidators uint64       `json:"maxElectableValidators"`
	MaxVotesPerAccount     *big.Int     `json:"maxVotesPerAccount"`
	ElectabilityThreshold  *fixed.Fixed `json:"electabilityThreshold"`
}

ElectionParameters are the initial configuration parameters for Elections

type ElectionParametersMarshaling

type ElectionParametersMarshaling struct {
	MaxVotesPerAccount *bigintstr.BigIntStr `json:"maxVotesPerAccount"`
}

type EpochRewardsParameters

type EpochRewardsParameters struct {
	MaxEpochPayment                *big.Int       `json:"maxValidatorEpochPayment"`
	CommunityRewardFraction        *fixed.Fixed   `json:"communityRewardFraction"`
	EpochMaintainerPaymentFraction *fixed.Fixed   `json:"epochRelayerPaymentFraction"`
	CommunityPartner               common.Address `json:"communityPartner"`
	MgrMaintainerAddress           common.Address `json:"mgrMaintainerAddress"`
}

EpochRewardsParameters are the initial configuration parameters for EpochRewards

type EpochRewardsParametersMarshaling

type EpochRewardsParametersMarshaling struct {
	MaxValidatorEpochPayment *bigintstr.BigIntStr `json:"maxValidatorEpochPayment"`
}

type GasPriceMinimumParametersMarshaling

type GasPriceMinimumParametersMarshaling struct {
	MinimumFloor *bigintstr.BigIntStr `json:"minimumFloor"`
}

type GoldTokenParameters

type GoldTokenParameters struct {
	InitialBalances BalanceList `json:"initialBalances"`
}

GoldTokenParameters are the initial configuration parameters for GoldToken

type GovernanceParametersMarshaling

type GovernanceParametersMarshaling struct {
	MinDeposit *bigintstr.BigIntStr `json:"minDeposit"`
}

type HardforkConfig

type HardforkConfig struct {
	ChurritoBlock *big.Int `json:"churritoBlock"`
	DonutBlock    *big.Int `json:"donutBlock"`
}

HardforkConfig contains atlas hardforks activation blocks

type LockedGoldParameters

type LockedGoldParameters struct {
	UnlockingPeriod uint64 `json:"unlockingPeriod"`
}

LockedGoldParameters are the initial configuration parameters for LockedGold

type LockedGoldRequirements

type LockedGoldRequirements struct {
	Value    *big.Int `json:"value"`
	Duration uint64   `json:"duration"`
}

LockedGoldRequirements represents value/duration requirments on locked gold

type LockedgoldRequirementsMarshaling

type LockedgoldRequirementsMarshaling struct {
	Value *bigintstr.BigIntStr `json:"value"`
}

type MarkerInfo

type MarkerInfo struct {
	AdminAddress string
	Validators   []AccoutInfo
}

type RandomParameters

type RandomParameters struct {
	RandomnessBlockRetentionWindow uint64 `json:"randomnessBlockRetentionWindow"`
}

RandomParameters are the initial configuration parameters for Random

type ValidatorsParameters

type ValidatorsParameters struct {
	ValidatorLockedGoldRequirements LockedGoldRequirements `json:"validatorLockedGoldRequirements"`
	ValidatorScoreExponent          uint64                 `json:"validatorScoreExponent"`
	ValidatorScoreAdjustmentSpeed   *fixed.Fixed           `json:"validatorScoreAdjustmentSpeed"`
	SlashingPenaltyResetPeriod      uint64                 `json:"slashingPenaltyResetPeriod"`
	CommissionUpdateDelay           uint64                 `json:"commissionUpdateDelay"`
	PledgeMultiplierInReward        *fixed.Fixed           `json:"pledgeMultiplierInReward"`
	DowntimeGracePeriod             uint64                 `json:"downtimeGracePeriod"`
	Commission                      *big.Int               `json:"commission"` // commission for genesis registered validator
}

ValidatorsParameters are the initial configuration parameters for Validators

type Version

type Version struct {
	Major int64 `json:"major"`
	Minor int64 `json:"minor"`
	Patch int64 `json:"patch"`
}

Version represents an artifact version number

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL