Documentation ¶
Index ¶
Constants ¶
const ( // These are the multipliers for network 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 Love = 1e18 Einstein = 1e21 Douglas = 1e42 )
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. 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. 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. 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 = 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. 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 = 24576 // Maximum bytecode to permit for a contract 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 ( VersionMajor = 0 // Major version component of the current release VersionMinor = 0 // Minor version component of the current release VersionPatch = 9 // Patch version component of the current release VersionMeta = "beta" // 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 ( // TODO MainnetGenesisHash = common.HexToHash("0xff4a7c7beda3c3eb3fb6eb2fd90f75db88f1ad0894ec773db43028787121691e") // Mainnet genesis hash to enforce below configs on TestnetGenesisHash = common.HexToHash("0x682c33863395ea58a7e08c63b0a655ffcdc707d1c03c8dda791f3642ba441a96") // Testnet genesis hash to enforce below configs on )
var ( // MainnetChainConfig is the chain parameters to run a node on the main network. MainnetChainConfig = &ChainConfig{ ChainId: big.NewInt(20180627), Dpovp: &DpovpConfig{Timeout: 10 * 1000, Sleeptime: 3 * 1000}, } // TestnetChainConfig contains the chain parameters to run a node on the Test network. TestnetChainConfig = &ChainConfig{ ChainId: big.NewInt(100), Dpovp: &DpovpConfig{Timeout: 10 * 1000, Sleeptime: 3 * 1000}, } // AllLovehashProtocolChanges contains every protocol change (EIPs) introduced // and accepted by the LoveBlock core developers into the Lovehash consensus. // // This configuration is intentionally not using keyed fields to force anyone // adding flags to the config to also have to set these fields. // AllLovehashProtocolChanges = &ChainConfig{big.NewInt(1337), &DpovpConfig{Timeout: 10 * 1000, Sleeptime: 3 * 1000}} AllLovehashProtocolChanges = &ChainConfig{big.NewInt(20180627), &DpovpConfig{Timeout: 10 * 1000, Sleeptime: 3 * 1000}} TestChainConfig = &ChainConfig{big.NewInt(1), new(DpovpConfig)} )
var ( DifficultyBoundDivisor = big.NewInt(2048) // The bound divisor of the difficulty, used in the update calculations. GenesisDifficulty = big.NewInt(0) // Difficulty of the Genesis block. MinimumDifficulty = big.NewInt(0) // 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 (
DefaultGasTable = GasTable{
ExtcodeSize: 700,
ExtcodeCopy: 700,
Balance: 400,
SLoad: 200,
Calls: 700,
Suicide: 5000,
ExpByte: 50,
CreateBySuicide: 25000,
}
)
var DiscoveryV5Bootnodes = []string{
"enode://7b1cb5d049aa08ac6e7be442d44fe0c9d3e2404b3a6d71d3ebe14d5aa961bf0d232571c8d64dd0ceeff37208312f1591ff9b2bab8030b2dbb03b588e41f36ba9@149.28.68.93:50301",
}
DiscoveryV5Bootnodes are the enode URLs of the P2P bootstrap nodes for the experimental RLPx v5 topic-discovery network.
var MainnetBootnodes = []string{
"enode://948cee7ebfbb76f425344e77314dabd7146e6f14d1b81b7d10485cb120f8d7cc04687a193a4500a014fbd26ed9c6cb8c52b1d08b13c1c27d0574cb73c22517c6@149.28.68.93:60603",
"enode://46880c2bc68d7fcf6819d04bcbc626caa170fad970a3a2158dc5b6c92244ea786c8c41e9fa206194a9c96b579f28e903d13e0f057cf642dfc3f49028a0bfe419@149.28.68.93:60000",
}
MainnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the main LoveBlock network.
var (
TargetGasLimit uint64 = GenesisGasLimit // The artificial target
)
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 VersionWithCommit ¶
Types ¶
type ChainConfig ¶
type ChainConfig struct { ChainId *big.Int `json:"chainId"` // Chain id identifies the current chain and is used for replay protection // Various consensus engines Dpovp *DpovpConfig `json:"dpovp,omitempty"` // sman for dpovp }
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) String ¶
func (c *ChainConfig) String() string
String implements the fmt.Stringer interface.
type ConfigCompatError ¶
type ConfigCompatError struct { What string // block numbers of the stored and new configurations StoredConfig, NewConfig *big.Int // the block number to which the local chain must be rewound to correct the error RewindTo uint64 }
ConfigCompatError is raised if the locally-stored blockchain is initialised with a ChainConfig that would alter the past.
func (*ConfigCompatError) Error ¶
func (err *ConfigCompatError) Error() string
type DpovpConfig ¶
type DpovpConfig struct { Timeout int64 `json:"Timeout"` // Number of timeout between blocks to produce millsecond Sleeptime int64 `json:"Sleeptime"` // Time of one block is produced and before ohter node begin produce another block millsecond }
sman DpovpConfig is the consensus engine configs for dpos
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 }