U32

Primitive 4 v393

About This Type

Unsigned 32-bit integer (0–4,294,967,295).

Used for block numbers, indices, and timestamps in Subtensor.

Encoding: Fixed-width: always exactly 4 bytes, little-endian.

Common Uses

  • • Block numbers
  • • Nonce values
  • • Epoch lengths and tempo values

Primitive Type

Name
U32
Byte Size
4 bytes
SCALE Encoding
Fixed-width, little-endian

SCALE Encoding

Rule
Fixed-width 4-byte unsigned integer, little-endian.
Size
4 bytes

Examples

Block 1,000,000 = 1,000,000
0x40420f00
40 42 0f 00 1,000,000 as u32 little-endian

Code Examples

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

const registry = new TypeRegistry();

// Encode a U32 value
const value = registry.createType("U32", 1000000);
console.log("Hex:", value.toHex());
console.log("Bytes:", value.toU8a());

Type Information

Type ID
4
Kind
Primitive
Runtime
v393