params

package
v0.49.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2025 License: GPL-3.0 Imports: 17 Imported by: 23

Documentation

Index

Constants

View Source
const (
	ColosseumName  = "colosseum"
	GardenName     = "garden"
	OrchardName    = "orchard"
	LighthouseName = "lighthouse"
	LocalName      = "local"
	DevName        = "dev"
)

Different Network names

View Source
const (
	Wei   = 1
	GWei  = 1e9
	Ether = 1e18
)

These are the multipliers for ether denominations. Example: To get the wei value of an amount in 'gwei', use

new(big.Int).Mul(value, big.NewInt(params.GWei))
View Source
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

	// 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 threshold.
	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

	MaxTxInWorkShare = 300
)
View Source
const (
	GasLimitBoundDivisor    uint64 = 1024     // The bound divisor of the gas limit, used in update calculations.
	PercentGasUsedThreshold uint64 = 90       // Percent Gas used threshold at which the gas limit adjusts
	GenesisGasLimit         uint64 = 12000000 // Gas limit of the Genesis block.

	StateCeil                 uint64 = 50000000 // Maximum the StateCeil may ever be
	StateLimitBoundDivisor    uint64 = 1024     // The bound divisor of the gas limit, used in update calculations.
	PercentStateUsedThreshold uint64 = 90       // Percent Gas used threshold at which the gas limit adjusts

	EtxStateUsed uint64 = 10000 // state used by a simple etx

	MaximumExtraDataSize  uint64 = 32    // Maximum size extra data may be after Genesis.
	CallValueTransferGas  uint64 = 9000  // Paid for CALL when the value transfer is non-zero.
	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.
	LogDataGas            uint64 = 8     // Per byte in a LOG* operation's data.
	CallStipend           uint64 = 2300  // Free gas given at beginning of call.
	ETXGas                uint64 = 21000 // Per ETX generated by opETX or normal cross-chain transfer.
	//  The etx fractions  should be based on the current  expansion number
	ETXRegionMaxFraction uint64 = 1          // The maximum fraction of transactions for cross-region ETXs
	ETXPrimeMaxFraction  uint64 = 1          // The maximum fraction of transactions for cross-prime ETXs
	ETXRLimitMin         uint64 = 50 * TxGas // Minimum possible cross-region ETX limit
	ETXPLimitMin         uint64 = 50 * TxGas // Minimum possible cross-prime ETX limit

	Sha3Gas     uint64 = 30 // Once per SHA3 operation.
	Sha3WordGas uint64 = 6  // Once per word of the SHA3 operation's data.

	JumpdestGas   uint64 = 1     // Once per JUMPDEST operation.
	EpochDuration uint64 = 30000 // Duration between proof-of-work epochs.

	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.
	Create2Gas            uint64 = 32000 // Once per CREATE2 operation
	SelfdestructRefundGas uint64 = 24000 // Refunded following a selfdestruct 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 = 16   // Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions.
	TxAccessListAddressGas    uint64 = 2400 // Per address specified in access list
	TxAccessListStorageKeyGas uint64 = 1900 // Per storage key specified in access list

	// These have been changed during the course of the chain
	SloadGas        uint64 = 800  // This is only used in the Qi tx processing
	SelfdestructGas 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 gas.
	ExtcodeCopyBase uint64 = 700

	// CreateBySelfdestructGas is used when the refunded account is one that does
	// not exist. This logic is similar to call.
	CreateBySelfdestructGas uint64 = 25000

	BaseFeeChangeDenominator = 8          // Bounds the amount the base fee can change between blocks.
	ElasticityMultiplier     = 2          // Bounds the maximum gas limit a block may have.
	InitialBaseFee           = 1 * Wei    // Initial base fee for blocks.
	MaxBaseFee               = 100 * GWei // Maximum base fee for blocks.
	InitialStateLimit        = 5000000    // Initial state fee for blocks.

	MaxCodeSize           = 24576   // Maximum bytecode to permit for a contract (24KB)
	NewMaxCodeSize        = 32768   // Maximum bytecode to permit for a contract after fork (32KB)
	MaxCodeSizeForkHeight = 3490000 // Block height at which the new 32KB code size limit activates

	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

	Bn256AddGas             uint64 = 150   // Gas needed for an elliptic curve addition
	Bn256ScalarMulGas       uint64 = 6000  // Gas needed for an elliptic curve scalar multiplication
	Bn256PairingBaseGas     uint64 = 45000 // Base price for an elliptic curve pairing check
	Bn256PairingPerPointGas uint64 = 34000 // Per-point price for an elliptic curve pairing check

	// The Refund Quotient is the cap on how much of the used gas can be refunded
	RefundQuotient                  uint64 = 5
	PreviousMaxAddressGrindAttempts int    = 1000  // Previous maximum number of attempts to grind an address to a valid one
	MaxAddressGrindAttempts         int    = 10000 // Maximum number of attempts to grind an address to a valid one
	MinimumEtxGasDivisor                   = 5     // The divisor for the minimum gas for inbound ETXs (Block gas limit / MinimumEtxGasDivisor)
	MaximumEtxGasMultiplier                = 2     // Multiplied with the minimum ETX gas for inbound ETXs (Block gas limit / MinimumEtxGasDivisor) * MaximumEtxGasMultiplier
	MinEtxCount                            = 50    // These counts are used in the case where tx is not eligible to be started
	MaxEtxCount                            = 100

	//  This is the threshold (range 0-100) above which the
	// score will begin the tree expansion decision process. This threshold should be
	// 	chosen high enough to not be easily triggered by minor changes in node
	// 	operating behavior, but not so high that the security efficiency becomes
	// 	unacceptably low.
	TREE_EXPANSION_THRESHOLD uint16 = math.MaxUint16

	// This is the smoothing factor (range 0-10) used by each zone in its low-pass
	// filter to gather a long running average of the zone's security efficiency
	// score. Choosing a larger will make the filter less responsive; the tree
	// expansion algorithm will be less susceptible to short term variations in the
	// efficiency score, but will take longer to decide to trigger an expansion when
	// one becomes necessary.
	TREE_EXPANSION_FILTER_ALPHA uint16 = 9

	//  Once all chains have confirmed above TREE_EXPANSION_THRESHOLD, this is
	//  the number of consecutive prime blocks that must remain above the
	//  threshold to confirm the decision to expand the tree.
	TREE_EXPANSION_TRIGGER_WINDOW uint16 = 144

	// Once the network has confirmed the decision to expand the tree, this is
	// the number of prime blocks to wait until the expansion is activated. This
	// should be chosen to give node operators some time to adjust their
	// infrastructure, if needed, to account for the upcoming network change.
	TREE_EXPANSION_WAIT_COUNT = 1024

	ConversionConfirmationContext = common.PRIME_CTX // A conversion requires a single coincident Dom confirmation
	QiToQuaiConversionGas         = 100000           // The gas used to convert Qi to Quai
	DefaultCoinbaseLockup         = 0                // The default lockup byte for coinbase rewards
	MaxCoinbaseTrancheElements    = 100              // Maximum number of elements in a coinbase tranche
)
View Source
const (
	TokenChoiceSetSize uint64 = 4000 // This should be same as the MinerDifficultyWindow
)

Variables

View Source
var (
	// Progpow GenesisHashes
	ProgpowColosseumGenesisHash  = common.HexToHash("0xac81c28f1a72591b87b5f16c9793cdc0e87c45c6d426d1a364c3b8f6386b5b8b")
	ProgpowGardenGenesisHash     = common.HexToHash("0x8a611a707f8da1129432cf5b97e6f1eccf902797124f26ea7b6a929b63fd8fde")
	ProgpowOrchardGenesisHash    = common.HexToHash("0x3c9e1b5879118260b45ec05aebdd127808e830ecf5fc5ef9cb46405d339f8dff")
	ProgpowLighthouseGenesisHash = common.HexToHash("0x83f1a345d1406d8d8b8e83b1d8e8369a3aa3070448d52cdffd30769a512b07c7")
	ProgpowLocalGenesisHash      = common.HexToHash("0x7ea6d5711d07d9cd5382e13511343c09c5734c6cf5251156f1a63b2598ab3179")

	// Blake3GenesisHashes
	Blake3PowColosseumGenesisHash  = common.HexToHash("0xda598b9b93c0aa101a238033ebb6017ca0be4d58f14945f71b19e9e77e8d12bb")
	Blake3PowGardenGenesisHash     = common.HexToHash("0x0f76154b9ea0efd13793a256ebda278140572ec87711a50480817afef3a48ecf")
	Blake3PowOrchardGenesisHash    = common.HexToHash("0xfdac121c2c3d7269b20eae8f30b50adcdb772227b8988c9f417b2d467b8aa011")
	Blake3PowLighthouseGenesisHash = common.HexToHash("0x130cb1771fef2ecfe5db987783da74f1de1131848a434f4118dd048515128b9f")
	Blake3PowLocalGenesisHash      = common.HexToHash("0x807757af788de808c702427dd465035f743038f0aa9840f0b904c50b7643e13e")

	AllocHash           = common.HexToHash("0xa1f3f565b62c83fcc0e61dfd219409fb06526570934a5d94b5db5afdad13f1da")
	LighthouseAllocHash = common.HexToHash("0x7af9921c72ee23443ec6bd016f92f1a6da0534aa931030c0a24f54107d35e010")
)

Genesis hashes to enforce below configs on.

View Source
var (
	// ColosseumChainConfig is the chain parameters to run a node on the Colosseum network.
	ProgpowColosseumChainConfig = &ChainConfig{
		ChainID: big.NewInt(9),
		Progpow: new(ProgpowConfig),
	}

	Blake3PowColosseumChainConfig = &ChainConfig{
		ChainID:   big.NewInt(9),
		Blake3Pow: new(Blake3powConfig),
	}

	// GardenChainConfig contains the chain parameters to run a node on the Garden test network.
	ProgpowGardenChainConfig = &ChainConfig{
		ChainID: big.NewInt(12000),
		Progpow: new(ProgpowConfig),
	}

	Blake3PowGardenChainConfig = &ChainConfig{
		ChainID:   big.NewInt(12000),
		Blake3Pow: new(Blake3powConfig),
	}

	// OrchardChainConfig contains the chain parameters to run a node on the Orchard test network.
	ProgpowOrchardChainConfig = &ChainConfig{
		ChainID: big.NewInt(15000),
		Progpow: new(ProgpowConfig),
	}

	Blake3PowOrchardChainConfig = &ChainConfig{
		ChainID:   big.NewInt(15000),
		Blake3Pow: new(Blake3powConfig),
	}

	// LighthouseChainConfig contains the chain parameters to run a node on the Lighthouse test network.
	ProgpowLighthouseChainConfig = &ChainConfig{
		ChainID:   big.NewInt(17000),
		Blake3Pow: new(Blake3powConfig),
		Progpow:   new(ProgpowConfig),
	}

	Blake3PowLighthouseChainConfig = &ChainConfig{
		ChainID:   big.NewInt(17000),
		Blake3Pow: new(Blake3powConfig),
	}

	// LocalChainConfig contains the chain parameters to run a node on the Local test network.
	ProgpowLocalChainConfig = &ChainConfig{
		ChainID: big.NewInt(1337),
		Progpow: new(ProgpowConfig),
	}

	Blake3PowLocalChainConfig = &ChainConfig{
		ChainID:   big.NewInt(1337),
		Blake3Pow: new(Blake3powConfig),
	}

	// AllProgpowProtocolChanges contains every protocol change introduced
	// and accepted by the Quai core developers into the Progpow consensus.
	//
	// This configuration is intentionally not using keyed fields to force anyone
	// adding flags to the config to also have to set these fields.
	AllProgpowProtocolChanges = &ChainConfig{big.NewInt(1337), "progpow", new(Blake3powConfig), new(ProgpowConfig), common.Location{}, common.Hash{}, false, false}

	TestChainConfig = &ChainConfig{big.NewInt(1), "progpow", new(Blake3powConfig), new(ProgpowConfig), common.Location{}, common.Hash{}, false, false}
	TestRules       = TestChainConfig.Rules(new(big.Int))
)
View Source
var (
	MaxGossipsubPacketSize            = 3 << 20
	GasCeil                    uint64 = 50000000
	ColosseumGasCeil           uint64 = 50000000
	GardenGasCeil              uint64 = 50000000
	OrchardGasCeil             uint64 = 50000000
	LighthouseGasCeil          uint64 = 50000000
	LocalGasCeil               uint64 = 50000000
	DurationLimit                     = big.NewInt(5) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
	GardenDurationLimit               = big.NewInt(5) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
	OrchardDurationLimit              = big.NewInt(5) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
	LighthouseDurationLimit           = big.NewInt(5) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
	LocalDurationLimit                = big.NewInt(1) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
	TimeToStartTx              uint64 = 15 * BlocksPerDay
	BlocksPerDay               uint64 = new(big.Int).Div(big.NewInt(86400), DurationLimit).Uint64() // BlocksPerDay is the number of blocks per day assuming 5 second block time
	BlocksPerWeek              uint64 = 7 * BlocksPerDay
	BlocksPerMonth             uint64 = 30 * BlocksPerDay
	PrimeBlocksPerMonth        uint64 = BlocksPerMonth / 4                                          // TODO: has to scale properly when the network expands
	BlocksPerYear              uint64 = 365 * BlocksPerDay                                          // BlocksPerYear is the number of blocks per year assuming 5 secs blocks
	DifficultyAdjustmentPeriod        = big.NewInt(720)                                             // This is the number of blocks over which the average has to be taken
	DifficultyAdjustmentFactor int64  = 40                                                          // This is the factor that divides the log of the change in the difficulty
	MinQuaiConversionAmount           = new(big.Int).Mul(big.NewInt(10000000000), big.NewInt(GWei)) // 0.000000001 Quai
	MaxWorkShareCount                 = 16
	WorkSharesThresholdDiff           = 3 // Number of bits lower than the target that the default consensus engine uses
	ExpectedWorksharesPerBlock        = 8 // The expected number of work shares per block
	WorkShareP2PThresholdDiff         = 7 // Default value in bits lower than the target
	WorkSharesInclusionDepth          = 3 // Number of blocks upto which the work shares can be referenced and this is protocol enforced
	MaxLockupByte                     = 3 // Max lockup byte allowed in the transactions for coinbase
	LockupByteToBlockDepth            = [4]uint64{
		ConversionLockPeriod,
		3 * BlocksPerMonth,
		6 * BlocksPerMonth,
		BlocksPerYear,
	}
	// The first value represents the multiplier that represents interest rate
	// for the first year, the second value represents the terminal rate these
	// values are divided by 100,000 to get the final values
	LockupByteToRewardsMultiple = [4][2]uint64{
		[2]uint64{},
		[2]uint64{103500, 100218},
		[2]uint64{110000, 100625},
		[2]uint64{125000, 101562},
	}
	ExchangeRate                                = big.NewInt(221077819000000000) // This is the initial exchange rate in Qi per Quai in Its/Qit.
	MaxTimeDiffBetweenBlocks             int64  = 100                            // Max time difference between the blocks to 100 secs
	OneOverAlpha                                = big.NewInt(1000)               // The alpha value for the quai to qi conversion
	ControllerKickInBlock                uint64 = 262000                         // This is in order of prime blocks
	CoinbaseLockupPrecompileKickInHeight        = 5 * BlocksPerWeek              // The height at which the coinbase lockup precompile is enabled
	MinBaseFeeInQits                            = big.NewInt(5)
	OneOverBaseFeeControllerAlpha               = big.NewInt(100)
	BaseFeeMultiplier                           = big.NewInt(50)

	ConversionLockPeriod uint64 = 2 * BlocksPerWeek
	CoinbaseEpochBlocks  uint64 = 50000

	// Controller related constants
	StartingKQuaiDiscount               = big.NewInt(100)
	StartingConversionFlowAmount        = new(big.Int).Mul(big.NewInt(10000), big.NewInt(Ether)) // Starting conversion flow amount in Quai
	MinConversionFlowAmount             = new(big.Int).Mul(big.NewInt(100), big.NewInt(Ether))   // Min conversion flow amount in Quai
	MinerDifficultyWindow        uint64 = 4000
	KQuaiDiscountMultiplier      int64  = 100000
	MinCubicDiscountBasisPoint   uint64 = 20
	MinCubicDiscountDivisor      uint64 = 10000
	TokenDiffAlpha                      = big.NewInt(5)

	SlipAmountRange = big.NewInt(10000)
	MaxSlip         = big.NewInt(9000)
	MinSlip         = big.NewInt(30)

	// QiActivationBlock is the approximated Zone block number for the corresponding prime controller kick in block
	QiActivationBlock uint64 = 1220000

	KQuaiChangeBlock        uint64 = 752000 // Prime block number at which k quai change happens
	KQuaiChangeHoldInterval uint64 = 20000  // Around 6-7 days worth of the prime blocks

	// KQuaiChangeTable is the table that defines the KQuai change at different blocks
	// The first value is the block number and the second value is the KQuai value left after the reduction
	KQuaiChangeTable = [][2]uint64{
		{KQuaiChangeBlock, 50},
		{KQuaiChangeBlock + 2*PrimeBlocksPerMonth, 75},
		{KQuaiChangeBlock + 4*PrimeBlocksPerMonth, 75},
		{KQuaiChangeBlock + 6*PrimeBlocksPerMonth, 75},
	}

	ConversionSlipChangeBlock uint64 = 285000

	MaxQiTxDataLength = 22 // Qi Tx Data can only be max of 22 bytes for the WrapQi it is 20 byte and 22 (2 byte slip + 20 byte address) byte for Conversion

	MaxGrindIncreaseForkBlock = big.NewInt(1865000)

	MaxAllowableEntropyDist uint64 = 40 // Maximum multiple of zone intrinsic S distance allowed from the current Entropy
)
View Source
var (
	KawPowForkBlock            uint64 = 1171500            // Block at which KawPow activates
	KawPowTransitionPeriod     uint64 = BlocksPerMonth / 4 // Progpow grace period after kawpow upgrade, 4 weeks
	TotalPowEngines            uint64 = 2                  // Total number of PoW engines supported (Progpow, Kawpow)
	AuxTemplateLivenessTime    uint64 = 15
	AuxTemplateStaleTime       uint64 = uint64(10 * time.Minute)
	ShareLivenessTime          uint32 = 18             // The time in seconds that a share is considered live for the purposes of inclusion in the block reward calculation
	ShareDiffRelativeThreshold        = big.NewInt(90) // 90% of the current header diff
	AlphaInverse                      = big.NewInt(1)

	ShaBlockTime    = big.NewInt(600) // btc/bch block time 10 mins in secs
	ScryptBlockTime = big.NewInt(60)  // Doge block time 1 min in secs

	// PoW share difficulty parameters
	InitialShaDiffMultiple    = big.NewInt(167000)
	InitialScryptDiffMultiple = big.NewInt(12)
	ShaDiffLowerBound         = big.NewInt(7e15)
	ScryptDiffLowerBound      = big.NewInt(7e11)

	PowDiffAdjustmentFactor = big.NewInt(300000)

	// Target number of shares per algo times 2^32
	TargetShaShares = big.NewInt(12884901888)
	MaxShaShares    = big.NewInt(17179869184) // 2x the target

	MinValidCount = big.NewInt(128849018) // 1% of the target

	// Maximum number of shares that can be included in a block for each algo.
	// This is to prevent a single block from being filled with shares from one
	// specific algo
	MaxShaSharesCount    = 8
	MaxScryptSharesCount = 8

	// Maximum amount of hashrate allowed on subsidy chain
	MaxSubsidyNumerator   = big.NewInt(3)
	MaxSubsidyDenominator = big.NewInt(4)

	InitialKawpowDiff       = big.NewInt(21500000000000) // Ravencoin mainnet has 4.3Th/s
	RavenQuaiBlockTimeRatio = big.NewInt(12)             // 60s/5s = 12

	RavencoinDiffPercentage  = big.NewInt(10000) // 100% in basis points
	RavencoinDiffCutoffEnd   = big.NewInt(9000)  // 90%
	RavencoinDiffCutoffStart = big.NewInt(7500)  // 75%
	RavencoinDiffCutoffRange = big.NewInt(1500)

	// The number of blocks to use in the exponential moving average
	WorkShareEmaBlocks = big.NewInt(1000)

	// MuSig2 2-of-3 public keys for AuxTemplate signing
	// Add this to go-quai/params/protocol_params.go
	MuSig2PublicKeys = []string{
		"02cae78e4905da54dc93d6009119d56a2ef91b11e129c8fa41342310ec3a9b499c",
		"03374cbfcea6cb8172b2fdc09e9f7ec0cc2ff10aaa2192fb19fa04d9391b0a75c2",
		"03abfe95f7d487a44cac59c9d62fe63e9e01dc3e06dc9fe96b7038d73d99a62fa6",
	}

	// MerkleNonce, MerkleSize is used for the auxpow2
	MerkleNonce uint32 = 0
	MerkleSize  uint32 = 2

	UnlivelySharePenalty      = big.NewInt(70) // Amount of share reward left after applying the penalty for shares that are not included in the block reward calculation due to being stale
	ProgpowPenalty            = big.NewInt(70) // Amount of share reward left after applying the penalty for shares that are not included in the block reward calculation due to share being progpow after the fork
	ShareRewardPenaltyDivisor = big.NewInt(100)

	KQuaiResetAfterKawPowForkBlock        uint64 = KawPowForkBlock
	ExchangeRateResetValueAfterKawpowFork        = new(big.Int).Mul(big.NewInt(30), ExchangeRate)
	ExchangeRateHoldInterval              uint64 = 3 * BlocksPerMonth / 4 // 3 months in prime block terms
	KQuaiDifficultyDivisor                uint64 = 300000000000           // Minimum difficulty after kawpow fork for the reward calculation
)
View Source
var (
	BigEther = new(big.Int).SetUint64(Ether)
)
View Source
var GitCommit string

Functions

func ArchiveVersion

func ArchiveVersion(gitCommit string) string

ArchiveVersion holds the textual version string used for Quai archives. e.g. "1.8.11-dea1ce05" for stable releases, or

"1.8.13-unstable-21c059b6" for unstable releases

func CalculateCoinbaseValueWithLockup added in v0.34.0

func CalculateCoinbaseValueWithLockup(value *big.Int, lockupByte uint8, blockNumber uint64) *big.Int

func CalculateGasWithStateScaling added in v0.32.0

func CalculateGasWithStateScaling(stateSize, contractSize *big.Int, baseRate uint64) uint64

func CalculateLockupByteRewardsMultiple added in v0.42.0

func CalculateLockupByteRewardsMultiple(lockupByte uint8, blockNumber uint64) (*big.Int, error)

func CalculateQiGasWithUTXOSetSizeScalingFactor added in v0.35.0

func CalculateQiGasWithUTXOSetSizeScalingFactor(scalingFactor float64, baseRate uint64) uint64

func CallNewAccountGas

func CallNewAccountGas(stateSize *big.Int) uint64

func ColdAccountAccessCost

func ColdAccountAccessCost(stateSize, contractSize *big.Int) uint64

func ColdSloadCost

func ColdSloadCost(stateSize, contractSize *big.Int) uint64

func GetMaxCodeSize added in v0.48.0

func GetMaxCodeSize(blockNumber uint64) int

func InitVersion added in v0.30.0

func InitVersion()

func MinGasLimit

func MinGasLimit(number uint64) uint64

func OneOverKqi added in v0.35.0

func OneOverKqi(number uint64) *big.Int

func PrimeEntropyTarget

func PrimeEntropyTarget(expansionNum uint8) *big.Int

This is TimeFactor*TimeFactor*common.NumZonesInRegion*common.NumRegionsInPrime

func RegionEntropyTarget

func RegionEntropyTarget(expansionNum uint8) *big.Int

This is TimeFactor*common.NumZonesInRegion

func SstoreClearsScheduleRefund

func SstoreClearsScheduleRefund(stateSize, contractSize *big.Int) uint64

SSTORE_CLEARS_SCHEDULE is defined as SSTORE_RESET_GAS + ACCESS_LIST_STORAGE_KEY_COST Which becomes: 5000 - 2100 + 1900 = 4800

func SstoreResetGas

func SstoreResetGas(stateSize, contractSize *big.Int) uint64

func SstoreSentryGas

func SstoreSentryGas(stateSize, contractSize *big.Int) uint64

func SstoreSetGas

func SstoreSetGas(stateSize, contractSize *big.Int) uint64

func VersionWithCommit

func VersionWithCommit(gitCommit, gitDate string) string

func WarmStorageReadCost

func WarmStorageReadCost(stateSize, contractSize *big.Int) uint64

Types

type Blake3powConfig

type Blake3powConfig struct{}

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

func (*Blake3powConfig) String

func (c *Blake3powConfig) String() string

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

type CachedVersion

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

Version contains software version data parsed from the VERSION file

var Version CachedVersion

func (*CachedVersion) Full

func (v *CachedVersion) Full() string

Full loads the cached full version string, or reads it from a file

func (*CachedVersion) Major

func (v *CachedVersion) Major() int

Major loads the cached major version, or reads it from a file

func (*CachedVersion) Meta

func (v *CachedVersion) Meta() string

Meta loads the cached version metadata, or reads it from a file Metadata may be empty if no metadata was provided

func (*CachedVersion) Minor

func (v *CachedVersion) Minor() int

Minor loads the cached minor version, or reads it from a file

func (*CachedVersion) Patch

func (v *CachedVersion) Patch() int

Patch loads the cached patch version, or reads it from a file

func (*CachedVersion) Short

func (v *CachedVersion) Short() string

Full loads the cached full version string, or reads it from a file

type ChainConfig

type ChainConfig struct {
	ChainID *big.Int `json:"chainId"` // chainId identifies the current chain and is used for replay protection
	// Various consensus engines
	ConsensusEngine    string
	Blake3Pow          *Blake3powConfig `json:"blake3pow,omitempty"`
	Progpow            *ProgpowConfig   `json:"progpow,omitempty"`
	Location           common.Location
	DefaultGenesisHash common.Hash
	IndexAddressUtxos  bool
	TelemetryEnabled   bool
}

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) Rules

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

Rules ensures c's ChainID is not nil.

func (*ChainConfig) SetLocation

func (cfg *ChainConfig) SetLocation(location common.Location)

SetLocation sets the location on the chain config

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

type GenesisAccount struct {
	UnlockSchedule  int                                      `json:"unlockSchedule"`
	Address         common.Address                           `json:"address"`
	Award           *big.Int                                 `json:"award"`
	Vested          *big.Int                                 `json:"vested"`
	LumpSumMonth    uint64                                   `json:"lumpSumMonth"`
	BalanceSchedule *orderedmap.OrderedMap[uint64, *big.Int] `json:"balanceSchedule"` // Map of blockNumber->balanceUnlocked (at that block).
}

GenesisAccount is an account in the state of the genesis block.

func GenerateGenesisUnlocks added in v0.49.0

func GenerateGenesisUnlocks(filename string) ([]GenesisAccount, error)

Will return all the GenesisAccounts with their calculated unlock schedules. Ignores any existing values in BalanceSchedule and recalculates them.

func VerifyGenesisAllocs added in v0.49.0

func VerifyGenesisAllocs(filename string, expectedHash common.Hash) ([]GenesisAccount, error)

Performs verification tasks on provided unlock info.

type Mode added in v0.49.0

type Mode uint

Mode defines the type and amount of PoW verification a kawpow engine makes.

const (
	ModeNormal Mode = iota
	ModeShared
	ModeTest
	ModeFake
	ModeFullFake
)

type PowConfig added in v0.49.0

type PowConfig struct {
	PowMode Mode

	CacheDir       string
	CachesInMem    int
	CachesOnDisk   int
	CachesLockMmap bool
	DurationLimit  *big.Int
	GasCeil        uint64
	MinDifficulty  *big.Int
	GenAllocs      []GenesisAccount

	NodeLocation common.Location

	WorkShareThreshold int

	// When set, notifications sent by the remote sealer will
	// be block header JSON objects instead of work package arrays.
	NotifyFull bool

	Log *log.Logger `toml:"-"`
	// Number of threads to mine on if mining
	NumThreads int
}

PowConfig are the configuration parameters of pow.

type ProgpowConfig

type ProgpowConfig struct{}

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

func (*ProgpowConfig) String

func (c *ProgpowConfig) String() string

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

type Rules

type Rules struct {
	ChainID *big.Int
}

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.

Jump to

Keyboard shortcuts

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