Previous Module
Zero-Knowledge Proof Intro

⚙️ The Ethereum Virtual Machine: Where Smart Contracts Live

Discover the decentralized computer that executes code across thousands of nodes

⚡ What is the Ethereum Virtual Machine (EVM)?

The EVM is a decentralized computer that runs on thousands of machines worldwide. It executes smart contracts identically everywhere—no single server, no single point of failure.

🧠 The Big Idea

💡
Virtual Machine = Software Computer
Just like VirtualBox or VMware runs Windows inside macOS, EVM runs smart contracts inside Ethereum nodes.
🌍
Decentralized Runtime
Every Ethereum node runs the SAME EVM. Your smart contract executes identically on 10,000+ computers simultaneously.
🔒
Deterministic Execution
Given the same inputs, EVM ALWAYS produces the same outputs. No randomness, no surprises—critical for consensus.

🎮 Interactive: Computer Layers

Click each layer to understand how EVM compares to traditional computing

🖥️

Physical Hardware

CPU, RAM, Storage

The actual computer components—processor, memory, hard drive. This is the physical machine.

🔍 EVM vs Traditional Computers

FeatureTraditional ComputerEthereum Virtual Machine
LocationYour laptop/server10,000+ nodes worldwide
ExecutionRuns once on one machineRuns on every node simultaneously
FailureCrash = downtimeNode crash = network continues
TrustTrust the server ownerTrust the code (verified by all)
CostServer hosting feesGas fees (pay per computation)

📦 What Does EVM Run?

📝

Smart Contracts

Self-executing code stored on blockchain. Written in Solidity, compiled to bytecode, executed by EVM.

🪙

Token Transfers

ERC20 tokens, NFTs, and other assets—all handled by smart contracts running on EVM.

🏦

DeFi Protocols

Uniswap, Aave, Compound—complex financial logic executed trustlessly by EVM.

🎮

Decentralized Apps

Games, DAOs, marketplaces—entire applications with backend logic in EVM.

⚙️ Key EVM Characteristics

🎯
Turing Complete
Can compute anything a regular computer can (with enough gas). Loops, conditionals, recursion—all possible.
📚
Stack-Based Architecture
Uses a stack (Last In, First Out) for operations. PUSH value, ADD two values, POP result—simple and efficient.
💾
Persistent Storage
Contracts can store data permanently on blockchain. State changes are recorded forever.
Gas-Metered Execution
Every operation costs gas to prevent infinite loops and spam. You pay for computation time.

💭 Think of EVM Like...

🌐 The Internet

No single server owns it. Distributed across millions of computers. EVM is the same—distributed smart contract execution.

☕ Java Virtual Machine (JVM)

"Write once, run anywhere." Java bytecode runs on any device with JVM. EVM bytecode runs on any device with Ethereum node.

🎰 Vending Machine

Insert coins (gas), select item (function call), get result (output). Deterministic and automatic—no human intervention.