params

package
v0.4.1-dev Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2019 License: GPL-3.0 Imports: 3 Imported by: 15

Documentation

Index

Constants

View Source
const (
	Ta    = 1
	Gta   = 1e9
	Ether = 1e18
)

These are the multipliers for ether denominations. Example: To get the ta value of an amount in 'sero', use

new(big.Int).Mul(value, big.NewInt(params.Sero))
View Source
const (
	GasLimitBoundDivisor uint64 = 1024     // The bound divisor of the gas limit, used in update calculations.
	MinGasLimit          uint64 = 5000000  // Minimum the gas limit may ever be.
	GenesisGasLimit      uint64 = 79999998 // 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 = 25000 // Per transaction not creating a contract. NOTE: Not payable on data of calls between transactions.
	TxGasContractCreation uint64 = 56000 // 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.
	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 = 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
	DefaultCurrency         string = "SERO"
)
View Source
const (
	VersionMajor = 0         // Major version component of the current release
	VersionMinor = 4         // Minor version component of the current release
	VersionPatch = 1         // Patch version component of the current release
	VersionMeta  = "beta.r2" // Version metadata to append to the version string
)
View Source
const (
	// BloomBitsBlocks is the number of blocks a single bloom bit section vector
	// contains.
	BloomBitsBlocks uint64 = 4096
)

Variables

View Source
var (
	MainnetGenesisHash  = common.HexToHash("0x113d483242270ab0cd4ba353cc04b64a062713a5f05bbe97b8a0548e73218e70")
	AlphanetGenesisHash = common.HexToHash("0x294e3d4cc16e116c4a9e1d576f868d759b07ac6e010251eb93c55adb15a562ca")
)

Genesis hashes to enforce below configs on.

View Source
var (
	// BetanetChainConfig is the chain parameters to run a node on the main network.
	BetanetChainConfig = &ChainConfig{
		ChainID:             big.NewInt(2019),
		AutumnTwilightBlock: big.NewInt(0),
		Ethash:              new(EthashConfig),
	}

	// AlphanetChainConfig contains the chain parameters to run a node on the Ropsten test network.
	AlphanetChainConfig = &ChainConfig{
		ChainID:             big.NewInt(1000),
		AutumnTwilightBlock: big.NewInt(0),
		Ethash:              new(EthashConfig),
	}

	// RinkebyChainConfig contains the chain parameters to run a node on the Rinkeby test network.
	DevnetChainConfig = &ChainConfig{
		ChainID:             big.NewInt(1024),
		AutumnTwilightBlock: big.NewInt(0),
		Ethash:              new(EthashConfig),
	}

	// AllEthashProtocolChanges contains every protocol change (EIPs) introduced
	// and accepted by the Ethereum core developers into the Ethash consensus.
	//
	// This configuration is intentionally not using keyed fields to force anyone
	// adding flags to the config to also have to set these fields.
	AllEthashProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), new(EthashConfig)}

	// 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}

	TestChainConfig = &ChainConfig{
		ChainID:             big.NewInt(1),
		AutumnTwilightBlock: big.NewInt(0),

		Ethash: new(EthashConfig),
	}
)
View Source
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.
	GenesisAvgUsedGas      = big.NewInt(25000)
)
View Source
var AlphanetBootnodes = []string{
	"snode://29ad1a59fbb8984ec167b890ddb52e8690c6c1699c6796ca209cc2d0a5603760f25747fdae61ecb937260491f51632e6651a9292b2b3ce871e6c2e0c7c0f7c00@118.25.146.113:60609",
}

AlphanetBootnodes are the enode URLs of the P2P bootstrap nodes running on the Ropsten test network.

View Source
var BetanetBootnodes = []string{
	"snode://c4c6aa3e3c73c1d86d53f904bb82ffbbc50edd75530487f053d37bbcf75e27ca4c7ec215f56274cf60176b5d7fb896c9bd54354ba2fedb7d3adb35efc053cd14@13.251.221.90:53719",
	"snode://1eb4b0bfa17bd70601b70da8df9070f5b4d1757864e0361e730bba04ccdc8e02cb0d51b8428921570684357eb9c053c433e23085a51e6ffde1c0d734f8dbbfe6@140.143.152.43:53719",
	"snode://f5f92eb85242a4ad9853d7315caeb5ff38ff90aa137e2348d42fef7ea90eb3012d369f4eae1efefb26ee20ee41c6380798f77108109039336b77ec9d65def74f@111.230.148.82:53719",
	"snode://81abed64774e612362f133e045289d4e6644cbfe6421c21856f0f01eb4145531256ce0a2b61bd1baa100f14b1e940fda79643fbdf34a75a5a3e470a1ab4e8a8e@118.25.146.113:53719",
}

BetanetBootnodes are the enode URLs of the P2P bootstrap nodes running on the main Ethereum network.

View Source
var DevBootnodes = []string{}
View Source
var DiscoveryV5Bootnodes = []string{
	"snode://bb50e2d89a4ed70663d080659fe0ad4b9bc3e06c17a227433966cb59ceee020decddbf6e00192011648d13b1c00af770c0c1bb609d4d3a5c98a43772e0e18ef4@192.168.15.252:60601",
}

DiscoveryV5Bootnodes are the enode URLs of the P2P bootstrap nodes for the experimental RLPx v5 topic-discovery network.

View Source
var (
	// 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.

View Source
var (
	TargetGasLimit = GenesisGasLimit // The artificial target
)
View Source
var Version = func() string {
	return fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
}()

Version holds the textual version string.

View Source
var VersionWithMeta = func() string {
	v := Version
	if VersionMeta != "" {
		v += "-" + VersionMeta
	}
	return v
}()

VersionWithMeta holds the textual version string including the metadata.

Functions

func ArchiveVersion

func ArchiveVersion(gitCommit string) string

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

func VersionWithCommit(gitCommit string) string

Types

type ChainConfig

type ChainConfig struct {
	ChainID *big.Int `json:"chainId"` // chainId identifies the current chain and is used for replay protection

	AutumnTwilightBlock *big.Int `json:"AutumnTwilightBlock,omitempty"` // AutumnTwilightBlock switch block (nil = no fork, 0 = already on AutumnTwilightBlock)

	// Various consensus engines
	Ethash *EthashConfig `json:"ethash,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) IsAutumnTwilight

func (c *ChainConfig) IsAutumnTwilight(num *big.Int) bool

IsAutumnTwilight returns whether num is either equal to the AutumnTwilight fork 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 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
	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
	IsAutumnTwilight bool
}

Rules wraps ChainConfig and is merely syntatic 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL