MultiAddress

Variant 176 v411

sp_runtime::multiaddress::MultiAddress

About This Type

Flexible address format supporting multiple encoding styles.

Allows specifying an account as Id (AccountId32), Index (u32 account index), Raw bytes, Address32, or Address20. Most commonly used with the Id variant.

Encoding: Variant: 0x00=Id (32 bytes), 0x01=Index (compact u32), 0x02=Raw, 0x03=Address32, 0x04=Address20.

Variants (5)

IndexNameFieldsDocs
0Id
1Index
2Raw
3Address32
4Address20

SCALE Encoding

Rule
1-byte variant index followed by variant-specific field data. 5 possible variants.
Size
variable (1+ bytes)

Examples

Id = Id(AccountId)
0x00<field0>
00 Variant index 0 = Id
field 0 field0: AccountId
Index = Index(Compact<()>)
0x01<field0>
01 Variant index 1 = Index
field 0 field0: Compact<()>
Raw = Raw(Vec<u8>)
0x02<field0>
02 Variant index 2 = Raw
field 0 field0: Vec<u8>

Code Examples

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

const registry = new TypeRegistry();

// Encode MultiAddress — variant "Id"
const value = registry.createType("MultiAddress", { Id: { value: "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" } });
console.log("Hex:", value.toHex());

Type Parameters

AccountId = AccountId
AccountIndex = ()

Referenced By (22)

and 2 more...

Type Information

Type ID
176
Kind
Variant
Path
sp_runtime::multiaddress::MultiAddress
Runtime
v411