Lock
Storage Map v411 → v490 · 1 shape changePer-coldkey per-subnet per-hotkey lock state. DMAP (coldkey , subnet , hotkey ) → LockState.
Explore chainThe Big Picture
Lock is the canonical record of every locked position. One coldkey can hold at most one lock per subnet, tied to a specific hotkey. Together with HotkeyLock and OwnerLock it forms the conviction substrate.
Use Cases
- Show a user their lock positions across subnets
- Compute subnet conviction tallies for owner allocation
- Audit lock state across the network
From Chain Metadata
DMAP ( coldkey, netuid, hotkey ) --> LockState | Exponential lock per coldkey per subnet.
Purpose & Usage
Purpose
Holds the individual lock position for each (coldkey, subnet) pair, including its locked amount, conviction, and decay clock.
Common Query Patterns
- Look up a single coldkey-subnet-hotkey lock
- Iterate locks for a given coldkey
- Iterate locks for a given subnet to compute aggregate conviction
Migration Notes
key type changed from (AccountId, u16, AccountId) to (AccountId, NetUid, AccountId)
Update decoders: SCALE encoding is positional, so any signature change (added, removed, or type-changed fields, or storage shape changes) shifts byte offsets and existing decoders will misparse this item. Re-derive types from the new metadata.
Query Keys
Stored Value
LockState (LockState)
Default Value
Optional storage: querying a key that has never been written returns no value (None) — do not assume a zero default.
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 Lock storage
const coldkey = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const netuid = 1;
const hotkey = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const result = await api.query.SubtensorModule.Lock.getValue(coldkey, netuid, hotkey);
console.log("Lock:", result);On-Chain Activity
10K to 100K writes
#201 most written storage item
Modified by both user extrinsics and runtime hooks
As of block 9,385,000
Version History
- key :
(AccountId, u16, AccountId)→(AccountId, NetUid, AccountId)
Runtime Info
View Source- Pallet
- SubtensorModule
- Storage Kind
- Map
- First Version
- v411
- Current Version
- v490