storage layout
Storage Slots & Layout
How variables map to slots.
In Solidity, state variables are mapped to 32-byte storage slots starting from index 0. If multiple variables can fit into a single 32-byte slot (like two uint128s), the compiler will "pack" them to save gas. For dynamic types like mappings and arrays, the storage slot is determined by hashing the key or the index using Keccak-256.
Execution Simulation
Assistant Note
"Currently at PUSH instruction. It's going to place a value on top of the stack."
Program
10 bytesStack
LIFO0 / 1024
Storage
PersistentStorage is a key-value store. In Solidity, variables are mapped to slots (0, 1, 2...) or hashed for mappings/arrays.
Gas Meter
Consumed0 / 1,000,000
Last Op Cost
-0
Refund
0
* Gas prevents infinite loops and DDoS. SSTORE is the most expensive opcode (20,000 gas for new slots).