Basic Types


SSZ support two Basic Types:


  1. Unisigned Integer

  2. Boolean

Unsigned Integers

  • Type:

    • uintN, where N can be: 8, 16, 32, 64, 128, 256.
  • Aliases:

    • uint8 <-> byte
    • uint256 <-> root
  • Default value:

    • 0
  • Size:

    • size_of(uintN): N / 8

Serialization

The serialized form on any unsined integer is the Bytes representation of that integer.

The serialization of uintN is defined using the Python version of int.to_bytes, little-endian.

Merkleization

The integers, represented as bytes, are padded on the right side with zeroed bytes to a total of 32 bytes for merkleization. Note:

  • Some complex types pack smaller integers together into 32 bytes, to reduce the merkleization cost.
  • Because of the little-endianness and right-padding, equal integers of different bit-sizes all map to the same 32 bytes value.

Booleans

  • Type: boolean

  • Alias: bit

  • Default value: False

  • Size: 1

Serialization

Booleans have two possible values: True or False

The Boolean value false is serialized into a byte of value 0

The Boolean value true is serialized into a byte of value 1

Merkleization

The boolean represented as byte is merkleized exactly like byte, including the ability to pack (but only to byte precision, refer to bitfields for more efficient packing).