[u8; 4]

Array 18 v393

About This Type

Fixed-length array of 4 u8 values.

Always exactly 4 elements. No length prefix needed since the size is known at compile time.

Encoding: 4 elements encoded consecutively, no length prefix.

Fixed-Length Array

Element Type
u8
Length
4
SCALE Encoding
Fixed-length (4 x element size bytes)

SCALE Encoding

Rule
4 elements encoded consecutively, no length prefix (size known at compile time).
Size
4 bytes

Examples

4-byte array = [u8; 4]
0xxxxxxxxx...
4 raw bytes 4 bytes concatenated, no prefix

Code Examples

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

const registry = new TypeRegistry();

// Encode a [u8; 4]
const arr = registry.createType("[u8; 4]", new Uint8Array(4));
console.log("Hex:", arr.toHex());

Referenced By (7)

Type Information

Type ID
18
Kind
Array
Runtime
v393