Documentation ¶
Index ¶
Constants ¶
const ( Ore = 1 Wav = 1e3 Grav = 1e6 Nucle = 1e9 Atom = 1e12 Moli = 1e15 Core = 1e18 Aer = 1e21 Orb = 1e24 Plano = 1e27 Terra = 1e30 Sola = 1e33 Galx = 1e36 Cluster = 1e39 Supermatter = 1e42 )
These are the multipliers for core denominations. Example: To get the ore value of an amount in 'nucle', use
new(big.Int).Mul(value, big.NewInt(params.Nucle))
const ( // BloomBitsBlocks is the number of blocks a single bloom bit section vector // contains on the server side. BloomBitsBlocks uint64 = 4096 // BloomBitsBlocksClient is the number of blocks a single bloom bit section vector // contains on the light client side BloomBitsBlocksClient uint64 = 32768 // BloomConfirms is the number of confirmation blocks before a bloom section is // considered probably final and its rotated bits are calculated. BloomConfirms = 256 // CHTFrequency is the block frequency for creating CHTs CHTFrequency = 2048 // BloomTrieFrequency is the block frequency for creating BloomTrie on both // server/client sides. BloomTrieFrequency = 32768 // HelperTrieConfirmations is the number of confirmations before a client is expected // to have the given HelperTrie available. HelperTrieConfirmations = 2048 // HelperTrieProcessConfirmations is the number of confirmations before a HelperTrie // is generated HelperTrieProcessConfirmations = 256 // CheckpointFrequency is the block frequency for creating checkpoint CheckpointFrequency = 32768 // CheckpointProcessConfirmations is the number before a checkpoint is generated CheckpointProcessConfirmations = 256 // FullImmutabilityThreshold is the number of blocks after which a chain segment is // considered immutable (i.e. soft finality). It is used by the downloader as a // hard limit against deep ancestors, by the blockchain against deep reorgs, by // the freezer as the cutoff treshold and by clique as the snapshot trust limit. FullImmutabilityThreshold = 90000 // LightImmutabilityThreshold is the number of blocks after which a header chain // segment is considered immutable for light client(i.e. soft finality). It is used by // the downloader as a hard limit against deep ancestors, by the blockchain against deep // reorgs, by the light pruner as the pruning validity guarantee. LightImmutabilityThreshold = 30000 )
const ( EnergyLimitBoundDivisor uint64 = 1024 // The bound divisor of the energy limit, used in update calculations. MinEnergyLimit uint64 = 5000 // Minimum the energy limit may ever be. GenesisEnergyLimit uint64 = 4712388 // Energy limit of the Genesis block. MaximumExtraDataSize uint64 = 32 // Maximum size extra data may be after Genesis. CallValueTransferEnergy uint64 = 9000 // Paid for CALL when the value transfer is non-zero. CallNewAccountEnergy uint64 = 25000 // Paid for CALL when the destination address didn't exist prior. TxEnergy uint64 = 21000 // Per transaction not creating a contract. NOTE: Not payable on data of calls between transactions. TxEnergyContractCreation uint64 = 53000 // Per transaction that creates a contract. NOTE: Not payable on data of calls between transactions. TxDataZeroEnergy 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. LogDataEnergy uint64 = 8 // Per byte in a LOG* operation's data. CallStipend uint64 = 2300 // Free energy given at beginning of call. Sha3Energy uint64 = 30 // Once per SHA3 operation. Sha3WordEnergy uint64 = 6 // Once per word of the SHA3 operation's data. SstoreSentryEnergy uint64 = 2300 // Minimum energy required to be present for an SSTORE call, not consumed SstoreNoopEnergy uint64 = 800 // Once per SSTORE operation if the value doesn't change. SstoreDirtyEnergy uint64 = 800 // Once per SSTORE operation if a dirty value is changed. SstoreInitEnergy uint64 = 20000 // Once per SSTORE operation from clean zero to non-zero SstoreInitRefund uint64 = 19200 // Once per SSTORE operation for resetting to the original zero value SstoreCleanEnergy uint64 = 5000 // Once per SSTORE operation from clean non-zero to something else SstoreCleanRefund uint64 = 4200 // Once per SSTORE operation for resetting to the original non-zero value SstoreClearRefund uint64 = 15000 // Once per SSTORE operation for clearing an originally existing storage slot JumpdestEnergy uint64 = 1 // Once per JUMPDEST operation. CreateDataEnergy uint64 = 200 // CallCreateDepth uint64 = 1024 // Maximum depth of call/create stack. ExpEnergy uint64 = 10 // Once per EXP instruction LogEnergy uint64 = 375 // Per LOG* operation. CopyEnergy uint64 = 3 // StackLimit uint64 = 1024 // Maximum size of VM stack allowed. LogTopicEnergy uint64 = 375 // Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicEnergy, LOG4 incurs 4 * c_txLogTopicEnergy. CreateEnergy uint64 = 32000 // Once per CREATE operation & contract-creation transaction. Create2Energy uint64 = 32000 // Once per CREATE2 operation SelfdestructRefundEnergy uint64 = 24000 // Refunded following a selfdestruct operation. MemoryEnergy 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. TxDataNonZeroEnergy uint64 = 16 // Per byte of non zero data attached to a transaction // These have been changed during the course of the chain CallEnergy uint64 = 700 // Static portion of energy for CALL-derivates BalanceEnergy uint64 = 700 // The cost of a BALANCE operation ExtcodeSizeEnergy uint64 = 700 // Cost of EXTCODESIZE SloadEnergy uint64 = 800 // Cost of SLOAD ExtcodeHashEnergy uint64 = 700 // Cost of EXTCODEHASH SelfdestructEnergy uint64 = 5000 // Cost of SELFDESTRUCT // EXP has a dynamic portion depending on the size of the exponent ExpByte uint64 = 50 // was raised to 50 // Extcodecopy has a dynamic AND a static cost. This represents only the // static portion of the energy. ExtcodeCopyBase uint64 = 700 // CreateBySelfdestructEnergy is used when the refunded account is one that does // not exist. This logic is similar to call. CreateBySelfdestructEnergy uint64 = 25000 MaxCodeSize = 24576 // Maximum bytecode to permit for a contract EcrecoverEnergy uint64 = 3000 // Elliptic curve sender recovery energy price Sha256BaseEnergy uint64 = 60 // Base price for a SHA256 operation Sha256PerWordEnergy uint64 = 12 // Per-word price for a SHA256 operation Ripemd160BaseEnergy uint64 = 600 // Base price for a RIPEMD160 operation Ripemd160PerWordEnergy uint64 = 120 // Per-word price for a RIPEMD160 operation IdentityBaseEnergy uint64 = 15 // Base price for a data copy operation IdentityPerWordEnergy uint64 = 3 // Per-work price for a data copy operation ModExpQuadCoeffDiv uint64 = 20 // Divisor for the quadratic particle of the big int modular exponentiation Bn256AddEnergy uint64 = 150 // Energy needed for an elliptic curve addition Bn256ScalarMulEnergy uint64 = 6000 // Energy needed for an elliptic curve scalar multiplication Bn256PairingBaseEnergy uint64 = 45000 // Base price for an elliptic curve pairing check Bn256PairingPerPointEnergy uint64 = 34000 // Per-point price for an elliptic curve pairing check )
const ( VersionMajor = 1 // Major version component of the current release VersionMinor = 0 // Minor version component of the current release VersionPatch = 56 // Patch version component of the current release VersionMeta = "stable" // Version metadata to append to the version string )
Variables ¶
var ( MainnetGenesisHash = common.HexToHash("0xa38b8f901cf91b3224a4be931e8c2a8d9b4f06b82948fa4a1d63dfad07fc7d3e") DevinGenesisHash = common.HexToHash("0x642de406e3cec5281f77f6e88308427b0b54ac00035ec3675065c1e47d7ec5c3") )
Genesis hashes to enforce below configs on.
var ( // MainnetChainConfig is the chain parameters to run a node on the main network. MainnetChainConfig = &ChainConfig{ NetworkID: big.NewInt(1), Cryptore: new(CryptoreConfig), } // MainnetTrustedCheckpoint contains the light client trusted checkpoint for the main network. MainnetTrustedCheckpoint = &TrustedCheckpoint{ SectionIndex: 289, SectionHead: common.HexToHash("0x5a95eed1a6e01d58b59f86c754cda88e8d6bede65428530eb0bec03267cda6a9"), CHTRoot: common.HexToHash("0x6d4abf2b0f3c015952e6a3cbd5cc9885aacc29b8e55d4de662d29783c74a62bf"), BloomRoot: common.HexToHash("0x1af2a8abbaca8048136b02f782cb6476ab546313186a1d1bd2b02df88ea48e7e"), } // MainnetCheckpointOracle contains a set of configs for the main network oracle. MainnetCheckpointOracle = &CheckpointOracleConfig{ Address: common.Address{}, Signers: []common.Address{}, Threshold: 2, } // DevinChainConfig contains the chain parameters to run a node on the Devin test network. DevinChainConfig = &ChainConfig{ NetworkID: big.NewInt(3), Cryptore: new(CryptoreConfig), } // DevinTrustedCheckpoint contains the light client trusted checkpoint for the Devin test network. DevinTrustedCheckpoint = &TrustedCheckpoint{ SectionIndex: 0, SectionHead: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), CHTRoot: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), BloomRoot: common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), } // DevinCheckpointOracle contains a set of configs for the Devin test network oracle. DevinCheckpointOracle = &CheckpointOracleConfig{ Address: common.Address{}, Signers: []common.Address{}, Threshold: 2, } // AllCryptoreProtocolChanges contains every protocol change (CIPs) introduced // and accepted by the Core core developers into the Cryptore consensus. // // This configuration is intentionally not using keyed fields to force anyone // adding flags to the config to also have to set these fields. AllCryptoreProtocolChanges = &ChainConfig{big.NewInt(1), nil, new(CryptoreConfig), nil} // AllCliqueProtocolChanges contains every protocol change (CIPs) introduced // and accepted by the Core 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(1), nil, nil, &CliqueConfig{Period: 0, Epoch: 30000}} TestChainConfig = &ChainConfig{big.NewInt(2), nil, new(CryptoreConfig), nil} TestRules = TestChainConfig.Rules(new(big.Int)) )
var ( DifficultyBoundDivisor = big.NewInt(2048) // The bound divisor of the difficulty, used in the update calculations. GenesisDifficulty = big.NewInt(8192) // Difficulty of the Genesis block. MinimumDifficulty = big.NewInt(8192) // The minimum that the difficulty may ever be. DurationLimit = big.NewInt(6) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not. )
var CheckpointOracles = map[common.Hash]*CheckpointOracleConfig{ MainnetGenesisHash: MainnetCheckpointOracle, DevinGenesisHash: DevinCheckpointOracle, }
CheckpointOracles associates each known checkpoint oracles with the genesis hash of the chain it belongs to.
var DevinBootnodes = []string{
"enode://93ecfbf2093dbb87f0bbee0ccdafa3afb74003aeb816513b0ca428acff9dd1ac15966f3e34ef5fb2acb98a477ffc289015d23446f0ec195b00@86.110.248.210:30300",
"enode://e0c9b6e9df3d45c90e83fb40135eefbc35a0ce411dd04acd005fa1ef4b97e635133629eee486b8f0a65084139a4ac31e8f8c88c8edbb600a00@86.110.248.211:30300",
"enode://e24c18eca931475b267b511c62e19cc8aa428919111d195e250d59f6edcda4a361d102de1c6c2eb5061aa7b246f820c19d03407d38b975b980@n1.coredevin.net:30300",
"enode://110aa01954eda50ae7ae1c018fdc9772c72108e0d6e9b0571e6ac5f766d99a3d07156894cb288e9b6ea756d660569743b847b385a539720c00@n2.coredevin.net:30300",
"enode://e5bcf68387187de4c533bfddde09538e8d0bc35798d6f0d8e84c9e40cb3b645b052920c4b89ec6527a33ef1903a44e9eae545521b50a07d980@n3.coredevin.net:30300",
"enode://936d469b555223d2cd207b975b9c9a82775513c1b57e3ecdf24c61430cbee7406e3eba1696329002f353f1c5e309e753abd6ff0a815ce96780@n4.coredevin.net:30300",
"enode://5c9182238e1b46c1f2346d5be703ae02dd1deedae4bf3cce4b57e42b9713067c752832ba94a0e59494442bd48bcb37a7892cf87aa097672f00@n5.coredevin.net:30300",
"enode://f77f9bcb352a64e3aa06ceefe2eaca267fbba6486f654505e88c44d85d3f434e4ba7736bd23ec1e0b5ef48819e5ca0d4d5f3bac344faf4f800@n6.coredevin.net:30300",
"enode://24c539cd87e8f4c37747776ae96842dc6c637a99c8311aef4ea56a81b977c5412f1d5f16694580c602bd53a3985d7dd87252b996c4c5dc2d00@n7.coredevin.net:30300",
"enode://4dc065ffd94b9f9b448a7c7d26277b2fc27f12348b765909d06d6f9d12c93c0d63f782cb6c2c3dc95f20bd97525ae8e6692f3df4e4c62abb80@n100.coredevin.net:30300",
}
DevinBootnodes are the enode URLs of the P2P bootstrap nodes running on the Devin test network.
var DiscoveryV5Bootnodes = []string{}
DiscoveryV5Bootnodes are the enode URLs of the P2P bootstrap nodes for the experimental RLPx v5 topic-discovery network.
var KnownDNSNetworks = map[common.Hash]string{
MainnetGenesisHash: dnsPrefix + "all.mainnet.corenode.stream",
DevinGenesisHash: dnsPrefix + "all.devin.corenode.stream",
}
These DNS names provide bootstrap connectivity for public testnets and the mainnet. See https://github.com/core-coin/discv4-dns-lists for more information.
var MainnetBootnodes = []string{
"enode://d74ae95f2967a731ff1341da75110daa050b603ad6dbf21c91a7d07e2b52674ce8018ba1ef529051e859b7cee358b80f5c0afae83b88f4b280@86.110.248.212:30300",
"enode://4b2b16a1bf3ee11f87cc45d2039d59936fd91e9b20a55f5e307d8aad9cd1428416d935d306be6cc5b640106877c90f6ca1f12a82362ccc2500@86.110.248.213:30300",
"enode://12b01bbbadf76c3fc4f1229c6a1af3430b61e8cbdda7d2de39413c949230496bda83ede613ac09f352b87fa7b0526dabaa366f8991b23f9300@86.110.248.214:30300",
"enode://7fcacb7a3f70e12db2accbc554ffce7889d4b42bfa3f94210c75960a498b8bb8062fe191f9bc4aa33d683dba2e0492ce7335675da912b9a300@n1.coremainnet.net:30300",
"enode://65749e415a8ebe4f584f7c95de3f5d84dd2f4f1cb789ccae35e67286aab00041797a630ffc0c21781bd10aefc51423f03fd2412b265e0d2d80@n2.coremainnet.net:30300",
"enode://1806510e9fcbce7f7bbf56c27298c1bbd3d6981bba81194d81882a4d3b6a9fd5d98f037feb6f08d09dc07df646a9c3d2e340196a8d4f0a9280@n3.coremainnet.net:30300",
"enode://9558dc01f8f804cf7c8ad819baf1182c743214acb6482143f593d2ac787b90c85a0e3965381ce3593c5041ac3aaf06282f24a9f6e8811c7080@n4.coremainnet.net:30300",
"enode://3dac96b50ca74c3de40d8141f0f58f83fbf98cf6a7126edf6766656242a7f943d92e9d1bb8b0a507aeb05d361499eb7f7df35d05aa53152d80@n5.coremainnet.net:30300",
"enode://7bf7c9093034622e11099cbb6ab2bb94aa9946e70717eee303bd9ca1f993b5b60c5aef74dc0f0f4f34000f3facb52e21fed732a0caea931180@n6.coremainnet.net:30300",
"enode://26f0bae496bdebb666ebbe7e787423af7afbd39914bc5b1d4f116ac963e5b5d123c0b9d8a437cd38d70c42ddd239932399e789426fab000880@n7.coremainnet.net:30300",
"enode://e549dcb77cecb405d7680744a00d3152cd423e258ada735de1cb70260303a2268a81fa7def1d2ccb8c09dbe44894bd7e8516b1b4293d292d00@n8.coremainnet.net:30300",
"enode://ef4951bb7f967b4d2fbb0ba17cba29d23cc9e05fe19bdcaa0f7a110a4f8e3db19783c9bba5f9626ff7018cf37a9b57258e7c50c1a486d5e080@n9.coremainnet.net:30300",
"enode://60c38b803e5e1493679a7c6cfc4a685bc6623cec5ca31f104b442edacbacb75bcbf2d7310eb00335fb6f74296b97e1f6a1d395bba3ba8bb580@n10.coremainnet.net:30300",
"enode://bbb3fb84b4a65a8099521dc1d7716754505b815b2a5b018a1435e3ab080a40d87a75a49516585812f59ad9021d9ca644878680cb0e75df5280@n11.coremainnet.net:30300",
"enode://a491871a099a255317b44635f68797445e71a30fb00e0766724bc3b57f7a693b563fa67dd8cf40cc52c9b4b41c80cb7348eebae23af93fed80@n12.coremainnet.net:30300",
"enode://617ef29e72bc1be3a4078208f9fef0826fe9aa2be2f77d5d6e9aa80d83c3571d52fa85334315ad49a1691eca5455d65f40ca009342ceb71f00@n13.coremainnet.net:30300",
"enode://57ba4f7f74741bc76edb9d9ce6e490da28c2ebb9051d8f1bedfe5f10ff432c950aa6ab54d0fc969f59abdabf7f0053c71734113c37d4ec5b00@n100.coremainnet.net:30300",
}
MainnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the main Core network.
var TrustedCheckpoints = map[common.Hash]*TrustedCheckpoint{ MainnetGenesisHash: MainnetTrustedCheckpoint, DevinGenesisHash: DevinTrustedCheckpoint, }
TrustedCheckpoints associates each known checkpoint with the genesis hash of the chain it belongs to.
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 ArchiveVersion ¶
ArchiveVersion holds the textual version string used for Gocore archives. e.g. "1.8.11-dea1ce05" for stable releases, or
"1.8.13-unstable-21c059b6" for unstable releases
func VersionWithCommit ¶
Types ¶
type ChainConfig ¶
type ChainConfig struct { NetworkID *big.Int `json:"networkId"` // networkId identifies the current chain and is used for replay protection EWASMBlock *big.Int `json:"ewasmBlock,omitempty"` // EWASM switch block (nil = no fork, 0 = already activated) // Various consensus engines Cryptore *CryptoreConfig `json:"cryptore,omitempty"` Clique *CliqueConfig `json:"clique,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) CheckConfigForkOrder ¶
func (c *ChainConfig) CheckConfigForkOrder() error
CheckConfigForkOrder checks that we don't "skip" any forks, gocore isn't pluggable enough to guarantee that forks can be implemented in a different order than on official networks
func (*ChainConfig) IsEWASM ¶
func (c *ChainConfig) IsEWASM(num *big.Int) bool
IsEWASM returns whether num represents a block number after the EWASM fork
func (*ChainConfig) Rules ¶
func (c *ChainConfig) Rules(num *big.Int) Rules
Rules ensures c's NetworkID is not nil.
func (*ChainConfig) String ¶
func (c *ChainConfig) String() string
String implements the fmt.Stringer interface.
type CheckpointOracleConfig ¶
type CheckpointOracleConfig struct { Address common.Address `json:"address"` Signers []common.Address `json:"signers"` Threshold uint64 `json:"threshold"` }
CheckpointOracleConfig represents a set of checkpoint contract(which acts as an oracle) config which used for light client checkpoint syncing.
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 CryptoreConfig ¶
type CryptoreConfig struct{}
CryptoreConfig is the consensus engine configs for proof-of-work based sealing.
func (*CryptoreConfig) String ¶
func (c *CryptoreConfig) String() string
String implements the stringer interface, returning the consensus engine details.
type Rules ¶
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 TrustedCheckpoint ¶
type TrustedCheckpoint struct { SectionIndex uint64 `json:"sectionIndex"` SectionHead common.Hash `json:"sectionHead"` CHTRoot common.Hash `json:"chtRoot"` BloomRoot common.Hash `json:"bloomRoot"` }
TrustedCheckpoint represents a set of post-processed trie roots (CHT and BloomTrie) associated with the appropriate section index and head hash. It is used to start light syncing from this checkpoint and avoid downloading the entire header chain while still being able to securely access old headers/logs.
func (*TrustedCheckpoint) Empty ¶
func (c *TrustedCheckpoint) Empty() bool
Empty returns an indicator whether the checkpoint is regarded as empty.
func (*TrustedCheckpoint) Hash ¶
func (c *TrustedCheckpoint) Hash() common.Hash
Hash returns the hash of checkpoint's four key fields(index, sectionHead, chtRoot and bloomTrieRoot).