Skip to main content

MemoryDump

EVM memory state snapshot captured during transaction execution. Memory is byte-addressable and organized in 32-byte words.

Overview

MemoryDump represents the complete memory state at a point in EVM execution. EVM memory grows dynamically during execution and is organized in 32-byte word boundaries for stack operations.

Type Definition

Usage

Creating Memory Dumps

Reading Memory Words

EVM operations read memory in 32-byte chunks:

Slicing Memory

Extract memory ranges for analysis:

EVM Memory Model

Word-Aligned Operations

EVM stack operations work with 32-byte words:
  • MLOAD: Load 32-byte word from memory
  • MSTORE: Store 32-byte word to memory
  • MSTORE8: Store single byte to memory

Memory Expansion

Memory expands dynamically during execution with quadratic gas costs:

Gas Costs

Memory expansion incurs quadratic costs:

Debug Tracing

MemoryDump used with debug_traceTransaction for execution analysis:

Common Patterns

ABI Encoding Analysis

Memory contains ABI-encoded data during calls:

Return Data

Return data stored in memory:

API Reference

Constructors

  • MemoryDump.from(bytes) - Create from Uint8Array
  • MemoryDump.from({ data, length }) - Create from object

Methods

  • MemoryDump.readWord(dump, offset) - Read 32-byte word
  • MemoryDump.slice(dump, start, end?) - Extract memory range

See Also

  • StateDiff - State changes during execution
  • StorageDiff - Storage slot changes
  • Hex - Hex encoding for memory display