Gas Numbers Every Solidity Dev Should Know
Created by dd0sxx for Macro
- ⟢ Each box is = 2,000 units of gas. All numbers indicate the number of gas units each operation requires to execute.
- ⟢ Warm/Cold and Dirty/Clean is whether or not a slot or address has been accessed or written to within the current execution context.
- ⟢ New-Address is when a CALL is made to an address that does not exist, forcing a new account to be created in the state trie.
Opcode gas numbers were sourced from the official Ethereum Docs, and contract-calls were sourced from Etherscan.io and converted into gas units using Wolfram Alpha for calculations.
Inspired by Norvig's Latency Numbers, and a post in the Macro discord from a student named Justin Phu, who suggested someone make a version with gas numbers for popular calls and opcodes.
SSTORE (clean: zero to nonzero): 22,100
SSTORE (clean: nonzero to nonzero): 5,000
SSTORE (clean: nonzero to zero): 5,000 (refund: 4,800)
SSTORE (dirty: zero to nonzero): 20,000
SSTORE (dirty: nonzero to nonzero): 2,900
SSTORE (dirty: nonzero to zero): 2,900 (refund: 4,800)
CALL (no-value, warm): 100
CALL (no-value, cold): 2,600
CALL (no-value, new-address): 25,000
CALL (value, cold): 11,600
CALL (value, warm): 9,100
CALL (value, new-address): 34,000
Uniswap V3::Swap: 184,361
Uniswap V2::Swap: 152,711
CoW Protocol::Swap: 343,007
ENS::Register Domain: 266,651
Gnosis Safe::Create Multisig: 288,015
Beacon Chain::Deposit: 53,014
Yearn Finance::Deposit: 216,011
Hop Protocol::Bridge: 121,457
Across Protocol::Bridge: 120,666
Want to become an expert smart contract developer? Check out the Macro Engineering Fellowship 🚀
Something missing from this page? Make an issue or PR on our github repo 🤖