Current Value
128Relevant for: developers
The Big Picture
Contract storage keys have a maximum length. Very long keys would waste storage and slow lookups. Keep keys short and structured.
From Chain Metadata
The maximum allowable length in bytes for storage keys.
Use Cases
- Plan storage key naming
- Understand storage constraints
Code Examples
import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443
const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);
// Query MaxStorageKeyLen constant
const value = await api.constants.Contracts.MaxStorageKeyLen();
console.log("MaxStorageKeyLen:", value);Type Information
- Type
- u32
- Byte Size
- 4 bytes
- Encoding
- fixed
- Raw Hex
- 0x80000000
Runtime Info
- Pallet
- Contracts
- First Version
- v334
- Latest Version
- v334
- Current Runtime
- v411