Documentation ¶
Index ¶
- Constants
- Variables
- func DAODrainList() []common.Address
- func VersionWithCommit(gitCommit string) string
- type ChainConfig
- func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64) *ConfigCompatError
- func (c *ChainConfig) GasTable(num *big.Int) GasTable
- func (c *ChainConfig) IsByzantium(num *big.Int) bool
- func (c *ChainConfig) IsEIP150(num *big.Int) bool
- func (c *ChainConfig) IsEIP155(num *big.Int) bool
- func (c *ChainConfig) IsEIP158(num *big.Int) bool
- func (c *ChainConfig) IsHomestead(num *big.Int) bool
- func (c *ChainConfig) Rules(num *big.Int) Rules
- func (c *ChainConfig) String() string
- type ConfigCompatError
- type EthashConfig
- type GasTable
- type Rules
Constants ¶
const ( // These are the multipliers for ether denominations. // Example: To get the wei value of an amount in 'douglas', use // // new(big.Int).Mul(value, big.NewInt(params.Douglas)) // Wei = 1 Ada = 1e3 Babbage = 1e6 Shannon = 1e9 Szabo = 1e12 Finney = 1e15 Ether = 1e18 Einstein = 1e21 Douglas = 1e42 )
const ( MaximumExtraDataSize uint64 = 32 // Maximum size extra data may be after Genesis. ExpByteGas uint64 = 2 // Times ceil(log256(exponent)) for the EXP instruction. SloadGas uint64 = 12 // Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added. CallValueTransferGas uint64 = 2000 // Paid for CALL when the value transfer is non-zero. CallNewAccountGas uint64 = 6000 // Paid for CALL when the destination address didn't exist prior. TxGas uint64 = 5000 // Per transaction not creating a contract. NOTE: Not payable on data of calls between transactions. TxGasContractCreation uint64 = 10000 // Per transaction that creates a contract. NOTE: Not payable on data of calls between transactions. TxDataZeroGas uint64 = 1 // Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions. QuadCoeffDiv uint64 = 512 // Divisor for the quadratic particle of the memory cost equation. SstoreSetGas uint64 = 5000 // Once per SLOAD operation. LogDataGas uint64 = 2 // Per byte in a LOG* operation's data. CallStipend uint64 = 600 // Free gas given at beginning of call. Sha3Gas uint64 = 8 // Once per SHA3 operation. Sha3WordGas uint64 = 2 // Once per word of the SHA3 operation's data. SstoreResetGas uint64 = 1200 // Once per SSTORE operation if the zeroness changes from zero. SstoreClearGas uint64 = 1200 // Once per SSTORE operation if the zeroness doesn't change. SstoreRefundGas uint64 = 3000 // Once per SSTORE operation if the zeroness changes to zero. JumpdestGas uint64 = 1 // Refunded gas, once per SSTORE operation if the zeroness changes to zero. EpochDuration uint64 = 30000 // Duration between proof-of-work epochs. CallGas uint64 = 10 // Once per CALL operation & message call transaction. CreateDataGas uint64 = 50 // CallCreateDepth uint64 = 1024 // Maximum depth of call/create stack. ExpGas uint64 = 3 // Once per EXP instruction LogGas uint64 = 80 // Per LOG* operation. CopyGas uint64 = 1 // StackLimit uint64 = 1024 // Maximum size of VM stack allowed. TierStepGas uint64 = 0 // Once per operation, for a selection of them. LogTopicGas uint64 = 80 // Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas. CreateGas uint64 = 8000 // Once per CREATE operation & contract-creation transaction. SuicideRefundGas uint64 = 6000 // Refunded following a suicide operation. MemoryGas uint64 = 1 // Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL. TxDataNonZeroGas uint64 = 20 // Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions. MaxCodeSize = 196608 // Maximum bytecode to permit for a contract EcrecoverGas uint64 = 800 // Elliptic curve sender recovery gas price Sha256BaseGas uint64 = 15 // Base price for a SHA256 operation Sha256PerWordGas uint64 = 3 // Per-word price for a SHA256 operation Ripemd160BaseGas uint64 = 150 // Base price for a RIPEMD160 operation Ripemd160PerWordGas uint64 = 30 // Per-word price for a RIPEMD160 operation IdentityBaseGas uint64 = 4 // Base price for a data copy operation IdentityPerWordGas uint64 = 1 // Per-work price for a data copy operation ModExpQuadCoeffDiv uint64 = 20 // Divisor for the quadratic particle of the big int modular exponentiation Bn256AddGas uint64 = 120 // Gas needed for an elliptic curve addition Bn256ScalarMulGas uint64 = 10000 // Gas needed for an elliptic curve scalar multiplication Bn256PairingBaseGas uint64 = 25000 // Base price for an elliptic curve pairing check Bn256PairingPerPointGas uint64 = 20000 // Per-point price for an elliptic curve pairing check )
const ( VersionMajor = 1 // Major version component of the current release VersionMinor = 1 // Minor version component of the current release VersionPatch = 3 // Patch version component of the current release VersionMeta = "stable" // Version metadata to append to the version string )
const ( // BloomBitsBlocks is the number of blocks a single bloom bit section vector // contains. BloomBitsBlocks uint64 = 4096 )
Variables ¶
var ( MainnetGenesisHash = common.HexToHash("0xc842bc77b01cb94f014e95e41dbcd62e199ae9576163a1e18c70c11d50c7f6e5") // Mainnet genesis hash to enforce below configs on TestnetGenesisHash = common.HexToHash("0x5dd82c73e5a6ecda153ce43948a9100e5df6c8b1cc2bf80a42cb09567254e1e6") // Testnet genesis hash to enforce below configs on )
var ( // MainnetChainConfig is the chain parameters to run a node on the main network. MainnetChainConfig = &ChainConfig{ ChainId: big.NewInt(16), HomesteadBlock: big.NewInt(1), EIP150Block: big.NewInt(2), EIP150Hash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), EIP155Block: big.NewInt(3), EIP158Block: big.NewInt(3), ByzantiumBlock: big.NewInt(4), Ethash: new(EthashConfig), } // TestnetChainConfig contains the chain parameters to run a node on the Ropsten test network. TestnetChainConfig = &ChainConfig{ ChainId: big.NewInt(17), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), EIP150Hash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), EIP155Block: big.NewInt(10), EIP158Block: big.NewInt(10), ByzantiumBlock: big.NewInt(20), Ethash: new(EthashConfig), } // RinkebyChainConfig contains the chain parameters to run a node on the Rinkeby test network. RinkebyChainConfig = &ChainConfig{ ChainId: big.NewInt(18), HomesteadBlock: big.NewInt(1), EIP150Block: big.NewInt(2), EIP150Hash: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), EIP155Block: big.NewInt(3), EIP158Block: big.NewInt(3), ByzantiumBlock: big.NewInt(20), } // AllProtocolChanges contains every protocol change (EIPs) // introduced and accepted by the Wtc core developers. // // This configuration is intentionally not using keyed fields. // This configuration must *always* have all forks enabled, which // means that all fields must be set at all times. This forces // anyone adding flags to the config to also have to set these // fields. AllProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), new(EthashConfig)} TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), new(EthashConfig)} TestRules = TestChainConfig.Rules(new(big.Int)) )
var ( // GasTableHomestead contain the gas prices for // the homestead phase. GasTableHomestead = GasTable{ ExtcodeSize: 20, ExtcodeCopy: 20, Balance: 20, SLoad: 50, Calls: 40, Suicide: 0, ExpByte: 10, } // GasTableHomestead contain the gas re-prices for // the homestead phase. GasTableEIP150 = GasTable{ ExtcodeSize: 700, ExtcodeCopy: 700, Balance: 400, SLoad: 200, Calls: 700, Suicide: 5000, ExpByte: 10, CreateBySuicide: 25000, } GasTableEIP158 = GasTable{ ExtcodeSize: 700, ExtcodeCopy: 700, Balance: 400, SLoad: 200, Calls: 700, Suicide: 5000, ExpByte: 50, CreateBySuicide: 25000, } )
var ( GasLimitBoundDivisor = big.NewInt(2048) // The bound divisor of the gas limit, used in update calculations. MinGasLimit = big.NewInt(78000000000) // Minimum the gas limit may ever be. GenesisGasLimit = big.NewInt(78000000000) // Gas limit of the Genesis block. TargetGasLimit = new(big.Int).Set(GenesisGasLimit) // The artificial target DifficultyBoundDivisor = big.NewInt(2048) // The bound divisor of the difficulty, used in the update calculations. GenesisDifficulty = big.NewInt(131072) // Difficulty of the Genesis block. MinimumDifficulty = big.NewInt(131072) // The minimum that the difficulty may ever be. DurationLimit = big.NewInt(6) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not. // MinGasFloorCreateContract = big.NewInt(50) // The floor of gas to create contract. add by disy.yin disy.yin@gmail.com 2018-12-10 AddedRewardForMN = big.NewInt(5000) // added reward for MN POSPhaseOneBalance = big.NewInt(5000000000) // 5000.000000 WTC POSPhaseTwoBalance = big.NewInt(500000000000) // 500000.000000 WTC HardForkV1 = big.NewInt(149500) // HardForkV1 fork 149500 HardForkV2 = big.NewInt(175366) // HardForkV2 fork 175366 HardForkV2diff = big.NewInt(4332176356141) // HardForkV2 fork difficulty HardForkV3 = big.NewInt(221500) // HardForkV3 fork MinGasLimitV3 = big.NewInt(150000000) // Minimum the gas limit may ever be. TargetGasLimitV3 = big.NewInt(150000000) // The artificial target )
var DAOForkBlockExtra = common.FromHex("0x64616f2d686172642d666f726b")
DAOForkBlockExtra is the block header extra-data field to set for the DAO fork point and a number of consecutive blocks to allow fast/light syncers to correctly pick the side they want ("dao-hard-fork").
var DAOForkExtraRange = big.NewInt(10)
DAOForkExtraRange is the number of consecutive blocks from the DAO fork point to override the extra-data in to prevent no-fork attacks.
var DAORefundContract = common.HexToAddress("0xbf4ed7b27f1d666546e30d74d50d173d20bca754")
DAORefundContract is the address of the refund contract to send DAO balances to.
var DiscoveryV5Bootnodes = []string{}
DiscoveryV5Bootnodes are the enode URLs of the P2P bootstrap nodes for the experimental RLPx v5 topic-discovery network.
var MainnetBootnodes = []string{
"enode://e1adaa6427fa63b7440f03188ab2f2e894593f41727a799d05bb08542b185412b96aca0af115d9b5e7628a94b1ce20ae2a30362fe95409ccaa03c7c12faf2d67@27.102.130.163:10101",
"enode://bc75d1861480101805e2f9277543421c45821dfeb26a19f64a899e7752135f624b7e72374086dbbdeac346ee85302db33ae67b357758bfa390474938353e7429@47.88.226.40:10101",
"enode://9bf63165d038b4739db680fbb510e9596164b0fc65f19bf53d15c112b485b09328f6c63925a3cfc5aff5ff44d5f8eecd1ec72a26c746a3d34fa20aa944996730@47.88.62.219:10101",
"enode://aaaae77d11539c63d16c43dbc35734a255e9f97676241d866135a50afe40acc54d566f61c657d152b5caa9039fe9a076ac24d8ad01abd57cc4571279806a9a82@45.76.135.125:10101",
"enode://cc9c8e97a669cce1af7d3e9acf8c7bf51505334abda1581a2a7cf811290ee7cdc91971561b3261b7560ec1919b30ea7c74239dbaee2bafce6d6b4b319fe5ab05@208.167.249.242:10101",
"enode://6559b12fda8f90242236e43afe5fe978b822467074260f7f6583d01fb0d31de7db87aa776d3c6f25f1b0bf42f3415641943ea7fae0af0c5b78647a29c3d69168@209.250.237.179:10101",
"enode://18fb4bbd45745468ff6a89375aa33687aa205741092f62c858c999a2df6ef9156d94585e4cfa0dd17a9c5d949a1f583d8bd7c75e591b6571161937c9e39d81ff@47.95.205.144:10101",
"enode://7248a6f713007c575e4de3fbf7bc2f8595ad1e974003591b2d216b75bd4ddfeb6e55b56d0fbda89d703e2c5da31a837d91b4ce9b77b0ed7a930a0826150bab08@47.111.4.61:10101",
"enode://0a36aac3e150d251dedb71164b0efd10fb13c2b140f0102b3b24d0f58ea8d894879d47f70012cc7d0041f4ae4fa624709872e598996e41cbaea218c24752c480@47.112.118.220:10101",
}
MainnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the main Wtc network.
var RinkebyBootnodes = []string{}
RinkebyBootnodes are the enode URLs of the P2P bootstrap nodes running on the Rinkeby test network.
var RinkebyV5Bootnodes = []string{}
RinkebyV5Bootnodes are the enode URLs of the P2P bootstrap nodes running on the Rinkeby test network for the experimental RLPx v5 topic-discovery network.
var TestnetBootnodes = []string{}
TestnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the Ropsten test network.
var Version = func() string { v := fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch) if VersionMeta != "" { v += "-" + VersionMeta } return v }()
Version holds the textual version string.
Functions ¶
func DAODrainList ¶
DAODrainList is the list of accounts whose full balances will be moved into a refund contract at the beginning of the dao-fork block.
func VersionWithCommit ¶
Types ¶
type ChainConfig ¶
type ChainConfig struct { ChainId *big.Int `json:"chainId"` // Chain id identifies the current chain and is used for replay protection HomesteadBlock *big.Int `json:"homesteadBlock,omitempty"` // Homestead switch block (nil = no fork, 0 = already homestead) // EIP150 implements the Gas price changes (https://github.com/wtc/EIPs/issues/150) EIP150Block *big.Int `json:"eip150Block,omitempty"` // EIP150 HF block (nil = no fork) EIP150Hash common.Hash `json:"eip150Hash,omitempty"` // EIP150 HF hash (fast sync aid) EIP155Block *big.Int `json:"eip155Block,omitempty"` // EIP155 HF block EIP158Block *big.Int `json:"eip158Block,omitempty"` // EIP158 HF block ByzantiumBlock *big.Int `json:"byzantiumBlock,omitempty"` // Byzantium switch block (nil = no fork, 0 = alraedy on homestead) // Various consensus engines Ethash *EthashConfig `json:"ethash,omitempty"` }
ChainConfig is the core config which determines the blockchain settings.
ChainConfig is stored in the database on a per block basis. This means that any network, identified by its genesis block, can have its own set of configuration options.
func (*ChainConfig) CheckCompatible ¶
func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64) *ConfigCompatError
CheckCompatible checks whether scheduled fork transitions have been imported with a mismatching chain configuration.
func (*ChainConfig) GasTable ¶
func (c *ChainConfig) GasTable(num *big.Int) GasTable
GasTable returns the gas table corresponding to the current phase (homestead or homestead reprice).
The returned GasTable's fields shouldn't, under any circumstances, be changed.
func (*ChainConfig) IsByzantium ¶
func (c *ChainConfig) IsByzantium(num *big.Int) bool
func (*ChainConfig) IsHomestead ¶
func (c *ChainConfig) IsHomestead(num *big.Int) bool
IsHomestead returns whether num is either equal to the homestead block or greater.
func (*ChainConfig) String ¶
func (c *ChainConfig) String() string
String implements the fmt.Stringer interface.
type ConfigCompatError ¶
type ConfigCompatError struct { What string // block numbers of the stored and new configurations StoredConfig, NewConfig *big.Int // the block number to which the local chain must be rewound to correct the error RewindTo uint64 }
ConfigCompatError is raised if the locally-stored blockchain is initialised with a ChainConfig that would alter the past.
func (*ConfigCompatError) Error ¶
func (err *ConfigCompatError) Error() string
type EthashConfig ¶
type EthashConfig struct{}
EthashConfig is the consensus engine configs for proof-of-work based sealing.
func (*EthashConfig) String ¶
func (c *EthashConfig) String() string
String implements the stringer interface, returning the consensus engine details.
type GasTable ¶
type GasTable struct { ExtcodeSize uint64 ExtcodeCopy uint64 Balance uint64 SLoad uint64 Calls uint64 Suicide uint64 ExpByte uint64 // CreateBySuicide occurs when the // refunded account is one that does // not exist. This logic is similar // to call. May be left nil. Nil means // not charged. CreateBySuicide uint64 }
type Rules ¶
type Rules struct { ChainId *big.Int IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool IsByzantium bool }
Rules wraps ChainConfig and is merely syntatic sugar or can be used for functions that do not have or require information about the block.
Rules is a one time interface meaning that it shouldn't be used in between transition phases.