params

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: GPL-3.0, GPL-3.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// StateRegisterOnce can be election only once
	StateRegisterOnce uint8 = 1 << iota
	// StateResgisterAuto can be election in every epoch
	StateResgisterAuto
	// StateUnregister can be redeem real time (after MaxRedeemHeight block)
	StateUnregister
	// StateUnregistered flag the asset which is unregistered in the height is redeemed
	StateUnregistered
)
View Source
const (
	OpQueryRegister uint8 = 1 << iota
	OpQueryLocked
	OpQueryUnlocking
	OpQueryReward
	OpQueryFine
)
View Source
const (
	StateUnusedFlag    = 0xa0
	StateUsedFlag      = 0xa1
	StateSwitchingFlag = 0xa2
	StateRemovedFlag   = 0xa3
	StateAppendFlag    = 0xa4
	// health enter type
	TypeFixed  = 0xa1
	TypeWorked = 0xa2
	TypeBack   = 0xa3
)
View Source
const (
	MainNetChainID   uint64 = 22776
	TestNetChainID   uint64 = 212
	DevNetChainID    uint64 = 213
	SingleNetChainID uint64 = 214
	Epoch            uint64 = 50000
)
View Source
const (
	MainnetNetWorkID = MainNetChainID
	TestnetWorkID    = TestNetChainID
	DevnetWorkID     = DevNetChainID
	SingleNetworkID  = SingleNetChainID
)

network id

View Source
const (
	DefaultGasLimit uint64 = 20000000 // Gas limit of the blocks before BlockchainParams contract is loaded.

	// Default intrinsic gas cost of transactions paying for gas in alternative currencies.
	// Calculated to estimate 1 balance read, 1 debit, and 4 credit transactions.
	IntrinsicGasForAlternativeFeeCurrency uint64 = 50 * thousand

	// Contract communication gas limits
	MaxGasForCalculateTargetEpochPaymentAndRewards uint64 = 2000 * million
	MaxGasForCommitments                           uint64 = 2000 * million
	MaxGasForComputeCommitment                     uint64 = 2000 * million
	MaxGasForBlockRandomness                       uint64 = 2000 * million
	MaxGasForDebitGasFeesTransactions              uint64 = 2000 * million
	MaxGasForCreditGasFeesTransactions             uint64 = 2000 * million
	MaxGasForDistributeEpochPayment                uint64 = 5000 * million
	MaxGasForDeregisterPayment1                    uint64 = 1 * million
	MaxGasForDeregisterPayment                     uint64 = 5000 * million
	MaxGasForDistributeVoterEpochRewards           uint64 = 5000 * million
	MaxGasForElectValidators                       uint64 = 5000 * million
	MaxGasForElectNValidatorSigners                uint64 = 5000 * million
	MaxGasForActiveAllPending                      uint64 = 5000 * million
	MaxGasForGetAddressFor                         uint64 = 1000 * million
	MaxGasForGetElectableValidators                uint64 = 1000 * million
	MaxGasForGetEligibleValidatorsVoteTotals       uint64 = 1000 * million
	MaxGasForGetGasPriceMinimum                    uint64 = 2000 * million
	MaxGasForGetGroupEpochRewards                  uint64 = 500 * thousand
	MaxGasForGetPledgeMultiplierInReward           uint64 = 500 * million
	MaxGasForGetOrComputeTobinTax                  uint64 = 1000 * million
	MaxGasForGetRegisteredValidators               uint64 = 2000 * million
	MaxGasForGetValidator                          uint64 = 100 * million
	MaxGasForGetWhiteList                          uint64 = 200 * million
	MaxGasForGetTransferWhitelist                  uint64 = 200 * million
	MaxGasForIncreaseSupply                        uint64 = 500 * thousand
	MaxGasForIsFrozen                              uint64 = 200 * thousand
	MaxGasForMedianRate                            uint64 = 100 * thousand
	MaxGasForReadBlockchainParameter               uint64 = 40 * thousand // ad-hoc measurement is ~26k
	MaxGasForRevealAndCommit                       uint64 = 20 * million
	MaxGasForUpdateGasPriceMinimum                 uint64 = 20 * million
	MaxGasForUpdateTargetVotingYield               uint64 = 20 * million
	MaxGasForUpdateValidatorScore                  uint64 = 10 * million
	MaxGasForTotalSupply                           uint64 = 50 * thousand
	MaxGasForMintGas                               uint64 = 5 * million
	MaxGasToReadErc20Balance                       uint64 = 100 * thousand
	MaxGasForIsReserveLow                          uint64 = 1 * million
	MaxGasForGetCommunityPartnerSettingPartner     uint64 = 100 * thousand
	MaxGasForGetMgrMaintainerAddress               uint64 = 100 * thousand

	////////////////////////////////////////////////////////////////////////////////////////////////
	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.
	Sha3Gas              uint64 = 30    // Once per SHA3 operation.
	Sha3WordGas          uint64 = 6     // Once per word of the SHA3 operation's data.
	// Precompiled contract gas prices
	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

	Bn256AddGasByzantium             uint64 = 500    // Byzantium gas needed for an elliptic curve addition
	Bn256AddGasIstanbul              uint64 = 150    // Gas needed for an elliptic curve addition
	Bn256ScalarMulGasByzantium       uint64 = 40000  // Byzantium gas needed for an elliptic curve scalar multiplication
	Bn256ScalarMulGasIstanbul        uint64 = 6000   // Gas needed for an elliptic curve scalar multiplication
	Bn256PairingBaseGasByzantium     uint64 = 100000 // Byzantium base price for an elliptic curve pairing check
	Bn256PairingBaseGasIstanbul      uint64 = 45000  // Base price for an elliptic curve pairing check
	Bn256PairingPerPointGasByzantium uint64 = 80000  // Byzantium per-point price for an elliptic curve pairing check
	Bn256PairingPerPointGasIstanbul  uint64 = 34000  // Per-point price for an elliptic curve pairing check
	// Atlas precompiled contracts
	FractionMulExpGas           uint64 = 50     // Cost of performing multiplication and exponentiation of fractions to an exponent of up to 10^3.
	ProofOfPossessionGas        uint64 = 350000 // Cost of verifying a BLS proof of possession.
	GetValidatorGas             uint64 = 1000   // Cost of reading a validator's address.
	GetValidatorBLSGas          uint64 = 1000   // Cost of reading a validator's BLS public key.
	GetEpochSizeGas             uint64 = 10     // Cost of querying the number of blocks in an epoch.
	GetBlockNumberFromHeaderGas uint64 = 10     // Cost of decoding a block header.
	HashHeaderGas               uint64 = 10     // Cost of hashing a block header.
	GetParentSealBitmapGas      uint64 = 100    // Cost of reading the parent seal bitmap from the chain.
	// May take a bit more time with 100 validators, need to bench that
	GetVerifiedSealBitmapGas uint64 = 350000           // Cost of verifying the seal on a given RLP encoded header.
	Ed25519VerifyGas         uint64 = 1500             // Gas needed for and Ed25519 signature verification
	Sha2_512BaseGas          uint64 = Sha256BaseGas    // Base price for a Sha2-512 operation
	Sha2_512PerWordGas       uint64 = Sha256PerWordGas // Per-word price for a Sha2-512 operation

	Sha3_256BaseGas     uint64 = Sha3Gas     // Base price for a Sha3-256 operation
	Sha3_256PerWordGas  uint64 = Sha3WordGas // Per-word price for a sha3-256 operation
	Sha3_512BaseGas     uint64 = Sha3Gas     // Base price for a Sha3-512 operation
	Sha3_512PerWordGas  uint64 = Sha3WordGas // Per-word price for a Sha3-512 operation
	Keccak512BaseGas    uint64 = Sha3Gas     // Per-word price for a Keccak512 operation
	Keccak512PerWordGas uint64 = Sha3WordGas // Base price for a Keccak512 operation

	Blake2sBaseGas    uint64 = Sha256BaseGas    // Per-word price for a Blake2s operation
	Blake2sPerWordGas uint64 = Sha256PerWordGas // Base price for a Blake2s
	InvalidCip20Gas   uint64 = 200              // Price of attempting to access an unsupported CIP20 hash function

	Bls12377G1AddGas          uint64 = 600   // Price for BLS12-377 elliptic curve G1 point addition
	Bls12377G1MulGas          uint64 = 12000 // Price for BLS12-377 elliptic curve G1 point scalar multiplication
	Bls12377G2AddGas          uint64 = 4500  // Price for BLS12-377 elliptic curve G2 point addition
	Bls12377G2MulGas          uint64 = 55000 // Price for BLS12-377 elliptic curve G2 point scalar multiplication
	Bls12377PairingBaseGas    uint64 = 65000 // Base gas price for BLS12-377 elliptic curve pairing check
	Bls12377PairingPerPairGas uint64 = 55000 // Per-point pair gas price for BLS12-377 elliptic curve pairing check

	Bls12381G1AddGas          uint64 = 600   // Price for BLS12-381 elliptic curve G1 point addition
	Bls12381G1MulGas          uint64 = 12000 // Price for BLS12-381 elliptic curve G1 point scalar multiplication
	Bls12381G2AddGas          uint64 = 800   // Price for BLS12-381 elliptic curve G2 point addition
	Bls12381G2MulGas          uint64 = 45000 // Price for BLS12-381 elliptic curve G2 point scalar multiplication
	Bls12381PairingBaseGas    uint64 = 65000 // Base gas price for BLS12-381 elliptic curve pairing check
	Bls12381PairingPerPairGas uint64 = 43000 // Per-point pair gas price for BLS12-381 elliptic curve pairing check
	Bls12381MapG1Gas          uint64 = 5500  // Gas price for BLS12-381 mapping field element to G1 operation
	Bls12381MapG2Gas          uint64 = 75000 // Gas price for BLS12-381 mapping field element to G2 operation

	VerifyEth2UpdateGas uint64 = 50000 // Cost of verifying the eth2.0 light client update

	MaxCodeSize        = 49152              // Maximum bytecode to permit for a contract
	MaxGasLimit uint64 = 0x7fffffffffffffff // Maximum the gas limit (2^63-1).
)
View Source
const (
	VersionMajor = 1        // Major version component of the current release
	VersionMinor = 1        // Minor version component of the current release
	VersionPatch = 0        // Patch version component of the current release
	VersionMeta  = "stable" // Version metadata to append to the version string
)
View Source
const HeaderStoreABIJSON = `` /* 2283-byte string literal not displayed */

HeaderStoreABIJSON header store abi json

type BlockHeader struct {
	From    *big.Int
	To      *big.Int
	Headers []byte
}
contract HeaderStore {
    event UpdateBlockHeader(address indexed account, uint256 indexed blockHeight);
    function updateBlockHeader(bytes memory blockHeader) public {}
    function currentNumberAndHash(uint256 chainID) public returns (uint256 number, bytes memory hash) {}
    function setRelayer(address relayer) public {}
    function getRelayer() public returns (address relayer) {}
    function reset(uint256 from, uint256 td, bytes memory header) public {}
    function verifyProofData(bytes memory receiptProof) public returns(bool success, string memory message, bytes memory logs) {}
}
View Source
const (
	MaximumExtraDataSize uint64 = 32 // Maximum size extra data may be after Genesis.
)
View Source
const TxVerifyABIJSON = `` /* 465-byte string literal not displayed */

TxVerifyABIJSON tx verify abi json

type ReceiptProof struct{
	Router   common.Address
	Coin     common.Address
	SrcChain *big.Int
	DstChain *big.Int
	TxProve  []byte
}
type TxProve struct {
	Receipt     *ethtypes.Receipt
	Prove       light.NodeList
	BlockNumber uint64
	TxIndex     uint
}
contract TxVerify {
    function verifyProofData(bytes memory receiptProof) public returns(bool success, string memory message, bytes memory logs) {}
}

Variables

View Source
var (
	Base       = big.NewInt(1e8)
	MaxBaseFee = big.NewInt(5000 * ethparams.GWei)
	MinBaseFee = big.NewInt(100 * ethparams.GWei)
)
View Source
var (
	NewRelayerAddress  = common.BytesToAddress([]byte("relayerAddress"))
	HeaderStoreAddress = common.BytesToAddress([]byte("headerstoreAddress"))
	TxVerifyAddress    = common.BytesToAddress([]byte("txVerifyAddress"))
)
View Source
var (
	ZeroAddress                  = BytesToAddress([]byte{})
	RegistrySmartContractAddress = common.HexToAddress("0x000000000000000000000000000000000000ce10")

	//AttestationsRegistryId         = makeRegistryId("Attestations")
	BlockchainParametersRegistryId = makeRegistryId("BlockchainParameters")
	ElectionRegistryId             = makeRegistryId("Election")
	EpochRewardsRegistryId         = makeRegistryId("EpochRewards")
	FeeCurrencyWhitelistRegistryId = makeRegistryId("FeeCurrencyWhitelist")
	GasPriceMinimumRegistryId      = makeRegistryId("GasPriceMinimum")
	GoldTokenRegistryId            = makeRegistryId("GoldToken")
	GovernanceRegistryId           = makeRegistryId("Governance")
	LockedGoldRegistryId           = makeRegistryId("LockedGold")
	RandomRegistryId               = makeRegistryId("Random")

	//TransferWhitelistRegistryId    = makeRegistryId("TransferWhitelist")
	ValidatorsRegistryId = makeRegistryId("Validators")
	AccountsId           = makeRegistryId("Accounts")

	// Function is "getOrComputeTobinTax()"
	// selector is first 4 bytes of keccak256 of "getOrComputeTobinTax()"
	// Source:
	// pip3 install pyethereum
	// python3 -c 'from ethereum.utils import sha3; print(sha3("getOrComputeTobinTax()")[0:4].hex())'
	TobinTaxFunctionSelector = hexutil.MustDecode("0x17f9a6f7")

	// Scale factor for the solidity fixidity library
	Fixidity1 = math.BigPow(10, 24)
)
View Source
var (
	RegistryProxyAddress      = common.HexToAddress("0xce10")
	ProxyOwnerStorageLocation = common.HexToHash("0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103")
)
View Source
var (
	MainnetGenesisHash = common.HexToHash("0x6b2bd27bee0f7675550204c541a30cc6a14aa1738431cb60e21e666b2fec8014")
	TestnetGenesisHash = common.HexToHash("0xede9749324b65e9df7b74830696637ed25c24ae4ffd07f8c36b8e5b6eac7dfa0")
	DevnetGenesisHash  = common.HexToHash("0xa7712fd6f430d32fbc796665289bf9702b6991e96393fd670e7834c48e15755f")
)

Genesis hashes to enforce below configs on.

View Source
var (
	MainnetChainConfig = &ChainConfig{
		ChainID:             big.NewInt(int64(MainNetChainID)),
		HomesteadBlock:      big.NewInt(0),
		DAOForkBlock:        big.NewInt(0),
		DAOForkSupport:      true,
		EIP150Block:         big.NewInt(0),
		EIP150Hash:          common.Hash{},
		EIP155Block:         big.NewInt(0),
		EIP158Block:         big.NewInt(0),
		ByzantiumBlock:      big.NewInt(0),
		ConstantinopleBlock: big.NewInt(0),
		PetersburgBlock:     big.NewInt(0),
		IstanbulBlock:       big.NewInt(0),
		MuirGlacierBlock:    big.NewInt(0),
		BerlinBlock:         big.NewInt(0),
		LondonBlock:         big.NewInt(0),
		EnableRewardBlock:   big.NewInt(1125000),
		BN256ForkBlock:      big.NewInt(2350001),
		DeregisterBlock:     big.NewInt(2990000),
		CalcBaseBlock:       big.NewInt(3790000),
		Istanbul: &IstanbulConfig{
			Epoch:          Epoch,
			ProposerPolicy: 2,
			BlockPeriod:    5,
			RequestTimeout: 3000,
			LookbackWindow: 12,
		},
		FullHeaderChainAvailable: true,
	}

	TestnetConfig = &ChainConfig{
		ChainID:             big.NewInt(212),
		HomesteadBlock:      big.NewInt(0),
		DAOForkBlock:        nil,
		DAOForkSupport:      true,
		EIP150Block:         big.NewInt(0),
		EIP150Hash:          common.Hash{},
		EIP155Block:         big.NewInt(0),
		EIP158Block:         big.NewInt(0),
		ByzantiumBlock:      big.NewInt(0),
		ConstantinopleBlock: big.NewInt(0),
		PetersburgBlock:     big.NewInt(0),
		IstanbulBlock:       big.NewInt(0),
		MuirGlacierBlock:    big.NewInt(0),
		BerlinBlock:         big.NewInt(0),
		LondonBlock:         big.NewInt(0),
		EnableRewardBlock:   big.NewInt(5000),
		BN256ForkBlock:      big.NewInt(20000),
		DeregisterBlock:     big.NewInt(1242000),
		CalcBaseBlock:       big.NewInt(1242000),
		Istanbul: &IstanbulConfig{
			Epoch:          4000,
			ProposerPolicy: 2,
			BlockPeriod:    5,
			RequestTimeout: 3000,
			LookbackWindow: 12,
		},
		FullHeaderChainAvailable: true,
	}

	DevnetConfig = &ChainConfig{
		ChainID:             big.NewInt(213),
		HomesteadBlock:      big.NewInt(0),
		DAOForkBlock:        nil,
		DAOForkSupport:      true,
		EIP150Block:         big.NewInt(0),
		EIP150Hash:          common.Hash{},
		EIP155Block:         big.NewInt(0),
		EIP158Block:         big.NewInt(0),
		ByzantiumBlock:      big.NewInt(0),
		ConstantinopleBlock: big.NewInt(0),
		PetersburgBlock:     big.NewInt(0),
		IstanbulBlock:       big.NewInt(0),
		MuirGlacierBlock:    big.NewInt(0),
		BerlinBlock:         big.NewInt(0),
		LondonBlock:         big.NewInt(0),
		EnableRewardBlock:   big.NewInt(0),
		BN256ForkBlock:      big.NewInt(2001),
		DeregisterBlock:     big.NewInt(0),
		CalcBaseBlock:       big.NewInt(0),
		Istanbul: &IstanbulConfig{
			Epoch:          1000,
			ProposerPolicy: 2,
			BlockPeriod:    5,
			RequestTimeout: 3000,
			LookbackWindow: 12,
		},
	}

	SingleNetConfig = &ChainConfig{
		ChainID:             new(big.Int).SetUint64(SingleNetChainID),
		HomesteadBlock:      big.NewInt(0),
		DAOForkBlock:        nil,
		DAOForkSupport:      true,
		EIP150Block:         big.NewInt(0),
		EIP150Hash:          common.Hash{},
		EIP155Block:         big.NewInt(0),
		EIP158Block:         big.NewInt(0),
		ByzantiumBlock:      big.NewInt(0),
		ConstantinopleBlock: big.NewInt(0),
		PetersburgBlock:     big.NewInt(0),
		IstanbulBlock:       big.NewInt(0),
		MuirGlacierBlock:    big.NewInt(0),
		BerlinBlock:         big.NewInt(0),
		LondonBlock:         big.NewInt(0),
		EnableRewardBlock:   big.NewInt(0),
		BN256ForkBlock:      big.NewInt(0),
		DeregisterBlock:     big.NewInt(0),
		CalcBaseBlock:       big.NewInt(0),
		Istanbul: &IstanbulConfig{
			Epoch:          1000,
			ProposerPolicy: 2,
			BlockPeriod:    5,
			RequestTimeout: 3000,
			LookbackWindow: 12,
		},
	}

	AllEthashProtocolChanges = &ChainConfig{
		ChainID:             big.NewInt(213),
		HomesteadBlock:      big.NewInt(0),
		DAOForkBlock:        nil,
		DAOForkSupport:      false,
		EIP150Block:         big.NewInt(0),
		EIP150Hash:          common.Hash{},
		EIP155Block:         big.NewInt(0),
		EIP158Block:         big.NewInt(0),
		ByzantiumBlock:      big.NewInt(0),
		ConstantinopleBlock: big.NewInt(0),
		PetersburgBlock:     big.NewInt(0),
		IstanbulBlock:       big.NewInt(0),
		MuirGlacierBlock:    big.NewInt(0),
		BerlinBlock:         big.NewInt(0),
		LondonBlock:         big.NewInt(0),
		EnableRewardBlock:   big.NewInt(0),
		BN256ForkBlock:      big.NewInt(2000),
		DeregisterBlock:     big.NewInt(0),
		CalcBaseBlock:       big.NewInt(0),
		DonutBlock:          nil,
		EWASMBlock:          nil,
		CatalystBlock:       nil,
		Istanbul: &IstanbulConfig{
			Epoch:          17280,
			ProposerPolicy: 2,
			BlockPeriod:    5,
			RequestTimeout: 3000,
			LookbackWindow: 12,
		},
		FullHeaderChainAvailable: true,
		Faker:                    true,
	}

	TestChainConfig = &ChainConfig{
		ChainID:             big.NewInt(1),
		HomesteadBlock:      big.NewInt(0),
		DAOForkBlock:        nil,
		DAOForkSupport:      false,
		EIP150Block:         big.NewInt(0),
		EIP150Hash:          common.Hash{},
		EIP155Block:         big.NewInt(0),
		EIP158Block:         big.NewInt(0),
		ByzantiumBlock:      big.NewInt(0),
		ConstantinopleBlock: big.NewInt(0),
		PetersburgBlock:     big.NewInt(0),
		IstanbulBlock:       big.NewInt(0),
		MuirGlacierBlock:    big.NewInt(0),
		BerlinBlock:         big.NewInt(0),
		LondonBlock:         big.NewInt(0),
		EnableRewardBlock:   big.NewInt(5000),
		BN256ForkBlock:      big.NewInt(20000),
		DeregisterBlock:     big.NewInt(0),
		CalcBaseBlock:       big.NewInt(0),
		DonutBlock:          nil,
		EWASMBlock:          nil,
		CatalystBlock:       nil,
		Istanbul: &IstanbulConfig{
			Epoch:          4000,
			ProposerPolicy: 2,
			BlockPeriod:    5,
			RequestTimeout: 3000,
			LookbackWindow: 12,
		},
		FullHeaderChainAvailable: true,
		Faker:                    true,
	}

	IstanbulTestChainConfig = &ChainConfig{
		ChainID:             big.NewInt(1337),
		HomesteadBlock:      big.NewInt(0),
		DAOForkBlock:        nil,
		DAOForkSupport:      false,
		EIP150Block:         big.NewInt(0),
		EIP150Hash:          common.Hash{},
		EIP155Block:         big.NewInt(0),
		EIP158Block:         big.NewInt(0),
		ByzantiumBlock:      big.NewInt(0),
		ConstantinopleBlock: big.NewInt(0),
		PetersburgBlock:     big.NewInt(0),
		IstanbulBlock:       big.NewInt(0),
		MuirGlacierBlock:    big.NewInt(0),
		EnableRewardBlock:   big.NewInt(0),
		BN256ForkBlock:      big.NewInt(2000),
		DeregisterBlock:     big.NewInt(0),
		CalcBaseBlock:       big.NewInt(0),
		BerlinBlock:         nil,
		LondonBlock:         nil,
		DonutBlock:          nil,
		EWASMBlock:          big.NewInt(0),
		CatalystBlock:       nil,
		Istanbul: &IstanbulConfig{
			Epoch:          300,
			ProposerPolicy: 0,
			RequestTimeout: 1000,
			BlockPeriod:    1,
		},
		FullHeaderChainAvailable: true,
		Faker:                    false,
	}
)
View Source
var (
	EthereumTestnetGenesisHeader = `` /* 1346-byte string literal not displayed */

	EthereumTestnetGenesisTD = big.NewInt(40060821605962080)
)
View Source
var CurrentVersionInfo = func() *VersionInfo {
	return &VersionInfo{VersionMajor, VersionMinor, VersionPatch}
}()
View Source
var DevnetBootnodes = []string{
	"enode://8aadaff997ddc4cafa63ea88aeb023a29c31e23dd95808fcb0866c0432bc8c367f3850225eec3167595f848a381b658c705d13b8d58080c121b3ee4023703c09@13.250.12.223:30321",
	"enode://d7f54ff377ca8fe0a6df5ace4ce5dd60b36a8c43c89a7a96747a7bc5cb2eb2400a9571e5af2c4a48f874db7564658c80621a42808b4a6dc4424df864124f904a@13.250.12.223:30322",
	"enode://e9ccb2587a9ba8e91a2f01004ff05530a3654907d703227a97a296c03a30db042e94bff768f95330a978841046a72a3bed541dce50bbe22cf2d6f73291da2598@3.0.19.66:30323",
	"enode://4bda7d541e2c7daa348bbbbc69448aeee33d5312b1b4d38777042534776d27537c12dc2937609ce37c7e9cd57c8b75acda15359257d8bd40b3559fde385c2da0@3.0.19.66:30324",
}
View Source
var MainnetBootnodes = []string{
	"enode://71ffdcb10afd3f105320f4c8e6e85d89c93c55d08723273282ad398570cbec7e2475a286ca491a7eedb4bca84ab587e17a801306671e9fba0e04e12ef64e71f9@13.251.42.33:28360",
	"enode://6aba005b149e0115489829d525ade140ad61a5b86c7517b287c47d9b0a89bc8ae3d335fe207cfa17710fce536f2e918a4ce3f0935ca1423cfc88833642fa1e27@13.214.132.40:28360",
	"enode://51961120e7f5ebc8ee6f559fc1a7f303ab0af6c8e019b8009b77b524e5eb6d53b3a24c1f92ad4b3c2a880e089ef011038041674b29b264c1b24fbde6b125d922@3.0.49.193:28360",
	"enode://6bc28d4c98a8e4af33c9350c699dc2560bbffd3cd4555dfdd100074a4d10c4603fd2d069d8e6abc22aa6d11b018ed251173a723d224452cc1ae95e7c22296292@18.138.231.32:28360",
	"enode://de4df7ce9afbe340a5397d17313fbbad2227e233e1100d40fb8a4a56bb057fa14f445b54dbab520f591285efc7babea020bb7146e3c078b4477d43cc5717a4a7@13.214.151.165:28360",
	"enode://cdac08bd6dc84d55295130a4d0073a6b5e820ca728faf80de5951c0a5c495884bca0bceec52b26a7d6ba9d5f3ea385771200058ce56ec7d08172b858a9dca0f5@18.142.162.63:28360",
}

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

View Source
var TestnetBootnodes = []string{
	"enode://023df9b6444a0b0182b06108d6af0ff549368fa377ec1f338531ecc2dec9be8abaca85dda5409e35ec574b7198b70ddb2d5d11ee95f0745742f10cf57719d389@8.219.183.167:30321",
	"enode://0d6541527fb9dc6e79c9f1c3f19f8657b27040527af63d8d062cfb24357b281c5f0bf31c6d74d2e6ce23a3cef42a29e9391f2bc45febd240b25e9f0c0d56c15a@8.219.238.137:30321",
	"enode://1c14593f00017ab08cf2262333c322d490968b618e7b5d28b657ae0d6f62808ab90945017ab34a91fdc16f31eebf21a3885e5e11b53ed76363a80899fe274160@8.219.118.187:30321",
	"enode://16ede4c000bf8110c04cdbb7f81ae9ee2957d9fd2836b662d8e05e2573a7f896590722bc3b523226ccd4bca845d917481c3c130848cb21b85f59f1c8560a8a96@8.219.242.200:30321",
}

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

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 Atlas archives. e.g. "1.8.11-dea1ce05" for stable releases, or

"1.8.13-unstable-21c059b6" for unstable releases

func BytesToAddress added in v0.3.1

func BytesToAddress(b []byte) common.Address

BytesToAddress returns Address with value b. If b is larger than len(h), b will be cropped from the left.

func IsBN256Fork added in v1.0.0

func IsBN256Fork(fork, cur *big.Int) bool

func KnownDNSNetwork

func KnownDNSNetwork(genesis common.Hash, protocol string) string

KnownDNSNetwork returns the address of a public DNS-based node list for the given genesis hash and protocol. See https://github.com/ethereum/discv4-dns-lists for more information.

func MustBigInt added in v0.3.4

func MustBigInt(str string) *big.Int

func VersionWithCommit

func VersionWithCommit(gitCommit, gitDate string) string

Types

type CSVRecorder added in v0.3.1

type CSVRecorder struct {
	// contains filtered or unexported fields
}

A CSVRecorder enables easy writing of CSV data a specified writer. The header is written on creation. Writing is thread safe.

func NewCSVRecorder added in v0.3.1

func NewCSVRecorder(wc WriterCloser, fields ...string) *CSVRecorder

NewCSVRecorder creates a CSV recorder that writes to the supplied writer. The writer is retained and can be closed by calling CSVRecorder.Close() The header is immediately written upon construction.

func (*CSVRecorder) Close added in v0.3.1

func (c *CSVRecorder) Close() error

Close closes the writer. This is a no-op for a nil receiver.

func (*CSVRecorder) Write added in v0.3.1

func (c *CSVRecorder) Write(values ...interface{})

WriteRow writes out as csv row. Will convert the values to a string using "%v".

type ChainConfig added in v0.3.1

type ChainConfig struct {
	ChainID *big.Int `json:"chainId"` // chainId 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)

	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/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
	BN256ForkBlock *big.Int `json:"bn256forkBlock,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)
	PetersburgBlock     *big.Int `json:"petersburgBlock,omitempty"`     // Petersburg switch block (nil = same as Constantinople)
	IstanbulBlock       *big.Int `json:"istanbulBlock,omitempty"`       // Istanbul switch block (nil = no fork, 0 = already on istanbul)
	MuirGlacierBlock    *big.Int `json:"muirGlacierBlock,omitempty"`    // Eip-2384 (bomb delay) switch block (nil = no fork, 0 = already activated)
	BerlinBlock         *big.Int `json:"berlinBlock,omitempty"`         // Berlin switch block (nil = no fork, 0 = already on berlin)
	LondonBlock         *big.Int `json:"londonBlock,omitempty"`         // London switch block (nil = no fork, 0 = already on london)

	DonutBlock *big.Int `json:"donutBlock,omitempty"` // Donut switch block (nil = no fork, 0 = already activated)

	//YoloV3Block   *big.Int `json:"yoloV3Block,omitempty"`   // YOLO v3: Gas repricings TODO @holiman add EIP references
	EWASMBlock    *big.Int `json:"ewasmBlock,omitempty"`    // EWASM switch block (nil = no fork, 0 = already activated)
	CatalystBlock *big.Int `json:"catalystBlock,omitempty"` // Catalyst switch block (nil = no fork, 0 = already on catalyst)

	// Various consensus engines
	Istanbul *IstanbulConfig `json:"istanbul,omitempty"`

	EnableRewardBlock *big.Int `json:"rewardblock,omitempty"`
	DeregisterBlock   *big.Int `json:"deregisterblock,omitempty"`
	CalcBaseBlock     *big.Int `json:"calcbaseblock,omitempty"`
	// This does not belong here but passing it to every function is not possible since that breaks
	// some implemented interfaces and introduces churn across the geth codebase.
	FullHeaderChainAvailable bool // False for lightest Sync mode, true otherwise

	// Requests mock engine if true
	Faker bool `json:"faker,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 added in v0.3.1

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) CheckConfigForkOrder added in v0.3.1

func (c *ChainConfig) CheckConfigForkOrder() error

CheckConfigForkOrder checks that we don't "skip" any forks, geth isn't pluggable enough to guarantee that forks can be implemented in a different order than on official networks

func (*ChainConfig) IsBerlin added in v0.3.1

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

IsBerlin returns whether num is either equal to the Berlin fork block or greater.

func (*ChainConfig) IsByzantium added in v0.3.1

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

IsByzantium returns whether num is either equal to the Byzantium fork block or greater.

func (*ChainConfig) IsCalc added in v1.1.0

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

func (*ChainConfig) IsCatalyst added in v0.3.1

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

IsCatalyst returns whether num is either equal to the Merge fork block or greater.

func (*ChainConfig) IsConstantinople added in v0.3.1

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

IsConstantinople returns whether num is either equal to the Constantinople fork block or greater.

func (*ChainConfig) IsDAOFork added in v0.3.1

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

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

func (*ChainConfig) IsEIP150 added in v0.3.1

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

IsEIP150 returns whether num is either equal to the EIP150 fork block or greater.

func (*ChainConfig) IsEIP155 added in v0.3.1

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

IsEIP155 returns whether num is either equal to the EIP155 fork block or greater.

func (*ChainConfig) IsEIP158 added in v0.3.1

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

IsEIP158 returns whether num is either equal to the EIP158 fork block or greater.

func (*ChainConfig) IsEWASM added in v0.3.1

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

IsEWASM returns whether num represents a block number after the EWASM fork

func (*ChainConfig) IsHomestead added in v0.3.1

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

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

func (*ChainConfig) IsIstanbul added in v0.3.1

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

IsIstanbul returns whether num is either equal to the Istanbul fork block or greater.

func (*ChainConfig) IsLondon added in v0.3.1

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

IsLondon returns whether num is either equal to the London fork block or greater.

func (*ChainConfig) IsMuirGlacier added in v0.3.1

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

IsMuirGlacier returns whether num is either equal to the Muir Glacier (EIP-2384) fork block or greater.

func (*ChainConfig) IsPetersburg added in v0.3.1

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

IsPetersburg returns whether num is either - equal to or greater than the PetersburgBlock fork block, - OR is nil, and Constantinople is active

func (*ChainConfig) Rules added in v0.3.1

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

Rules ensures c's ChainID is not nil.

func (*ChainConfig) String added in v0.3.1

func (c *ChainConfig) String() string

String implements the fmt.Stringer interface.

type CliqueConfig added in v0.3.1

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 added in v0.3.1

func (c *CliqueConfig) String() string

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

type ConfigCompatError added in v0.3.1

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 added in v0.3.1

func (err *ConfigCompatError) Error() string

type EthashConfig added in v0.3.1

type EthashConfig struct{}

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

func (*EthashConfig) String added in v0.3.1

func (c *EthashConfig) String() string

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

type IstanbulConfig added in v0.3.1

type IstanbulConfig struct {
	Epoch          uint64 `json:"epoch"`                 // Epoch length to reset votes and checkpoint
	ProposerPolicy uint64 `json:"policy"`                // The policy for proposer selection
	LookbackWindow uint64 `json:"lookbackwindow"`        // The number of blocks to look back when calculating uptime
	BlockPeriod    uint64 `json:"blockperiod,omitempty"` // Default minimum difference between two consecutive block's timestamps in second

	// The base timeout for each Istanbul round in milliseconds. The first
	// round will have a timeout of exactly this and subsequent rounds will
	// have timeouts of this + additional time that increases with round
	// number.
	RequestTimeout uint64 `json:"requesttimeout,omitempty"`
}

IstanbulConfig is the consensus engine configs for Istanbul based sealing.

func (*IstanbulConfig) String added in v0.3.1

func (c *IstanbulConfig) String() string

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

type NumberHash added in v0.4.1

type NumberHash struct {
	Number uint64
	Hash   common.Hash
}

NumberHash is just a container for a number and a hash, to represent a block

type RelayerMember

type RelayerMember struct {
	Coinbase    common.Address `json:"coinbase`
	RelayerBase common.Address `json:"relayerbase`
	Publickey   []byte
	Flag        uint32
	MType       uint32
}

func (*RelayerMember) Compared

func (c *RelayerMember) Compared(d *RelayerMember) bool

func (*RelayerMember) String

func (c *RelayerMember) String() string

func (*RelayerMember) UnmarshalJSON

func (c *RelayerMember) UnmarshalJSON(input []byte) error

type Rules added in v0.3.1

type Rules struct {
	ChainID                                                 *big.Int
	IsHomestead, IsEIP150, IsEIP155, IsEIP158               bool
	IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool
	IsBerlin, IsLondon, IsCatalyst                          bool
}

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

type VersionInfo added in v0.3.1

type VersionInfo struct {
	Major uint64
	Minor uint64
	Patch uint64
}

func (*VersionInfo) Cmp added in v0.3.1

func (v *VersionInfo) Cmp(version *VersionInfo) int

type WriterCloser added in v0.3.1

type WriterCloser interface {
	io.Writer
	io.Closer
}

Jump to

Keyboard shortcuts

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