Overview
BundleHash is a brandedUint8Array 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.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).fromBundle
Compute bundle hash from a Bundle containing transactions. Requires a keccak256 implementation.- Hashing each transaction with keccak256
- Concatenating all transaction hashes
- Hashing the concatenated result
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
| Error | Extends | Code | When Thrown |
|---|---|---|---|
InvalidBundleHashError | InvalidLengthError | INVALID_BUNDLE_HASH | Invalid hash format or length |
MissingCryptoDependencyError | ValidationError | MISSING_CRYPTO_DEPENDENCY | keccak256 not provided |
- 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
- TransactionHash - Individual transaction identifier
- BlockHash - Block identifier
- Keccak256 - Hash function used for bundle hashing

