5/5
_Follow along with this video:_ --- ### Expanding on The Stack Let's expand further on the concepts from the previous lesson because there are two more locations to which data can be allocated. - Memory - Storage  As depicted above, unlike the stack, data can be stored and retrieved from any slot available. The important distinctions to keep in mind when considering `memory` and `storage` are: - Memory is temporary and data will be cleared when an operation completes. - Storage is persistent and data will remain accessible when an operation completes. In addition to these, accessing data in `storage` is _much_ more expensive than that of data in `memory`. This can be seen clearly when comparing the appropriate opcodes at [**evm.codes**](https://www.evm.codes/?fork=shanghai) (we'll be referencing this a lot, you might want to book mark it!). I'll draw your attention to the SSTORE and MSTORE  We can see clearly to what extent I mean _"more expensive"_. The difference in gas when accessing data in `storage` is **massive.** In the next lesson, I'll introduce you to two more opcodes you're likely to see quite often, `PUSH` and `ADD`.
Follow along with this video:
Let's expand further on the concepts from the previous lesson because there are two more locations to which data can be allocated.
Memory
Storage

As depicted above, unlike the stack, data can be stored and retrieved from any slot available.
The important distinctions to keep in mind when considering memory and storage are:
Memory is temporary and data will be cleared when an operation completes.
Storage is persistent and data will remain accessible when an operation completes.
In addition to these, accessing data in storage is much more expensive than that of data in memory. This can be seen clearly when comparing the appropriate opcodes at evm.codes (we'll be referencing this a lot, you might want to book mark it!).
I'll draw your attention to the SSTORE and MSTORE

We can see clearly to what extent I mean "more expensive". The difference in gas when accessing data in storage is massive.
In the next lesson, I'll introduce you to two more opcodes you're likely to see quite often, PUSH and ADD.
A detailed guide to understanding memory and storage within the EVM. This lesson covers how memory and storage operate within the Ethereum Virtual Machine and explains how these two features relate to the stack of pancakes.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
Assembly
Writing smart contracts using Huff and Yul
Ethereum Virtual Machine OPCodes
Formal verification testing
Smart contract invariant testing
Halmos, Certora, Kontrol
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Guest lecturers:
Last updated on August 11, 2025
Duration: 30min
Duration: 4h 38min
Duration: 3h 57min
Duration: 1h 56min
Course Overview
About the course
Assembly
Writing smart contracts using Huff and Yul
Ethereum Virtual Machine OPCodes
Formal verification testing
Smart contract invariant testing
Halmos, Certora, Kontrol
Security researcher
$49,999 - $120,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Guest lecturers:
Last updated on August 11, 2025