Skip to main content
Bytes32 (Bytes32Type) is a branded fixed-length 32-byte Uint8Array representing a single 256-bit EVM word, Solidity bytes32 value, storage slot value, or CREATE2 salt. Unlike Hash, Bytes32 carries no semantic claim that its contents are a cryptographic digest.

Quick Start

Import from @tevm/voltaire.

Layout & Constants

When encoding integers with fromNumber or fromBigint, bytes are big-endian and left-padded with 0x00 to 32 bytes. toAddress extracts the rightmost 20 bytes ([12:32]).

API Reference

Constructors & Factories

Conversions & Operations

Notice method casing: Bytes32.fromBigint and Bytes32.toBigint use lowercase i, whereas Bytes.fromBigInt and Hex.fromBigInt use capital I.

Edge Cases

  • fromBytes and fromHex throw InvalidLengthError if the input is not exactly 32 bytes.
  • fromBigint rejects negative values and values >= 2n ** 256n.
  • Bytes32.ZERO is a shared constant; use Bytes32.zero() or Bytes32.clone() when mutating bytes.
  • Bytes — Variable-length byte arrays and Bytes1–Bytes64
  • Hash — 32-byte cryptographic digests
  • Uint256 — 256-bit unsigned integer arithmetic