# set-auto-stake (/docs/tx/set-auto-stake)

Sets the coldkey's autostake destination for the subnet: all future
rewards earned there are automatically staked to the chosen hotkey
(defaulting to the wallet's own hotkey) instead of accumulating unstaked.
A configuration change only — it moves no funds by itself and applies just
to that subnet. The hotkey must be registered on the subnet
(`HotKeyNotRegisteredInSubNet`), and setting the hotkey that is
already the destination fails (`SameAutoStakeHotkeyAlreadySet`). Call
it again with a different hotkey to redirect; read the current setting
back with the `auto_stake` read.

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

## Parameters [#parameters]

| Parameter     | Type    | Required | Description                                                            |
| ------------- | ------- | -------- | ---------------------------------------------------------------------- |
| `netuid`      | integer | yes      | Subnet whose future rewards are auto-staked.                           |
| `hotkey_ss58` | string  | no       | Hotkey the rewards are staked to. Defaults to the wallet's own hotkey. |

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 set-auto-stake \
  --netuid <int> --dry-run
btcli tx set-auto-stake \
  --netuid <int> -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.SetAutoStake(netuid=1)

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("set_auto_stake", {...}, wallet)
```
