Skip to content

Hash (Class)

A 32-byte hash value.

Used for transaction IDs, block hashes, and other cryptographic purposes.

__bytes__

__bytes__() -> bytes

The byte representation

__eq__

__eq__(other: object) -> bool

__new__

__new__(hex_str: str) -> Hash

Create a new Hash from a hex string.

PARAMETER DESCRIPTION
hex_str

A 64-character hex string representing the hash.

TYPE: str

RETURNS DESCRIPTION
Hash

A new Hash instance.

TYPE: Hash

RAISES DESCRIPTION
Exception

If the hex string is invalid.

__str__

__str__() -> str

The string representation.

RETURNS DESCRIPTION
str

The Hash as a hex string

TYPE: str

to_string

to_string() -> str

Convert the hash to a hex string.

RETURNS DESCRIPTION
str

A 64-character hex string.

TYPE: str