Documentation ¶
Index ¶
Constants ¶
const ( // These are the multipliers for won denominations. // Example: To get the wei value of an amount in 'douglas', use // // new(big.Int).Mul(value, big.NewInt(params.Douglas)) // Wei = 1 Ada = 1e3 Babbage = 1e6 Shannon = 1e9 Szabo = 1e12 Finney = 1e15 WON = 1e18 Einstein = 1e21 Douglas = 1e42 )
const ( GasLimitBoundDivisor uint64 = 1024 // The bound divisor of the gas limit, used in update calculations. MinGasLimit uint64 = 20 // Minimum the gas limit may ever be. GenesisGasLimit uint64 = 4712388 // Gas limit of the Genesis block. MaximumExtraDataSize uint64 = 32 // Maximum size extra data may be after Genesis. ExpByteGas uint64 = 2 // Times ceil(log256(exponent)) for the EXP instruction. SloadGas uint64 = 5 // Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added. CallValueTransferGas uint64 = 5 // Paid for CALL when the value transfer is non-zero. CallNewAccountGas uint64 = 5 // Paid for CALL when the destination address didn't exist prior. TxGas uint64 = 210 // Per transaction not creating a contract. NOTE: Not payable on data of calls between transactions. TxGasContractCreation uint64 = 5 // Per transaction that creates a contract. NOTE: Not payable on data of calls between transactions. TxDataZeroGas uint64 = 2 // 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 = 2 // Once per SLOAD operation. LogDataGas uint64 = 2 // Per byte in a LOG* operation's data. CallStipend uint64 = 2 // Free gas given at beginning of call. Sha3Gas uint64 = 3 // Once per SHA3 operation. Sha3WordGas uint64 = 2 // Once per word of the SHA3 operation's data. SstoreResetGas uint64 = 5 // Once per SSTORE operation if the zeroness changes from zero. SstoreClearGas uint64 = 5 // Once per SSTORE operation if the zeroness doesn't change. SstoreRefundGas uint64 = 5 // 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 = 2 // Once per CALL operation & message call transaction. CreateDataGas uint64 = 2 // CallCreateDepth uint64 = 1024 // Maximum depth of call/create stack. ExpGas uint64 = 2 // Once per EXP instruction LogGas uint64 = 3 // 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 = 3 // Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas. CreateGas uint64 = 2 // Once per CREATE operation & contract-creation transaction. SuicideRefundGas uint64 = 2 // 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 = 6 // Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions. MaxCodeSize = 24576 // Maximum bytecode to permit for a contract EcrecoverGas uint64 = 3 // Elliptic curve sender recovery gas price Sha256BaseGas uint64 = 3 // Base price for a SHA256 operation Sha256PerWordGas uint64 = 2 // Per-word price for a SHA256 operation Ripemd160BaseGas uint64 = 6 // Base price for a RIPEMD160 operation Ripemd160PerWordGas uint64 = 2 // Per-word price for a RIPEMD160 operation IdentityBaseGas uint64 = 2 // 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 = 1 // Gas needed for an elliptic curve addition Bn256ScalarMulGas uint64 = 1 // Gas needed for an elliptic curve scalar multiplication Bn256PairingBaseGas uint64 = 1 // Base price for an elliptic curve pairing check Bn256PairingPerPointGas uint64 = 2 // Per-point price for an elliptic curve pairing check )
const ( VersionMajor = 1 // Major version component of the current release VersionMinor = 8 // Minor version component of the current release VersionPatch = 6 // Patch version component of the current release VersionMeta = "unstable" // Version metadata to append to the version string )
const ( // BloomBitsBlocks is the number of blocks a single bloom bit section vector // contains. BloomBitsBlocks uint64 = 4096 )
Variables ¶
var ( MainnetGenesisHash = common.HexToHash("0x7a027e2464b52d43bb8bc0145484cf866bdab41dfdd86f69bde335211ff80601") // Mainnet genesis hash to enforce below configs on TestnetGenesisHash = common.HexToHash("0x038876a973c23f5987028029fc0906a970b785b8879723e9b36170654d55fa7d") // Testnet genesis hash to enforce below configs on BetanetGenesisHash = common.HexToHash("0xe10b936cc354fc014aba0bc576a8eb407fabbeebf25df53f1b61a1b6d8f18138") // Betanet genesis hash to enforce below configs on TODO FIX )
var ( // MainnetChainConfig is the chain parameters to run a node on the main network. MainnetChainConfig = &ChainConfig{ ChainId: big.NewInt(1), CheckForTokenKycBlock: big.NewInt(233000), Clique: &CliqueConfig{Period: 3, Epoch: 30000}, } // TestnetChainConfig contains the chain parameters to run a node on the Ropsten test network. TestnetChainConfig = &ChainConfig{ ChainId: big.NewInt(2), Clique: &CliqueConfig{Period: 3, Epoch: 30000}, } DevChainConfig = &ChainConfig{ ChainId: big.NewInt(3), Clique: &CliqueConfig{Period: 0, Epoch: 30000}, } TestChainConfig = &ChainConfig{ ChainId: big.NewInt(3), Clique: &CliqueConfig{Period: 0, Epoch: 30000}, } // BetanetChainConfig contains the chain parameters to run a node on the Betanet test network. BetanetChainConfig = &ChainConfig{ ChainId: big.NewInt(20180902), Dpos: &DposConfig{Period: 1, Epoch: 30000, MaxDposConfirm: 1024, ProducerRepetions: 12}, } )
var ( // GasTableHomestead contain the gas prices for // the homestead phase. GasTableHomestead = GasTable{ ExtcodeSize: 2, ExtcodeCopy: 2, Balance: 2, SLoad: 5, Calls: 2, Suicide: 0, ExpByte: 2, } // GasTableHomestead contain the gas re-prices for // the homestead phase. GasTableEIP150 = GasTable{ ExtcodeSize: 2, ExtcodeCopy: 2, Balance: 2, SLoad: 5, Calls: 2, Suicide: 0, ExpByte: 2, CreateBySuicide: 5, } GasTableEIP158 = GasTable{ ExtcodeSize: 2, ExtcodeCopy: 2, Balance: 2, SLoad: 5, Calls: 2, Suicide: 0, ExpByte: 2, CreateBySuicide: 5, } GasPrice = 10 * Wei )
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. )
var BetanetBootnodes = []string{
"enode://3434564bbc92c6cbd376788b8050c8c6cf656b9dc211c0594189fbb9975125732e06dc66b2a6da131ea8e6f1bc5e7a17eef22d899f6586d81d18b74a868c1dea@192.168.1.41:30304",
}
BetanetBootnodes are the enode URLs of the P2P bootstrap nodes running on the Betanet test network.
var DAOForkBlockExtra = common.FromHex("0x64616f2d686172642d666f726b")
DAOForkBlockExtra is the block header extra-data field to set for the DAO fork point and a number of consecutive blocks to allow fast/light syncers to correctly pick the side they want ("dao-hard-fork").
var DAOForkExtraRange = big.NewInt(10)
DAOForkExtraRange is the number of consecutive blocks from the DAO fork point to override the extra-data in to prevent no-fork attacks.
var DAORefundContract = common.HexToAddress("0xbf4ed7b27f1d666546e30d74d50d173d20bca754")
DAORefundContract is the address of the refund contract to send DAO balances to.
var DiscoveryV5Bootnodes = []string{
"enode://19b78a841f81bbd2e928827b9efb68288db9374ca83ba2d978b1d95cf5b4624b2627034598f7ec67fc1306cbd34fd7fae443005b0fc83ac8f3f891d998471aa5@35.203.113.254:30331",
}
DiscoveryV5Bootnodes are the enode URLs of the P2P bootstrap nodes for the experimental RLPx v5 topic-discovery network.
var MainnetBootnodes = []string{
"enode://ad336b0e0878c66a368beea8361ca74b5382548c10d1e205e278f72d7cdd5005963f8eb9d7ef234f7bd636516523e6031ab478fa9287926720a84f7b3f13f6c3@104.196.238.56:30331",
"enode://19b78a841f81bbd2e928827b9efb68288db9374ca83ba2d978b1d95cf5b4624b2627034598f7ec67fc1306cbd34fd7fae443005b0fc83ac8f3f891d998471aa5@35.203.113.254:30331",
}
MainnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the main WorldOpenNetwork network.
var (
TargetGasLimit uint64 = GenesisGasLimit // The artificial target
)
var TestnetBootnodes = []string{
"enode://2f2a4f853b9799b6faed8653a586c7b6bc4f1906e54462d076acc9825ae2c0f383ad3d867f7af4eb53a5ec4f582b5836882b1af81e66ecf7b69a2187362232ee@35.236.95.86:30331",
}
TestnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the won alpha test network.
var Version = func() string { v := fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch) if VersionMeta != "" { v += "-" + VersionMeta } return v }()
Version holds the textual version string.
Functions ¶
func DAODrainList ¶
DAODrainList is the list of accounts whose full balances will be moved into a refund contract at the beginning of the dao-fork block.
func VersionWithCommit ¶
Types ¶
type ChainConfig ¶
type ChainConfig struct { ChainId *big.Int `json:"chainId"` // Chain id identifies the current chain and is used for replay protection CheckForTokenKycBlock *big.Int `json:"checkforTokonKycBlock,omitempty"` // Various consensus engines Ethash *EthashConfig `json:"ethash,omitempty"` Clique *CliqueConfig `json:"clique,omitempty"` Dpos *DposConfig `json:"dpos,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) 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 DposConfig ¶
type DposConfig struct { Period uint64 `json:"period"` // Number of seconds between blocks to enforce Epoch uint64 `json:"epoch"` // Epoch length to reset votes and checkpoint MaxDposConfirm uint64 `json:"maxDposConfirm"` ProducerRepetions uint64 `json:"producerRepetions"` }
func (*DposConfig) String ¶
func (c *DposConfig) String() string
String implements the stringer interface, returning the consensus engine details.
type EthashConfig ¶
type EthashConfig struct{}
EthashConfig is the consensus engine configs for proof-of-work based sealing.
func (*EthashConfig) String ¶
func (c *EthashConfig) String() string
String implements the stringer interface, returning the consensus engine details.
type GasTable ¶
type GasTable struct { ExtcodeSize uint64 ExtcodeCopy uint64 Balance uint64 SLoad uint64 Calls uint64 Suicide uint64 ExpByte uint64 // CreateBySuicide occurs when the // refunded account is one that does // not exist. This logic is similar // to call. May be left nil. Nil means // not charged. CreateBySuicide uint64 }