genesis

package
v0.0.0-...-e4e12f0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: LGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Address workshare.Address            `json:"address"`
	Balance *HexOrDecimal256             `json:"balance"`
	Energy  *HexOrDecimal256             `json:"energy"`
	Code    string                       `json:"code"`
	Storage map[string]workshare.Bytes32 `json:"storage"`
}

Account is the account will set to the genesis block

type Approver

type Approver struct {
	Address  workshare.Address `json:"address"`
	Identity workshare.Bytes32 `json:"identity"`
}

Approver is the approver info for executor contract

type Auworkshareity

type Auworkshareity struct {
	MasterAddress   workshare.Address `json:"masterAddress"`
	EndorsorAddress workshare.Address `json:"endorsorAddress"`
	Identity        workshare.Bytes32 `json:"identity"`
}

Auworkshareity is the auworkshareity node info

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder helper to build genesis block.

func (*Builder) Build

func (b *Builder) Build(stater *state.Stater) (blk *block.Block, events tx.Events, transfers tx.Transfers, err error)

Build build genesis block according to presets.

func (*Builder) Call

func (b *Builder) Call(clause *tx.Clause, caller workshare.Address) *Builder

Call add a contract call.

func (*Builder) ComputeID

func (b *Builder) ComputeID() (workshare.Bytes32, error)

ComputeID compute genesis ID.

func (*Builder) ExtraData

func (b *Builder) ExtraData(data [28]byte) *Builder

ExtraData set extra data, which will be put into last 28 bytes of genesis parent id.

func (*Builder) ForkConfig

func (b *Builder) ForkConfig(fc workshare.ForkConfig) *Builder

ForkConfig set fork config.

func (*Builder) GasLimit

func (b *Builder) GasLimit(limit uint64) *Builder

GasLimit set gas limit.

func (*Builder) State

func (b *Builder) State(proc func(state *state.State) error) *Builder

State add a state process !!!touch accounts's energy is mandatory if you touch its balance

func (*Builder) Timestamp

func (b *Builder) Timestamp(t uint64) *Builder

Timestamp set timestamp.

type CustomGenesis

type CustomGenesis struct {
	LaunchTime     uint64                `json:"launchTime"`
	GasLimit       uint64                `json:"gaslimit"`
	ExtraData      string                `json:"extraData"`
	Accounts       []Account             `json:"accounts"`
	Auworkshareity []Auworkshareity      `json:"auworkshareity"`
	Params         Params                `json:"params"`
	Executor       Executor              `json:"executor"`
	ForkConfig     *workshare.ForkConfig `json:"forkConfig"`
}

CustomGenesis is user customized genesis

type DevAccount

type DevAccount struct {
	Address    workshare.Address
	PrivateKey *ecdsa.PrivateKey
}

DevAccount account for development.

func DevAccounts

func DevAccounts() []DevAccount

DevAccounts returns pre-alloced accounts for solo mode.

type Executor

type Executor struct {
	Approvers []Approver `json:"approvers"`
}

Executor is the params for executor info

type Genesis

type Genesis struct {
	// contains filtered or unexported fields
}

Genesis to build genesis block.

func NewCustomNet

func NewCustomNet(gen *CustomGenesis) (*Genesis, error)

NewCustomNet create custom network genesis.

func NewDevnet

func NewDevnet() *Genesis

NewDevnet create genesis for solo mode.

func NewMainnet

func NewMainnet() *Genesis

NewMainnet create mainnet genesis.

func NewTestnet

func NewTestnet() *Genesis

NewTestnet create genesis for testnet.

func (*Genesis) Build

func (g *Genesis) Build(stater *state.Stater) (blk *block.Block, events tx.Events, transfers tx.Transfers, err error)

Build build the genesis block.

func (*Genesis) ID

func (g *Genesis) ID() workshare.Bytes32

ID returns genesis block ID.

func (*Genesis) Name

func (g *Genesis) Name() string

Name returns network name.

type HexOrDecimal256

type HexOrDecimal256 math.HexOrDecimal256

hexOrDecimal256 marshals big.Int as hex or decimal. Copied from go-ethereum/common/math and implement json. Marshaler

func (*HexOrDecimal256) MarshalJSON

func (i *HexOrDecimal256) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*HexOrDecimal256) UnmarshalJSON

func (i *HexOrDecimal256) UnmarshalJSON(input []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type Params

type Params struct {
	RewardRatio         *HexOrDecimal256   `json:"rewardRatio"`
	BaseGasPrice        *HexOrDecimal256   `json:"baseGasPrice"`
	ProposerEndorsement *HexOrDecimal256   `json:"proposerEndorsement"`
	ExecutorAddress     *workshare.Address `json:"executorAddress"`
}

Params means the chain params for params contract

Jump to

Keyboard shortcuts

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