H256

Composite 13 v393

primitive_types::H256

About This Type

256-bit hash value (32 bytes).

Used for block hashes, extrinsic hashes, storage keys, and Merkle tree roots. Typically the output of Blake2b-256 hashing.

Encoding: Fixed-width: always exactly 32 bytes, no length prefix.

Common Uses

  • • Block hashes for querying historical state
  • • Extrinsic hashes for tracking transactions
  • • Storage root hashes for state verification

Fields (1)

#NameType
0(unnamed)[u8; 32]

SCALE Encoding

Rule
Fixed 32 bytes — raw hash, no length prefix.
Size
32 bytes

Examples

Block hash example = 0x91b1...
0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3
91b171bb...70ce90c3 32 bytes of Blake2b-256 hash output

Code Examples

import { TypeRegistry } from "@polkadot/types";

const registry = new TypeRegistry();

// Encode H256
const value = registry.createType("H256", {
  field: 0
});
console.log("Hex:", value.toHex());

Referenced By (67)

and 47 more...

Type Information

Type ID
13
Kind
Composite
Path
primitive_types::H256
Runtime
v393