StakeSwapped

Event Re-added v233 → v247, v252 → v265, v273 → v277, v290 → v315, v320 → v326, v334 → v367, v372 → v377, v385 → current #90

Emitted when stake is swapped between subnets for the same coldkey -hotkey pair.

View events on chain
Useful for: stakersvalidatorsanalytics

The 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

Effects

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

#NameTypeDescription
0
arg0
AccountId Event field #0 (AccountId) (hex -> SS58)
1
arg1
AccountId Event field #1 (AccountId) (hex -> SS58)
2
arg2
u16 Event field #2 (u16)
3
arg3
u16 Event field #3 (u16)
4
arg4
u64 Event field #4 (u64)

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

Emission Frequency
●●●●○○ Significant 1M–5M emissions

Major features with millions of emissions

#25 most emitted event

As of block 7,429,232

Version History

v233 block 4,920,350 5 args
v252 block 5,163,656 5 args
v273 block 5,659,032 5 args
v290 block 5,947,548 5 args
v320 block 6,523,566 5 args
v334 block 6,811,690 5 args
v372 block 7,430,358 5 args
v385 block 7,782,670 5 args Current

Runtime Info

View Source
Pallet Index
7
Event Index
90
First Version
v233
Current Version
v393