# Bytes32

Exactly 32 bytes — used for hashes, AES keys, and similar values.

## Definition

```python
class Bytes32(_SizedHexBytes):
    _size = 32
```

## Construction

| Parameter | Type                  | Required | Description                       |
| --------- | --------------------- | -------- | --------------------------------- |
| `val`     | `bytes \| str \| int` | Yes      | Hex string, raw bytes, or integer |

Raises `ValueError` if length is not exactly 32 bytes.

## Example

```python
from seismic_web3 import Bytes32

block_hash = Bytes32("0x" + "ab" * 32)
print(len(block_hash))        # 32
print(block_hash.to_0x_hex())
```

## Key properties

* Inherits from `HexBytes` — passes `isinstance(x, bytes)` checks
* Immutable and hashable
* Has `.to_0x_hex()` method for `"0x"`-prefixed hex output

## See Also

* [PrivateKey](/clients/python/api-reference/types/private-key.md) — 32-byte subclass for signing keys
* [CompressedPublicKey](/clients/python/api-reference/types/compressed-public-key.md) — 33-byte public key
* [EncryptionNonce](/clients/python/api-reference/types/encryption-nonce.md) — 12-byte nonce


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.seismic.systems/clients/python/api-reference/types/bytes32.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
