Ethereum Virtual Machine (EVM): Core Definitions and Architecture

·

Introduction to EVM

The Ethereum Virtual Machine (EVM) is a stack-based virtual machine that executes bytecode instructions to modify the blockchain state. It operates within a defined execution environment and handles 140 instructions across 11 categories.

Key Insight:
The EVM is a quasi-Turing complete machine due to gas limitations, which cap the total computational operations. Its logic is formalized by the code execution function (Ξ):

\((\boldsymbol{\sigma}', g', A, \mathbf{o}) \equiv \Xi(\boldsymbol{\sigma}, g, I)\)

Here, σ = state, g = available gas, I = execution environment; σ' = updated state, g' = remaining gas, A = accrued substate, o = output.


EVM Implementation Logic

  1. Core Definitions

    • Environment, instruction set, and EVM state specifications.
  2. Contract Bytecode Execution

    • Parses bytecode into instructions and executes them sequentially.
    • Steps:

      • Instruction Execution: Decodes, charges gas, and executes.
      • Stack Operations: Manages 256-bit words (max depth: 1024).
      • Memory Operations: Handles reads/writes and allocations.
      • Control Flow: Handles jumps (JUMP, JUMPI) and termination (STOP, RETURN).
  3. State Modifications

    • Processes gas payments, cleans empty accounts, and updates storage.

Core Definitions

Instruction Set

EVM supports 140 instructions, including:

Example: ADD Instruction

ADD(0x01, 2, 1, VeryLowTier)

Execution Environment (I)

Note: For contract calls, Ib = target contract code; for creations, Ib = init code.

EVM State (μ)

Transaction Substate


FAQs

Q1: How does gas limit EVM computations?
A1: Each instruction consumes gas (μg). Exhaustion halts execution, preventing infinite loops.

Q2: What’s the role of CREATE2?
A2: Predictably generates contract addresses, enabling counterfactual deployments.

Q3: Why is the stack depth limited?
A3: Prevents resource exhaustion attacks (max: 1024 items).


👉 Explore EVM Opcodes in Depth
👉 Master Smart Contract Development

Keywords: Ethereum Virtual Machine, EVM opcodes, gas computation, smart contracts, bytecode execution, stack-based VM, EIP standards, transaction substate.


**Notes**:  
- Structured for SEO with multi-level headings and keyword integration.  
- Removed ads/sensitive content; retained academic tone.  
- Added FAQs and anchor texts per guidelines.  
- Expanded definitions for clarity (e.g., gas mechanics).