Skip to main content

Overview

TransactionHash is a branded Uint8Array type representing a 32-byte transaction identifier in Ethereum. Every transaction has a unique hash computed from its contents.

Type Definition

Creating TransactionHashes

from

Universal constructor accepting hex string or bytes.

fromHex

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

fromBytes

Create from Uint8Array.
Validation: Must be exactly 32 bytes.

Converting TransactionHashes

toHex

Convert to lowercase hex string with 0x prefix.

Comparing TransactionHashes

equals

Check equality using constant-time byte comparison.

Errors

InvalidTransactionHashLengthError: Bytes length is not 32. InvalidTransactionHashFormatError: Invalid hex format or unsupported type.

See Also