Skip to main content
GasConstants exports exact bigint EVM gas constants from the Ethereum Yellow Paper and subsequent EIPs (EIP-150, EIP-2200, EIP-2929, EIP-3529, EIP-3860, EIP-1153, EIP-4844) together with dynamic gas and refund calculators.

Core Gas Constants

Quick Start

Import from @tevm/voltaire or @tevm/voltaire/GasConstants.

Dynamic Calculators & Fork Queries

Memory Expansion Formula

For w=⌈byteSize/32⌉w = \lceil \text{byteSize} / 32 \rceil words: cost(w)=3w+⌊w2512⌋\text{cost}(w) = 3w + \left\lfloor \frac{w^2}{512} \right\rfloor Expansion gas is cost(wnew)−cost(wold)\text{cost}(w_{\text{new}}) - \text{cost}(w_{\text{old}}) when wnew>woldw_{\text{new}} > w_{\text{old}}, else 0n.
  • Opcode — Static opcode metadata
  • Hardfork — Protocol upgrade activation ordering
  • AccessList — EIP-2930 pre-warming gas deltas