U32

Primitive 4 v411

About This Type

Unsigned 32-bit integer (0 to 2^32 - 1).

Fixed-width 4-byte unsigned integer.

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

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());

Also See

Type Information

Type ID
4
Kind
Primitive
Runtime
v411