U128

Primitive 8 v411

About This Type

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

Fixed-width 16-byte unsigned integer.

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

Primitive Type

Name
U128
Byte Size
16 bytes
SCALE Encoding
Fixed-width, little-endian

SCALE Encoding

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

Examples

1 TAO (u128) = 1,000,000,000
0x00ca9a3b000000000000000000000000
00ca9a3b...(16 bytes) 16 bytes little-endian

Code Examples

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

const registry = new TypeRegistry();

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

Type Information

Type ID
8
Kind
Primitive
Runtime
v411