U8
Primitive 2 v411About This Type
Unsigned 8-bit integer (0 to 2^8 - 1).
Fixed-width 1-byte unsigned integer.
Encoding: Fixed-width: 1 byte, little-endian.
Primitive Type
- Name
- U8
- Byte Size
- 1 byte
- SCALE Encoding
- Fixed-width, little-endian
SCALE Encoding
- Rule
- Fixed-width 1-byte unsigned integer, little-endian.
- Size
- 1 byte
Examples
Value 42 = 42
0x2a2a 42 in hexMax (255) = 255
0xffff 255 = maximum u8Code Examples
import { TypeRegistry } from "@polkadot/types";
const registry = new TypeRegistry();
// Encode a U8 value
const value = registry.createType("U8", 42);
console.log("Hex:", value.toHex());
console.log("Bytes:", value.toU8a());Type Information
- Type ID
- 2
- Kind
- Primitive
- Runtime
- v411