Storage, Memory and Stack in Solidity Ethereum Smart Contracts

  1. Storage
  2. Memory
  3. Stack

Storage

  • It stores data in blockchain form
  • It store data permanently and no one can change it
  • It’s costly. It have high Gas Fee (cost to run smart contract on EVM)
  • generally data of users, tokens and balance are stored here
  • It have higher gas fee because it’s stored in blockchain.

Memory

  • Its short term memory, it’s stored data during code/function execute
  • Its like storing something on RAM. when program completed, RAM cleaned
  • Its cheaper than Storage and Stack
  • Its not stored in blockchain, its just simple storage stored for sometime.
  • Its also not stored in any storage — database, its stored in the function itself.

Stack

  • It store data in personal database of Ethereum, not in Ethereum blockchain
  • Its cheaper than storage
  • Its generally used to store temporary data which’re needed for immidiate processing

Useful links

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store