Documentation
¶
Index ¶
- Constants
- Variables
- type Account
- type Approver
- type Authority
- type Builder
- func (b *Builder) Build(stater *state.Stater) (blk *block.Block, events tx.Events, transfers tx.Transfers, err error)
- func (b *Builder) Call(clause *tx.Clause, caller thor.Address) *Builder
- func (b *Builder) ComputeID() (thor.Bytes32, error)
- func (b *Builder) ExtraData(data [28]byte) *Builder
- func (b *Builder) ForkConfig(fc *thor.ForkConfig) *Builder
- func (b *Builder) GasLimit(limit uint64) *Builder
- func (b *Builder) PostCallState(f func(state *state.State) error) *Builder
- func (b *Builder) State(proc func(state *state.State) error) *Builder
- func (b *Builder) Timestamp(t uint64) *Builder
- type CustomGenesis
- type DevAccount
- type DevConfig
- type Executor
- type Genesis
- type HexOrDecimal256
- type Params
- type Validator
Constants ¶
const ( // DefaultDevnetLaunchTime is the default genesis timestamp for devnet. // Wed May 16 2018 00:00:00 GMT+0800 (CST) DefaultDevnetLaunchTime = uint64(1526400000) // InitialDevAccountBalance is 1 billion VET in wei (1e27). InitialDevAccountBalance = "1000000000000000000000000000" )
Variables ¶
var DefaultHayabusaTP = uint32(0)
DefaultHayabusaTP is the default Hayabusa transition period (0 = immediate PoS).
var SoloConfig = thor.Config{ LowStakingPeriod: 12, MediumStakingPeriod: 30, HighStakingPeriod: 90, CooldownPeriod: 12, HayabusaTP: &DefaultHayabusaTP, }
SoloConfig is the default configuration for solo/dev mode. Uses short staking periods for faster testing.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
Address thor.Address `json:"address"`
Balance *HexOrDecimal256 `json:"balance"`
Energy *HexOrDecimal256 `json:"energy"`
Code string `json:"code"`
Storage map[string]thor.Bytes32 `json:"storage"`
}
Account is the account will set to the genesis block
type Approver ¶
type Approver struct {
Address thor.Address `json:"address"`
Identity thor.Bytes32 `json:"identity"`
}
Approver is the approver info for executor contract
type Authority ¶
type Authority struct {
MasterAddress thor.Address `json:"masterAddress"`
EndorsorAddress thor.Address `json:"endorsorAddress"`
Identity thor.Bytes32 `json:"identity"`
}
Authority is the authority 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) ExtraData ¶
ExtraData set extra data, which will be put into last 28 bytes of genesis parent id.
func (*Builder) ForkConfig ¶
func (b *Builder) ForkConfig(fc *thor.ForkConfig) *Builder
ForkConfig set fork config.
func (*Builder) PostCallState ¶ added in v2.4.0
PostCallState executes state changes after the contract calls
type CustomGenesis ¶
type CustomGenesis struct {
LaunchTime uint64 `json:"launchTime"`
GasLimit uint64 `json:"gaslimit"`
ExtraData string `json:"extraData"`
Accounts []Account `json:"accounts"`
Authority []Authority `json:"authority"`
Stakers []Validator `json:"stakers"`
Params Params `json:"params"`
Executor Executor `json:"executor"`
ForkConfig *thor.ForkConfig `json:"forkConfig"`
Config *thor.Config `json:"config"`
}
CustomGenesis is user customized genesis
type DevAccount ¶
type DevAccount struct {
Address thor.Address
PrivateKey *ecdsa.PrivateKey
}
DevAccount account for development.
func DevAccounts ¶
func DevAccounts() []DevAccount
DevAccounts returns pre-alloced accounts for solo mode.
type DevConfig ¶ added in v2.3.0
type DevConfig struct {
ForkConfig *thor.ForkConfig
BaseGasPrice *big.Int
LaunchTime uint64
Config *thor.Config
GasLimit uint64
}
Config for the devnet network, to be extended by our needs
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 block
func NewCustomNetWithName ¶ added in v2.4.1
func NewCustomNetWithName(gen *CustomGenesis, name string) (*Genesis, error)
NewCustomNetWithName create custom network genesis block with given name
func NewDevnet ¶
func NewDevnet() (*Genesis, *thor.ForkConfig)
func NewDevnetWithConfig ¶ added in v2.2.0
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 *thor.Address `json:"executorAddress"`
MaxBlockProposers *uint64 `json:"maxBlockProposers"`
DelegatorContract *thor.Address `json:"delegatorContract"`
CurveFactor *uint64 `json:"curveFactor"`
StakerSwitches *uint8 `json:"stakerSwitches"`
RewardPercentage *uint8 `json:"validatorRewardPercentage"`
}
Params means the chain params for params contract