Solidity 8 – Data Location

Published by Mario Oettler on

The Ethereum Virtual Machine (EVM) knows three places where to store data (actually, it is five):

  • storage,
  • memory,
  • stack,
  • calldata
  • (logs)

Knowing the storage place can be relevant for gas optimization, initialization, and value assignment to variables. It can also be important to understand how contracts work and explain some behavior of contracts.

The logs are reserved for events and are not important for us in this context.