Documentation ¶
Index ¶
- Constants
- Variables
- func ArchiveVersion(gitCommit string) string
- func ClearVerkleWitnessCosts()
- func VersionWithCommit(gitCommit, gitDate string) string
- type ChainConfig
- func (c *ChainConfig) BaseFeeChangeDenominator() uint64
- func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64, time uint64) *ConfigCompatError
- func (c *ChainConfig) CheckConfigForkOrder() error
- func (c *ChainConfig) Description() string
- func (c *ChainConfig) ElasticityMultiplier() uint64
- func (c *ChainConfig) IsArrowGlacier(num *big.Int) bool
- func (c *ChainConfig) IsBerlin(num *big.Int) bool
- func (c *ChainConfig) IsByzantium(num *big.Int) bool
- func (c *ChainConfig) IsCancun(num *big.Int, time uint64) bool
- func (c *ChainConfig) IsConstantinople(num *big.Int) bool
- func (c *ChainConfig) IsDAOFork(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) IsEIP4762(num *big.Int, time uint64) bool
- func (c *ChainConfig) IsGrayGlacier(num *big.Int) bool
- func (c *ChainConfig) IsHomestead(num *big.Int) bool
- func (c *ChainConfig) IsIstanbul(num *big.Int) bool
- func (c *ChainConfig) IsLondon(num *big.Int) bool
- func (c *ChainConfig) IsMuirGlacier(num *big.Int) bool
- func (c *ChainConfig) IsPetersburg(num *big.Int) bool
- func (c *ChainConfig) IsPrague(num *big.Int, time uint64) bool
- func (c *ChainConfig) IsShanghai(num *big.Int, time uint64) bool
- func (c *ChainConfig) IsTerminalPoWBlock(parentTotalDiff *big.Int, totalDiff *big.Int) bool
- func (c *ChainConfig) IsVerkle(num *big.Int, time uint64) bool
- func (c *ChainConfig) LatestFork(time uint64) forks.Fork
- func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules
- type CliqueConfig
- type ConfigCompatError
- type EthashConfig
- type Rules
Constants ¶
const ( Wei = 1 GWei = 1e9 Ether = 1e18 )
These are the multipliers for ether denominations. Example: To get the wei value of an amount in 'gwei', use
new(big.Int).Mul(value, big.NewInt(params.GWei))
const ( GasLimitBoundDivisor uint64 = 1024 // The bound divisor of the gas limit, used in update calculations. MinGasLimit uint64 = 5000 // Minimum the gas limit may ever be. MaxGasLimit uint64 = 0x7fffffffffffffff // Maximum the gas limit (2^63-1). GenesisGasLimit uint64 = 4712388 // Gas limit of the Genesis block. MaximumExtraDataSize uint64 = 32 // Maximum size extra data may be after Genesis. ExpByteGas uint64 = 10 // Times ceil(log256(exponent)) for the EXP instruction. SloadGas uint64 = 50 // Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added. CallValueTransferGas uint64 = 9000 // Paid for CALL when the value transfer is non-zero. CallNewAccountGas uint64 = 25000 // Paid for CALL when the destination address didn't exist prior. TxGas uint64 = 21000 // Per transaction not creating a contract. NOTE: Not payable on data of calls between transactions. TxGasContractCreation uint64 = 53000 // Per transaction that creates a contract. NOTE: Not payable on data of calls between transactions. TxDataZeroGas uint64 = 4 // 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. LogDataGas uint64 = 8 // Per byte in a LOG* operation's data. CallStipend uint64 = 2300 // Free gas given at beginning of call. Keccak256Gas uint64 = 30 // Once per KECCAK256 operation. Keccak256WordGas uint64 = 6 // Once per word of the KECCAK256 operation's data. InitCodeWordGas uint64 = 2 // Once per word of the init code when creating a contract. SstoreSetGas uint64 = 20000 // Once per SSTORE operation. SstoreResetGas uint64 = 5000 // Once per SSTORE operation if the zeroness changes from zero. SstoreClearGas uint64 = 5000 // Once per SSTORE operation if the zeroness doesn't change. SstoreRefundGas uint64 = 15000 // Once per SSTORE operation if the zeroness changes to zero. NetSstoreNoopGas uint64 = 200 // Once per SSTORE operation if the value doesn't change. NetSstoreInitGas uint64 = 20000 // Once per SSTORE operation from clean zero. NetSstoreCleanGas uint64 = 5000 // Once per SSTORE operation from clean non-zero. NetSstoreDirtyGas uint64 = 200 // Once per SSTORE operation from dirty. NetSstoreClearRefund uint64 = 15000 // Once per SSTORE operation for clearing an originally existing storage slot NetSstoreResetRefund uint64 = 4800 // Once per SSTORE operation for resetting to the original non-zero value NetSstoreResetClearRefund uint64 = 19800 // Once per SSTORE operation for resetting to the original zero value SstoreSentryGasEIP2200 uint64 = 2300 // Minimum gas required to be present for an SSTORE call, not consumed SstoreSetGasEIP2200 uint64 = 20000 // Once per SSTORE operation from clean zero to non-zero SstoreResetGasEIP2200 uint64 = 5000 // Once per SSTORE operation from clean non-zero to something else SstoreClearsScheduleRefundEIP2200 uint64 = 15000 // Once per SSTORE operation for clearing an originally existing storage slot ColdAccountAccessCostEIP2929 = uint64(2600) // COLD_ACCOUNT_ACCESS_COST ColdSloadCostEIP2929 = uint64(2100) // COLD_SLOAD_COST WarmStorageReadCostEIP2929 = uint64(100) // WARM_STORAGE_READ_COST // In EIP-2200: SstoreResetGas was 5000. // In EIP-2929: SstoreResetGas was changed to '5000 - COLD_SLOAD_COST'. // In EIP-3529: SSTORE_CLEARS_SCHEDULE is defined as SSTORE_RESET_GAS + ACCESS_LIST_STORAGE_KEY_COST // Which becomes: 5000 - 2100 + 1900 = 4800 SstoreClearsScheduleRefundEIP3529 uint64 = SstoreResetGasEIP2200 - ColdSloadCostEIP2929 + TxAccessListStorageKeyGas JumpdestGas uint64 = 1 // Once per JUMPDEST operation. EpochDuration uint64 = 30000 // Duration between proof-of-work epochs. CreateDataGas uint64 = 200 // CallCreateDepth uint64 = 1024 // Maximum depth of call/create stack. ExpGas uint64 = 10 // Once per EXP instruction LogGas uint64 = 375 // Per LOG* operation. CopyGas uint64 = 3 // StackLimit uint64 = 1024 // Maximum size of VM stack allowed. TierStepGas uint64 = 0 // Once per operation, for a selection of them. LogTopicGas uint64 = 375 // Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas. CreateGas uint64 = 32000 // Once per CREATE operation & contract-creation transaction. Create2Gas uint64 = 32000 // Once per CREATE2 operation CreateNGasEip4762 uint64 = 1000 // Once per CREATEn operations post-verkle SelfdestructRefundGas uint64 = 24000 // Refunded following a selfdestruct operation. MemoryGas uint64 = 3 // 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. TxDataNonZeroGasFrontier uint64 = 68 // Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions. TxDataNonZeroGasEIP2028 uint64 = 16 // Per byte of non zero data attached to a transaction after EIP 2028 (part in Istanbul) TxAccessListAddressGas uint64 = 2400 // Per address specified in EIP 2930 access list TxAccessListStorageKeyGas uint64 = 1900 // Per storage key specified in EIP 2930 access list // These have been changed during the course of the chain CallGasFrontier uint64 = 40 // Once per CALL operation & message call transaction. CallGasEIP150 uint64 = 700 // Static portion of gas for CALL-derivates after EIP 150 (Tangerine) BalanceGasFrontier uint64 = 20 // The cost of a BALANCE operation BalanceGasEIP150 uint64 = 400 // The cost of a BALANCE operation after Tangerine BalanceGasEIP1884 uint64 = 700 // The cost of a BALANCE operation after EIP 1884 (part of Istanbul) ExtcodeSizeGasFrontier uint64 = 20 // Cost of EXTCODESIZE before EIP 150 (Tangerine) ExtcodeSizeGasEIP150 uint64 = 700 // Cost of EXTCODESIZE after EIP 150 (Tangerine) SloadGasFrontier uint64 = 50 SloadGasEIP150 uint64 = 200 SloadGasEIP1884 uint64 = 800 // Cost of SLOAD after EIP 1884 (part of Istanbul) SloadGasEIP2200 uint64 = 800 // Cost of SLOAD after EIP 2200 (part of Istanbul) ExtcodeHashGasConstantinople uint64 = 400 // Cost of EXTCODEHASH (introduced in Constantinople) ExtcodeHashGasEIP1884 uint64 = 700 // Cost of EXTCODEHASH after EIP 1884 (part in Istanbul) SelfdestructGasEIP150 uint64 = 5000 // Cost of SELFDESTRUCT post EIP 150 (Tangerine) // EXP has a dynamic portion depending on the size of the exponent ExpByteFrontier uint64 = 10 // was set to 10 in Frontier ExpByteEIP158 uint64 = 50 // was raised to 50 during Eip158 (Spurious Dragon) // Extcodecopy has a dynamic AND a static cost. This represents only the // static portion of the gas. It was changed during EIP 150 (Tangerine) ExtcodeCopyBaseFrontier uint64 = 20 ExtcodeCopyBaseEIP150 uint64 = 700 // CreateBySelfdestructGas is used when the refunded account is one that does // not exist. This logic is similar to call. // Introduced in Tangerine Whistle (Eip 150) CreateBySelfdestructGas uint64 = 25000 DefaultBaseFeeChangeDenominator = 8 // Bounds the amount the base fee can change between blocks. DefaultElasticityMultiplier = 2 // Bounds the maximum gas limit an EIP-1559 block may have. InitialBaseFee = 1000000000 // Initial base fee for EIP-1559 blocks. MaxCodeSize = 24576 // Maximum bytecode to permit for a contract MaxInitCodeSize = 2 * MaxCodeSize // Maximum initcode to permit in a creation transaction and create instructions EcrecoverGas uint64 = 3000 // Elliptic curve sender recovery gas price Sha256BaseGas uint64 = 60 // Base price for a SHA256 operation Sha256PerWordGas uint64 = 12 // Per-word price for a SHA256 operation Ripemd160BaseGas uint64 = 600 // Base price for a RIPEMD160 operation Ripemd160PerWordGas uint64 = 120 // Per-word price for a RIPEMD160 operation IdentityBaseGas uint64 = 15 // Base price for a data copy operation IdentityPerWordGas uint64 = 3 // Per-work price for a data copy operation Bn256AddGasByzantium uint64 = 500 // Byzantium gas needed for an elliptic curve addition Bn256AddGasIstanbul uint64 = 150 // Gas needed for an elliptic curve addition Bn256ScalarMulGasByzantium uint64 = 40000 // Byzantium gas needed for an elliptic curve scalar multiplication Bn256ScalarMulGasIstanbul uint64 = 6000 // Gas needed for an elliptic curve scalar multiplication Bn256PairingBaseGasByzantium uint64 = 100000 // Byzantium base price for an elliptic curve pairing check Bn256PairingBaseGasIstanbul uint64 = 45000 // Base price for an elliptic curve pairing check Bn256PairingPerPointGasByzantium uint64 = 80000 // Byzantium per-point price for an elliptic curve pairing check Bn256PairingPerPointGasIstanbul uint64 = 34000 // Per-point price for an elliptic curve pairing check Bls12381G1AddGas uint64 = 500 // Price for BLS12-381 elliptic curve G1 point addition Bls12381G1MulGas uint64 = 12000 // Price for BLS12-381 elliptic curve G1 point scalar multiplication Bls12381G2AddGas uint64 = 800 // Price for BLS12-381 elliptic curve G2 point addition Bls12381G2MulGas uint64 = 45000 // Price for BLS12-381 elliptic curve G2 point scalar multiplication Bls12381PairingBaseGas uint64 = 65000 // Base gas price for BLS12-381 elliptic curve pairing check Bls12381PairingPerPairGas uint64 = 43000 // Per-point pair gas price for BLS12-381 elliptic curve pairing check Bls12381MapG1Gas uint64 = 5500 // Gas price for BLS12-381 mapping field element to G1 operation Bls12381MapG2Gas uint64 = 75000 // Gas price for BLS12-381 mapping field element to G2 operation // The Refund Quotient is the cap on how much of the used gas can be refunded. Before EIP-3529, // up to half the consumed gas could be refunded. Redefined as 1/5th in EIP-3529 RefundQuotient uint64 = 2 RefundQuotientEIP3529 uint64 = 5 BlobTxBytesPerFieldElement = 32 // Size in bytes of a field element BlobTxFieldElementsPerBlob = 4096 // Number of field elements stored in a single data blob BlobTxBlobGasPerBlob = 1 << 17 // Gas consumption of a single data blob (== blob byte size) BlobTxMinBlobGasprice = 1 // Minimum gas price for data blobs BlobTxBlobGaspriceUpdateFraction = 3338477 // Controls the maximum rate of change for blob gas price BlobTxPointEvaluationPrecompileGas = 50000 // Gas price for the point evaluation precompile. BlobTxTargetBlobGasPerBlock = 3 * BlobTxBlobGasPerBlob // Target consumable blob gas for data blobs per block (for 1559-like pricing) MaxBlobGasPerBlock = 6 * BlobTxBlobGasPerBlob // Maximum consumable blob gas for data blobs per block )
const ( VersionMajor = 1 // Major version component of the current release VersionMinor = 14 // Minor version component of the current release VersionPatch = 7 // Patch version component of the current release VersionMeta = "stable" // Version metadata to append to the version string )
Variables ¶
var ( MainnetGenesisHash = common.HexToHash("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3") HoleskyGenesisHash = common.HexToHash("0xb5f7f912443c940f21fd611f12828d75b534364ed9e95ca4e307729a4661bde4") SepoliaGenesisHash = common.HexToHash("0x25a5cc106eea7138acab33231d7160d69cb777ee0c2c553fcddf5138993e6dd9") GoerliGenesisHash = common.HexToHash("0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a") )
Genesis hashes to enforce below configs on.
var (
MainnetTerminalTotalDifficulty, _ = new(big.Int).SetString("58_750_000_000_000_000_000_000", 0)
// MainnetChainConfig is the chain parameters to run a node on the main network.
MainnetChainConfig = &ChainConfig{
ChainID: big.NewInt(1),
HomesteadBlock: big.NewInt(1_150_000),
DAOForkBlock: big.NewInt(1_920_000),
DAOForkSupport: true,
EIP150Block: big.NewInt(2_463_000),
EIP155Block: big.NewInt(2_675_000),
EIP158Block: big.NewInt(2_675_000),
ByzantiumBlock: big.NewInt(4_370_000),
ConstantinopleBlock: big.NewInt(7_280_000),
PetersburgBlock: big.NewInt(7_280_000),
IstanbulBlock: big.NewInt(9_069_000),
MuirGlacierBlock: big.NewInt(9_200_000),
BerlinBlock: big.NewInt(12_244_000),
LondonBlock: big.NewInt(12_965_000),
ArrowGlacierBlock: big.NewInt(13_773_000),
GrayGlacierBlock: big.NewInt(15_050_000),
TerminalTotalDifficulty: MainnetTerminalTotalDifficulty,
TerminalTotalDifficultyPassed: true,
ShanghaiTime: newUint64(1681338455),
CancunTime: newUint64(1710338135),
Ethash: new(EthashConfig),
}
// HoleskyChainConfig contains the chain parameters to run a node on the Holesky test network.
HoleskyChainConfig = &ChainConfig{
ChainID: big.NewInt(17000),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: true,
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: nil,
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ArrowGlacierBlock: nil,
GrayGlacierBlock: nil,
TerminalTotalDifficulty: big.NewInt(0),
TerminalTotalDifficultyPassed: true,
MergeNetsplitBlock: nil,
ShanghaiTime: newUint64(1696000704),
CancunTime: newUint64(1707305664),
Ethash: new(EthashConfig),
}
// SepoliaChainConfig contains the chain parameters to run a node on the Sepolia test network.
SepoliaChainConfig = &ChainConfig{
ChainID: big.NewInt(11155111),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: true,
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ArrowGlacierBlock: nil,
GrayGlacierBlock: nil,
TerminalTotalDifficulty: big.NewInt(17_000_000_000_000_000),
TerminalTotalDifficultyPassed: true,
MergeNetsplitBlock: big.NewInt(1735371),
ShanghaiTime: newUint64(1677557088),
CancunTime: newUint64(1706655072),
Ethash: new(EthashConfig),
}
// GoerliChainConfig contains the chain parameters to run a node on the Görli test network.
GoerliChainConfig = &ChainConfig{
ChainID: big.NewInt(5),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: true,
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(1_561_651),
MuirGlacierBlock: nil,
BerlinBlock: big.NewInt(4_460_644),
LondonBlock: big.NewInt(5_062_605),
ArrowGlacierBlock: nil,
TerminalTotalDifficulty: big.NewInt(10_790_000),
TerminalTotalDifficultyPassed: true,
ShanghaiTime: newUint64(1678832736),
CancunTime: newUint64(1705473120),
Clique: &CliqueConfig{
Period: 15,
Epoch: 30000,
},
}
// AllEthashProtocolChanges contains every protocol change (EIPs) introduced
// and accepted by the Ethereum core developers into the Ethash consensus.
AllEthashProtocolChanges = &ChainConfig{
ChainID: big.NewInt(1337),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: false,
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ArrowGlacierBlock: big.NewInt(0),
GrayGlacierBlock: big.NewInt(0),
MergeNetsplitBlock: nil,
ShanghaiTime: nil,
CancunTime: nil,
PragueTime: nil,
VerkleTime: nil,
TerminalTotalDifficulty: nil,
TerminalTotalDifficultyPassed: true,
Ethash: new(EthashConfig),
Clique: nil,
}
AllDevChainProtocolChanges = &ChainConfig{
ChainID: big.NewInt(1337),
HomesteadBlock: big.NewInt(0),
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ArrowGlacierBlock: big.NewInt(0),
GrayGlacierBlock: big.NewInt(0),
ShanghaiTime: newUint64(0),
CancunTime: newUint64(0),
TerminalTotalDifficulty: big.NewInt(0),
TerminalTotalDifficultyPassed: true,
}
// AllCliqueProtocolChanges contains every protocol change (EIPs) introduced
// and accepted by the Ethereum core developers into the Clique consensus.
AllCliqueProtocolChanges = &ChainConfig{
ChainID: big.NewInt(1337),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: false,
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ArrowGlacierBlock: nil,
GrayGlacierBlock: nil,
MergeNetsplitBlock: nil,
ShanghaiTime: nil,
CancunTime: nil,
PragueTime: nil,
VerkleTime: nil,
TerminalTotalDifficulty: nil,
TerminalTotalDifficultyPassed: false,
Ethash: nil,
Clique: &CliqueConfig{Period: 0, Epoch: 30000},
}
// TestChainConfig contains every protocol change (EIPs) introduced
// and accepted by the Ethereum core developers for testing purposes.
TestChainConfig = &ChainConfig{
ChainID: big.NewInt(1),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: false,
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ArrowGlacierBlock: big.NewInt(0),
GrayGlacierBlock: big.NewInt(0),
MergeNetsplitBlock: nil,
ShanghaiTime: nil,
CancunTime: nil,
PragueTime: nil,
VerkleTime: nil,
TerminalTotalDifficulty: nil,
TerminalTotalDifficultyPassed: false,
Ethash: new(EthashConfig),
Clique: nil,
}
// MergedTestChainConfig contains every protocol change (EIPs) introduced
// and accepted by the Ethereum core developers for testing purposes.
MergedTestChainConfig = &ChainConfig{
ChainID: big.NewInt(1),
HomesteadBlock: big.NewInt(0),
DAOForkBlock: nil,
DAOForkSupport: false,
EIP150Block: big.NewInt(0),
EIP155Block: big.NewInt(0),
EIP158Block: big.NewInt(0),
ByzantiumBlock: big.NewInt(0),
ConstantinopleBlock: big.NewInt(0),
PetersburgBlock: big.NewInt(0),
IstanbulBlock: big.NewInt(0),
MuirGlacierBlock: big.NewInt(0),
BerlinBlock: big.NewInt(0),
LondonBlock: big.NewInt(0),
ArrowGlacierBlock: big.NewInt(0),
GrayGlacierBlock: big.NewInt(0),
MergeNetsplitBlock: big.NewInt(0),
ShanghaiTime: newUint64(0),
CancunTime: newUint64(0),
PragueTime: nil,
VerkleTime: nil,
TerminalTotalDifficulty: big.NewInt(0),
TerminalTotalDifficultyPassed: true,
Ethash: new(EthashConfig),
Clique: nil,
}
// NonActivatedConfig defines the chain configuration without activating
// any protocol change (EIPs).
NonActivatedConfig = &ChainConfig{
ChainID: big.NewInt(1),
HomesteadBlock: nil,
DAOForkBlock: nil,
DAOForkSupport: false,
EIP150Block: nil,
EIP155Block: nil,
EIP158Block: nil,
ByzantiumBlock: nil,
ConstantinopleBlock: nil,
PetersburgBlock: nil,
IstanbulBlock: nil,
MuirGlacierBlock: nil,
BerlinBlock: nil,
LondonBlock: nil,
ArrowGlacierBlock: nil,
GrayGlacierBlock: nil,
MergeNetsplitBlock: nil,
ShanghaiTime: nil,
CancunTime: nil,
PragueTime: nil,
VerkleTime: nil,
TerminalTotalDifficulty: nil,
TerminalTotalDifficultyPassed: false,
Ethash: new(EthashConfig),
Clique: nil,
}
TestRules = TestChainConfig.Rules(new(big.Int), false, 0)
)
var ( 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(13) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not. // BeaconRootsAddress is the address where historical beacon roots are stored as per EIP-4788 BeaconRootsAddress = common.HexToAddress("0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02") // BeaconRootsCode is the code where historical beacon roots are stored as per EIP-4788 BeaconRootsCode = common.FromHex("3373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500") // SystemAddress is where the system-transaction is sent from as per EIP-4788 SystemAddress = common.HexToAddress("0xfffffffffffffffffffffffffffffffffffffffe") )
var ( WitnessBranchReadCost uint64 = 1900 WitnessChunkReadCost uint64 = 200 WitnessBranchWriteCost uint64 = 3000 WitnessChunkWriteCost uint64 = 500 WitnessChunkFillCost uint64 = 6200 )
Verkle tree EIP: costs associated to witness accesses
var Bls12381MultiExpDiscountTable = [128]uint64{} /* 128 elements not displayed */
Gas discount table for BLS12-381 G1 and G2 multi exponentiation operations
var NetworkNames = map[string]string{ MainnetChainConfig.ChainID.String(): "mainnet", GoerliChainConfig.ChainID.String(): "goerli", SepoliaChainConfig.ChainID.String(): "sepolia", HoleskyChainConfig.ChainID.String(): "holesky", }
NetworkNames are user friendly names to use in the chain spec banner.
var Version = func() string { return fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch) }()
Version holds the textual version string.
var VersionWithMeta = func() string { v := Version if VersionMeta != "" { v += "-" + VersionMeta } return v }()
VersionWithMeta holds the textual version string including the metadata.
Functions ¶
func ArchiveVersion ¶
ArchiveVersion holds the textual version string used for Geth archives. e.g. "1.8.11-dea1ce05" for stable releases, or "1.8.13-unstable-21c059b6" for unstable releases.
func ClearVerkleWitnessCosts ¶ added in v1.26.0
func ClearVerkleWitnessCosts()
ClearVerkleWitnessCosts sets all witness costs to 0, which is necessary for historical block replay simulations.
func VersionWithCommit ¶
Types ¶
type ChainConfig ¶
type ChainConfig struct { ChainID *big.Int `json:"chainId"` // chainId 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) DAOForkBlock *big.Int `json:"daoForkBlock,omitempty"` // TheDAO hard-fork switch block (nil = no fork) DAOForkSupport bool `json:"daoForkSupport,omitempty"` // Whether the nodes supports or opposes the DAO hard-fork // EIP150 implements the Gas price changes (https://github.com/ethereum/EIPs/issues/150) EIP150Block *big.Int `json:"eip150Block,omitempty"` // EIP150 HF block (nil = no fork) 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 = already on byzantium) ConstantinopleBlock *big.Int `json:"constantinopleBlock,omitempty"` // Constantinople switch block (nil = no fork, 0 = already activated) PetersburgBlock *big.Int `json:"petersburgBlock,omitempty"` // Petersburg switch block (nil = same as Constantinople) IstanbulBlock *big.Int `json:"istanbulBlock,omitempty"` // Istanbul switch block (nil = no fork, 0 = already on istanbul) MuirGlacierBlock *big.Int `json:"muirGlacierBlock,omitempty"` // Eip-2384 (bomb delay) switch block (nil = no fork, 0 = already activated) BerlinBlock *big.Int `json:"berlinBlock,omitempty"` // Berlin switch block (nil = no fork, 0 = already on berlin) LondonBlock *big.Int `json:"londonBlock,omitempty"` // London switch block (nil = no fork, 0 = already on london) ArrowGlacierBlock *big.Int `json:"arrowGlacierBlock,omitempty"` // Eip-4345 (bomb delay) switch block (nil = no fork, 0 = already activated) GrayGlacierBlock *big.Int `json:"grayGlacierBlock,omitempty"` // Eip-5133 (bomb delay) switch block (nil = no fork, 0 = already activated) MergeNetsplitBlock *big.Int `json:"mergeNetsplitBlock,omitempty"` // Virtual fork after The Merge to use as a network splitter ShanghaiTime *uint64 `json:"shanghaiTime,omitempty"` // Shanghai switch time (nil = no fork, 0 = already on shanghai) CancunTime *uint64 `json:"cancunTime,omitempty"` // Cancun switch time (nil = no fork, 0 = already on cancun) PragueTime *uint64 `json:"pragueTime,omitempty"` // Prague switch time (nil = no fork, 0 = already on prague) VerkleTime *uint64 `json:"verkleTime,omitempty"` // Verkle switch time (nil = no fork, 0 = already on verkle) // TerminalTotalDifficulty is the amount of total difficulty reached by // the network that triggers the consensus upgrade. TerminalTotalDifficulty *big.Int `json:"terminalTotalDifficulty,omitempty"` // TerminalTotalDifficultyPassed is a flag specifying that the network already // passed the terminal total difficulty. Its purpose is to disable legacy sync // even without having seen the TTD locally (safer long term). // // TODO(karalabe): Drop this field eventually (always assuming PoS mode) TerminalTotalDifficultyPassed bool `json:"terminalTotalDifficultyPassed,omitempty"` // Various consensus engines Ethash *EthashConfig `json:"ethash,omitempty"` Clique *CliqueConfig `json:"clique,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) BaseFeeChangeDenominator ¶ added in v1.26.0
func (c *ChainConfig) BaseFeeChangeDenominator() uint64
BaseFeeChangeDenominator bounds the amount the base fee can change between blocks.
func (*ChainConfig) CheckCompatible ¶
func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64, time uint64) *ConfigCompatError
CheckCompatible checks whether scheduled fork transitions have been imported with a mismatching chain configuration.
func (*ChainConfig) CheckConfigForkOrder ¶
func (c *ChainConfig) CheckConfigForkOrder() error
CheckConfigForkOrder checks that we don't "skip" any forks, geth isn't pluggable enough to guarantee that forks can be implemented in a different order than on official networks
func (*ChainConfig) Description ¶ added in v1.26.0
func (c *ChainConfig) Description() string
Description returns a human-readable description of ChainConfig.
func (*ChainConfig) ElasticityMultiplier ¶ added in v1.26.0
func (c *ChainConfig) ElasticityMultiplier() uint64
ElasticityMultiplier bounds the maximum gas limit an EIP-1559 block may have.
func (*ChainConfig) IsArrowGlacier ¶ added in v1.8.1
func (c *ChainConfig) IsArrowGlacier(num *big.Int) bool
IsArrowGlacier returns whether num is either equal to the Arrow Glacier (EIP-4345) fork block or greater.
func (*ChainConfig) IsBerlin ¶ added in v1.6.0
func (c *ChainConfig) IsBerlin(num *big.Int) bool
IsBerlin returns whether num is either equal to the Berlin fork block or greater.
func (*ChainConfig) IsByzantium ¶
func (c *ChainConfig) IsByzantium(num *big.Int) bool
IsByzantium returns whether num is either equal to the Byzantium fork block or greater.
func (*ChainConfig) IsCancun ¶ added in v1.16.0
func (c *ChainConfig) IsCancun(num *big.Int, time uint64) bool
IsCancun returns whether time is either equal to the Cancun fork time or greater.
func (*ChainConfig) IsConstantinople ¶
func (c *ChainConfig) IsConstantinople(num *big.Int) bool
IsConstantinople returns whether num is either equal to the Constantinople fork block or greater.
func (*ChainConfig) IsDAOFork ¶
func (c *ChainConfig) IsDAOFork(num *big.Int) bool
IsDAOFork returns whether num is either equal to the DAO fork block or greater.
func (*ChainConfig) IsEIP150 ¶
func (c *ChainConfig) IsEIP150(num *big.Int) bool
IsEIP150 returns whether num is either equal to the EIP150 fork block or greater.
func (*ChainConfig) IsEIP155 ¶
func (c *ChainConfig) IsEIP155(num *big.Int) bool
IsEIP155 returns whether num is either equal to the EIP155 fork block or greater.
func (*ChainConfig) IsEIP158 ¶
func (c *ChainConfig) IsEIP158(num *big.Int) bool
IsEIP158 returns whether num is either equal to the EIP158 fork block or greater.
func (*ChainConfig) IsEIP4762 ¶ added in v1.26.0
func (c *ChainConfig) IsEIP4762(num *big.Int, time uint64) bool
IsEIP4762 returns whether eip 4762 has been activated at given block.
func (*ChainConfig) IsGrayGlacier ¶ added in v1.16.0
func (c *ChainConfig) IsGrayGlacier(num *big.Int) bool
IsGrayGlacier returns whether num is either equal to the Gray Glacier (EIP-5133) fork block or greater.
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) IsIstanbul ¶
func (c *ChainConfig) IsIstanbul(num *big.Int) bool
IsIstanbul returns whether num is either equal to the Istanbul fork block or greater.
func (*ChainConfig) IsLondon ¶ added in v1.6.0
func (c *ChainConfig) IsLondon(num *big.Int) bool
IsLondon returns whether num is either equal to the London fork block or greater.
func (*ChainConfig) IsMuirGlacier ¶
func (c *ChainConfig) IsMuirGlacier(num *big.Int) bool
IsMuirGlacier returns whether num is either equal to the Muir Glacier (EIP-2384) fork block or greater.
func (*ChainConfig) IsPetersburg ¶
func (c *ChainConfig) IsPetersburg(num *big.Int) bool
IsPetersburg returns whether num is either - equal to or greater than the PetersburgBlock fork block, - OR is nil, and Constantinople is active
func (*ChainConfig) IsPrague ¶ added in v1.26.0
func (c *ChainConfig) IsPrague(num *big.Int, time uint64) bool
IsPrague returns whether time is either equal to the Prague fork time or greater.
func (*ChainConfig) IsShanghai ¶ added in v1.16.0
func (c *ChainConfig) IsShanghai(num *big.Int, time uint64) bool
IsShanghai returns whether time is either equal to the Shanghai fork time or greater.
func (*ChainConfig) IsTerminalPoWBlock ¶ added in v1.8.0
IsTerminalPoWBlock returns whether the given block is the last block of PoW stage.
func (*ChainConfig) IsVerkle ¶ added in v1.26.0
func (c *ChainConfig) IsVerkle(num *big.Int, time uint64) bool
IsVerkle returns whether time is either equal to the Verkle fork time or greater.
func (*ChainConfig) LatestFork ¶ added in v1.26.0
func (c *ChainConfig) LatestFork(time uint64) forks.Fork
LatestFork returns the latest time-based fork that would be active for the given time.
type CliqueConfig ¶
type CliqueConfig struct { Period uint64 `json:"period"` // Number of seconds between blocks to enforce Epoch uint64 `json:"epoch"` // Epoch length to reset votes and checkpoint }
CliqueConfig is the consensus engine configs for proof-of-authority based sealing.
func (CliqueConfig) String ¶
func (c CliqueConfig) String() string
String implements the stringer interface, returning the consensus engine details.
type ConfigCompatError ¶
type ConfigCompatError struct { What string // block numbers of the stored and new configurations if block based forking StoredBlock, NewBlock *big.Int // timestamps of the stored and new configurations if time based forking StoredTime, NewTime *uint64 // the block number to which the local chain must be rewound to correct the error RewindToBlock uint64 // the timestamp to which the local chain must be rewound to correct the error RewindToTime 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 Rules ¶
type Rules struct { ChainID *big.Int IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool IsEIP2929, IsEIP4762 bool IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool IsBerlin, IsLondon bool IsMerge, IsShanghai, IsCancun, IsPrague bool IsVerkle bool }
Rules wraps ChainConfig and is merely syntactic 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.