← 🧮 Cryptography & Distributed Systems

🧮 Stack Machine (2D)

PC: 0
Opcode: —
Stack depth: 0
Top of stack: —
Program tape at top · stack on the left · storage grid on the right

🧮 Stack Machine (2D): How Smart Contracts Execute

A flat 2D redraw of the same stack-based virtual machine: choose one of three bytecode programs and watch PUSH, ADD, MUL, DUP, SWAP and SSTORE opcodes execute one at a time, pushing value-blocks onto a stack and writing results into a persistent storage grid.

🔬 What It Demonstrates

The same EVM-style opcode execution model as the 3D version, drawn as a flat instruction tape, stack column and storage grid so the mechanics of the machine are easy to trace step by step.

🎮 How to Use

Pick a program, play/pause the auto-run, or step one instruction at a time; adjust the speed slider and rebuild to restart from the first instruction.

💡 Did You Know?

Every opcode in a real stack-based VM like the EVM has a fixed gas cost, so a node can precisely predict the worst-case computational cost of a transaction before executing a single instruction.