genesis

package
v0.0.0-...-ee306bc Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(config *Config) (sealed *chain.SignedBlock, err error)

Init - Initializes a new chain.

Types

type Config

type Config struct {
	// Wallet - Wallet to use for genesis.
	// Default wallet is used if empty.
	Wallet *wallet.Wallet

	// Power - Initial power distribution.
	Power []*Distribution

	// Database - State database to use.
	Database *trie.Database
}

Config - Genesis config.

func (*Config) Assign

func (config *Config) Assign(power *Distribution)

Assign - Assign power distribution.

func (*Config) WalletKeys

func (config *Config) WalletKeys() (keys []string)

WalletKeys - Unique wallet keys requiring unlocking.

type Distribution

type Distribution struct {
	// Address - Usually public key hash.
	Address *cells.CID

	// WalletKeyPath - Wallet key path.
	WalletKeyPath *wallet.KeyPath

	// AssignQuantity - Quantity of power to assign.
	AssignQuantity uint64

	// DelegateQuantity - Quantity of power to delegate.
	// Only possible if wallet key path is set.
	DelegateQuantity uint64
}

Distribution - Genesis power distribution.

func MustParsePowerString

func MustParsePowerString(keyPath string) (res *Distribution)

MustParsePowerString - Parses power distribution string. Panics on error.

func ParsePowerString

func ParsePowerString(keyPath string) (res *Distribution, err error)

ParsePowerString - Parses power distribution string.

Following formats are allowed:

  • `<wallet-key-path>:<assign-power>:<delegate-power>`
  • `<pubkeyhash-addr>:<assign-power>`

If delegate value is `-1` it's equal to assign power.

Jump to

Keyboard shortcuts

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