Account Metadata
Account metadata provides optional profile information associated with a Substrate account. It is stored directly on-chain in pallet-account-mapping and is queryable by any application or indexer.
Fields
| Field | Type | Max length | Description |
|---|---|---|---|
display_name | Option<Vec<u8>> | 128 bytes | Human-readable display name (UTF-8 free-form) |
bio | Option<Vec<u8>> | 128 bytes | Short description or tagline |
avatar | Option<Vec<u8>> | 128 bytes | IPFS CID or URL pointing to a profile image |
All fields are optional and independently updatable. Setting a field to None clears it.
Setting metadata
pallet: AccountMapping (index 14)
call: set_account_metadata (index 10)
args:
display_name: Option<BoundedVec<u8, 128>>
bio: Option<BoundedVec<u8, 128>>
avatar: Option<BoundedVec<u8, 128>>
origin: Signed
Constraints:
- The account must own an alias (
NoAlias). This gate prevents unbounded metadata entries in chain state from accounts that have not reserved an alias deposit. - Each field is bounded at 128 bytes on-chain.
On success, emits:
MetadataUpdated { account: AccountId32 }
Querying metadata
Via runtime helper:
AccountMapping::get_account_metadata(&AccountId32) -> Option<AccountMetadata>
Via storage directly:
AccountMetadatas: StorageMap<AccountId32, AccountMetadata>
Applications and indexers can subscribe to MetadataUpdated events to maintain an off-chain index.
Notes on the avatar field
The avatar field is unrestricted in format — it accepts any byte string up to 128 bytes. Recommended usage is an IPFS CID v1 (e.g. bafybeig...), which keeps the actual image off-chain while making the reference content-addressable and censorship-resistant.
Using HTTP URLs is technically accepted but not recommended for applications that aim for decentralization.
Relationship to the alias system
Metadata is stored per AccountId32, not per alias. However, the alias is required as an anti-spam gate — it ensures the account has a deposit at stake before writing to chain state.
If an account releases its alias and later registers a new one, any previously stored metadata remains in AccountMetadatas and is still accessible. The metadata is not automatically deleted when an alias is released.
The display_name field is informational only. On-chain name resolution uses the alias (see Aliases), not the display name. Two accounts can have the same display name, but aliases are unique.