Documentation ¶
Index ¶
- func DefaultConsensusParams() *tmproto.ConsensusParams
- func Document(ecfg encoding.Config, params *tmproto.ConsensusParams, chainID string, ...) (*coretypes.GenesisDoc, error)
- func GenerateEd25519(seed []byte) crypto.PrivKey
- func InitFiles(dir string, tmCfg *config.Config, g *Genesis, validatorIndex int) (string, error)
- func NewSeed(r *mrand.Rand) []byte
- type Account
- type Genesis
- func (g *Genesis) Accounts() []Account
- func (g *Genesis) AddAccount(acc Account) error
- func (g *Genesis) AddValidator(val Validator) error
- func (g *Genesis) Export() (*coretypes.GenesisDoc, error)
- func (g *Genesis) Keyring() keyring.Keyring
- func (g *Genesis) Validator(i int) (Validator, bool)
- func (g *Genesis) Validators() []Validator
- func (g *Genesis) WithAccounts(accs ...Account) *Genesis
- func (g *Genesis) WithChainID(chainID string) *Genesis
- func (g *Genesis) WithConsensusParams(params *tmproto.ConsensusParams) *Genesis
- func (g *Genesis) WithGenesisTime(genesisTime time.Time) *Genesis
- func (g *Genesis) WithModifiers(ops ...Modifier) *Genesis
- func (g *Genesis) WithValidators(vals ...Validator) *Genesis
- type Modifier
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultConsensusParams ¶
func DefaultConsensusParams() *tmproto.ConsensusParams
func Document ¶
func Document( ecfg encoding.Config, params *tmproto.ConsensusParams, chainID string, gentxs []json.RawMessage, addrs []string, pubkeys []cryptotypes.PubKey, mods ...Modifier, ) (*coretypes.GenesisDoc, error)
Document will create a valid genesis doc with funded addresses.
func GenerateEd25519 ¶
Types ¶
type Genesis ¶
type Genesis struct { // ConsensusParams are the consensus parameters of the network. ConsensusParams *tmproto.ConsensusParams // ChainID is the chain ID of the network. ChainID string // GenesisTime is the genesis time of the network. GenesisTime time.Time // contains filtered or unexported fields }
Genesis manages the creation of the genesis state of a network. It is meant to be used as the first step to any test that requires a network.
func NewDefaultGenesis ¶
func NewDefaultGenesis() *Genesis
NewDefaultGenesis creates a new default genesis with no accounts or validators.
func (*Genesis) AddAccount ¶
func (*Genesis) AddValidator ¶
func (*Genesis) Validator ¶
Validator returns the validator at the given index. False is returned if the index is out of bounds.
func (*Genesis) Validators ¶
func (*Genesis) WithAccounts ¶
func (*Genesis) WithChainID ¶
func (*Genesis) WithConsensusParams ¶
func (g *Genesis) WithConsensusParams(params *tmproto.ConsensusParams) *Genesis
func (*Genesis) WithModifiers ¶
func (*Genesis) WithValidators ¶
type Modifier ¶
type Modifier func(state map[string]json.RawMessage) map[string]json.RawMessage
Modifier allows for arbitrary changes to be made on the genesis state after initial accounts have been added. It accepts the genesis state as input and is expected to return the modified genesis as output.
func FundAccounts ¶
FundAccounts adds a set of accounts to the genesis and then sets their balance as provided. This is good in the case where you have a separate keyring you want to test against and not use the one generated by the testnet infra.
func ImmediateProposals ¶
ImmediateProposals sets the thresholds for getting a gov proposal to very low levels.
func SetBlobParams ¶
SetBlobParams will set the provided blob params as genesis state.
type Validator ¶
type Validator struct { Account Stake int64 // ConsensusKey is the key used by the validator to sign votes. ConsensusKey crypto.PrivKey NetworkKey crypto.PrivKey }
func NewDefaultValidator ¶
func (*Validator) GenTx ¶
GenTx generates a genesis transaction to create a validator as configured by the validator struct. It assumes the validator's genesis account has already been added to the keyring and that the sequence for that account is 0.
func (*Validator) ValidateBasic ¶
ValidateBasic performs stateless validation on the validitor