Documentation ¶
Index ¶
- Constants
- type GenesisSpec
- func DeveloperAccount(index int) GenesisSpec
- func FullAccount(index int) GenesisSpec
- func GenesisSpecFromJSON(jsonBlob []byte) (*GenesisSpec, error)
- func MergeGenesisSpecs(genesisSpecs ...GenesisSpec) GenesisSpec
- func ParticipantAccount(index int) GenesisSpec
- func RootAccount(index int) GenesisSpec
- func ValidatorAccount(index int) GenesisSpec
- type TemplateAccount
- func (ta TemplateAccount) Account(keyClient keys.KeyClient, index int) (*genesis.Account, error)
- func (ta TemplateAccount) AccountPermissions() (ptypes.AccountPermissions, error)
- func (ta TemplateAccount) RealisePubKeyAndAddress(keyClient keys.KeyClient) (pubKey acm.PublicKey, address acm.Address, err error)
- func (ta TemplateAccount) Validator(keyClient keys.KeyClient, index int) (*genesis.Validator, error)
Constants ¶
const DefaultAmount uint64 = 1000000
const DefaultAmountBonded uint64 = 10000
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GenesisSpec ¶
type GenesisSpec struct { GenesisTime *time.Time `json:",omitempty"` ChainName string `json:",omitempty"` Salt []byte `json:",omitempty"` GlobalPermissions []string `json:",omitempty"` Accounts []TemplateAccount `json:",omitempty"` }
A GenesisSpec is schematic representation of a genesis state, that is it is a template for a GenesisDoc excluding that which needs to be instantiated at the point of genesis so it describes the type and number of accounts, the genesis salt, but not the account keys or addresses, or the GenesisTime. It is responsible for generating keys by interacting with the KeysClient it is passed and other information not known at specification time
func DeveloperAccount ¶
func DeveloperAccount(index int) GenesisSpec
func FullAccount ¶
func FullAccount(index int) GenesisSpec
func GenesisSpecFromJSON ¶
func GenesisSpecFromJSON(jsonBlob []byte) (*GenesisSpec, error)
func MergeGenesisSpecs ¶
func MergeGenesisSpecs(genesisSpecs ...GenesisSpec) GenesisSpec
func ParticipantAccount ¶
func ParticipantAccount(index int) GenesisSpec
func RootAccount ¶
func RootAccount(index int) GenesisSpec
func ValidatorAccount ¶
func ValidatorAccount(index int) GenesisSpec
func (*GenesisSpec) GenesisDoc ¶
func (gs *GenesisSpec) GenesisDoc(keyClient keys.KeyClient) (*genesis.GenesisDoc, error)
Produce a fully realised GenesisDoc from a template GenesisDoc that may omit values
func (*GenesisSpec) Hash ¶
func (gs *GenesisSpec) Hash() []byte
func (*GenesisSpec) JSONBytes ¶
func (gs *GenesisSpec) JSONBytes() ([]byte, error)
func (*GenesisSpec) ShortHash ¶
func (gs *GenesisSpec) ShortHash() []byte
type TemplateAccount ¶
type TemplateAccount struct { // Address is convenient to have in file for reference, but otherwise ignored since derived from PublicKey Address *acm.Address `json:",omitempty"` PublicKey *acm.PublicKey `json:",omitempty"` Amount *uint64 `json:",omitempty"` // If any bonded amount then this account is also a Validator AmountBonded *uint64 `json:",omitempty"` Name string `json:",omitempty"` Permissions []string `json:",omitempty"` Roles []string `json:",omitempty"` }
func (TemplateAccount) AccountPermissions ¶
func (ta TemplateAccount) AccountPermissions() (ptypes.AccountPermissions, error)
func (TemplateAccount) RealisePubKeyAndAddress ¶
func (ta TemplateAccount) RealisePubKeyAndAddress(keyClient keys.KeyClient) (pubKey acm.PublicKey, address acm.Address, err error)
Adds a public key and address to the template. If PublicKey will try to fetch it by Address. If both PublicKey and Address are not set will use the keyClient to generate a new keypair