unstake_all
Call v233 → current #83Removes all stake from a hotkey back to the coldkey .
View calls on chainCall Workflow
Click items to navigate. Pan and zoom to explore.
The Big Picture
Sometimes you need a clean break. unstake_all empties your entire stake from a hotkey without needing to specify exact amounts. No dust left behind, no partial positions to track. Clean exit.
Why This Matters
Tracking exact stake amounts across subnets is tedious. When you want out of a position entirely, unstake_all handles the math. It's the 'close position' button.
Example Scenario
You delegated to a validator 6 months ago. They've underperformed, and you want out. Your original 100 TAO has grown/shrunk with Alpha. Call unstake_all(hotkey=validator). All your stake converts to TAO (say 87 TAO) and returns to your coldkey. Position closed.
Common Questions
- Is this the same as unstaking for the max amount?
- Functionally yes, but unstake_all is cleaner - you don't need to query your exact balance first. It handles whatever amount exists.
- What if I have stake on multiple subnets with this hotkey?
- unstake_all removes stake from all subnets for that hotkey-coldkey pair. You'll receive TAO for all of it.
Use Cases
- Completely exit a validator position
- Close out stake before swapping coldkey
- Emergency withdrawal when validator misbehaves
- Simplify portfolio by removing small positions entirely
From Chain Metadata
- The implementation for the extrinsic unstake_all: Removes all stake from a hotkey account across all subnets and adds it onto a coldkey.
Input Parameters
| # | Name | Type | Description |
|---|---|---|---|
| 0 | hotkey | AccountId | Hot wallet address (active operations) (hex -> SS58) |
Permissions
Permission data inferred from metadata. May be incomplete.
Requirements
- Hotkey has stake from this coldkey
- Coldkey is associated with the hotkey
Effects
Events Emitted
Storage Modified
Postconditions
- Coldkey balance increased by total unstaked amount
- Hotkey's stake from this coldkey is zero
- Network's TotalStake decreased
Side Effects
- May remove hotkey from validator set
- May remove coldkey from StakingHotkeys
Possible Errors
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 });
// Build unstake_all call
const hotkey = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const call = api.tx[stringCamelCase("SubtensorModule")][stringCamelCase("unstake_all")](
hotkey
);On-Chain Activity
Primary protocol calls
#16 most used call
Over 95% of submissions succeed
As of block 7,429,232
Runtime Info
View Source- Pallet Index
- 7
- Call Index
- 83
- First Version
- v233
- Current Version
- v393