Skip to main content
@tevm/voltaire
@tevm/voltaire / GasCosts

GasCosts

Gas cost constants for EVM operations Provides comprehensive gas cost constants for:
  • EVM opcodes
  • Transaction types
  • Storage operations
  • Block limits

Variables

BLOCK_GAS_LIMITS

const BLOCK_GAS_LIMITS: object
Defined in: src/primitives/GasCosts/constants.ts:113 Block gas limit constants

Type Declaration

MAINNET
readonly MAINNET: 30000000n = 30_000_000n
Typical mainnet block gas limit (30M)
MINIMUM
readonly MINIMUM: 5000n = 5000n
Minimum gas limit per EIP-1559

GAS_COSTS

const GAS_COSTS: object
Defined in: src/primitives/GasCosts/constants.ts:9 Gas cost constants for EVM operations Based on Yellow Paper Appendix G and various EIPs

Type Declaration

BALANCE
readonly BALANCE: 2600n = 2600n
Cold BALANCE access (EIP-2929)
BASE
readonly BASE: 2n = 2n
Base cost for most opcodes
BLOCKHASH
readonly BLOCKHASH: 20n = 20n
BLOCKHASH opcode
CALL
readonly CALL: 100n = 100n
Base gas for message call
CALL_STIPEND
readonly CALL_STIPEND: 2300n = 2300n
Gas stipend provided to called contract when value > 0
CALL_VALUE
readonly CALL_VALUE: 9000n = 9000n
Additional cost for non-zero value transfer
CALLDATA_NONZERO
readonly CALLDATA_NONZERO: 16n = 16n
Non-zero byte in calldata
CALLDATA_ZERO
readonly CALLDATA_ZERO: 4n = 4n
Zero byte in calldata (cheaper)
COLD_ACCOUNT_ACCESS
readonly COLD_ACCOUNT_ACCESS: 2600n = 2600n
Cold account access cost (EIP-2929)
COPY
readonly COPY: 3n = 3n
Memory/storage copy cost per word
CREATE
readonly CREATE: 32000n = 32000n
Contract creation base cost
EXP
readonly EXP: 10n = 10n
EXP base cost
EXP_BYTE
readonly EXP_BYTE: 50n = 50n
EXP per byte cost
EXTCODECOPY
readonly EXTCODECOPY: 2600n = 2600n
Cold EXTCODECOPY access (EIP-2929)
HIGH
readonly HIGH: 10n = 10n
High cost operations
JUMPDEST
readonly JUMPDEST: 1n = 1n
JUMPDEST cost
LOG
readonly LOG: 375n = 375n
LOG0 base cost
LOG_DATA
readonly LOG_DATA: 8n = 8n
Cost per byte of LOG data
LOG_TOPIC
readonly LOG_TOPIC: 375n = 375n
Cost per LOG topic
LOW
readonly LOW: 5n = 5n
Low cost operations (MUL, DIV, etc)
MEMORY
readonly MEMORY: 3n = 3n
Memory expansion cost per word
MID
readonly MID: 8n = 8n
Mid cost operations
SELFDESTRUCT
readonly SELFDESTRUCT: 5000n = 5000n
SELFDESTRUCT cost (no refund post-London)
SHA3
readonly SHA3: 30n = 30n
SHA3/KECCAK256 base cost
SHA3_WORD
readonly SHA3_WORD: 6n = 6n
SHA3/KECCAK256 per word cost
SLOAD
readonly SLOAD: 2100n = 2100n
Cold SLOAD cost (EIP-2929)
SLOAD_WARM
readonly SLOAD_WARM: 100n = 100n
Cost of SLOAD from warm storage
SSTORE_CLEAR
readonly SSTORE_CLEAR: 15000n = 15000n
SSTORE clear refund (pre-London: 15000, post-London: none)
SSTORE_RESET
readonly SSTORE_RESET: 5000n = 5000n
SSTORE from non-zero to non-zero
SSTORE_SET
readonly SSTORE_SET: 20000n = 20000n
SSTORE from zero to non-zero (most expensive)
TRANSACTION
readonly TRANSACTION: 21000n = 21000n
Base transaction cost (21000 gas)
VERY_LOW
readonly VERY_LOW: 3n = 3n
Very low cost operations (ADD, SUB, etc)
WARM_STORAGE_READ
readonly WARM_STORAGE_READ: 100n = 100n
Warm storage access cost (EIP-2929)

See


TRANSACTION_COSTS

const TRANSACTION_COSTS: object
Defined in: src/primitives/GasCosts/constants.ts:124 Transaction type gas costs

Type Declaration

CONTRACT_DEPLOY
readonly CONTRACT_DEPLOY: 32000n = 32000n
Contract deployment base
ERC20_TRANSFER
readonly ERC20_TRANSFER: 65000n = 65000n
Typical ERC20 transfer cost
SIMPLE_TRANSFER
readonly SIMPLE_TRANSFER: 21000n = 21000n
Minimum gas for simple ETH transfer
UNISWAP_SWAP
readonly UNISWAP_SWAP: 150000n = 150000n
Typical Uniswap V2 swap cost