Bytes32
Fixed-size 32-byte value type
Exactly 32 bytes — used for hashes, AES keys, and similar values.
Definition
class Bytes32(_SizedHexBytes):
_size = 32Construction
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
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— passesisinstance(x, bytes)checksImmutable and hashable
Has
.to_0x_hex()method for"0x"-prefixed hex output
See Also
PrivateKey — 32-byte subclass for signing keys
CompressedPublicKey — 33-byte public key
EncryptionNonce — 12-byte nonce
Last updated

