MaxStorageKeyLen

Constant v334 → current u32

Limits individual storage key sizes.

Current Value

128
Relevant 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 { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";

const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });

// Query MaxStorageKeyLen constant
const value = api.consts[stringCamelCase("Contracts")][stringCamelCase("MaxStorageKeyLen")];
console.log("MaxStorageKeyLen:", value.toHuman());

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
v393