Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateGenesisFileBytes(chainName string, genesisAccounts []*GenesisAccount, ...) ([]byte, error)
- func GenerateKnown(chainID, accountsPathCSV, validatorsPathCSV string) (string, error)
- func GetGenesisFileBytes(genesisDoc *GenesisDoc) ([]byte, error)
- type BasicAccount
- type GenesisAccount
- type GenesisDoc
- type GenesisParams
- type GenesisPrivateValidator
- type GenesisValidator
Constants ¶
const ( PublicKeyEd25519ByteLength int = 32 PublicKeySecp256k1ByteLength int = 64 )
Variables ¶
var GenDocKey = []byte("GenDocKey")
Functions ¶
func GenerateGenesisFileBytes ¶
func GenerateGenesisFileBytes(chainName string, genesisAccounts []*GenesisAccount, genesisValidators []*GenesisValidator) ([]byte, error)
func GenerateKnown ¶
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 ¶
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 (*GenesisValidator) Clone ¶
func (genesisValidator *GenesisValidator) Clone() (GenesisValidator, error)
Clone clones the genesis validator