Documentation
¶
Index ¶
- Constants
- Variables
- func DAODrainList() []common.Address
- func IsMainChain(chainId string) bool
- func VersionWithCommit(gitCommit string) string
- type ChainConfig
- func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64) *ConfigCompatError
- func (c *ChainConfig) GasTable(num *big.Int) GasTable
- func (c *ChainConfig) IsByzantium(num *big.Int) bool
- func (c *ChainConfig) IsConstantinople(num *big.Int) bool
- func (c *ChainConfig) IsEIP150(num *big.Int) bool
- func (c *ChainConfig) IsEIP155(num *big.Int) bool
- func (c *ChainConfig) IsEIP158(num *big.Int) bool
- func (c *ChainConfig) IsEWASM(num *big.Int) bool
- func (c *ChainConfig) IsHomestead(num *big.Int) bool
- func (c *ChainConfig) IsMainChain() bool
- func (c *ChainConfig) Rules(num *big.Int) Rules
- func (c *ChainConfig) String() string
- type ConfigCompatError
- type GasTable
- type GeneralConfig
- type NeatConConfig
- type Rules
Constants ¶
const ( Opoh = 1 NEAT = 100 )
const ( GasLimitBoundDivisor uint64 = 1024 MinGasLimit uint64 = 1 GenesisGasLimit uint64 = 1 MaximumExtraDataSize uint64 = 32 ExpByteGas uint64 = 1 SloadGas uint64 = 1 CallValueTransferGas uint64 = 1 CallNewAccountGas uint64 = 2 TxGas uint64 = 1 TxGasContractCreation uint64 = 2 TxDataZeroGas uint64 = 1 QuadCoeffDiv uint64 = 512 LogDataGas uint64 = 1 CallStipend uint64 = 1 Sha3Gas uint64 = 1 Sha3WordGas uint64 = 1 SstoreSetGas uint64 = 1 SstoreResetGas uint64 = 1 SstoreClearGas uint64 = 1 SstoreRefundGas uint64 = 1 NetSstoreNoopGas uint64 = 1 NetSstoreInitGas uint64 = 1 NetSstoreCleanGas uint64 = 1 NetSstoreDirtyGas uint64 = 1 NetSstoreClearRefund uint64 = 1 NetSstoreResetRefund uint64 = 1 NetSstoreResetClearRefund uint64 = 1 SstoreSentryGasEIP2200 uint64 = 1 SstoreNoopGasEIP2200 uint64 = 1 SstoreDirtyGasEIP2200 uint64 = 1 SstoreInitGasEIP2200 uint64 = 1 SstoreInitRefundEIP2200 uint64 = 1 SstoreCleanGasEIP2200 uint64 = 1 SstoreCleanRefundEIP2200 uint64 = 1 SstoreClearRefundEIP2200 uint64 = 1 JumpdestGas uint64 = 1 EpochDuration uint64 = 3600 CreateDataGas uint64 = 1 CallCreateDepth uint64 = 1024 ExpGas uint64 = 1 LogGas uint64 = 1 CopyGas uint64 = 1 StackLimit uint64 = 1024 TierStepGas uint64 = 0 LogTopicGas uint64 = 1 CreateGas uint64 = 1 Create2Gas uint64 = 1 SelfdestructRefundGas uint64 = 1 SuicideRefundGas uint64 = 1 MemoryGas uint64 = 1 TxDataNonZeroGasFrontier uint64 = 1 TxDataNonZeroGasEIP2028 uint64 = 1 CallGasFrontier uint64 = 1 CallGasEIP150 uint64 = 1 BalanceGasFrontier uint64 = 1 BalanceGasEIP150 uint64 = 1 BalanceGasEIP1884 uint64 = 1 ExtcodeSizeGasFrontier uint64 = 1 ExtcodeSizeGasEIP150 uint64 = 1 SloadGasFrontier uint64 = 1 SloadGasEIP150 uint64 = 1 SloadGasEIP1884 uint64 = 1 ExtcodeHashGasConstantinople uint64 = 1 ExtcodeHashGasEIP1884 uint64 = 1 SelfdestructGasEIP150 uint64 = 1 ExpByteFrontier uint64 = 1 ExpByteEIP158 uint64 = 1 ExtcodeCopyBaseFrontier uint64 = 1 ExtcodeCopyBaseEIP150 uint64 = 1 CreateBySelfdestructGas uint64 = 1 MaxCodeSize = 24576 EcrecoverGas uint64 = 1 Sha256BaseGas uint64 = 1 Sha256PerWordGas uint64 = 1 Ripemd160BaseGas uint64 = 1 Ripemd160PerWordGas uint64 = 1 IdentityBaseGas uint64 = 1 IdentityPerWordGas uint64 = 1 ModExpQuadCoeffDiv uint64 = 1 Bn256AddGas uint64 = 1 Bn256ScalarMulGas uint64 = 1 Bn256PairingBaseGas uint64 = 1 Bn256PairingPerPointGas uint64 = 1 Bn256AddGasByzantium uint64 = 1 Bn256AddGasIstanbul uint64 = 1 Bn256ScalarMulGasByzantium uint64 = 1 Bn256ScalarMulGasIstanbul uint64 = 1 Bn256PairingBaseGasByzantium uint64 = 1 Bn256PairingBaseGasIstanbul uint64 = 1 Bn256PairingPerPointGasByzantium uint64 = 1 Bn256PairingPerPointGasIstanbul uint64 = 1 )
const ( VersionMajor = 1 // Major version component of the current release VersionMinor = 5 // Minor version component of the current release VersionPatch = 2 // Patch version component of the current release VersionMeta = "unstable" // Version metadata to append to the version string )
const (
BloomBitsBlocks uint64 = 4096
)
Variables ¶
var ( MainnetGenesisHash = common.HexToHash("0x4acbb93c3033234cc2c659ccfd2b4f7e835743296e874f23778cb06aa9836060") // Mainnet genesis hash to enforce below configs on TestnetGenesisHash = common.HexToHash("0x4acbb93c3033234cc2c659ccfd2b4f7e835743296e874f23778cb06aa9836060") // Testnet genesis hash to enforce below configs on )
var ( // MainnetChainConfig is the chain parameters to run a node on the main network. MainnetChainConfig = &ChainConfig{ NeatChainId: "neatio", ChainId: big.NewInt(1), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), EIP150Hash: common.HexToHash("0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0"), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: nil, NeatCon: &NeatConConfig{ Epoch: 30000, ProposerPolicy: 0, }, } // TestnetChainConfig contains the chain parameters to run a node on the test network. TestnetChainConfig = &ChainConfig{ NeatChainId: "testnet", ChainId: big.NewInt(2), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), EIP150Hash: common.HexToHash("0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0"), EIP155Block: big.NewInt(0), EIP158Block: big.NewInt(0), ByzantiumBlock: big.NewInt(0), ConstantinopleBlock: nil, NeatCon: &NeatConConfig{ Epoch: 30000, ProposerPolicy: 0, }, } TestChainConfig = &ChainConfig{"", big.NewInt(1), big.NewInt(0), big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil} TestRules = TestChainConfig.Rules(new(big.Int)) )
var ( GasTableHomestead = GasTable{ ExtcodeSize: 1, ExtcodeCopy: 1, Balance: 1, SLoad: 1, Calls: 1, Suicide: 0, ExpByte: 1, } GasTableEIP150 = GasTable{ ExtcodeSize: 1, ExtcodeCopy: 1, Balance: 1, SLoad: 1, Calls: 1, Suicide: 1, ExpByte: 110, CreateBySuicide: 1, } GasTableEIP158 = GasTable{ ExtcodeSize: 1, ExtcodeCopy: 1, Balance: 1, SLoad: 1, Calls: 1, Suicide: 1, ExpByte: 1, CreateBySuicide: 1, } GasTableConstantinople = GasTable{ ExtcodeSize: 1, ExtcodeCopy: 1, ExtcodeHash: 1, Balance: 1, SLoad: 1, Calls: 1, Suicide: 1, ExpByte: 1, CreateBySuicide: 1, } )
var ( DifficultyBoundDivisor = big.NewInt(2048) GenesisDifficulty = big.NewInt(1) MinimumDifficulty = big.NewInt(1) DurationLimit = big.NewInt(1) )
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 GenCfg = GeneralConfig{PerfTest: false}
var MainnetBootnodes = []string{
"enode://eb0e6f3cd8f53cf36e82a6ff061cbd7fe31bd76b41bb4681bb4d11601ca3e7f913f69cf25d31861111e816f73f20ac6b44a39f2722c244a14dd805f36a6ee9f3@135.181.195.79:9910",
}
MainnetBootnodes are the enode URLs of the P2P bootstrap nodes running on NEAT Blockchain main network.
var TestnetBootnodes = []string{
"enode://eb0e6f3cd8f53cf36e82a6ff061cbd7fe31bd76b41bb4681bb4d11601ca3e7f913f69cf25d31861111e816f73f20ac6b44a39f2722c244a14dd805f36a6ee9f3@135.181.195.79:9910",
}
TestnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the NEAT Blockchain test network.
var Version = func() string { return fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch) }()
Version holds the textual version string.
var VersionWithMeta = func() string { v := Version if VersionMeta != "" { v += "-" + VersionMeta } return v }()
VersionWithMeta holds the textual version string including the metadata.
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 IsMainChain ¶
Check provided chain id is on main chain or not
func VersionWithCommit ¶
Types ¶
type ChainConfig ¶
type ChainConfig struct {
NeatChainId string `json:"NeatChainId"` //NeatIO id identifies the current chain
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)
// EIP150 implements the Gas price changes (https://github.com/ethereum/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
NeatCon *NeatConConfig `json:"neatcon,omitempty"`
ChainLogger log.Logger `json:"-"`
}
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 NewSideChainConfig ¶
func NewSideChainConfig(sideChainID string) *ChainConfig
Create a new Chain Config based on the Chain ID, for side chain creation purpose
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) IsByzantium ¶
func (c *ChainConfig) IsByzantium(num *big.Int) bool
func (*ChainConfig) IsConstantinople ¶
func (c *ChainConfig) IsConstantinople(num *big.Int) bool
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) IsMainChain ¶
func (c *ChainConfig) IsMainChain() bool
Check whether is on main chain or not
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 GeneralConfig ¶
type GeneralConfig struct {
// Whether doing performance test, will remove some limitations and cause system more frigile
PerfTest bool `json:"perfTest,omitempty"`
}
configuations in this structure is read-only, it gives a way to put/get general settings
type NeatConConfig ¶ added in v1.5.1
type NeatConConfig struct {
Epoch uint64 `json:"epoch"` // Epoch length to reset votes and checkpoint
ProposerPolicy uint64 `json:"policy"` // The policy for proposer selection
}
NeatConConfig is the consensus engine configs for Istanbul based sealing.
func (*NeatConConfig) String ¶ added in v1.5.1
func (c *NeatConConfig) String() string
String implements the stringer interface, returning the consensus engine details.
type Rules ¶
type Rules struct {
ChainId *big.Int
IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool
IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul 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.