StakeSwapped
Event Re-added v233 → v247, v252 → v265, v273 → v277, v290 → v315, v320 → v326, v334 → v367, v372 → v377, v385 → current #90Emitted when stake is swapped between subnets for the same coldkey -hotkey pair.
View events on chainThe Big Picture
When you stake to a hotkey that operates on multiple subnets, your stake might be concentrated on one subnet. Swapping lets you move that stake between subnets while keeping it with the same validator. This is useful when one subnet has better emissions or you want to diversify risk across subnets without changing validators.
Why This Matters
Different subnets have different emission rates and risks. Swapping lets you optimize your stake distribution without changing validators - you're just choosing which of your validator's subnets you want exposure to.
Example Scenario
You have 100 TAO staked to Validator X on subnet 1, but subnet 3 (also run by Validator X) has higher emissions. You swap 50 TAO from subnet 1 to subnet 3. StakeSwapped fires showing the move. Now you're earning from both subnets through the same validator.
Common Questions
- How is this different from StakeMoved?
- StakeSwapped moves stake between subnets for the SAME hotkey. StakeMoved moves stake between DIFFERENT hotkeys (possibly different validators entirely).
- Does swapping affect my validator relationship?
- No, your stake stays with the same validator - you're just choosing which of their subnets your stake is active on.
Use Cases
- Rebalance stake across subnets for the same validator
- Optimize exposure to different subnet emission rates
- Track how validators distribute stake across their subnets
How to Use This Event
- → Monitor your own stake distribution across subnets
- → Track how top validators allocate delegated stake
- → Build portfolio optimization tools
From Chain Metadata
Stake has been swapped from one subnet to another for the same coldkey-hotkey pair. Parameters: (coldkey, hotkey, origin_netuid, destination_netuid, amount)
Triggers
Emitted by
Preconditions
- Coldkey-hotkey pair has stake on origin subnet
- Hotkey is registered on destination subnet
- Swap operation is not rate limited
May fail with
Effects
Storage Modified
Postconditions
- Stake moved from origin subnet to destination subnet
- Same coldkey-hotkey relationship preserved
Side Effects
- Rebalances alpha stake between subnets
- May affect subnet-specific rankings
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 StakeSwapped events
api.query.system.events((events) => {
events
.filter(({ event }) =>
event.section === stringCamelCase("SubtensorModule") &&
event.method === "StakeSwapped"
)
.forEach(({ event }) => {
console.log("StakeSwapped:", event.data.toHuman());
});
});On-Chain Activity
Major features with millions of emissions
#25 most emitted event
As of block 7,429,232
Version History
Runtime Info
View Source- Pallet Index
- 7
- Event Index
- 90
- First Version
- v233
- Current Version
- v393