# remove-stake (/docs/tx/remove-stake)

Swaps the alpha position back to TAO at the current pool price and credits
it to the signing coldkey's free balance. Pass `all` to exit the entire
position on that hotkey and subnet (the build fails if nothing is staked
there). Like staking, the swap moves the pool, so large amounts incur
slippage — use `remove_stake_limit` to bound the price. The hotkey and
netuid must match where the stake is actually held, and the subnet must
have subtoken trading enabled. The requested amount is capped to the
stake currently available. A partial unstake must leave a remainder
worth at least 0.002 TAO at the simulated pool price — exit the full
position instead of leaving dust (`AmountTooLow`).

| Signer    | Pallet          | Wraps                          |
| --------- | --------------- | ------------------------------ |
| `coldkey` | SubtensorModule | `SubtensorModule.remove_stake` |

## Parameters [#parameters]

| Parameter      | Type              | Required | Description                                                       |
| -------------- | ----------------- | -------- | ----------------------------------------------------------------- |
| `hotkey_ss58`  | string            | yes      | Hotkey the stake is held on (the validator backing the position). |
| `netuid`       | integer           | yes      | Subnet the stake lives on (netuid 0 is the root network).         |
| `amount_alpha` | number \| `"all"` | yes      | How much to unstake from this position, or `all`.                 |

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

## CLI [#cli]

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

```bash
btcli tx remove-stake \
  --hotkey <ss58|name> \
  --netuid <int> \
  --amount-alpha <amount|all> --dry-run
btcli tx remove-stake \
  --hotkey <ss58|name> \
  --netuid <int> \
  --amount-alpha <amount|all> -w my_coldkey
```

## Python [#python]

```python
import bittensor as sub
from bittensor.wallet import Wallet

wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = sub.RemoveStake(hotkey_ss58="5F...", netuid=1, amount_alpha=1.0)

async with sub.Client("finney") as client:
    plan = await client.plan(intent, wallet)   # fee, effects, policy — no submission
    result = await client.execute(intent, wallet)
    if not result.success:
        print(result.error.code, result.error.remediation)
```

Or build it by op name, as an agent would:

```python
await client.execute_tool("remove_stake", {...}, wallet)
```
