Vec<u8>

Sequence 14 v411

About This Type

Variable-length list of u8 values.

A dynamically-sized collection. The encoded length precedes the element data.

Encoding: Compact<u32> length prefix followed by each element encoded in sequence.

Sequence (Vec)

Element Type
u8
SCALE Encoding
Length-prefixed (Compact<u32> length followed by elements)

SCALE Encoding

Rule
Fixed 1 byte: 0x00 = false, 0x01 = true.
Size
1 byte

Examples

true
0x01
01 true
false
0x00
00 false

Code Examples

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

const registry = new TypeRegistry();

// Encode a Vec<u8>
const vec = registry.createType("Vec<u8>", [1, 2, 3]);
console.log("Hex:", vec.toHex());

Referenced By (88)

and 68 more...

Type Information

Type ID
14
Kind
Sequence
Runtime
v411