burrow: github.com/hyperledger/burrow/genesis Index | Files | Directories

package genesis

import "github.com/hyperledger/burrow/genesis"

Index

Package Files

deterministic_genesis.go genesis.go

Constants

const DefaultProposalThreshold uint64 = 3
const ShortHashSuffixBytes = 3

How many bytes to take from the front of the GenesisDoc hash to append to the ChainName to form the ChainID. The idea is to avoid some classes of replay attack between chains with the same name.

Variables

var DefaultPermissionsAccount = PermissionsAccount(permission.DefaultAccountPermissions)

func NewDeterministicGenesis Uses

func NewDeterministicGenesis(seed int64) *deterministicGenesis

Generates deterministic pseudo-random genesis state

func PermissionsAccount Uses

func PermissionsAccount(globalPerms permission.AccountPermissions) *acm.Account

type Account Uses

type Account struct {
    BasicAccount
    Name        string
    Permissions permission.AccountPermissions
}

func GenesisAccountFromAccount Uses

func GenesisAccountFromAccount(name string, account *acm.Account) Account

func (*Account) AcmAccount Uses

func (genesisAccount *Account) AcmAccount() *acm.Account

func (*Account) Clone Uses

func (genesisAccount *Account) Clone() Account

Clone clones the genesis account

type BasicAccount Uses

type BasicAccount struct {
    // Address is convenient to have in file for reference, but otherwise ignored since derived from PublicKey
    Address   crypto.Address
    PublicKey crypto.PublicKey
    Amount    uint64
}

func (*BasicAccount) Clone Uses

func (basicAccount *BasicAccount) Clone() BasicAccount

Clone clones the basic account

type GenesisDoc Uses

type GenesisDoc struct {
    GenesisTime       time.Time
    ChainName         string
    AppHash           binary.HexBytes `json:",omitempty" toml:",omitempty"`
    Params            params          `json:",omitempty" toml:",omitempty"`
    Salt              []byte          `json:",omitempty" toml:",omitempty"`
    GlobalPermissions permission.AccountPermissions
    Accounts          []Account
    Validators        []Validator
    // contains filtered or unexported fields
}

func GenesisDocFromJSON Uses

func GenesisDocFromJSON(jsonBlob []byte) (*GenesisDoc, error)

func MakeGenesisDocFromAccounts Uses

func MakeGenesisDocFromAccounts(chainName string, salt []byte, genesisTime time.Time, accounts map[string]*acm.Account,
    validators map[string]*validator.Validator) *GenesisDoc

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

func (*GenesisDoc) ChainID Uses

func (genesisDoc *GenesisDoc) ChainID() string

func (*GenesisDoc) GlobalPermissionsAccount Uses

func (genesisDoc *GenesisDoc) GlobalPermissionsAccount() *acm.Account

func (*GenesisDoc) Hash Uses

func (genesisDoc *GenesisDoc) Hash() []byte

func (*GenesisDoc) JSONBytes Uses

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

JSONBytes returns the JSON canonical bytes for a given GenesisDoc or an error.

func (*GenesisDoc) JSONString Uses

func (genesisDoc *GenesisDoc) JSONString() string

func (*GenesisDoc) ShortHash Uses

func (genesisDoc *GenesisDoc) ShortHash() []byte

type Validator Uses

type Validator struct {
    BasicAccount
    Name     string
    UnbondTo []BasicAccount
}

func (*Validator) Clone Uses

func (gv *Validator) Clone() Validator

Clone clones the genesis validator

func (*Validator) Validator Uses

func (gv *Validator) Validator() validator.Validator

Directories

PathSynopsis
spec

Package genesis imports 11 packages (graph) and is imported by 66 packages. Updated 2020-05-03. Refresh now. Tools for package owners.