U64

Primitive 6 v393

About This Type

Unsigned 64-bit integer, commonly used for TAO/RAO balance amounts.

The primary balance type in Subtensor. All TAO amounts are stored as RAO (1 TAO = 10^9 RAO). Also used for weights, stake amounts, and emission values.

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

RAO → TAO: divide by 1,000,000,000 (10^9).

Common Uses

  • • Balance amounts (free, reserved, staked)
  • • Emission and reward calculations
  • • Weight and rank values

Primitive Type

Name
U64
Byte Size
8 bytes
SCALE Encoding
Fixed-width, little-endian

SCALE Encoding

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

Examples

1 TAO (1,000,000,000 RAO) = 1,000,000,000
0x00ca9a3b00000000
00 ca 9a 3b 00 00 00 00 8 bytes little-endian (0x3B9ACA00 = 10^9)
Zero = 0
0x0000000000000000
00 00 00 00 00 00 00 00 8 zero bytes

Code Examples

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

const registry = new TypeRegistry();

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

Type Information

Type ID
6
Kind
Primitive
Runtime
v393