Vec<u8>
Sequence 15 v490About 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
- Compact<u32> length prefix followed by each u8 element encoded in sequence.
- Size
- variable
Examples
Byte vector [1, 2, 3] = [1, 2, 3]
0x0c0102030c Compact length = 3 (3 << 2 = 12 = 0x0C)01 02 03 3 raw bytesEmpty vector = []
0x0000 Compact length = 0Code 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 (111)
#18 DigestItem via PreRuntime#18 DigestItem via Consensus#18 DigestItem via Seal#18 DigestItem via Other#40 SubtensorModule::Event via SymbolUpdated.symbol#70 SubnetIdentityV3 via subnet_name#70 SubnetIdentityV3 via github_repo#70 SubnetIdentityV3 via subnet_contact#70 SubnetIdentityV3 via subnet_url#70 SubnetIdentityV3 via discord#70 SubnetIdentityV3 via description#70 SubnetIdentityV3 via logo_url#70 SubnetIdentityV3 via additional#76 BoundedVec #97 Ethereum::Event via Executed.extra_data#107 Log via data#116 Contracts::Event via ContractEmitted.data#130 System::Call via remark.remark#130 System::Call via set_code.code#130 System::Call via set_code_without_checks.code
and 91 more...
Type Information
- Type ID
- 15
- Kind
- Sequence
- Runtime
- v490