Skip to main content
@tevm/voltaire
@tevm/voltaire / primitives/GasConstants

primitives/GasConstants

Namespaces

Type Aliases

CallDetails

CallDetails = object
Defined in: src/primitives/GasConstants/types.ts:44 Call operation details

Properties

gas
gas: bigint
Defined in: src/primitives/GasConstants/types.ts:48
hasValue
hasValue: boolean
Defined in: src/primitives/GasConstants/types.ts:46
isNewAccount
isNewAccount: boolean
Defined in: src/primitives/GasConstants/types.ts:47
isWarm
isWarm: boolean
Defined in: src/primitives/GasConstants/types.ts:45

Config

Config = object
Defined in: src/primitives/GasConstants/types.ts:18 Gas configuration for hardfork-specific calculations

Properties

hardfork
hardfork: Hardfork
Defined in: src/primitives/GasConstants/types.ts:19

CostResult

CostResult = object
Defined in: src/primitives/GasConstants/types.ts:25 Gas cost calculation result

Properties

base
base: bigint
Defined in: src/primitives/GasConstants/types.ts:26
dynamic
dynamic: bigint
Defined in: src/primitives/GasConstants/types.ts:27
total
total: bigint
Defined in: src/primitives/GasConstants/types.ts:28

Hardfork

Hardfork = "homestead" | "byzantium" | "constantinople" | "istanbul" | "berlin" | "london" | "paris" | "shanghai" | "cancun"
Defined in: src/primitives/GasConstants/types.ts:4 Ethereum hardfork identifiers

MemoryExpansion

MemoryExpansion = object
Defined in: src/primitives/GasConstants/types.ts:34 Memory expansion details

Properties

expansionCost
expansionCost: bigint
Defined in: src/primitives/GasConstants/types.ts:37
newCost
newCost: bigint
Defined in: src/primitives/GasConstants/types.ts:36
oldCost
oldCost: bigint
Defined in: src/primitives/GasConstants/types.ts:35
words
words: bigint
Defined in: src/primitives/GasConstants/types.ts:38

Variables

BlobBaseFee

const BlobBaseFee: 2n = 2n
Defined in: src/primitives/GasConstants/constants.js:325 BLOBBASEFEE opcode cost (2 gas)

BlobHash

const BlobHash: 3n = 3n
Defined in: src/primitives/GasConstants/constants.js:319 BLOBHASH opcode cost (3 gas)

BrandedGasConstants

const BrandedGasConstants: object
Defined in: src/primitives/GasConstants/index.ts:74

Type Declaration

calculateCallCost()
calculateCallCost: (isWarm, hasValue, isNewAccount, availableGas) => object
Calculate CALL operation gas cost
Parameters
isWarm
boolean Whether target account is warm
hasValue
boolean Whether call transfers value
isNewAccount
boolean Whether target account doesn’t exist
availableGas
bigint Gas available for the call
Returns
object Gas cost breakdown
base
base: bigint
dynamic
dynamic: bigint
forwarded
forwarded: bigint
stipend
stipend: bigint
total
total: bigint
Example
const result = calculateCallCost(true, true, false, 100000n);
// { base, dynamic, stipend, forwarded, total }
calculateCopyCost()
calculateCopyCost: (size) => bigint
Calculate copy operation gas cost
Parameters
size
bigint Size of data to copy in bytes
Returns
bigint Gas cost
calculateCreateCost()
calculateCreateCost: (initcodeSize, deployedSize) => object
Calculate contract creation gas cost
Parameters
initcodeSize
bigint Size of initcode in bytes
deployedSize
bigint Size of deployed bytecode in bytes
Returns
object Gas cost breakdown
base
base: bigint
dynamic
dynamic: bigint
total
total: bigint
Throws
If initcode size exceeds maximum
Example
const result = calculateCreateCost(1000n, 500n);
// { base: 32000n, initcode: ..., deployed: ..., total: ... }
calculateKeccak256Cost()
calculateKeccak256Cost: (dataSize) => bigint
Calculate KECCAK256 gas cost
Parameters
dataSize
bigint Size of data in bytes
Returns
bigint Total gas cost
Example
const cost = calculateKeccak256Cost(64n); // 30 + (2 * 6) = 42 gas
calculateLogCost()
calculateLogCost: (topicCount, dataSize) => bigint
Calculate LOG gas cost
Parameters
topicCount
bigint Number of topics (0-4)
dataSize
bigint Size of log data in bytes
Returns
bigint Total gas cost
Example
const cost = calculateLogCost(2n, 64n); // LOG2 with 64 bytes
// 375 + (2 * 375) + (64 * 8) = 1637 gas
calculateMaxRefund()
calculateMaxRefund: (gasUsed) => bigint
Calculate maximum gas refund
Parameters
gasUsed
bigint Total gas used in transaction
Returns
bigint Maximum refundable gas
calculateMemoryExpansionCost()
calculateMemoryExpansionCost: (oldSize, newSize) => object
Calculate memory expansion cost
Parameters
oldSize
bigint Previous memory size in bytes
newSize
bigint New memory size in bytes
Returns
object Memory expansion cost
expansionCost
expansionCost: bigint
newCost
newCost: bigint
oldCost
oldCost: bigint
words
words: bigint
Example
const expansion = calculateMemoryExpansionCost(64n, 128n);
// { oldCost, newCost, expansionCost, words }
calculateSstoreCost()
calculateSstoreCost: (isWarm, currentValue, newValue) => object
Calculate SSTORE gas cost
Parameters
isWarm
boolean Whether slot is warm (previously accessed)
currentValue
bigint Current storage value (0n if empty)
newValue
bigint New storage value
Returns
object Gas cost and potential refund
cost
cost: bigint
refund
refund: bigint
Example
const result = calculateSstoreCost(false, 0n, 100n);
// { cost: 22100n, refund: 0n } - cold + set
calculateTxIntrinsicGas()
calculateTxIntrinsicGas: (data, isCreate) => bigint
Calculate transaction intrinsic gas cost
Parameters
data
Uint8Array<ArrayBufferLike> Transaction calldata
isCreate
boolean Whether transaction creates a contract
Returns
bigint Intrinsic gas cost
Example
const data = new Uint8Array([0, 1, 2, 0, 0]);
const cost = calculateTxIntrinsicGas(data, false);
// 21000 + (3 * 4) + (2 * 16) = 21044 gas
callCost()
callCost: (this) => object
Calculate CALL operation gas cost (convenience form with this:)
Parameters
this
availableGas
bigint
hasValue
boolean
isNewAccount
boolean
isWarm
boolean
Returns
object
base
base: bigint
dynamic
dynamic: bigint
forwarded
forwarded: bigint
stipend
stipend: bigint
total
total: bigint
copyCost()
copyCost: (this) => bigint
Calculate copy operation gas cost (convenience form with this:)
Parameters
this
bigint
Returns
bigint
createCost()
createCost: (this) => object
Calculate contract creation gas cost (convenience form with this:)
Parameters
this
deployedSize
bigint
initcodeSize
bigint
Returns
object
base
base: bigint
dynamic
dynamic: bigint
total
total: bigint
getColdAccountAccessCost()
getColdAccountAccessCost: (hardfork) => bigint
Get cold account access cost for hardfork
Parameters
hardfork
Hardfork EVM hardfork
Returns
bigint Gas cost
getColdSloadCost()
getColdSloadCost: (hardfork) => bigint
Get cold storage cost for hardfork
Parameters
hardfork
Hardfork EVM hardfork
Returns
bigint Gas cost
getSelfdestructRefund()
getSelfdestructRefund: (hardfork) => bigint
Get selfdestruct refund for hardfork
Parameters
hardfork
Hardfork EVM hardfork
Returns
bigint Gas refund amount
getSstoreRefund()
getSstoreRefund: (hardfork) => bigint
Get storage refund for hardfork
Parameters
hardfork
Hardfork EVM hardfork
Returns
bigint Gas refund amount
hasEIP1153()
hasEIP1153: (hardfork) => boolean
Check if a hardfork includes EIP-1153 (transient storage)
Parameters
hardfork
Hardfork EVM hardfork
Returns
boolean Whether hardfork includes EIP-1153
hasEIP2929()
hasEIP2929: (hardfork) => boolean
Check if a hardfork includes EIP-2929 (cold/warm access costs)
Parameters
hardfork
Hardfork EVM hardfork
Returns
boolean Whether hardfork includes EIP-2929
hasEIP3529()
hasEIP3529: (hardfork) => boolean
Check if a hardfork includes EIP-3529 (reduced refunds)
Parameters
hardfork
Hardfork EVM hardfork
Returns
boolean Whether hardfork includes EIP-3529
hasEIP3860()
hasEIP3860: (hardfork) => boolean
Check if a hardfork includes EIP-3860 (initcode size limit)
Parameters
hardfork
Hardfork EVM hardfork
Returns
boolean Whether hardfork includes EIP-3860
hasEIP4844()
hasEIP4844: (hardfork) => boolean
Check if a hardfork includes EIP-4844 (blob transactions)
Parameters
hardfork
Hardfork EVM hardfork
Returns
boolean Whether hardfork includes EIP-4844
keccak256Cost()
keccak256Cost: (this) => bigint
Calculate KECCAK256 gas cost (convenience form with this:)
Parameters
this
bigint
Returns
bigint Total gas cost
logCost()
logCost: (this) => bigint
Calculate LOG gas cost (convenience form with this:)
Parameters
this
dataSize
bigint
topicCount
bigint
Returns
bigint
maxRefund()
maxRefund: (this) => bigint
Calculate maximum gas refund (convenience form with this:)
Parameters
this
bigint
Returns
bigint
memoryExpansionCost()
memoryExpansionCost: (this) => object
Calculate memory expansion cost (convenience form with this:)
Parameters
this
newSize
bigint
oldSize
bigint
Returns
object
expansionCost
expansionCost: bigint
newCost
newCost: bigint
oldCost
oldCost: bigint
words
words: bigint
Precompile
Precompile: Precompile
ECRECOVER (address 0x01) - Fixed cost
sstoreCost()
sstoreCost: (this) => object
Calculate SSTORE gas cost (convenience form with this:)
Parameters
this
currentValue
bigint
isWarm
boolean
newValue
bigint
Returns
object
cost
cost: bigint
refund
refund: bigint
txIntrinsicGas()
txIntrinsicGas: (this) => bigint
Calculate transaction intrinsic gas cost (convenience form with this:)
Parameters
this
data
Uint8Array
isCreate
boolean
Returns
bigint

Call

const Call: 40n = 40n
Defined in: src/primitives/GasConstants/constants.js:177 Base CALL cost (40 gas)

CallCode

const CallCode: 700n = 700n
Defined in: src/primitives/GasConstants/constants.js:201 CALLCODE cost (700 gas) - EIP-150

CallGasRetentionDivisor

const CallGasRetentionDivisor: 64n = 64n
Defined in: src/primitives/GasConstants/constants.js:231 63/64 rule divisor for gas forwarding

CallNewAccount

const CallNewAccount: 25000n = 25000n
Defined in: src/primitives/GasConstants/constants.js:195 Additional cost for new account creation (25000 gas)

CallStipend

const CallStipend: 2300n = 2300n
Defined in: src/primitives/GasConstants/constants.js:183 Gas stipend for value transfer (2300 gas)

CallValueTransfer

const CallValueTransfer: 9000n = 9000n
Defined in: src/primitives/GasConstants/constants.js:189 Additional cost for value transfer (9000 gas)

ColdAccountAccess

const ColdAccountAccess: 2600n = 2600n
Defined in: src/primitives/GasConstants/constants.js:93 Cold account access (2600 gas) - EIP-2929 BALANCE, EXTCODESIZE, EXTCODECOPY, EXTCODEHASH, CALL family

ColdSload

const ColdSload: 2100n = 2100n
Defined in: src/primitives/GasConstants/constants.js:86 Cold SLOAD (2100 gas) - EIP-2929

Copy

const Copy: 3n = 3n
Defined in: src/primitives/GasConstants/constants.js:303 Per word for copy operations (3 gas)

Create

const Create: 32000n = 32000n
Defined in: src/primitives/GasConstants/constants.js:171 Base CREATE cost (32000 gas)

CreateData

const CreateData: 200n = 200n
Defined in: src/primitives/GasConstants/constants.js:257 Per-byte cost for deployed code (200 gas)

DelegateCall

const DelegateCall: 700n = 700n
Defined in: src/primitives/GasConstants/constants.js:207 DELEGATECALL cost (700 gas) - EIP-150

ExtStep

const ExtStep: 20n = 20n
Defined in: src/primitives/GasConstants/constants.js:54 External account interaction (20 gas) BALANCE, EXTCODESIZE, BLOCKHASH

FastestStep

const FastestStep: 3n = 3n
Defined in: src/primitives/GasConstants/constants.js:26 Simple arithmetic and logic (3 gas) ADD, SUB, NOT, LT, GT, SLT, SGT, EQ, ISZERO, AND, OR, XOR, CALLDATALOAD, MLOAD, MSTORE, MSTORE8, PUSH, DUP, SWAP

FastStep

const FastStep: 5n = 5n
Defined in: src/primitives/GasConstants/constants.js:33 Multiplication and division (5 gas) MUL, DIV, SDIV, MOD, SMOD

InitcodeWord

const InitcodeWord: 2n = 2n
Defined in: src/primitives/GasConstants/constants.js:263 Per-word cost for initcode (2 gas) - EIP-3860

Jumpdest

const Jumpdest: 1n = 1n
Defined in: src/primitives/GasConstants/constants.js:139 JUMPDEST marker (1 gas)

Keccak256Base

const Keccak256Base: 30n = 30n
Defined in: src/primitives/GasConstants/constants.js:64 Base cost for KECCAK256 (30 gas)

Keccak256Word

const Keccak256Word: 6n = 6n
Defined in: src/primitives/GasConstants/constants.js:70 Per-word cost for KECCAK256 (6 gas per 32 bytes)

LogBase

const LogBase: 375n = 375n
Defined in: src/primitives/GasConstants/constants.js:149 Base cost for LOG operations (375 gas)

LogData

const LogData: 8n = 8n
Defined in: src/primitives/GasConstants/constants.js:155 Per-byte cost for LOG data (8 gas)

LogTopic

const LogTopic: 375n = 375n
Defined in: src/primitives/GasConstants/constants.js:161 Per-topic cost for LOG (375 gas)

MaxInitcodeSize

const MaxInitcodeSize: 49152n = 49152n
Defined in: src/primitives/GasConstants/constants.js:269 Maximum initcode size (49152 bytes) - EIP-3860

MaxRefundQuotient

const MaxRefundQuotient: 5n = 5n
Defined in: src/primitives/GasConstants/constants.js:309 Maximum refund quotient (1/5) - EIP-3529

Memory

const Memory: 3n = 3n
Defined in: src/primitives/GasConstants/constants.js:241 Linear coefficient for memory (3 gas)

MidStep

const MidStep: 8n = 8n
Defined in: src/primitives/GasConstants/constants.js:40 Advanced arithmetic (8 gas) ADDMOD, MULMOD, SIGNEXTEND

QuadCoeffDiv

const QuadCoeffDiv: 512n = 512n
Defined in: src/primitives/GasConstants/constants.js:247 Quadratic coefficient divisor (512)

QuickStep

const QuickStep: 2n = 2n
Defined in: src/primitives/GasConstants/constants.js:18 Very cheap operations (2 gas) ADDRESS, ORIGIN, CALLER, CALLVALUE, CALLDATASIZE, CODESIZE, GASPRICE, RETURNDATASIZE, PC, MSIZE, GAS, CHAINID, SELFBALANCE

Selfdestruct

const Selfdestruct: 5000n = 5000n
Defined in: src/primitives/GasConstants/constants.js:219 SELFDESTRUCT base cost (5000 gas) - EIP-150

SelfdestructRefund

const SelfdestructRefund: 24000n = 24000n
Defined in: src/primitives/GasConstants/constants.js:225 SELFDESTRUCT refund (24000 gas) - Removed in EIP-3529

Sload

const Sload: 100n = 100n
Defined in: src/primitives/GasConstants/constants.js:80 SLOAD on warm slot (100 gas)

SlowStep

const SlowStep: 10n = 10n
Defined in: src/primitives/GasConstants/constants.js:47 Moderate computation (10 gas) JUMPI

SstoreClear

const SstoreClear: 5000n = 5000n
Defined in: src/primitives/GasConstants/constants.js:123 SSTORE clear to zero (5000 gas)

SstoreRefund

const SstoreRefund: 4800n = 4800n
Defined in: src/primitives/GasConstants/constants.js:129 Gas refund for clearing storage (4800 gas) - EIP-3529

SstoreReset

const SstoreReset: 5000n = 5000n
Defined in: src/primitives/GasConstants/constants.js:117 SSTORE modify existing non-zero (5000 gas)

SstoreSentry

const SstoreSentry: 2300n = 2300n
Defined in: src/primitives/GasConstants/constants.js:105 Minimum gas for SSTORE (2300 gas)

SstoreSet

const SstoreSet: 20000n = 20000n
Defined in: src/primitives/GasConstants/constants.js:111 SSTORE zero to non-zero (20000 gas)

StaticCall

const StaticCall: 700n = 700n
Defined in: src/primitives/GasConstants/constants.js:213 STATICCALL cost (700 gas) - EIP-214

TLoad

const TLoad: 100n = 100n
Defined in: src/primitives/GasConstants/constants.js:335 TLOAD cost (100 gas)

TStore

const TStore: 100n = 100n
Defined in: src/primitives/GasConstants/constants.js:341 TSTORE cost (100 gas)

Tx

const Tx: 21000n = 21000n
Defined in: src/primitives/GasConstants/constants.js:279 Base transaction cost (21000 gas)

TxContractCreation

const TxContractCreation: 53000n = 53000n
Defined in: src/primitives/GasConstants/constants.js:285 Contract creation transaction base cost (53000 gas)

TxDataNonZero

const TxDataNonZero: 16n = 16n
Defined in: src/primitives/GasConstants/constants.js:297 Per non-zero byte in calldata (16 gas)

TxDataZero

const TxDataZero: 4n = 4n
Defined in: src/primitives/GasConstants/constants.js:291 Per zero byte in calldata (4 gas)

WarmStorageRead

const WarmStorageRead: 100n = 100n
Defined in: src/primitives/GasConstants/constants.js:99 Warm storage read (100 gas) - EIP-2929

Functions

calculateCallCost()

calculateCallCost(isWarm, hasValue, isNewAccount, availableGas): object
Defined in: src/primitives/GasConstants/calculateCallCost.js:25 Calculate CALL operation gas cost

Parameters

isWarm
boolean Whether target account is warm
hasValue
boolean Whether call transfers value
isNewAccount
boolean Whether target account doesn’t exist
availableGas
bigint Gas available for the call

Returns

object Gas cost breakdown
base
base: bigint
dynamic
dynamic: bigint
forwarded
forwarded: bigint
stipend
stipend: bigint
total
total: bigint

Example

const result = calculateCallCost(true, true, false, 100000n);
// { base, dynamic, stipend, forwarded, total }

calculateCopyCost()

calculateCopyCost(size): bigint
Defined in: src/primitives/GasConstants/calculateCopyCost.js:9 Calculate copy operation gas cost

Parameters

size
bigint Size of data to copy in bytes

Returns

bigint Gas cost

calculateCreateCost()

calculateCreateCost(initcodeSize, deployedSize): object
Defined in: src/primitives/GasConstants/calculateCreateCost.js:23 Calculate contract creation gas cost

Parameters

initcodeSize
bigint Size of initcode in bytes
deployedSize
bigint Size of deployed bytecode in bytes

Returns

object Gas cost breakdown
base
base: bigint
dynamic
dynamic: bigint
total
total: bigint

Throws

If initcode size exceeds maximum

Example

const result = calculateCreateCost(1000n, 500n);
// { base: 32000n, initcode: ..., deployed: ..., total: ... }

calculateKeccak256Cost()

calculateKeccak256Cost(dataSize): bigint
Defined in: src/primitives/GasConstants/calculateKeccak256Cost.js:14 Calculate KECCAK256 gas cost

Parameters

dataSize
bigint Size of data in bytes

Returns

bigint Total gas cost

Example

const cost = calculateKeccak256Cost(64n); // 30 + (2 * 6) = 42 gas

calculateLogCost()

calculateLogCost(topicCount, dataSize): bigint
Defined in: src/primitives/GasConstants/calculateLogCost.js:16 Calculate LOG gas cost

Parameters

topicCount
bigint Number of topics (0-4)
dataSize
bigint Size of log data in bytes

Returns

bigint Total gas cost

Example

const cost = calculateLogCost(2n, 64n); // LOG2 with 64 bytes
// 375 + (2 * 375) + (64 * 8) = 1637 gas

calculateMaxRefund()

calculateMaxRefund(gasUsed): bigint
Defined in: src/primitives/GasConstants/calculateMaxRefund.js:9 Calculate maximum gas refund

Parameters

gasUsed
bigint Total gas used in transaction

Returns

bigint Maximum refundable gas

calculateMemoryExpansionCost()

calculateMemoryExpansionCost(oldSize, newSize): object
Defined in: src/primitives/GasConstants/calculateMemoryExpansionCost.js:16 Calculate memory expansion cost

Parameters

oldSize
bigint Previous memory size in bytes
newSize
bigint New memory size in bytes

Returns

object Memory expansion cost
expansionCost
expansionCost: bigint
newCost
newCost: bigint
oldCost
oldCost: bigint
words
words: bigint

Example

const expansion = calculateMemoryExpansionCost(64n, 128n);
// { oldCost, newCost, expansionCost, words }

calculateSstoreCost()

calculateSstoreCost(isWarm, currentValue, newValue): object
Defined in: src/primitives/GasConstants/calculateSstoreCost.js:24 Calculate SSTORE gas cost

Parameters

isWarm
boolean Whether slot is warm (previously accessed)
currentValue
bigint Current storage value (0n if empty)
newValue
bigint New storage value

Returns

object Gas cost and potential refund
cost
cost: bigint
refund
refund: bigint

Example

const result = calculateSstoreCost(false, 0n, 100n);
// { cost: 22100n, refund: 0n } - cold + set

calculateTxIntrinsicGas()

calculateTxIntrinsicGas(data, isCreate): bigint
Defined in: src/primitives/GasConstants/calculateTxIntrinsicGas.js:22 Calculate transaction intrinsic gas cost

Parameters

data
Uint8Array<ArrayBufferLike> Transaction calldata
isCreate
boolean Whether transaction creates a contract

Returns

bigint Intrinsic gas cost

Example

const data = new Uint8Array([0, 1, 2, 0, 0]);
const cost = calculateTxIntrinsicGas(data, false);
// 21000 + (3 * 4) + (2 * 16) = 21044 gas

callCost()

callCost(this): object
Defined in: src/primitives/GasConstants/callCost.js:9 Calculate CALL operation gas cost (convenience form with this:)

Parameters

this
availableGas
bigint
hasValue
boolean
isNewAccount
boolean
isWarm
boolean

Returns

object
base
base: bigint
dynamic
dynamic: bigint
forwarded
forwarded: bigint
stipend
stipend: bigint
total
total: bigint

copyCost()

copyCost(this): bigint
Defined in: src/primitives/GasConstants/copyCost.js:9 Calculate copy operation gas cost (convenience form with this:)

Parameters

this
bigint

Returns

bigint

createCost()

createCost(this): object
Defined in: src/primitives/GasConstants/createCost.js:9 Calculate contract creation gas cost (convenience form with this:)

Parameters

this
deployedSize
bigint
initcodeSize
bigint

Returns

object
base
base: bigint
dynamic
dynamic: bigint
total
total: bigint

getColdAccountAccessCost()

getColdAccountAccessCost(hardfork): bigint
Defined in: src/primitives/GasConstants/getColdAccountAccessCost.js:10 Get cold account access cost for hardfork

Parameters

hardfork
Hardfork EVM hardfork

Returns

bigint Gas cost

getColdSloadCost()

getColdSloadCost(hardfork): bigint
Defined in: src/primitives/GasConstants/getColdSloadCost.js:10 Get cold storage cost for hardfork

Parameters

hardfork
Hardfork EVM hardfork

Returns

bigint Gas cost

getSelfdestructRefund()

getSelfdestructRefund(hardfork): bigint
Defined in: src/primitives/GasConstants/getSelfdestructRefund.js:10 Get selfdestruct refund for hardfork

Parameters

hardfork
Hardfork EVM hardfork

Returns

bigint Gas refund amount

getSstoreRefund()

getSstoreRefund(hardfork): bigint
Defined in: src/primitives/GasConstants/getSstoreRefund.js:10 Get storage refund for hardfork

Parameters

hardfork
Hardfork EVM hardfork

Returns

bigint Gas refund amount

hasEIP1153()

hasEIP1153(hardfork): boolean
Defined in: src/primitives/GasConstants/hasEIP1153.js:7 Check if a hardfork includes EIP-1153 (transient storage)

Parameters

hardfork
Hardfork EVM hardfork

Returns

boolean Whether hardfork includes EIP-1153

hasEIP2929()

hasEIP2929(hardfork): boolean
Defined in: src/primitives/GasConstants/hasEIP2929.js:7 Check if a hardfork includes EIP-2929 (cold/warm access costs)

Parameters

hardfork
Hardfork EVM hardfork

Returns

boolean Whether hardfork includes EIP-2929

hasEIP3529()

hasEIP3529(hardfork): boolean
Defined in: src/primitives/GasConstants/hasEIP3529.js:7 Check if a hardfork includes EIP-3529 (reduced refunds)

Parameters

hardfork
Hardfork EVM hardfork

Returns

boolean Whether hardfork includes EIP-3529

hasEIP3860()

hasEIP3860(hardfork): boolean
Defined in: src/primitives/GasConstants/hasEIP3860.js:7 Check if a hardfork includes EIP-3860 (initcode size limit)

Parameters

hardfork
Hardfork EVM hardfork

Returns

boolean Whether hardfork includes EIP-3860

hasEIP4844()

hasEIP4844(hardfork): boolean
Defined in: src/primitives/GasConstants/hasEIP4844.js:7 Check if a hardfork includes EIP-4844 (blob transactions)

Parameters

hardfork
Hardfork EVM hardfork

Returns

boolean Whether hardfork includes EIP-4844

keccak256Cost()

keccak256Cost(this): bigint
Defined in: src/primitives/GasConstants/keccak256Cost.js:9 Calculate KECCAK256 gas cost (convenience form with this:)

Parameters

this
bigint

Returns

bigint Total gas cost

logCost()

logCost(this): bigint
Defined in: src/primitives/GasConstants/logCost.js:9 Calculate LOG gas cost (convenience form with this:)

Parameters

this
dataSize
bigint
topicCount
bigint

Returns

bigint

maxRefund()

maxRefund(this): bigint
Defined in: src/primitives/GasConstants/maxRefund.js:9 Calculate maximum gas refund (convenience form with this:)

Parameters

this
bigint

Returns

bigint

memoryExpansionCost()

memoryExpansionCost(this): object
Defined in: src/primitives/GasConstants/memoryExpansionCost.js:9 Calculate memory expansion cost (convenience form with this:)

Parameters

this
newSize
bigint
oldSize
bigint

Returns

object
expansionCost
expansionCost: bigint
newCost
newCost: bigint
oldCost
oldCost: bigint
words
words: bigint

sstoreCost()

sstoreCost(this): object
Defined in: src/primitives/GasConstants/sstoreCost.js:9 Calculate SSTORE gas cost (convenience form with this:)

Parameters

this
currentValue
bigint
isWarm
boolean
newValue
bigint

Returns

object
cost
cost: bigint
refund
refund: bigint

txIntrinsicGas()

txIntrinsicGas(this): bigint
Defined in: src/primitives/GasConstants/txIntrinsicGas.js:9 Calculate transaction intrinsic gas cost (convenience form with this:)

Parameters

this
data
Uint8Array
isCreate
boolean

Returns

bigint