Skip to main content

Overview

BundleHash is a branded Uint8Array type representing a 32-byte identifier for MEV transaction bundles. Computed as keccak256 of concatenated transaction hashes, it’s used to track bundle status through MEV relays and block builders like Flashbots.

Type Definition

Constants

Creating BundleHashes

from

Universal constructor accepting hex string or bytes.
Throws InvalidBundleHashError if:
  • Bytes length is not 32
  • Hex string is not 64 characters
  • Invalid hex characters
  • Unsupported input type

fromHex

Parse from hex string (with or without 0x prefix).
Validation: Must be exactly 64 hex characters (32 bytes).

fromBundle

Compute bundle hash from a Bundle containing transactions. Requires a keccak256 implementation.
The hash is computed by:
  1. Hashing each transaction with keccak256
  2. Concatenating all transaction hashes
  3. Hashing the concatenated result
This matches the bundle hash format used by Flashbots and other MEV relays.

Converting BundleHashes

toHex

Convert to lowercase hex string with 0x prefix.

Comparing BundleHashes

equals

Check equality using byte comparison.

Errors

BundleHash provides typed errors that extend the Voltaire error hierarchy:

InvalidBundleHashError

Thrown when BundleHash operations fail due to invalid data.

MissingCryptoDependencyError

Thrown when required crypto function is not provided.

Error Types

ErrorExtendsCodeWhen Thrown
InvalidBundleHashErrorInvalidLengthErrorINVALID_BUNDLE_HASHInvalid hash format or length
MissingCryptoDependencyErrorValidationErrorMISSING_CRYPTO_DEPENDENCYkeccak256 not provided
Common scenarios:
  • Invalid byte length (not 32 bytes)
  • Invalid hex string length (not 64 characters)
  • Invalid hex characters
  • Unsupported input type
  • Missing keccak256 dependency in fromBundle

MEV Use Cases

Tracking Bundle Status

Verifying Bundle Inclusion

See Also