Skip to main content

Types

Types in ethdebug/format describe the structure and interpretation of raw bytes. They tell a debugger how to decode values from EVM state into human-readable representations.

Why types matter

When a debugger reads bytes from storage, memory, or the stack, those bytes are meaningless without context. A 32-byte value could be:

  • A uint256 representing a token balance
  • An address padded to 32 bytes
  • Part of a string or bytes array
  • A storage slot containing packed struct members

Type information bridges this gap. It tells the debugger exactly how to interpret the raw bytes and present them to developers in a meaningful way.

Core ideas

Types are organized by kind

Every type representation is a JSON object with a kind field:

{
"kind": "uint",
"bits": 256
}

The kind field determines which schema applies. Common kinds include:

  • Elementary types: uint, int, bool, address, bytes, string, enum, ufixed, fixed
  • Complex types: array, struct, mapping, tuple, alias, function

Elementary vs. complex

Types fall into two classes:

  • Elementary types stand alone—they don't contain other types. Examples: uint256, address, bool
  • Complex types compose other types. A uint256[] array contains a uint256. A mapping(address => uint256) contains both address and uint256.

Complex types use contains

Complex types express their composition through a contains field. This field can take three forms:

Single type (arrays, aliases):

{
"kind": "array",
"contains": {
"type": { "kind": "uint", "bits": 256 }
}
}

Ordered list (structs, tuples):

{
"kind": "struct",
"contains": [
{ "name": "balance", "type": { "kind": "uint", "bits": 256 } },
{ "name": "owner", "type": { "kind": "address" } }
]
}

Object mapping (mappings):

{
"kind": "mapping",
"contains": {
"key": { "type": { "kind": "address" } },
"value": { "type": { "kind": "uint", "bits": 256 } }
}
}

Type references avoid duplication

Instead of repeating a full type definition everywhere it's used, you can reference types by ID:

{
"kind": "array",
"contains": {
"type": { "id": "some-opaque-type-id" }
}
}

This keeps debugging information compact and allows types to reference each other (useful for recursive structures).

What's next

Elementary types

Integers, addresses, booleans, and other atomic types.

Composite types

Arrays, structs, mappings, and types that contain other types.

Representation

How types map to bytes in storage vs. memory encoding contexts.

Full specification

Complete JSON schemas and detailed reference.