Skip to main content
Type-first EVM architecture. Every execution primitive is a strongly-typed branded Uint8Array or interface.
These are low-level primitives for EVM operations, not a full EVM implementation. For complete EVM implementations, see evmts/guillotine-mini (lightweight) or evmts/guillotine (full-featured).

Core Types

Opcode

Branded number type for EVM instructions (0x00-0xFF).
See Opcode documentation for complete reference.

Instruction

Opcode with program counter offset and optional immediate data.
Instructions are returned by bytecode analysis:

Execution Types

Frame

EVM execution frame with stack, memory, and execution state.
Frame represents the complete execution state at any point in EVM execution.

Host

Interface for external state access (accounts, storage, code) and nested execution.
The call and create methods are optional. When not provided, system opcodes (CALL, CREATE, etc.) return a NotImplemented error. For full EVM execution with nested calls, use:
  • guillotine: Production EVM with async state, tracing, full EIP support
  • guillotine-mini: Lightweight synchronous EVM for testing
Host provides pluggable state backend - implement for custom chains or test environments.

InstructionHandler

Function signature for opcode implementations.
Example handler implementation:
All 166 EVM opcodes follow this pattern. See Instructions.

Call Types

CallParams

Parameters for cross-contract calls (CALL, STATICCALL, DELEGATECALL).
Example usage:

CallResult

Result of call operation.
Example:

Creation Types

CreateParams

Parameters for contract deployment (CREATE, CREATE2).
Example:

CreateResult

Result of contract creation.
Example:

Error Types

EvmError

Execution errors that halt the EVM.
The NotImplemented error is returned by system opcodes (CALL, CREATE, etc.) when the host doesn’t provide call or create methods. This is intentional - these low-level primitives don’t include an execution engine. Use guillotine or guillotine-mini for full EVM execution.
Error handling:

Opcode Metadata

Info

Opcode metadata (gas cost, stack effect).

Type Safety Benefits

Prevents Type Confusion

Compile-Time Validation

IDE Autocomplete

TypeScript provides full IntelliSense:

Zero Runtime Overhead

Branded types are compile-time only:

Architecture

Execution Flow

Pluggable Backend

Host interface allows custom state implementations:

Opcode

Opcode type and constants

Bytecode

Bytecode analysis and instruction parsing

Instructions

All 166 opcode handlers

Address

Address type for account references

References