Transactions

unstake-all-alpha

Unstake all alpha from a hotkey across subnets (moves it to root).

View as Markdown

Sells every alpha position the signing coldkey holds on this hotkey and restakes the proceeds as TAO on the root network (netuid 0), instead of releasing them to the free balance. Subnets where subtoken trading is disabled or where the position fails validation are silently skipped. Use it to consolidate onto root while keeping funds staked; use unstake_all to exit to free balance instead. Each pool swap happens at the current price with no limit protection, so large positions can incur slippage.

SignerOriginPalletWraps
coldkeysigned account (pallet role may apply)SubtensorModuleSubtensorModule.unstake_all_alpha

Parameters

ParameterTypeRequiredDescription
hotkey_ss58stringyesHotkey whose alpha stake is moved to root.

Address parameters (--hotkey, --coldkey, --dest, ...) accept a raw ss58 address, an address-book or proxy-book name, or a local wallet/hotkey name.

CLI

Preview with --dry-run (shows fee, effects, and policy result without submitting), then submit:

btcli tx unstake-all-alpha \
  --hotkey <ss58|name> --dry-run
btcli tx unstake-all-alpha \
  --hotkey <ss58|name> -w my_coldkey

Python

import bittensor as bt
from bittensor.wallet import Wallet

wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = bt.UnstakeAllAlpha(hotkey_ss58="5F...")

sub = bt.Subtensor()
plan = sub.plan(intent, wallet)   # fee, effects, policy — no submission
result = sub.execute(intent, wallet)
if not result.success:
    print(result.error.code, result.error.remediation)

(bt.Subtensor is also the async client — async with bt.Subtensor() as client: — see The client.) Or build the intent by op name, as an agent would:

result = sub.execute_tool("unstake_all_alpha", {...}, wallet)

On-chain implementation

SubtensorModule.unstake_all_alphapallets/subtensor/src/macros/dispatches.rs#L1236:

#[pallet::call_index(84)]
#[pallet::weight(<T as crate::pallet::Config>::WeightInfo::unstake_all_alpha())]
pub fn unstake_all_alpha(origin: OriginFor<T>, hotkey: T::AccountId) -> DispatchResult {
    Self::do_unstake_all_alpha(origin, hotkey)
}

Delegates to do_unstake_all_alpha.

Every file is browsable under /code exactly as built into the runtime, or as plain text under /code/raw/<path> (index: /code/index.json).