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 = 32768 // 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 // ImmutabilityThreshold 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. ImmutabilityThreshold = 90000 )
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 = 25 // Patch version component of the current release VersionMeta = "stable" // Version metadata to append to the version string )
Variables ¶
var ( MainnetGenesisHash = common.HexToHash("0x6894bcf15a005884af1253227df1057885f2ccff132eff7665f9761b7e3ea98a") DevinGenesisHash = common.HexToHash("0x4d22056fa4d6321bf031c046f040a370128b10a557f620c2d169c6655e6ba30c") KolibaGenesisHash = common.HexToHash("0xa171c867f5b1d4c8b87ca5ea3a4205234b60768a03252f06e42936fa0bd62bf8") )
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, } // KolibaChainConfig contains the chain parameters to run a node on the Koliba test network. KolibaChainConfig = &ChainConfig{ NetworkID: big.NewInt(4), Clique: &CliqueConfig{ Period: 15, Epoch: 30000, }, } // KolibaTrustedCheckpoint contains the light client trusted checkpoint for the Koliba test network. KolibaTrustedCheckpoint = &TrustedCheckpoint{ SectionIndex: 66, SectionHead: common.HexToHash("0xeea3a7b2cb275956f3049dd27e6cdacd8a6ef86738d593d556efee5361019475"), CHTRoot: common.HexToHash("0x11712af50b4083dc5910e452ca69fbfc0f2940770b9846200a573f87a0af94e6"), BloomRoot: common.HexToHash("0x331b7a7b273e81daeac8cafb9952a16669d7facc7be3b0ebd3a792b4d8b95cc5"), } // KolibaCheckpointOracle contains a set of configs for the Koliba test network oracle. KolibaCheckpointOracle = &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(1024) // 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, KolibaGenesisHash: KolibaCheckpointOracle, }
CheckpointOracles associates each known checkpoint oracles with the genesis hash of the chain it belongs to.
var DevinBootnodes = []string{
"enode://caeef3fe131f1ed322735e4195ed8a887c3a5316dbd13595e09d98f02ef816c375a8be2baf9dbfac571d6d497c0d1afeb5b014d8df04cc5c00@168.119.231.210:30300",
"enode://d67d5db87c8e6bc8139df78c45819675bbd992eded7bbc5c18b1868c53beb7a0b5242e95d7e9ddfdd0ad5f833531302616059fd4f60ce24a80@78.47.203.14:30300",
"enode://4a19d5ac99da155f54cc5d56751f069a8a7e475c8d0a5fafdcabeb409a9fb71f33008592571cfdc949d8db8733a6ba7ecf8b759c42799baa80@51.15.51.158:30300",
"enode://6819914de7cc04e0cd8521974e0c0910acf89d862bce0b284afda70d0fe8e7b5115e058d33b54cc6eb73e9f8ccdc3a6400fb1499109769d680@51.158.123.140: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",
KolibaGenesisHash: dnsPrefix + "all.koliba.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 KolibaBootnodes = []string{
"enode://7081d1a8a52a9d0b8bd/c0247cb7fd04277a8e76a30f85ce8a9daf41a4e8e1f79902d4959416a663a779cd28390b10a881f56d73469deb695@51.75.247.236:30303",
}
KolibaBootnodes are the enode URLs of the P2P bootstrap nodes running on the Koliba test network.
var MainnetBootnodes = []string{
"",
}
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, KolibaGenesisHash: KolibaTrustedCheckpoint, }
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).