Documentation ¶
Index ¶
- Constants
- Variables
- func ArchiveVersion(gitCommit string) string
- 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) 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) IsHomestead(num *big.Int) bool
- func (c *ChainConfig) Rules(num *big.Int) Rules
- func (c *ChainConfig) String() string
- type CliqueConfig
- type ConfigCompatError
- type CuckooConfig
- type GasTable
- 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 ( // 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 // CHTFrequencyClient is the block frequency for creating CHTs on the client side. CHTFrequencyClient = 32768 // CHTFrequencyServer is the block frequency for creating CHTs on the server side. // Eventually this can be merged back with the client version, but that requires a // full database upgrade, so that should be left for a suitable moment. CHTFrequencyServer = 4096 // 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 )
const ( GasLimitBoundDivisor uint64 = 1024 // The bound divisor of the gas limit, used in update calculations. MinGasLimit uint64 = 1048576 // Minimum the gas limit may ever be. GenesisGasLimit uint64 = 16777216 // 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. UploadGas uint64 = 42000 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. SstoreSetGas uint64 = 20000 // Once per SLOAD operation. LogDataGas uint64 = 8 // Per byte in a LOG* operation's data. CallStipend uint64 = 2300 // Free gas given at beginning of call. CallInferGas uint64 = 300000 // Base gas for call infer Sha3Gas uint64 = 30 // Once per SHA3 operation. Sha3WordGas uint64 = 6 // Once per word of the SHA3 operation's data. 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. 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 = 40 // Once per CALL operation & message call transaction. CreateDataGas uint64 = 20 //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 SuicideRefundGas uint64 = 24000 // Refunded following a suicide 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. TxDataNonZeroGas 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. MaxCodeSize = 504 * 1024 //24576// Maximum bytecode to permit for a contract MaxRawSize = 384 * 1024 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 ModExpQuadCoeffDiv uint64 = 20 // Divisor for the quadratic particle of the big int modular exponentiation Bn256AddGas uint64 = 500 // Gas needed for an elliptic curve addition Bn256ScalarMulGas uint64 = 40000 // Gas needed for an elliptic curve scalar multiplication Bn256PairingBaseGas uint64 = 100000 // Base price for an elliptic curve pairing check Bn256PairingPerPointGas uint64 = 80000 // Per-point price for an elliptic curve pairing check )
const ( MatureBlks = 10 //For the full node to synchronize the models ExpiredBlks = 1000000000000000000 //8409600 PER_UPLOAD_BYTES uint64 = 1 * 512 * 1024 //How many bytes per upload DEFAULT_UPLOAD_BYTES uint64 = 384 * 1024 //default upload bytes MODEL_MIN_UPLOAD_BYTES = 0 MODEL_MAX_UPLOAD_BYTES uint64 = 1024 * 1024 * 1024 * 1024 MODEL_GAS_LIMIT uint64 = 65536 //max gas limit for model call CONFIRM_TIME = -3600 * 24 * 7 // * time.Second BLOCK_QUOTA uint64 = 512 * 1024 //one block includes 512k file quota )
const ( VersionMajor = 0 // Major version component of the current release VersionMinor = 1 // Minor version component of the current release VersionPatch = 1 // Patch version component of the current release VersionMeta = "testnet" // Version metadata to append to the version string )
Variables ¶
var ( MainnetGenesisHash = common.HexToHash("0xd2ebcd4f5c95dd351528b98e46b1a6c2a5bc5a09aa314652f7df63c3e83b30dc") CerebroGenesisHash = common.HexToHash("0x1875c8fde48d2f71e82708489390ec29385749701a41459622c70565bbc37ccb") RinkebyGenesisHash = common.HexToHash("0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177") )
Genesis hashes to enforce below configs on.
var ( // MainnetChainConfig is the chain parameters to run a node on the main network. MainnetChainConfig = &ChainConfig{ ChainID: big.NewInt(8888), HomesteadBlock: nil, DAOForkBlock: nil, DAOForkSupport: false, EIP150Block: nil, EIP150Hash: common.HexToHash("0x"), EIP155Block: nil, EIP158Block: nil, ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: nil, Cuckoo: new(CuckooConfig), } // TestnetChainConfig contains the chain parameters to run a node on the Ropsten test network. CerebroChainConfig = &ChainConfig{ ChainID: big.NewInt(42), 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: nil, Cuckoo: new(CuckooConfig), } // TestnetChainConfig contains the chain parameters to run a node on the Ropsten test network. TestnetChainConfig = &ChainConfig{ ChainID: big.NewInt(27), 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: nil, Cuckoo: new(CuckooConfig), } // RinkebyChainConfig contains the chain parameters to run a node on the Rinkeby test network. RinkebyChainConfig = &ChainConfig{ ChainID: big.NewInt(48888), HomesteadBlock: big.NewInt(1), DAOForkBlock: nil, DAOForkSupport: false, EIP150Block: big.NewInt(2), EIP150Hash: common.HexToHash("0x9b095b36c15eaf13044373aef8ee0bd3a382a5abb92e402afa44b8249c3a90e9"), EIP155Block: big.NewInt(3), EIP158Block: big.NewInt(3), ByzantiumBlock: big.NewInt(1035301), ConstantinopleBlock: nil, Clique: &CliqueConfig{ Period: 15, Epoch: 30000, }, } // AllCuckooProtocolChanges contains every protocol change (EIPs) introduced // and accepted by the Ethereum core developers into the Cuckoo consensus. // // This configuration is intentionally not using keyed fields to force anyone // adding flags to the config to also have to set these fields. AllCuckooProtocolChanges = &ChainConfig{ big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(CuckooConfig), nil} // AllCliqueProtocolChanges contains every protocol change (EIPs) introduced // and accepted by the Ethereum core developers into the Clique consensus. // // This configuration is intentionally not using keyed fields to force anyone // adding flags to the config to also have to set these fields. AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, &CliqueConfig{Period: 0, Epoch: 30000}} TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(CuckooConfig), nil} 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, } // GasTableEIP150 contain the gas re-prices for // the EIP150 phase. GasTableEIP150 = GasTable{ ExtcodeSize: 700, ExtcodeCopy: 700, Balance: 400, SLoad: 200, Calls: 700, Suicide: 5000, ExpByte: 10, CreateBySuicide: 25000, } // GasTableEIP158 contain the gas re-prices for // the EIP155/EIP158 phase. GasTableEIP158 = GasTable{ ExtcodeSize: 700, ExtcodeCopy: 700, Balance: 400, SLoad: 200, Calls: 700, Suicide: 5000, ExpByte: 50, CreateBySuicide: 25000, } // GasTableConstantinople contain the gas re-prices for // the constantinople phase. GasTableConstantinople = GasTable{ ExtcodeSize: 700, ExtcodeCopy: 700, ExtcodeHash: 400, Balance: 400, SLoad: 200, Calls: 700, Suicide: 5000, ExpByte: 50, CreateBySuicide: 25000, } )
Variables containing gas prices for different ethereum phases.
var ( DifficultyBoundDivisor = big.NewInt(8) // The bound divisor of the difficulty, used in the update calculations. GenesisDifficulty = big.NewInt(16) // Difficulty of the Genesis block. MinimumDifficulty = big.NewInt(16) // The minimum that the difficulty may ever be. MeanDifficultyBoundDivisor = big.NewInt(1024) HighDifficultyBoundDivisor = big.NewInt(2048) // The bound divisor of the difficulty, used in the update calculations. DurationLimit = big.NewInt(13) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not. CTXC_TOP = big.NewInt(0).Mul(big.NewInt(299792458), big.NewInt(1000000000000000000)) CTXC_INIT = big.NewInt(0).Mul(big.NewInt(149792458), big.NewInt(1000000000000000000)) CTXC_MINING = big.NewInt(0).Mul(big.NewInt(150000000), big.NewInt(1000000000000000000)) )
var CerebroBootnodes = []string{
"enode://5091a81e18f722e6aa8fa7fd887836a4e030b6117ec0d11a7024871a4b9c5bfde35ee60063145f0b3bb2ec5def3fae941423fa7dc6d57f3fe23920242ea8d184@47.74.15.143:37566",
"enode://0d6eedee4ed1c4a1b9f273de9ed28fb30581b3bad6b733609870b39ed5a716cc59c5067deb1a43570b15f5965ab22ac04c7067a79aef1e240667d78e8ffdf81d@47.254.135.53:37566",
"enode://c8119e731b29bed3222ee5e63ec514926fa683f0bc999c73ff171d54a3100aea4211d70640bf937d1d61d39fdf313470b131213ae11ddfea5ccb96669f603749@47.88.174.57:37566",
"enode://0778ac6fe1a572a2f5834452c1d4b6f77b57a2a4baa72e0e2582ad0dbfe88f41e4e66aa020a451a32936a86c29788d257ccaa19f58e5676943595b945e615b9e@139.224.132.6:37566",
"enode://a4d20d02a05c3674791f1a0cf9900f0db50485037f96c99395287e931a6845f624e16adbce9e84e7106f803278360979e6a6999b7ca8c25cf64b4445a6de75e6@47.52.39.170:37566",
"enode://927fa865522a4737e9d773c1ea4fd77ab199872ad8cf42f0790df9a138908c5b94b372d297413bb489765c7241322e4413e0b3444c440e8a4d30652fe5d74116@47.75.211.148:37566",
"enode://411fe1332751ecfafb77990156d1b8b9573bdf2e3ac099379792a8f296f1f951328c462b1c01f366a6768f020950bd15cf89d66a5f90e8f44a663c49cebdff8c@54.183.146.247:37566",
"enode://767ea197d2e19a3f9ec63c5966f1fb625629791428941b58fd290b9ecf232dcb07eec210c8a2207ef3c0eecd4cd5ad515d967c9fedabbd3451db540c46e486c4@18.130.232.151:37566",
"enode://3c893c87cef40b090feaad65bae4f69ba8545fd1e0d2212852d85172af6042d07a3373a5187ba93ad2f3c85562a8bac4a3f8969efbfbf4269e0239266be6136b@52.194.191.24:37566",
"enode://72f70e8e77f68f5526d730f1003e04caa0995eb5c8fb66644da72b23656dc8c16075b0f740d687a3c2aa9d0db1337bf826715c69ae2adb64dc106d3d4165fd79@47.91.91.217:37566",
"enode://c5780febab5e5a7bd6387a20a2662df3f1b16a10d93931a40a147e0f6cfd89a576c2e2f758e0e886c3f91a1bc43b3c7fa01af0c8b8ce39c8004c048ca880bccf@47.74.1.234:37566",
"enode://9b3b10d4223e010b01411a252312fb69da63b88fd610c07adb5bfa941a8598009a4bb2deeac42c41498acbdaec2196e2cc1fe746286c46f0b5c47d42c5c777b3@47.88.7.24:37566",
}
TestnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the Cerebro test network.
var (
CortexBlockRewardPeriod = big.NewInt(8409600)
)
var DiscoveryV5Bootnodes = []string{}
DiscoveryV5Bootnodes are the enode URLs of the P2P bootstrap nodes for the experimental RLPx v5 topic-discovery network.
var MainnetBootnodes = []string{}
MainnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the main Ethereum network.
var RinkebyBootnodes = []string{}
RinkebyBootnodes are the enode URLs of the P2P bootstrap nodes running on the Rinkeby test network.
var TestnetBootnodes = []string{}
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 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) EIP150Hash common.Hash `json:"eip150Hash,omitempty"` // EIP150 HF hash (needed for header only clients as only gas pricing changed) 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) // Various consensus engines Cuckoo *CuckooConfig `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) 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
IsByzantium returns whether num is either equal to the Byzantium fork block 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) IsHomestead ¶
func (c *ChainConfig) IsHomestead(num *big.Int) bool
IsHomestead returns whether num is either equal to the homestead block or greater.
func (*ChainConfig) Rules ¶
func (c *ChainConfig) Rules(num *big.Int) Rules
Rules ensures c's ChainID is not nil.
func (*ChainConfig) String ¶
func (c *ChainConfig) String() string
String implements the fmt.Stringer interface.
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 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 CuckooConfig ¶ added in v1.0.0
type CuckooConfig struct{}
func (*CuckooConfig) String ¶ added in v1.0.0
func (c *CuckooConfig) String() string
String implements the stringer interface, returning the consensus engine details.
type GasTable ¶
type GasTable struct { ExtcodeSize uint64 ExtcodeCopy uint64 ExtcodeHash 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 }
GasTable organizes gas prices for different ethereum phases.
type Rules ¶
type Rules struct { ChainID *big.Int IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool IsByzantium 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.