params

package
v1.7.8 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2018 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// These are the multipliers for ether 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
	Aquaer   = 1e18
	Aqua     = 1e18
	Einstein = 1e21
	Douglas  = 1e42
)
View Source
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
)
View Source
const (
	VersionMajor = 1     // Major version component of the current release
	VersionMinor = 7     // Minor version component of the current release
	VersionPatch = 8     // Patch version component of the current release
	VersionMeta  = "HF7" // 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
)
View Source
const KnownHF = 9

Variables

View Source
var (
	MainnetGenesisHash  = common.HexToHash("0x381c8d2c3e3bc702533ee504d7621d510339cafd830028337a4b532ff27cd505") // Mainnet genesis hash to enforce below configs on
	TestnetGenesisHash  = common.HexToHash("0xa8773cb7d32b8f7e1b32b0c2c8b735c293b8936dd3760c15afc291a23eb0cf88") // Testnet genesis hash to enforce below configs on
	Testnet2GenesisHash = common.HexToHash("0xde434983d3ada19cd43c44d8ad5511bad01ed12b3cc9a99b1717449a245120df") // Testnet2 genesis hash to enforce below configs on
)
View Source
var (
	AquachainHF = ForkMap{
		0: big.NewInt(3000),
		1: big.NewInt(3600),
		2: big.NewInt(7200),
		3: big.NewInt(13026),
		4: big.NewInt(21800),
		5: big.NewInt(22800),
		6: big.NewInt(36000),
		7: big.NewInt(36050),
	}

	// TestnetHF ...
	TestnetHF = ForkMap{
		0: big.NewInt(0),
		1: big.NewInt(1),
		2: big.NewInt(2),
		3: big.NewInt(3),
		4: big.NewInt(4),
		5: big.NewInt(5),
		6: big.NewInt(6),
		7: big.NewInt(25),
		8: big.NewInt(650),
	}

	// Testnet2HF for -testnet2 private network
	Testnet2HF = ForkMap{
		5: big.NewInt(0),
		6: big.NewInt(0),
		7: big.NewInt(0),
		8: big.NewInt(8),
		9: big.NewInt(19),
	}

	// TestHF for test suite
	TestHF = ForkMap{
		0: big.NewInt(0),

		4: big.NewInt(12),
		5: big.NewInt(13),

		7: big.NewInt(30),
	}
)
View Source
var (
	// MainnetChainConfig is the chain parameters to run a node on the main network.
	MainnetChainConfig = &ChainConfig{
		ChainId:        big.NewInt(61717561),
		HomesteadBlock: big.NewInt(0),
		EIP150Block:    big.NewInt(0),
		EIP155Block:    AquachainHF[7],
		EIP158Block:    AquachainHF[7],
		ByzantiumBlock: AquachainHF[7],
		Aquahash:       new(AquahashConfig),
		HF:             AquachainHF,
	}

	// TestnetChainConfig contains the chain parameters to run a node on the Aquachain test network.
	TestnetChainConfig = &ChainConfig{
		ChainId:        big.NewInt(3),
		HomesteadBlock: big.NewInt(0),
		EIP150Block:    big.NewInt(0),
		EIP155Block:    TestnetHF[7],
		EIP158Block:    TestnetHF[7],
		ByzantiumBlock: TestnetHF[7],
		Aquahash:       new(AquahashConfig),
		HF:             TestnetHF,
	}

	// Testnet2ChainConfig contains the chain parameters to run a node on the Testnet2 test network.
	Testnet2ChainConfig = &ChainConfig{
		ChainId:        big.NewInt(4096),
		HomesteadBlock: big.NewInt(0),
		EIP150Block:    big.NewInt(0),
		EIP155Block:    Testnet2HF[7],
		EIP158Block:    Testnet2HF[7],
		ByzantiumBlock: Testnet2HF[7],
		Aquahash:       new(AquahashConfig),
		HF:             Testnet2HF,
	}

	// AllAquahashProtocolChanges contains every protocol change (EIPs) introduced
	// and accepted by the AquaChain core developers into the Aquahash consensus.
	//
	// This configuration is intentionally not using keyed fields to force anyone
	// adding flags to the config to also have to set these fields.
	AllAquahashProtocolChanges = &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(AquahashConfig), TestHF}

	TestChainConfig = &ChainConfig{big.NewInt(3), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, new(AquahashConfig), TestHF}
	TestRules       = TestChainConfig.Rules(new(big.Int))
)
View Source
var (
	// GasTableHomestead contain the gas prices for
	// the homestead phase.
	GasTableHomestead = GasTable{
		ExtcodeSize: 700,
		ExtcodeCopy: 700,
		Balance:     400,
		SLoad:       200,
		Calls:       700,
		Suicide:     5000,
		ExpByte:     10,

		CreateBySuicide: 25000,
	}

	// GasTableHF1 contain the gas re-prices for
	// the HF1 phase.
	GasTableHF1 = GasTable{
		ExtcodeSize: 700,
		ExtcodeCopy: 700,
		Balance:     400,
		SLoad:       200,
		Calls:       700,
		Suicide:     5000,
		ExpByte:     50,

		CreateBySuicide: 25000,
	}
)
View Source
var (
	MaxMoney             = big.NewInt(42000000) // At block 42mil rewards will be fees-only
	BlockReward *big.Int = big.NewInt(1e+18)    // Block reward in wei for successfully mining a block
)
View Source
var (
	GenesisDifficulty           = big.NewInt(99999999)        // Difficulty of the Genesis block.
	MinimumDifficultyGenesis    = big.NewInt(99999999)        // The minimum that the difficulty may ever be
	MinimumDifficultyHF1        = big.NewInt(100001792)       // The minimum that the difficulty may ever be (changed to a nice multiple of 2048).
	MinimumDifficultyHF3        = big.NewInt(3095918580 * 10) // GPU Announcement
	MinimumDifficultyHF8Testnet = big.NewInt(64)              // Argon2id Announcement
	MinimumDifficultyHF5Testnet = big.NewInt(4096)            // Argon2id Announcement
	MinimumDifficultyHF5        = big.NewInt(46039386)        // Argon2id Announcement
	MinimumDifficultyTestnet    = big.NewInt(4096)            // Argon2id Testnet
)
View Source
var (
	DifficultyBoundDivisor           = big.NewInt(2048) // The bound divisor of the difficulty, used in the update calculations.
	DifficultyBoundDivisorHF5        = big.NewInt(16)   // The bound divisor of the difficulty, used in the update calculations.
	DifficultyBoundDivisorHF6        = big.NewInt(128)  // The bound divisor of the difficulty, used in the update calculations.
	DifficultyBoundDivisorHF8        = big.NewInt(1024) // The bound divisor of the difficulty, used in the update calculations.
	DifficultyBoundDivisorHF8Testnet = big.NewInt(8)    // The bound divisor of the difficulty, used in the update calculations.
	DifficultyBoundDivisorHF9        = big.NewInt(2048) // The bound divisor of the difficulty, used in the update calculations.
)
View Source
var (
	DurationLimit    = big.NewInt(240) // The decision boundary on the blocktime duration used to determine difficulty direction.
	DurationLimitHF6 = big.NewInt(180) // DurationLimitHF6 lowers the duration limit, keeping 240 second target

)
View Source
var DiscoveryV5Bootnodes = []string{
	"enode://7f636b8198a41abb10c1a571992335b8cb760d6ef973efc5f3ff613dda7acbe9e6d6b27254e076ef7b684ac7ea09a27bd05a37844cd8ad242199593bdd8cec21@107.161.24.142:21001",
	"enode://6227ff2948ff51ee4f09e5f1df2c1270c47b753718d406605787326341de6ff8e7cb6a5f01a4deed5437dcdd7b9fb8e656f0ad6a08c1f677c2ca5d0e666a92fc@168.235.78.103:21001",
}

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

View Source
var MainnetBootnodes = []string{

	"enode://7f636b8198a41abb10c1a571992335b8cb760d6ef973efc5f3ff613dda7acbe9e6d6b27254e076ef7b684ac7ea09a27bd05a37844cd8ad242199593bdd8cec21@107.161.24.142:21000",
	"enode://6227ff2948ff51ee4f09e5f1df2c1270c47b753718d406605787326341de6ff8e7cb6a5f01a4deed5437dcdd7b9fb8e656f0ad6a08c1f677c2ca5d0e666a92fc@168.235.78.103:21000",
	"enode://1a6b78cf626540d1eecfeba1f364e72bf92847561b9344403ac7010b2be184cfc760b5bcd21402b19713deebef256dcdfc5af67487554650bf07807737a36203@23.94.123.137:21303",
	"enode://a341920437d7141e4355ed1f298fd2415cbec781c8b4fedd943eac37fd0c835375718085b1a65208c0a06af10c388d452a4148b8430da93bd0b75100b2315f3c@107.161.24.142:21303",
}

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

View Source
var (
	TargetGasLimit uint64 = GenesisGasLimit // The artificial gas limit target
)
View Source
var Testnet2Bootnodes = []string{}

Testnet2Bootnodes are the enode URLs of the P2P bootstrap nodes running on the Testnet2 test network.

View Source
var TestnetBootnodes = []string{
	"enode://6227ff2948ff51ee4f09e5f1df2c1270c47b753718d406605787326341de6ff8e7cb6a5f01a4deed5437dcdd7b9fb8e656f0ad6a08c1f677c2ca5d0e666a92fc@168.235.78.103:21002",
}

TestnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the test network. (port 21002)

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

func VersionWithCommit

func VersionWithCommit(gitCommit string) string

Types

type AquahashConfig

type AquahashConfig struct{}

AquahashConfig is the consensus engine configs for proof-of-work based sealing.

func (*AquahashConfig) String

func (c *AquahashConfig) String() string

String implements the stringer interface, returning the consensus engine details.

type ChainConfig

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,omitempty"` // Homestead switch block (nil = no fork, 0 = already homestead)

	// et junk to remove
	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/aquanetwork/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
	Aquahash *AquahashConfig `json:"aquahash,omitempty"`

	// HF Scheduled Maintenance Hardforks
	HF ForkMap `json:"hf,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.

The returned GasTable's fields shouldn't, under any circumstances, be changed.

func (ChainConfig) GetBlockVersion added in v1.5.1

func (c ChainConfig) GetBlockVersion(height *big.Int) HeaderVersion

func (*ChainConfig) GetHF added in v1.5.1

func (c *ChainConfig) GetHF(hf int) *big.Int

GetHF returns the height of input hf, can be nil.

func (*ChainConfig) IsByzantium

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

func (*ChainConfig) IsConstantinople

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

func (*ChainConfig) IsDAOFork

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

IsDAO returns whether num is either equal to the DAO fork block or greater.

func (*ChainConfig) IsEIP150

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

func (*ChainConfig) IsEIP155

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

func (*ChainConfig) IsEIP158

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

func (*ChainConfig) IsHF

func (c *ChainConfig) IsHF(hf int, num *big.Int) bool

IsHF returns whether num is either equal to the hf 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) NextHF

func (c *ChainConfig) NextHF(cur *big.Int) *big.Int

NextHF returns the next scheduled hard fork block number

func (*ChainConfig) Rules

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

func (*ChainConfig) String

func (c *ChainConfig) String() string

String implements the fmt.Stringer interface.

func (*ChainConfig) UseHF added in v1.7.8

func (c *ChainConfig) UseHF(height *big.Int) int

UseHF returns the highest hf that is activated

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 ForkMap

type ForkMap map[int]*big.Int

func (ForkMap) Sorted added in v1.7.8

func (f ForkMap) Sorted() (hfs []int)

func (ForkMap) String

func (f ForkMap) String() (s string)

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
}

type HeaderVersion added in v1.5.1

type HeaderVersion byte

HeaderVersion is not stored in db, or rlp encoded, or sent over the network.

type Rules

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