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

Hands the position itself to the destination coldkey: after this call that
coldkey — not you — controls and can unstake those funds, so this is a
transfer of value and is irreversible. Double-check the destination
address. The stake stays on the same hotkey by default; pass a destination
hotkey to re-delegate it in the same call (dispatched as
`transfer_stake_and_hotkey`). It can also land on a different subnet,
swapping through both pools (with slippage) when the netuids differ. Fails
with `TransferDisallowed` when the subnet owner has disabled stake
transfers on the origin or destination subnet. A spend-cap policy treats
this as an unbounded spend and blocks it until the cap is raised. Use
`move_stake` to re-delegate without changing owners.

| Signer    | Origin                                 | Pallet          | Wraps                                                                                                                                                                                                         |
| --------- | -------------------------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `coldkey` | signed account (pallet role may apply) | SubtensorModule | [`SubtensorModule.transfer_stake`](/code/pallets/subtensor/src/macros/dispatches.rs#L1299-L1317), [`SubtensorModule.transfer_stake_and_hotkey`](/code/pallets/subtensor/src/macros/dispatches.rs#L2383-L2403) |

## Parameters [#parameters]

| Parameter           | Type              | Required | Description                                                                                                                                            |
| ------------------- | ----------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `dest_coldkey_ss58` | string            | yes      | Coldkey that becomes the new owner of the stake.                                                                                                       |
| `hotkey_ss58`       | string            | yes      | Hotkey the stake is held on (the validator backing the position).                                                                                      |
| `origin_netuid`     | integer           | yes      | Subnet the stake currently sits on.                                                                                                                    |
| `dest_netuid`       | integer           | yes      | Subnet the stake ends up on. When it differs from the origin, the position is swapped through both subnet pools, which can incur slippage on each leg. |
| `amount_alpha`      | number \| `"all"` | yes      | How much of the position to hand over (an explicit amount; `all` is not accepted).                                                                     |
| `dest_hotkey_ss58`  | string            | no       | Hotkey the stake lands on. Defaults to the origin hotkey (the position stays with the same validator).                                                 |

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 transfer-stake \
  --dest-coldkey <ss58|name> \
  --hotkey <ss58|name> \
  --origin-netuid <int> \
  --dest-netuid <int> \
  --amount-alpha <amount|all> --dry-run
btcli tx transfer-stake \
  --dest-coldkey <ss58|name> \
  --hotkey <ss58|name> \
  --origin-netuid <int> \
  --dest-netuid <int> \
  --amount-alpha <amount|all> -w my_coldkey
```

## Python [#python]

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

wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = bt.TransferStake(dest_coldkey_ss58="5F...", hotkey_ss58="5F...", origin_netuid=0, dest_netuid=0, amount_alpha=1.0)

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](/docs/concepts/client).) Or build the intent by op name, as
an agent would:

```python
result = sub.execute_tool("transfer_stake", {...}, wallet)
```

## On-chain implementation [#on-chain-implementation]

`SubtensorModule.transfer_stake` — [`pallets/subtensor/src/macros/dispatches.rs#L1301`](/code/pallets/subtensor/src/macros/dispatches.rs#L1299-L1317):

```rust
#[pallet::call_index(86)]
#[pallet::weight(<T as crate::pallet::Config>::WeightInfo::transfer_stake())]
pub fn transfer_stake(
    origin: OriginFor<T>,
    destination_coldkey: T::AccountId,
    hotkey: T::AccountId,
    origin_netuid: NetUid,
    destination_netuid: NetUid,
    alpha_amount: AlphaBalance,
) -> DispatchResult {
    Self::do_transfer_stake(
        origin,
        destination_coldkey,
        hotkey,
        origin_netuid,
        destination_netuid,
        alpha_amount,
    )
}
```

Delegates to [`do_transfer_stake`](/code/pallets/subtensor/src/staking/move_stake.rs#L120).

`SubtensorModule.transfer_stake_and_hotkey` — [`pallets/subtensor/src/macros/dispatches.rs#L2385`](/code/pallets/subtensor/src/macros/dispatches.rs#L2383-L2403):

```rust
#[pallet::call_index(143)]
#[pallet::weight(<T as crate::pallet::Config>::WeightInfo::transfer_stake_and_hotkey())]
pub fn transfer_stake_and_hotkey(
    origin: OriginFor<T>,
    destination_coldkey: T::AccountId,
    origin_hotkey: T::AccountId,
    destination_hotkey: T::AccountId,
    origin_netuid: NetUid,
    destination_netuid: NetUid,
    alpha_amount: AlphaBalance,
) -> DispatchResult {
    Self::do_transfer_stake_and_hotkey(
        origin,
        destination_coldkey,
        origin_hotkey,
        destination_hotkey,
        origin_netuid,
        destination_netuid,
        alpha_amount,
    )
}
```

Delegates to [`do_transfer_stake_and_hotkey`](/code/pallets/subtensor/src/staking/move_stake.rs#L193).

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