genesis

package
v0.0.0-...-f798b02 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2020 License: LGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileName       = "genesis.json"
	InitGasLimit   = 4700000
	InitDifficulty = 1
)

Variables

This section is empty.

Functions

func New

func New(options ...Option) *core.Genesis

func NewFile

func NewFile(isSmilo bool, options ...Option) string

func NewFileAt

func NewFileAt(dir string, isSmilo bool, options ...Option) string

func Save

func Save(dataDir string, genesis *core.Genesis, isSmilo bool) error

Types

type Option

type Option func(*core.Genesis)

func Alloc

func Alloc(addrs []common.Address, balance *big.Int) Option

func Fullnodes

func Fullnodes(addrs ...common.Address) Option

func GasLimit

func GasLimit(limit uint64) Option

type SmiloChainConfig

type SmiloChainConfig struct {
	*params.ChainConfig
	IsSmilo       bool `json:"isSmilo,omitempty"`
	IsGas         bool `json:"isGas,omitempty"`
	IsGasRefunded bool `json:"isGasRefunded,omitempty"`
}

type SmiloGenesis

type SmiloGenesis struct {
	Config     *SmiloChainConfig `json:"config"`
	Nonce      uint64            `json:"nonce"`
	Timestamp  uint64            `json:"timestamp"`
	ExtraData  []byte            `json:"extraData"`
	GasLimit   uint64            `json:"gasLimit"   gencodec:"required"`
	Difficulty *big.Int          `json:"difficulty" gencodec:"required"`
	Mixhash    common.Hash       `json:"mixHash"`
	Coinbase   common.Address    `json:"coinbase"`
	Alloc      core.GenesisAlloc `json:"alloc"      gencodec:"required"`

	// These fields are used for consensus tests. Please don't use them
	// in actual genesis blocks.
	Number     uint64      `json:"number"`
	GasUsed    uint64      `json:"gasUsed"`
	ParentHash common.Hash `json:"parentHash"`
}

func ToSmilo

func ToSmilo(g *core.Genesis, isSmilo bool) *SmiloGenesis

ToSmilo converts standard genesis to smilo genesis

func (SmiloGenesis) MarshalJSON

func (s SmiloGenesis) MarshalJSON() ([]byte, error)

MarshalJSON marshals as JSON.

func (*SmiloGenesis) UnmarshalJSON

func (s *SmiloGenesis) UnmarshalJSON(input []byte) error

UnmarshalJSON unmarshals from JSON.

Jump to

Keyboard shortcuts

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