Documentation ¶
Index ¶
Constants ¶
const ( BlockInterval uint64 = 10 // time interval between two consecutive blocks. TxGas uint64 = 5000 ClauseGas uint64 = params.TxGas - TxGas ClauseGasContractCreation uint64 = params.TxGasContractCreation - TxGas MinGasLimit uint64 = 1000 * 1000 InitialGasLimit uint64 = 10 * 1000 * 1000 // InitialGasLimit gas limit value int genesis block. GasLimitBoundDivisor uint64 = 1024 // from ethereum GetBalanceGas uint64 = 400 //EIP158 gas table SloadGas uint64 = 200 // EIP158 gas table SstoreSetGas uint64 = params.SstoreSetGas SstoreResetGas uint64 = params.SstoreResetGas MaxTxWorkDelay uint32 = 30 // (unit: block) if tx delay exceeds this value, no energy can be exchanged. MaxBlockProposers uint64 = 101 TolerableBlockPackingTime = 2 * time.Second // the indicator to adjust target block gas limit MaxBackTrackingBlockNumber = 65535 )
Constants of block chain.
const ( // AddressLength length of address in bytes. AddressLength = common.AddressLength )
Variables ¶
var ( KeyExecutorAddress = BytesToBytes32([]byte("executor")) KeyRewardRatio = BytesToBytes32([]byte("reward-ratio")) KeyBaseGasPrice = BytesToBytes32([]byte("base-gas-price")) KeyProposerEndorsement = BytesToBytes32([]byte("proposer-endorsement")) InitialRewardRatio = big.NewInt(3e17) // 30% InitialBaseGasPrice = big.NewInt(1e15) InitialProposerEndorsement = new(big.Int).Mul(big.NewInt(1e18), big.NewInt(25000000)) EnergyGrowthRate = big.NewInt(5000000000) // WEI POWERPLAY per token(PMK) per second. about 0.000325 POWERPLAY per token per day. )
Keys of governance params.
var NoFork = ForkConfig{ FixTransferLog: math.MaxUint32, }
NoFork a special config without any forks.
Functions ¶
func EstimateBloomK ¶
EstimateBloomK estimate k(num of hash funcs) according to item count.
Types ¶
type Address ¶
Address address of account.
func BytesToAddress ¶
BytesToAddress converts bytes slice into address. If b is larger than address legnth, b will be cropped (from the left). If b is smaller than address length, b will be extended (from the left).
func CreateContractAddress ¶
CreateContractAddress to generate contract address according to tx id, clause index and contract creation count.
func MustParseAddress ¶
MustParseAddress convert string presented address into Address type, panic on error.
func ParseAddress ¶
ParseAddress convert string presented address into Address type.
func (*Address) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Address) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type Bytes32 ¶
type Bytes32 [32]byte
Bytes32 array of 32 bytes.
func BytesToBytes32 ¶
BytesToBytes32 converts bytes slice into Bytes32. If b is larger than Bytes32 legnth, b will be cropped (from the left). If b is smaller than Bytes32 length, b will be extended (from the left).
func MustParseBytes32 ¶
MustParseBytes32 convert string presented into Bytes32 type, panic on error.
func ParseBytes32 ¶
ParseBytes32 convert string presented into Bytes32 type
func (Bytes32) AbbrevString ¶
AbbrevString returns abbrev string presentation.
func (*Bytes32) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Bytes32) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type ForkConfig ¶
type ForkConfig struct {
FixTransferLog uint32
}
ForkConfig config for a fork.
func GetForkConfig ¶
func GetForkConfig(genesisID Bytes32) ForkConfig
GetForkConfig get fork config for given genesis ID.
func (ForkConfig) String ¶
func (fc ForkConfig) String() string