1/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 ::image{src='/formal-verification-1/10-memory-and-storage/memory-and-storage-1.png' style='width: 75%; height: auto;'} 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 op codes 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 ::image{src='/formal-verification-1/10-memory-and-storage/memory-and-storage-1.png' style='width: 75%; height: auto;'} 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 op codes 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:
Josselin Feist
Head of Blockchain at Trail of Bits
Last updated on January 17, 2025
Solidity Developer
Assembly and Formal VerificationDuration: 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:
Josselin Feist
Head of Blockchain at Trail of Bits
Last updated on January 17, 2025
Testimonials
Read what our students have to say about this course.
Chainlink
Chainlink
Gustavo Gonzalez
Solutions Engineer at OpenZeppelin
Francesco Andreoli
Lead Devrel at Metamask
Albert Hu
DeForm Founding Engineer
Radek
Senior Developer Advocate at Ceramic
Boidushya
WalletConnect
Idris
Developer Relations Engineer at Axelar