TransactionKeyLastBlock

Storage Map v195 → v490 · 1 shape change

Last block for rate-limited transaction by key.

Explore chain
Queried by: developers

The Big Picture

Various transactions are rate-limited per key. This tracks the last block for each transaction type to enforce cooldowns.

Use Cases

  • Debug rate limits
  • Monitor transaction frequency

From Chain Metadata

NMAP ( hot, netuid, name ) --> last_block | Returns the last block of a transaction for a given key, netuid, and name.

Purpose & Usage

Purpose

Track transaction timing for rate limiting.

Common Query Patterns

  • Query by (hotkey, netuid, name)

Migration Notes

v424 v432 Breaking

key type changed from (AccountId, u16, u16) to (AccountId, NetUid, u16)

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

#NameTypeDescription
1
hot
AccountId hot (AccountId, hashed key component) (hex -> SS58)
2
netuid
NetUid netuid (NetUid, hashed key component)
3
name
u16 name (u16, hashed key component)

Stored Value

last_block (u64)

RAO -> TAO (/ 10^9)

Default Value

0 0x0000000000000000

Absent keys read as this value — querying a key that has never been written returns this default, not an error or empty result.

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 TransactionKeyLastBlock storage
const hot = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const netuid = 1;
const name = 0;

const result = await api.query.SubtensorModule.TransactionKeyLastBlock.getValue(hot, netuid, name);
console.log("TransactionKeyLastBlock:", result);

On-Chain Activity

Write Frequency
●●●●○○ Medium 100K–1M est. writes

100K to 1M writes

#184 most written storage item

Write Source Calls + Hooks

Modified by both user extrinsics and runtime hooks

As of block 9,385,000

Version History

v195 block 3,791,350 Added
v425–v431 · runtime versions skipped on chain (never deployed)
v432 block 8,636,190 Shape changed Current
  • key : (AccountId, u16, u16) → (AccountId, NetUid, u16)

Runtime Info

View Source
Pallet
SubtensorModule
Storage Kind
Map
First Version
v195
Current Version
v490