genesis

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainType

type ChainType uint8
const (
	Mainnet  ChainType = 0
	Testnet  ChainType = 1
	Localnet ChainType = 2
)

func (ChainType) IsMainnet

func (n ChainType) IsMainnet() bool

func (ChainType) IsTestnet

func (n ChainType) IsTestnet() bool

func (ChainType) String

func (n ChainType) String() string

type Genesis

type Genesis struct {
	// contains filtered or unexported fields
}

Genesis is stored in the state database.

func LoadFromFile

func LoadFromFile(file string) (*Genesis, error)

LoadFromFile loads genesis object from a JSON file.

func MainnetGenesis

func MainnetGenesis() *Genesis

func MakeGenesis

func MakeGenesis(genesisTime time.Time, accounts map[crypto.Address]*account.Account,
	validators []*validator.Validator, params *GenesisParams,
) *Genesis

func TestnetGenesis

func TestnetGenesis() *Genesis

func (*Genesis) Accounts

func (gen *Genesis) Accounts() map[crypto.Address]*account.Account

func (*Genesis) ChainType

func (gen *Genesis) ChainType() ChainType

func (*Genesis) GenesisTime

func (gen *Genesis) GenesisTime() time.Time

func (*Genesis) Hash

func (gen *Genesis) Hash() hash.Hash

func (*Genesis) MarshalJSON

func (gen *Genesis) MarshalJSON() ([]byte, error)

func (*Genesis) Params

func (gen *Genesis) Params() *GenesisParams

func (*Genesis) SaveToFile

func (gen *Genesis) SaveToFile(file string) error

SaveToFile saves the genesis into a JSON file.

func (*Genesis) TotalSupply

func (gen *Genesis) TotalSupply() amount.Amount

func (*Genesis) UnmarshalJSON

func (gen *Genesis) UnmarshalJSON(bs []byte) error

func (*Genesis) Validate

func (gen *Genesis) Validate() error

func (*Genesis) Validators

func (gen *Genesis) Validators() []*validator.Validator

type GenesisParams

type GenesisParams struct {
	BlockVersion              protocol.Version `cbor:"1,keyasint"  json:"block_version"`
	BlockIntervalInSecond     int              `cbor:"2,keyasint"  json:"block_interval_in_second"`
	CommitteeSize             int              `cbor:"3,keyasint"  json:"committee_size"`
	BlockReward               amount.Amount    `cbor:"4,keyasint"  json:"block_reward"`
	TransactionToLiveInterval uint32           `cbor:"5,keyasint"  json:"transaction_to_live_interval"`
	BondInterval              uint32           `cbor:"6,keyasint"  json:"bond_interval"`
	UnbondInterval            uint32           `cbor:"7,keyasint"  json:"unbond_interval"`
	SortitionInterval         uint32           `cbor:"8,keyasint"  json:"sortition_interval"`
	MinimumStake              amount.Amount    `cobr:"12,keyasint" json:"minimum_stake"`
	MaximumStake              amount.Amount    `cbor:"13,keyasint" json:"maximum_stake"`
}

func DefaultGenesisParams

func DefaultGenesisParams() *GenesisParams

func (*GenesisParams) BlockInterval

func (p *GenesisParams) BlockInterval() time.Duration

Jump to

Keyboard shortcuts

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