HotkeySwappedOnSubnet
Event Re-added v276 → v277, v290 → v315, v320 → v326, v334 → v367, v372 → v377, v385 → current #100Emitted for each subnet when a hotkey swap occurs.
View events on chainThe Big Picture
When a hotkey is swapped, the registration needs to update on each subnet where that hotkey was registered. This event fires once per subnet, confirming the subnet-level records are updated. Your UID stays the same, but the hotkey address associated with it changes. This is the granular view of what HotkeySwapped accomplished.
Why This Matters
If you're swapping a hotkey that's on multiple subnets, you want confirmation for each subnet. This event provides that - one event per subnet showing the hotkey swap was recorded there. If you see HotkeySwapped but not HotkeySwappedOnSubnet for a subnet, something may be wrong.
Example Scenario
You're swapping a hotkey registered on subnets 1, 3, and 7. During the swap, you see three HotkeySwappedOnSubnet events: one for netuid 1, one for netuid 3, one for netuid 7. Each confirms your UID on that subnet now points to your new hotkey address.
Common Questions
- Do I get one event per subnet automatically?
- Yes, the runtime emits one HotkeySwappedOnSubnet for each subnet where the old hotkey was registered. You don't need to do anything special.
- What if I'm missing an event for a subnet?
- Check if the hotkey was actually registered there. If it wasn't, no event would fire. If it was and there's no event, investigate - the migration may have partially failed.
- Does this mean my miner/validator is still running?
- This updates the chain's records. Your actual miner/validator software needs to be updated with the new hotkey independently. The chain knows the new identity; your software needs to use it.
Use Cases
- Track hotkey migration across specific subnets
- Verify registrations transferred correctly per subnet
- Monitor subnet-level identity changes
- Build per-subnet hotkey tracking tools
How to Use This Event
- → Monitor for each subnet you operate on during hotkey swap
- → Track per-subnet migration for verification
- → Build detailed migration audit trails
From Chain Metadata
the hotkey is swapped
Triggers
Emitted by
Preconditions
- Hotkey swap is in progress
- Hotkey was registered on this subnet
Effects
Storage Modified
Postconditions
- Subnet-specific registrations updated
Side Effects
- UIDs preserved across swap
Event Data
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 });
// Subscribe to HotkeySwappedOnSubnet events
api.query.system.events((events) => {
events
.filter(({ event }) =>
event.section === stringCamelCase("SubtensorModule") &&
event.method === "HotkeySwappedOnSubnet"
)
.forEach(({ event }) => {
console.log("HotkeySwappedOnSubnet:", event.data.toHuman());
});
});Version History
Runtime Info
View Source- Pallet Index
- 7
- Event Index
- 100
- First Version
- v276
- Current Version
- v393