Skip to main content

Overview

The Host module provides an interface for EVM opcodes to access external blockchain state. It abstracts account storage, balances, code, and nonces behind a unified API that instruction handlers call during execution. This is the boundary between the EVM execution engine and the state layer - whether that’s an in-memory mock, a database, or a live Ethereum node.

Architecture Note

This module provides low-level EVM primitives (opcode handlers, frame management). For full EVM execution with nested calls, use:
  • guillotine: Production EVM with async state access, tracing, and full EIP support
  • guillotine-mini: Lightweight synchronous EVM for testing and simple use cases
The optional call and create methods enable nested execution. When not provided, system opcodes (CALL, CREATE, etc.) return NotImplemented error.

Type Definition

API

Host(impl)

Create a Host from an implementation object.

Host.from(impl)

Alias for Host(impl). Creates a branded Host from implementation.

Host.createMemoryHost()

Create an in-memory Host for testing. All state stored in Maps.

Methods

Account State

Persistent Storage

Transient Storage (EIP-1153)

Transaction-scoped storage cleared at end of transaction.

Nested Execution (Optional)

Examples

Custom Host with Logging

Using with SLOAD Instruction

Multiple Account Management

Transient Storage (EIP-1153)

Transient storage provides transaction-scoped data that is:
  • Isolated per contract address
  • Cleared at end of transaction
  • Cheaper than persistent storage (no disk writes)
  • Useful for reentrancy locks, callbacks, flash loans

Edge Cases

Uninitialized Values

Max Uint256 Values

Large Code (EIP-170: 24KB limit)

References