spec

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2018 License: Apache-2.0 Imports: 11 Imported by: 6

Documentation

Index

Constants

View Source
const DefaultAmount uint64 = 1000000
View Source
const DefaultPower uint64 = 10000

Variables

This section is empty.

Functions

This section is empty.

Types

type GenesisSpec

type GenesisSpec struct {
	GenesisTime       *time.Time        `json:",omitempty" toml:",omitempty"`
	ChainName         string            `json:",omitempty" toml:",omitempty"`
	Salt              []byte            `json:",omitempty" toml:",omitempty"`
	GlobalPermissions []string          `json:",omitempty" toml:",omitempty"`
	Accounts          []TemplateAccount `json:",omitempty" toml:",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(name string) GenesisSpec

func FullAccount

func FullAccount(name string) GenesisSpec

func GenesisSpecFromJSON

func GenesisSpecFromJSON(jsonBlob []byte) (*GenesisSpec, error)

func MergeGenesisSpecs

func MergeGenesisSpecs(genesisSpecs ...GenesisSpec) GenesisSpec

func ParticipantAccount

func ParticipantAccount(name string) GenesisSpec

func RootAccount

func RootAccount(name string) GenesisSpec

func ValidatorAccount

func ValidatorAccount(name string) GenesisSpec

func (*GenesisSpec) GenesisDoc

func (gs *GenesisSpec) GenesisDoc(keyClient keys.KeyClient, generateNodeKeys bool) (*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) RealiseKeys added in v0.19.0

func (gs *GenesisSpec) RealiseKeys(keyClient keys.KeyClient) error

func (*GenesisSpec) ShortHash

func (gs *GenesisSpec) ShortHash() []byte

type TemplateAccount

type TemplateAccount struct {
	// Template accounts sharing a name will be merged when merging genesis specs
	Name string `json:",omitempty" toml:",omitempty"`
	// Address  is convenient to have in file for reference, but otherwise ignored since derived from PublicKey
	Address     *crypto.Address   `json:",omitempty" toml:",omitempty"`
	NodeAddress *crypto.Address   `json:",omitempty" toml:",omitempty"`
	PublicKey   *crypto.PublicKey `json:",omitempty" toml:",omitempty"`
	Amount      *uint64           `json:",omitempty" toml:",omitempty"`
	Power       *uint64           `json:",omitempty" toml:",omitempty"`
	Permissions []string          `json:",omitempty" toml:",omitempty"`
	Roles       []string          `json:",omitempty" toml:",omitempty"`
}

func (TemplateAccount) Account

func (ta TemplateAccount) Account(keyClient keys.KeyClient, index int) (*genesis.Account, error)

func (TemplateAccount) AccountPermissions

func (ta TemplateAccount) AccountPermissions() (ptypes.AccountPermissions, error)

func (TemplateAccount) RealisePubKeyAndAddress

func (ta TemplateAccount) RealisePubKeyAndAddress(keyClient keys.KeyClient) (pubKey crypto.PublicKey, address crypto.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

func (TemplateAccount) Validator

func (ta TemplateAccount) Validator(keyClient keys.KeyClient, index int, generateNodeKeys bool) (*genesis.Validator, error)

Jump to

Keyboard shortcuts

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