Skip to main content

Elementary types

Elementary types are atomic—they don't contain other types. These form the building blocks that complex types compose.

Numeric types

Unsigned integers (uint)

Unsigned integers range from 8 to 256 bits, in increments of 8:

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

The bits field is required and must be a multiple of 8 between 8 and 256.

Signed integers (int)

Signed integers use two's complement representation:

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

Like uint, the bits field must be a multiple of 8 between 8 and 256.

Fixed-point numbers (ufixed, fixed)

Fixed-point decimals specify both total bits and decimal places:

{ "kind": "ufixed", "bits": 128, "places": 18 }
{ "kind": "fixed", "bits": 128, "places": 18 }

Address type

Addresses represent 20-byte Ethereum addresses:

{ "kind": "address" }

In Solidity, address payable is a distinct type but uses the same representation—the distinction is semantic rather than structural.

Boolean type

Booleans represent true/false values:

{ "kind": "bool" }

In the EVM, booleans occupy a full 32-byte word where 0 is false and any non-zero value is true.

Byte types

Fixed-size bytes (bytes)

Fixed-size byte arrays range from 1 to 32 bytes:

{ "kind": "bytes", "size": 32 }
{ "kind": "bytes", "size": 4 }

The size field is required for fixed-size bytes.

Dynamic bytes (bytes)

Dynamic byte arrays have no size limit:

{ "kind": "bytes" }

When size is omitted, the type represents dynamically-sized bytes.

String type

Strings represent UTF-8 encoded text:

{ "kind": "string" }

Strings are dynamically sized. Languages that treat strings as character arrays may choose to represent them as array types instead.

Enum type

Enums represent a fixed set of named values:

{
"kind": "enum",
"definition": {
"name": "Status"
},
"values": ["Pending", "Active", "Completed"]
}

The values field lists all possible values in order. The underlying representation is typically a uint8 (or larger if needed).

User-defined types with definitions

Some elementary types (particularly enums) are defined in source code. These include a definition field:

{
"kind": "enum",
"definition": {
"name": "OrderStatus",
"source": {
"id": 42,
"range": {
"start": { "line": 10, "column": 0 },
"end": { "line": 15, "column": 1 }
}
}
},
"values": ["Created", "Filled", "Cancelled"]
}

The definition field can include:

  • name: The identifier used in source code
  • source: A reference to where the type is defined

Learn more

For complete schema definitions and all available fields, see the elementary types specification.