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

Spends TAO from the signing coldkey to buy the subnet's alpha and burn it,
reducing alpha supply (a buyback-and-burn) rather than adding to the
signer's stake. The TAO is spent permanently — nothing lands in your stake,
so this is not an investment call; use a regular add-stake intent to
acquire a position. Fails on the root subnet
(`CannotBurnOrRecycleOnRootSubnet`). The chain accepts an optional
limit (omitted = market order), but this intent always requires
`limit_price` and executes all-or-nothing: the swap fails instead of
partially filling at a worse rate. Counts against a configured spend
cap.

| Signer    | Origin                                 | Pallet          | Wraps                                                                                            |
| --------- | -------------------------------------- | --------------- | ------------------------------------------------------------------------------------------------ |
| `coldkey` | signed account (pallet role may apply) | SubtensorModule | [`SubtensorModule.add_stake_burn`](/code/pallets/subtensor/src/macros/dispatches.rs#L2168-L2178) |

## Parameters [#parameters]

| Parameter     | Type              | Required | Description                                                                            |
| ------------- | ----------------- | -------- | -------------------------------------------------------------------------------------- |
| `netuid`      | integer           | yes      | Subnet whose alpha is bought and burned.                                               |
| `amount_tao`  | number \| `"all"` | yes      | Spent from the coldkey to buy alpha that is then burned.                               |
| `limit_price` | integer           | yes      | Worst acceptable price in rao per alpha; the call fails rather than filling beyond it. |
| `hotkey_ss58` | string            | no       | Hotkey the burn is routed through; defaults to the wallet's 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 stake-burn \
  --netuid <int> \
  --amount-tao <amount|all> \
  --limit-price <int> --dry-run
btcli tx stake-burn \
  --netuid <int> \
  --amount-tao <amount|all> \
  --limit-price <int> -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.StakeBurn(netuid=1, amount_tao=1.0, limit_price=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("stake_burn", {...}, wallet)
```

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

`SubtensorModule.add_stake_burn` — [`pallets/subtensor/src/macros/dispatches.rs#L2170`](/code/pallets/subtensor/src/macros/dispatches.rs#L2168-L2178):

```rust
#[pallet::call_index(132)]
#[pallet::weight(<T as crate::pallet::Config>::WeightInfo::add_stake_burn())]
pub fn add_stake_burn(
    origin: OriginFor<T>,
    hotkey: T::AccountId,
    netuid: NetUid,
    amount: TaoBalance,
    limit: Option<TaoBalance>,
) -> DispatchResult {
    Self::do_add_stake_burn(origin, hotkey, netuid, amount, limit)
}
```

Delegates to [`do_add_stake_burn`](/code/pallets/subtensor/src/staking/recycle_alpha.rs#L131).

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)).
