StakeSwapped

Event v233 → v247, v252 → v265, v273 → v277, v290 → v298, v301 → v315, v320 → v326, v334 → v367, v372 → v377, v385 → v385, v391 → v402, v411 → v422, v423 → v424, v432 → v440, v441 → current #93

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)

Migration Notes

v424 v432 Breaking

arg2 changed from u16 to NetUid; arg3 changed from u16 to NetUid; arg4 changed from u64 to TaoBalance

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.

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
→ coldkey
AccountId Coldkey performing the swap (held constant) (hex -> SS58)
1
arg1
→ hotkey
AccountId Hotkey (held constant — swap only changes netuid) (hex -> SS58)
2
arg2
→ origin_netuid
NetUid Subnet swapped FROM
3
arg3
→ destination_netuid
NetUid Subnet swapped TO
4
arg4
→ amount_tao
TaoBalance Net TAO realised crossing subnets, post-fee (RAO): the unstake leg amount_paid_out from v290, tao_unstaked minus the flat TAO staking fee v233 through v277. A same-subnet swap takes the transfer_stake_within_subnet path and emits the price-equivalent TAO.

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);

// Subscribe to StakeSwapped events
client.finalizedBlock$.subscribe(async (block) => {
  const events = await api.event.SubtensorModule.StakeSwapped.get(block.hash);
  for (const evt of events) {
    console.log("StakeSwapped:", evt.payload);
  }
});

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
v301 block 6,205,194 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
v391 block 7,782,857 5 args
v411 block 8,283,784 5 args
v423 block 8,486,593 5 args
v432 block 8,636,190 5 args
v441 block 8,765,683 5 args Current

Runtime Info

View Source
Pallet Index
7
Event Index
93
First Version
v233
Current Version
v472