Documentation ¶
Index ¶
- Constants
- Variables
- func ArchiveVersion(gitCommit string) string
- func DAODrainList() []common.Address
- func KnownDNSNetwork(genesis common.Hash, protocol string) string
- 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(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) IsGaspar(num *big.Int) 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(time uint64) bool
- func (c *ChainConfig) IsShanghai(time uint64) bool
- func (c *ChainConfig) IsTerminalPoWBlock(parentTotalDiff *big.Int, totalDiff *big.Int) bool
- func (c *ChainConfig) IsVeldin(num *big.Int) bool
- func (c *ChainConfig) Rules(num *big.Int, isMerge bool, timestamp uint64) Rules
- type CheckpointOracleConfig
- type CliqueConfig
- type ConfigCompatError
- type EthashConfig
- type RethereumForks
- type Rules
- type TrustedCheckpoint
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 ( // BloomBitsBlocks is the number of blocks a single bloom bit section vector // contains on the server side. BloomBitsBlocks uint64 = 4096 // BloomBitsBlocksClient is the number of blocks a single bloom bit section vector // contains on the light client side BloomBitsBlocksClient uint64 = 32768 // BloomConfirms is the number of confirmation blocks before a bloom section is // considered probably final and its rotated bits are calculated. BloomConfirms = 256 // CHTFrequency is the block frequency for creating CHTs CHTFrequency = 32768 // BloomTrieFrequency is the block frequency for creating BloomTrie on both // server/client sides. BloomTrieFrequency = 32768 // HelperTrieConfirmations is the number of confirmations before a client is expected // to have the given HelperTrie available. HelperTrieConfirmations = 2048 // HelperTrieProcessConfirmations is the number of confirmations before a HelperTrie // is generated HelperTrieProcessConfirmations = 256 // CheckpointFrequency is the block frequency for creating checkpoint CheckpointFrequency = 32707 // CheckpointProcessConfirmations is the number before a checkpoint is generated CheckpointProcessConfirmations = 256 // FullImmutabilityThreshold is the number of blocks after which a chain segment is // considered immutable (i.e. soft finality). It is used by the downloader as a // hard limit against deep ancestors, by the blockchain against deep reorgs, by // the freezer as the cutoff threshold and by clique as the snapshot trust limit. FullImmutabilityThreshold = 90000 // LightImmutabilityThreshold is the number of blocks after which a header chain // segment is considered immutable for light client(i.e. soft finality). It is used by // the downloader as a hard limit against deep ancestors, by the blockchain against deep // reorgs, by the light pruner as the pruning validity guarantee. LightImmutabilityThreshold = 30000 )
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. 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 SstoreClearsScheduleRefundEIP3529 uint64 = SstoreResetGasEIP2200 - ColdSloadCostEIP2929 + TxAccessListStorageKeyGas JumpdestGas uint64 = 1 // Once per JUMPDEST operation. 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. 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 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 = 1 * GWei // 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 = 600 // Price for BLS12-381 elliptic curve G1 point addition Bls12381G1MulGas uint64 = 12000 // Price for BLS12-381 elliptic curve G1 point scalar multiplication Bls12381G2AddGas uint64 = 4500 // Price for BLS12-381 elliptic curve G2 point addition Bls12381G2MulGas uint64 = 55000 // Price for BLS12-381 elliptic curve G2 point scalar multiplication Bls12381PairingBaseGas uint64 = 115000 // Base gas price for BLS12-381 elliptic curve pairing check Bls12381PairingPerPairGas uint64 = 23000 // 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 = 110000 // 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 BlobTxMinDataGasprice = 1 // Minimum gas price for data blobs BlobTxDataGaspriceUpdateFraction = 2225652 // Controls the maximum rate of change for data gas price )
const ( VersionMetaStable = "stable" VersionMetaDev = "dev" VersionMajor = 1 // Major version component of the current release VersionMinor = 13 // Minor version component of the current release VersionPatch = 1 // Patch version component of the current release VersionMeta = VersionMetaStable // Version metadata to append to the version string )
Variables ¶
var ( MainnetGenesisHash = common.HexToHash("0x0fb784d1481f0aa911d21d639641763ca09641413842b35f1d10eb5d208abdf8") KrontosGenesisHash = common.HexToHash("0xbdde357c87af3772f4b8fc900ea2b409b54cc7391d322a4470f547bbae3c536d") RinkebyGenesisHash = common.HexToHash("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177") GoerliGenesisHash = common.HexToHash("0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a") )
Genesis hashes to enforce below configs on.
var ( // MainnetChainConfig is the chain parameters to run a node on the main network. // All checkpoints should be a prime number the prevent the possibility of a collision with a malicious checkpoint. MainnetChainConfig = &ChainConfig{ ChainID: big.NewInt(622277), HomesteadBlock: big.NewInt(0), DAOForkBlock: big.NewInt(0), DAOForkSupport: false, EIP150Block: big.NewInt(0), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(1001), ConstantinopleBlock: big.NewInt(5503), PetersburgBlock: big.NewInt(5507), IstanbulBlock: big.NewInt(5519), MuirGlacierBlock: big.NewInt(5521), BerlinBlock: big.NewInt(5527), LondonBlock: big.NewInt(13_524_557), ArrowGlacierBlock: big.NewInt(27_200_177), GrayGlacierBlock: big.NewInt(40_725_107), RethereumForks: &RethereumForks{ Veldin: big.NewInt(500_009), Gaspar: big.NewInt(1_600_957), }, TerminalTotalDifficulty: nil, TerminalTotalDifficultyPassed: false, Ethash: new(EthashConfig), } // MainnetTrustedCheckpoint contains the light client trusted checkpoint for the main network. MainnetTrustedCheckpoint = &TrustedCheckpoint{ BloomRoot: common.HexToHash("0xb09a3dc1215903dc757dd83c960c6dd77ec508e03c185b16df62af069d197fc3"), CHTRoot: common.HexToHash("0x21f6a69cbd097bd2c1d250ed7144888e483d46105b66a99a68e4847c99a863cd"), SectionHead: common.HexToHash("0x2461cbf15f92264332e09ba8a9d6b9106c12b3cf0e7d7bfff78483c1b271e902"), SectionIndex: 43, } // MainnetCheckpointOracle contains a set of configs for the main network oracle. MainnetCheckpointOracle = &CheckpointOracleConfig{ Address: common.HexToAddress("0x3da2b20732aA2268655ABdb21875F66413C213aE"), Signers: []common.Address{ common.HexToAddress("0x26ef08C12b37b8C14f7bCe8A492474A0902Dd2E0"), }, Threshold: 1, } // KrontosChainConfig contains the chain parameters to run a node on the Krontos test network. KrontosChainConfig = &ChainConfig{ ChainID: big.NewInt(622301), 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(1000), ArrowGlacierBlock: big.NewInt(1000), GrayGlacierBlock: big.NewInt(1000), RethereumForks: &RethereumForks{ Veldin: big.NewInt(0), Gaspar: big.NewInt(255), }, TerminalTotalDifficulty: nil, TerminalTotalDifficultyPassed: false, Ethash: new(EthashConfig), } // KrontosTrustedCheckpoint contains the light client trusted checkpoint for the Krontos test network. KrontosTrustedCheckpoint = &TrustedCheckpoint{ BloomRoot: common.Hash{}, CHTRoot: common.Hash{}, SectionHead: common.Hash{}, SectionIndex: 0, } // RinkebyChainConfig contains the chain parameters to run a node on the Rinkeby test network. RinkebyChainConfig = &ChainConfig{ ChainID: big.NewInt(4), HomesteadBlock: big.NewInt(1), DAOForkBlock: nil, DAOForkSupport: true, EIP150Block: big.NewInt(2), EIP155Block: big.NewInt(3), EIP158Block: big.NewInt(3), ByzantiumBlock: big.NewInt(1_035_301), ConstantinopleBlock: big.NewInt(3_660_663), PetersburgBlock: big.NewInt(4_321_234), IstanbulBlock: big.NewInt(5_435_345), MuirGlacierBlock: nil, BerlinBlock: big.NewInt(8_290_928), LondonBlock: big.NewInt(8_897_988), ArrowGlacierBlock: nil, Clique: &CliqueConfig{ Period: 15, Epoch: 30000, }, } // RinkebyTrustedCheckpoint contains the light client trusted checkpoint for the Rinkeby test network. RinkebyTrustedCheckpoint = &TrustedCheckpoint{ SectionIndex: 373, SectionHead: common.HexToHash("0x09f6d8f0d08d61025ccf4578dc214220b78013841470d445ed86faab4a5a885a"), CHTRoot: common.HexToHash("0xef72902b944a111e9fdfee5fb69a5e46f68bf11a1f0bd430321f92d6b66987df"), BloomRoot: common.HexToHash("0xd0120268729c51dd6fa2714f7f88527adfecbdb08592c671233ad2e0ad7cd835"), } // RinkebyCheckpointOracle contains a set of configs for the Rinkeby test network oracle. RinkebyCheckpointOracle = &CheckpointOracleConfig{ Address: common.HexToAddress("0xebe8eFA441B9302A0d7eaECc277c09d20D684540"), Signers: []common.Address{ common.HexToAddress("0xd9c9cd5f6779558b6e0ed4e6acf6b1947e7fa1f3"), common.HexToAddress("0x78d1aD571A1A09D60D9BBf25894b44e4C8859595"), common.HexToAddress("0x286834935f4A8Cfb4FF4C77D5770C2775aE2b0E7"), common.HexToAddress("0xb86e2B0Ab5A4B1373e40c51A7C712c70Ba2f9f8E"), }, Threshold: 2, } // 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), Clique: &CliqueConfig{ Period: 15, Epoch: 30000, }, } // GoerliTrustedCheckpoint contains the light client trusted checkpoint for the Görli test network. GoerliTrustedCheckpoint = &TrustedCheckpoint{ SectionIndex: 229, SectionHead: common.HexToHash("0xc5a7b57cb4af7b3d4cc251ac5f29acaac94e7464365358e7ad26129083b7729a"), CHTRoot: common.HexToHash("0x54c0d5c756d9c48eda26ea13c2a49c2e31f1cb7dfb01514ddc49f3d24272c77e"), BloomRoot: common.HexToHash("0xd681970a496f6187d089f8c8665a3587b5a78212d79b6ceef97c0dabd0188e56"), } // GoerliCheckpointOracle contains a set of configs for the Goerli test network oracle. GoerliCheckpointOracle = &CheckpointOracleConfig{ Address: common.HexToAddress("0x18CA0E045F0D772a851BC7e48357Bcaab0a0795D"), Signers: []common.Address{ common.HexToAddress("0x4769bcaD07e3b938B7f43EB7D278Bc7Cb9efFb38"), common.HexToAddress("0x78d1aD571A1A09D60D9BBf25894b44e4C8859595"), common.HexToAddress("0x286834935f4A8Cfb4FF4C77D5770C2775aE2b0E7"), common.HexToAddress("0xb86e2B0Ab5A4B1373e40c51A7C712c70Ba2f9f8E"), common.HexToAddress("0x0DF8fa387C602AE62559cC4aFa4972A7045d6707"), }, Threshold: 2, } // 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, TerminalTotalDifficulty: nil, TerminalTotalDifficultyPassed: false, Ethash: new(EthashConfig), Clique: nil, } // 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, 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 proposes. 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, RethereumForks: &RethereumForks{ Veldin: big.NewInt(0), Gaspar: big.NewInt(0), }, CancunTime: nil, PragueTime: nil, TerminalTotalDifficulty: nil, TerminalTotalDifficultyPassed: false, 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, RethereumForks: &RethereumForks{ Veldin: nil, Gaspar: nil, }, CancunTime: nil, PragueTime: 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(5_002_317) // Difficulty of the Genesis block. MinimumDifficulty = big.NewInt(1_002_317) // The minimum that the difficulty may ever be. DurationLimit = big.NewInt(7) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not. )
var Bls12381MultiExpDiscountTable = [128]uint64{} /* 128 elements not displayed */
Gas discount table for BLS12-381 G1 and G2 multi exponentiation operations
var CheckpointOracles = map[common.Hash]*CheckpointOracleConfig{ MainnetGenesisHash: MainnetCheckpointOracle, RinkebyGenesisHash: RinkebyCheckpointOracle, GoerliGenesisHash: GoerliCheckpointOracle, }
CheckpointOracles associates each known checkpoint oracles with the genesis hash of the chain it belongs to.
var DAOForkBlockExtra = common.FromHex("0x0")
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(0)
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("0x0")
DAORefundContract is the address of the refund contract to send DAO balances to.
var GoerliBootnodes = []string{}
GoerliBootnodes are the enode URLs of the P2P bootstrap nodes running on the Görli test network.
var KrontosBootnodes = []string{
"enode://9a392272f3688e8fa414c88bd9a341690acc651078d4e22551f1161b3a96e28f60a09fd39bae0a78f63388aa62f549011853444f195cc6b0db85954745b017fa@77.100.75.201:30305",
}
KrontosBootnodes are the enode URLs of the P2P bootstrap nodes running on the Krontos test network.
var MainnetBootnodes = []string{
"enode://b3d8c6ad187f54860bd288e8e343c5cb05db023b3a74a4cd9d85cae3e2677074f92b3afecfd2bb445f9cba151848d3294abff9bedcee5d437ff161300f5144e9@77.100.75.201:30303",
"enode://301c2d2d622fe3d49f9a9d5a294a1a65ce0f686a10b5b6ea2e965533b7e84ecea25f1f2eec78e6fa948ca129ec5f9a8fe731d9641df0163e4847ded09dbfd1e4@54.36.108.60:30303",
"enode://959f6378ee6162f57977e5e6ab8dd56bd8ef5d1bc2a1bb01c6b41cfc2d07ea490d4c939c7625f13886c684b221a9c3e710e4a66a718a3231c40d2536c344df9d@27.254.39.27:30308",
"enode://e82bf286f09a7b86f5528a0e7c29928a8bb0bf9416d9678a91da9e2729480700a71777490ed115cad82b9f75268fc1f9a0d9483bb65acd6665708778c2d035f5@178.234.84.24:30303?discport=1337",
"enode://fe072785d5044f22b393df8a364dcc92d927b9f88aff14bff2484db20caa8350a07df3b9b1f0fb0b222304f426ab887ad9829bff6948aba84e3b5f1776b8dd52@195.201.122.219:30303",
}
MainnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the main Ethereum network.
var NetworkNames = map[string]string{ MainnetChainConfig.ChainID.String(): "Hypra Mainnet", RinkebyChainConfig.ChainID.String(): "rinkeby", GoerliChainConfig.ChainID.String(): "goerli", KrontosChainConfig.ChainID.String(): "krontos", }
NetworkNames are user friendly names to use in the chain spec banner.
var RinkebyBootnodes = []string{}
RinkebyBootnodes are the enode URLs of the P2P bootstrap nodes running on the Rinkeby test network.
var TrustedCheckpoints = map[common.Hash]*TrustedCheckpoint{ MainnetGenesisHash: MainnetTrustedCheckpoint, RinkebyGenesisHash: RinkebyTrustedCheckpoint, GoerliGenesisHash: GoerliTrustedCheckpoint, }
TrustedCheckpoints associates each known checkpoint with the genesis hash of the chain it belongs to.
var V5Bootnodes = []string{
"enr:-KW4QPeYjGcWLIq9Jtmly0R8wlhPJWz5D6lWwUIQ_3ycVLUED3puuQhqMtQ-osu_IYgdIkoMcR7Qgd077Fbe9-rOj1iGAYlu4Ek8g2V0aMnIhEIH29-CFUmCaWSCdjSCaXCETWRLyYlzZWNwMjU2azGhAkEGf2xmqbqacLe5pVhVCImq3VwB8CfxKHxXCSzCMNzthHNuYXDAg3RjcIJ2X4N1ZHCCdl8",
"enr:-KG4QDyytgmE4f7AnvW-ZaUOIi9i79qX4JwjRAiXBZCU65wOfBu-3Nb5I7b_Rmg3KCOcZM_C3y5pg7EBU5XGrcLTduQEhGV0aDKQ9aX9QgAAAAD__________4JpZIJ2NIJpcIQ2_DUbiXNlY3AyNTZrMaEDKnz_-ps3UUOfHWVYaskI5kWYO_vtYMGYCQRAR3gHDouDdGNwgiMog3VkcIIjKA",
}
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 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 KnownDNSNetwork ¶
KnownDNSNetwork returns the address of a public DNS-based node list for the given genesis hash and protocol. See https://github.com/ethereum/discv4-dns-lists for more information.
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 RethereumForks *RethereumForks `json:"rethereumForks,omitempty"` // Rethereum fork schedule 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) // 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). 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 ¶
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 ¶
func (c *ChainConfig) Description() string
Description returns a human-readable description of ChainConfig.
func (*ChainConfig) ElasticityMultiplier ¶
func (c *ChainConfig) ElasticityMultiplier() uint64
ElasticityMultiplier bounds the maximum gas limit an EIP-1559 block may have.
func (*ChainConfig) IsArrowGlacier ¶
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 ¶
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 ¶
func (c *ChainConfig) IsCancun(time uint64) bool
IsCancun returns whether num 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) IsGaspar ¶ added in v1.12.3
func (c *ChainConfig) IsGaspar(num *big.Int) bool
IsGaspar
func (*ChainConfig) IsGrayGlacier ¶
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 ¶
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 ¶
func (c *ChainConfig) IsPrague(time uint64) bool
IsPrague returns whether num is either equal to the Prague fork time or greater.
func (*ChainConfig) IsShanghai ¶
func (c *ChainConfig) IsShanghai(time uint64) bool
IsShanghai returns whether time is either equal to the Shanghai fork time or greater.
func (*ChainConfig) IsTerminalPoWBlock ¶
IsTerminalPoWBlock returns whether the given block is the last block of PoW stage.
type CheckpointOracleConfig ¶
type CheckpointOracleConfig struct { Address common.Address `json:"address"` Signers []common.Address `json:"signers"` Threshold uint64 `json:"threshold"` }
CheckpointOracleConfig represents a set of checkpoint contract(which acts as an oracle) config which used for light client checkpoint syncing.
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 RethereumForks ¶
type Rules ¶
type Rules struct { ChainID *big.Int IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool IsBerlin, IsLondon bool IsMerge, IsShanghai, IsCancun, IsPrague, IsGaspar 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.
type TrustedCheckpoint ¶
type TrustedCheckpoint struct { SectionIndex uint64 `json:"sectionIndex"` SectionHead common.Hash `json:"sectionHead"` CHTRoot common.Hash `json:"chtRoot"` BloomRoot common.Hash `json:"bloomRoot"` }
TrustedCheckpoint represents a set of post-processed trie roots (CHT and BloomTrie) associated with the appropriate section index and head hash. It is used to start light syncing from this checkpoint and avoid downloading the entire header chain while still being able to securely access old headers/logs.
func (*TrustedCheckpoint) Empty ¶
func (c *TrustedCheckpoint) Empty() bool
Empty returns an indicator whether the checkpoint is regarded as empty.
func (*TrustedCheckpoint) Hash ¶
func (c *TrustedCheckpoint) Hash() common.Hash
Hash returns the hash of checkpoint's four key fields(index, sectionHead, chtRoot and bloomTrieRoot).