@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
Defined in: src/primitives/GasCosts/constants.ts:113 Block gas limit constantsconstBLOCK_GAS_LIMITS:object
Type Declaration
MAINNET
Typical mainnet block gas limit (30M)readonlyMAINNET:30000000n=30_000_000n
MINIMUM
Minimum gas limit per EIP-1559readonlyMINIMUM:5000n=5000n
GAS_COSTS
Defined in: src/primitives/GasCosts/constants.ts:9 Gas cost constants for EVM operations Based on Yellow Paper Appendix G and various EIPsconstGAS_COSTS:object
Type Declaration
BALANCE
Cold BALANCE access (EIP-2929)readonlyBALANCE:2600n=2600n
BASE
Base cost for most opcodesreadonlyBASE:2n=2n
BLOCKHASH
BLOCKHASH opcodereadonlyBLOCKHASH:20n=20n
CALL
Base gas for message callreadonlyCALL:100n=100n
CALL_STIPEND
Gas stipend provided to called contract when value > 0readonlyCALL_STIPEND:2300n=2300n
CALL_VALUE
Additional cost for non-zero value transferreadonlyCALL_VALUE:9000n=9000n
CALLDATA_NONZERO
Non-zero byte in calldatareadonlyCALLDATA_NONZERO:16n=16n
CALLDATA_ZERO
Zero byte in calldata (cheaper)readonlyCALLDATA_ZERO:4n=4n
COLD_ACCOUNT_ACCESS
Cold account access cost (EIP-2929)readonlyCOLD_ACCOUNT_ACCESS:2600n=2600n
COPY
Memory/storage copy cost per wordreadonlyCOPY:3n=3n
CREATE
Contract creation base costreadonlyCREATE:32000n=32000n
EXP
EXP base costreadonlyEXP:10n=10n
EXP_BYTE
EXP per byte costreadonlyEXP_BYTE:50n=50n
EXTCODECOPY
Cold EXTCODECOPY access (EIP-2929)readonlyEXTCODECOPY:2600n=2600n
HIGH
High cost operationsreadonlyHIGH:10n=10n
JUMPDEST
JUMPDEST costreadonlyJUMPDEST:1n=1n
LOG
LOG0 base costreadonlyLOG:375n=375n
LOG_DATA
Cost per byte of LOG datareadonlyLOG_DATA:8n=8n
LOG_TOPIC
Cost per LOG topicreadonlyLOG_TOPIC:375n=375n
LOW
Low cost operations (MUL, DIV, etc)readonlyLOW:5n=5n
MEMORY
Memory expansion cost per wordreadonlyMEMORY:3n=3n
MID
Mid cost operationsreadonlyMID:8n=8n
SELFDESTRUCT
SELFDESTRUCT cost (no refund post-London)readonlySELFDESTRUCT:5000n=5000n
SHA3
SHA3/KECCAK256 base costreadonlySHA3:30n=30n
SHA3_WORD
SHA3/KECCAK256 per word costreadonlySHA3_WORD:6n=6n
SLOAD
Cold SLOAD cost (EIP-2929)readonlySLOAD:2100n=2100n
SLOAD_WARM
Cost of SLOAD from warm storagereadonlySLOAD_WARM:100n=100n
SSTORE_CLEAR
SSTORE clear refund (pre-London: 15000, post-London: none)readonlySSTORE_CLEAR:15000n=15000n
SSTORE_RESET
SSTORE from non-zero to non-zeroreadonlySSTORE_RESET:5000n=5000n
SSTORE_SET
SSTORE from zero to non-zero (most expensive)readonlySSTORE_SET:20000n=20000n
TRANSACTION
Base transaction cost (21000 gas)readonlyTRANSACTION:21000n=21000n
VERY_LOW
Very low cost operations (ADD, SUB, etc)readonlyVERY_LOW:3n=3n
WARM_STORAGE_READ
Warm storage access cost (EIP-2929)readonlyWARM_STORAGE_READ:100n=100n
See
- https://ethereum.github.io/yellowpaper/paper.pdf
- EIP-2929 (Gas cost increases for state access)
- EIP-3529 (Refund reduction)
TRANSACTION_COSTS
Defined in: src/primitives/GasCosts/constants.ts:124 Transaction type gas costsconstTRANSACTION_COSTS:object
Type Declaration
CONTRACT_DEPLOY
Contract deployment basereadonlyCONTRACT_DEPLOY:32000n=32000n
ERC20_TRANSFER
Typical ERC20 transfer costreadonlyERC20_TRANSFER:65000n=65000n
SIMPLE_TRANSFER
Minimum gas for simple ETH transferreadonlySIMPLE_TRANSFER:21000n=21000n
UNISWAP_SWAP
Typical Uniswap V2 swap costreadonlyUNISWAP_SWAP:150000n=150000n

