params

package
v1.5.99 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2017 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VersionMajor = 1        // Major version component of the current release
	VersionMinor = 5        // Minor version component of the current release
	VersionPatch = 99       // Patch version component of the current release
	VersionMeta  = "stable" // Version metadata to append to the version string
)

Variables

View Source
var (
	TestChainConfig = &ChainConfig{big.NewInt(1), new(big.Int), new(big.Int), true, new(big.Int), common.Hash{}, new(big.Int), new(big.Int), new(big.Int)}
	TestRules       = TestChainConfig.Rules(new(big.Int))
)
View Source
var (
	// GasTableHomestead contain the gas prices for
	// the homestead phase.
	GasTableHomestead = GasTable{
		ExtcodeSize: big.NewInt(20),
		ExtcodeCopy: big.NewInt(20),
		Balance:     big.NewInt(20),
		SLoad:       big.NewInt(50),
		Calls:       big.NewInt(40),
		Suicide:     big.NewInt(0),
		ExpByte:     big.NewInt(10),

		CreateBySuicide: nil,
	}

	// GasTableHomestead contain the gas re-prices for
	// the homestead phase.
	//
	// TODO rename to GasTableEIP150
	GasTableHomesteadGasRepriceFork = GasTable{
		ExtcodeSize: big.NewInt(700),
		ExtcodeCopy: big.NewInt(700),
		Balance:     big.NewInt(400),
		SLoad:       big.NewInt(200),
		Calls:       big.NewInt(700),
		Suicide:     big.NewInt(5000),
		ExpByte:     big.NewInt(10),

		CreateBySuicide: big.NewInt(25000),
	}

	GasTableEIP158 = GasTable{
		ExtcodeSize: big.NewInt(700),
		ExtcodeCopy: big.NewInt(700),
		Balance:     big.NewInt(400),
		SLoad:       big.NewInt(200),
		Calls:       big.NewInt(700),
		Suicide:     big.NewInt(5000),
		ExpByte:     big.NewInt(50),

		CreateBySuicide: big.NewInt(25000),
	}
)
View Source
var (
	MaximumExtraDataSize   = big.NewInt(32)     // Maximum size extra data may be after Genesis.
	ExpByteGas             = big.NewInt(10)     // Times ceil(log256(exponent)) for the EXP instruction.
	SloadGas               = big.NewInt(50)     // Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added.
	CallValueTransferGas   = big.NewInt(9000)   // Paid for CALL when the value transfer is non-zero.
	CallNewAccountGas      = big.NewInt(25000)  // Paid for CALL when the destination address didn't exist prior.
	TxGas                  = big.NewInt(21000)  // Per transaction not creating a contract. NOTE: Not payable on data of calls between transactions.
	TxGasContractCreation  = big.NewInt(53000)  // Per transaction that creates a contract. NOTE: Not payable on data of calls between transactions.
	TxDataZeroGas          = big.NewInt(4)      // Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions.
	DifficultyBoundDivisor = big.NewInt(2048)   // The bound divisor of the difficulty, used in the update calculations.
	QuadCoeffDiv           = big.NewInt(512)    // Divisor for the quadratic particle of the memory cost equation.
	GenesisDifficulty      = big.NewInt(131072) // Difficulty of the Genesis block.
	DurationLimit          = big.NewInt(13)     // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
	SstoreSetGas           = big.NewInt(20000)  // Once per SLOAD operation.
	LogDataGas             = big.NewInt(8)      // Per byte in a LOG* operation's data.
	CallStipend            = big.NewInt(2300)   // Free gas given at beginning of call.
	EcrecoverGas           = big.NewInt(3000)   //
	Sha256WordGas          = big.NewInt(12)     //

	MinGasLimit     = big.NewInt(5000)                  // Minimum the gas limit may ever be.
	GenesisGasLimit = big.NewInt(4712388)               // Gas limit of the Genesis block.
	TargetGasLimit  = new(big.Int).Set(GenesisGasLimit) // The artificial target

	Sha3Gas              = big.NewInt(30)     // Once per SHA3 operation.
	Sha256Gas            = big.NewInt(60)     //
	IdentityWordGas      = big.NewInt(3)      //
	Sha3WordGas          = big.NewInt(6)      // Once per word of the SHA3 operation's data.
	SstoreResetGas       = big.NewInt(5000)   // Once per SSTORE operation if the zeroness changes from zero.
	SstoreClearGas       = big.NewInt(5000)   // Once per SSTORE operation if the zeroness doesn't change.
	SstoreRefundGas      = big.NewInt(15000)  // Once per SSTORE operation if the zeroness changes to zero.
	JumpdestGas          = big.NewInt(1)      // Refunded gas, once per SSTORE operation if the zeroness changes to zero.
	IdentityGas          = big.NewInt(15)     //
	GasLimitBoundDivisor = big.NewInt(1024)   // The bound divisor of the gas limit, used in update calculations.
	EpochDuration        = big.NewInt(30000)  // Duration between proof-of-work epochs.
	CallGas              = big.NewInt(40)     // Once per CALL operation & message call transaction.
	CreateDataGas        = big.NewInt(200)    //
	Ripemd160Gas         = big.NewInt(600)    //
	Ripemd160WordGas     = big.NewInt(120)    //
	MinimumDifficulty    = big.NewInt(131072) // The minimum that the difficulty may ever be.
	CallCreateDepth      = big.NewInt(1024)   // Maximum depth of call/create stack.
	ExpGas               = big.NewInt(10)     // Once per EXP instruction.
	LogGas               = big.NewInt(375)    // Per LOG* operation.
	CopyGas              = big.NewInt(3)      //
	StackLimit           = big.NewInt(1024)   // Maximum size of VM stack allowed.
	TierStepGas          = big.NewInt(0)      // Once per operation, for a selection of them.
	LogTopicGas          = big.NewInt(375)    // Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas.
	CreateGas            = big.NewInt(32000)  // Once per CREATE operation & contract-creation transaction.
	SuicideRefundGas     = big.NewInt(24000)  // Refunded following a suicide operation.
	MemoryGas            = big.NewInt(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     = big.NewInt(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
)
View Source
var (
	TestNetGenesisHash = common.HexToHash("")                                                                   // Testnet genesis hash to enforce below configs on
	MainNetGenesisHash = common.HexToHash("0xc7130c992fb03c628c86439f8e5d1facdbf48f3f3c115ffd99a0e3abefa1016f") // Mainnet genesis hash to enforce below configs on

	TestNetHomesteadBlock = big.NewInt(0) // Testnet homestead block
	MainNetHomesteadBlock = big.NewInt(0) // Mainnet homestead block

	TestNetHomesteadGasRepriceBlock = big.NewInt(0)       // Testnet gas reprice block
	MainNetHomesteadGasRepriceBlock = big.NewInt(1900000) // Mainnet gas reprice block

	TestNetHomesteadGasRepriceHash = common.HexToHash("")                                                                   // Testnet gas reprice block hash (used by fast sync)
	MainNetHomesteadGasRepriceHash = common.HexToHash("0xa5424a91123120af253eb00ef60da314294424a8466f6cf3ac687092a726995e") // Mainnet gas reprice block hash (used by fast sync)

	TestNetSpuriousDragon = big.NewInt(0)
	MainNetSpuriousDragon = big.NewInt(1900000)

	MainNetTronRecursive = big.NewInt(1900000)

	TestNetChainID = big.NewInt(70709) // Test net default chain ID
	MainNetChainID = big.NewInt(73733) // main net default chain ID
)
View Source
var DiscoveryV5Bootnodes = []string{}

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

View Source
var INTERATELLARDrainList []common.Address

INTERATELLARDrainList is the list of accounts whose full balances will be moved into a refund contract at the beginning of the interstellar-leap block.

View Source
var INTERSTELLARRefundContract = common.HexToAddress("0xbf4ed7b27f1d666546e30d74d50d173d20bca754")

INTERSTELLARRefundContract is the address of the refund contract to send INTERSTELLAR balances to.

View Source
var INTERSTELLARleapBlockExtra = common.FromHex("0x7065726d616e656e746c7920656e6c617267696e67")

INTERSTELLARleapBlockExtra is the block header extra-data field to set for the INTERSTELLAR leap point and a number of consecutive blocks to allow fast/light syncers to correctly pick the side they want ("interstellar-hard-leap").

View Source
var INTERSTELLARleapExtraRange = big.NewInt(10)

INTERSTELLARleapExtraRange is the number of consecutive blocks from the INTERSTELLAR leap point to override the extra-data in to prevent no-leap attacks.

View Source
var MainNetINTERSTELLARleapBlock = big.NewInt(9223372036854775805)

MainNetINTERSTELLARleapBlock is the block number where the INTERSTELLAR hyperz-leap commences on the Elementrem main network.

View Source
var MainnetBootnodes = []string{

	"enode://4c20c27d0331c2961faa7f678d74a03344dc6f6562ee62fff3891e85297f1ce48d1a667900d0da92b8085ed26883d7521b4a4ed2ff542b7ad2fa3cc4f1554e40@52.51.84.216:30707",
	"enode://a24a2c48f6b42c52521c2a0e7dff64c1f4ca98226aadbba499d08a59eb19b2b0802aa35f77b668ff1eb39d7f2ef53445e8624f02a7b42930355b43bc59cb4c93@50.17.164.173:30707",
	"enode://ef13e446f647dd3d86bace64bd0e704b4782ae9eb9930154eae0e18975f7bb13b6a0150da32b033de47423a425f205e76f2099d5f647fc32c61c073c40a3ae41@52.160.107.78:30707",
	"enode://d9b6745d1dcdc9122e7ba44a18c78ccc5140f4627ee019c430fe4a8094b6e91bbd5bcbac99a2cdac9b86e99c6109eea5408fbfa6ad41817cd12e83151ebb7fe7@34.195.98.164:30707",
}

MainnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the main Elementrem network.

View Source
var MainnetChainConfig = &ChainConfig{
	ChainId:                 MainNetChainID,
	HomesteadBlock:          MainNetHomesteadBlock,
	INTERSTELLARleapBlock:   MainNetINTERSTELLARleapBlock,
	INTERSTELLARleapSupport: true,
	EIP150Block:             MainNetHomesteadGasRepriceBlock,
	EIP150Hash:              MainNetHomesteadGasRepriceHash,
	EIP155Block:             MainNetSpuriousDragon,
	EIP158Block:             MainNetSpuriousDragon,
	TronBlock:               MainNetTronRecursive,
}

MainnetChainConfig is the chain parameters to run a node on the main network.

View Source
var TestNetINTERSTELLARleapBlock *big.Int

TestNetINTERSTELLARleapBlock is the block number where the INTERSTELLAR hyperz-leap commences on the Elementrem test network. It's enforced nil since it was decided not to do a testnet transition.

View Source
var TestnetBootnodes = []string{}

TestnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the Morden test network.

View Source
var TestnetChainConfig = &ChainConfig{
	ChainId:                 big.NewInt(3),
	HomesteadBlock:          big.NewInt(0),
	INTERSTELLARleapBlock:   nil,
	INTERSTELLARleapSupport: true,
	EIP150Block:             big.NewInt(0),
	EIP150Hash:              common.HexToHash("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d"),
	EIP155Block:             big.NewInt(10),
	EIP158Block:             big.NewInt(10),
}

TestnetChainConfig is the chain parameters to run a node on the test network.

View Source
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

This section is empty.

Types

type ChainConfig added in v1.5.97

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

	HomesteadBlock          *big.Int `json:"homesteadBlock"`          // Homestead switch block (nil = no fork, 0 = already homestead)
	INTERSTELLARleapBlock   *big.Int `json:"interstellarLeapBlock"`   // TheINTERSTELLAR hyperz-leap switch block (nil = no fork)
	INTERSTELLARleapSupport bool     `json:"interstellarLeapSupport"` // Whether the nodes supports or opposes the INTERSTELLAR hyperz-leap

	// EIP150 implements the Gas price changes
	EIP150Block *big.Int    `json:"eip150Block"` // EIP150 HF block (nil = no fork)
	EIP150Hash  common.Hash `json:"eip150Hash"`  // EIP150 HF hash (fast sync aid)

	EIP155Block *big.Int `json:"eip155Block"` // EIP155 HF block
	EIP158Block *big.Int `json:"eip158Block"` // EIP158 HF block
	TronBlock   *big.Int `json:"tronblock"`   // POW 2.0
}

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) GasTable added in v1.5.97

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) IsEIP150 added in v1.5.97

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

func (*ChainConfig) IsEIP155 added in v1.5.97

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

func (*ChainConfig) IsEIP158 added in v1.5.97

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

func (*ChainConfig) IsHomestead added in v1.5.97

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

IsHomestead returns whether num is either equal to the homestead block or greater.

func (*ChainConfig) Rules added in v1.5.97

func (c *ChainConfig) Rules(num *big.Int) Rules

func (*ChainConfig) String added in v1.5.97

func (c *ChainConfig) String() string

String implements the Stringer interface.

type GasTable added in v1.5.97

type GasTable struct {
	ExtcodeSize *big.Int
	ExtcodeCopy *big.Int
	Balance     *big.Int
	SLoad       *big.Int
	Calls       *big.Int
	Suicide     *big.Int

	ExpByte *big.Int

	// 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 *big.Int
}

type Rules added in v1.5.97

type Rules struct {
	ChainId                                   *big.Int
	IsHomestead, IsEIP150, IsEIP155, IsEIP158 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