genesis

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PublicKeyEd25519ByteLength   int = 32
	PublicKeySecp256k1ByteLength int = 64
)

Variables

View Source
var GenDocKey = []byte("GenDocKey")

Functions

func GenerateGenesisFileBytes

func GenerateGenesisFileBytes(chainName string, genesisAccounts []*GenesisAccount,
	genesisValidators []*GenesisValidator) ([]byte, error)

func GenerateKnown

func GenerateKnown(chainID, accountsPathCSV, validatorsPathCSV string) (string, error)

func GetGenesisFileBytes

func GetGenesisFileBytes(genesisDoc *GenesisDoc) ([]byte, error)

GetGenesisFileBytes returns the JSON (not-yet) canonical bytes for a given GenesisDoc or an error. In a first rewrite, rely on go-wire for the JSON serialisation with type-bytes.

Types

type BasicAccount

type BasicAccount struct {
	Address []byte `json:"address"`
	Amount  int64  `json:"amount"`
}

func (*BasicAccount) Clone

func (basicAccount *BasicAccount) Clone() BasicAccount

Clone clones the basic account

type GenesisAccount

type GenesisAccount struct {
	Address     []byte                     `json:"address"`
	Amount      int64                      `json:"amount"`
	Name        string                     `json:"name"`
	Permissions *ptypes.AccountPermissions `json:"permissions"`
}

func NewGenesisAccount

func NewGenesisAccount(address []byte, amount int64, name string,
	permissions *ptypes.AccountPermissions) *GenesisAccount

NewGenesisAccount returns a new GenesisAccount

func (*GenesisAccount) Clone

func (genesisAccount *GenesisAccount) Clone() GenesisAccount

Clone clones the genesis account

type GenesisDoc

type GenesisDoc struct {
	GenesisTime time.Time          `json:"genesis_time"`
	ChainID     string             `json:"chain_id"`
	Params      *GenesisParams     `json:"params"`
	Accounts    []GenesisAccount   `json:"accounts"`
	Validators  []GenesisValidator `json:"validators"`
}

func GenesisDocFromJSON

func GenesisDocFromJSON(jsonBlob []byte) (genState *GenesisDoc)

func MakeGenesisDocFromAccounts

func MakeGenesisDocFromAccounts(chainName string, accounts []*GenesisAccount,
	validators []*GenesisValidator) (GenesisDoc, error)

MakeGenesisDocFromAccounts takes a chainName and a slice of pointers to GenesisAccount, and a slice of pointers to GenesisValidator to construct a GenesisDoc, or returns an error on failure. In particular MakeGenesisDocFromAccount uses the local time as a timestamp for the GenesisDoc.

type GenesisParams

type GenesisParams struct {
	GlobalPermissions *ptypes.AccountPermissions `json:"global_permissions"`
}

type GenesisPrivateValidator

type GenesisPrivateValidator struct {
	Address    string        `json:"address"`
	PubKey     []interface{} `json:"pub_key"`
	PrivKey    []interface{} `json:"priv_key"`
	LastHeight int64         `json:"last_height"`
	LastRound  int64         `json:"last_round"`
	LastStep   int64         `json:"last_step"`
}

GenesisPrivateValidator marshals the state of the private validator for the purpose of Genesis creation; and hence is defined in genesis and not under consensus, where PrivateValidator (currently inherited from Tendermint) is.

type GenesisValidator

type GenesisValidator struct {
	PubKey   crypto.PubKey  `json:"pub_key"`
	Amount   int64          `json:"amount"`
	Name     string         `json:"name"`
	UnbondTo []BasicAccount `json:"unbond_to"`
}

func NewGenesisValidator

func NewGenesisValidator(amount int64, name string, unbondToAddress []byte,
	unbondAmount int64, keyType string, publicKeyBytes []byte) (*GenesisValidator, error)

func (*GenesisValidator) Clone

func (genesisValidator *GenesisValidator) Clone() (GenesisValidator, error)

Clone clones the genesis validator

Jump to

Keyboard shortcuts

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