freecoding.school100% FREE · NO SIGNUP
Ledger LandISSUE #28 of 90

evm · opcodes · stack · memory · storage

BlockyVSDouble-Spend Dan
Blocky saysThe EVM works with opcodes over a stack, volatile memory, and persistent storage.

EVM bytecode is a sequence of opcodes (ADD, SSTORE, CALL…) operating on a stack. Three data areas matter: the stack (cheap, transient), memory (cheap, cleared each call), and storage (persistent on-chain, expensive — every SSTORE costs significant gas). Knowing storage is the costly one is why gas optimization centers on minimizing writes.

Power-ups you unlock

Double-Spend Dan attacks — common mistakes

Boss battleRank stack, memory, and storage by gas cost and explain why.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>stack   → cheapest, transient
memory  → cheap, cleared per call
storage → persistent, EXPENSIVE (SSTORE)
→ optimize by writing storage less</pre></body></html>
▶ Open the interactive comic issue
‹ Evm · The Ethereum Virtual MachineSolidity · The Contract Language ›