# set-root-claim-type (/docs/tx/set-root-claim-type)

Controls what happens to root dividends when they are claimed (see
`claim_root`): `Swap` converts all alpha emission to TAO (the chain
default), `Keep` keeps everything as subnet alpha, and `KeepSubnets`
keeps alpha on the listed `subnets` while swapping the rest. The setting
is per-coldkey and persists until changed again; it does not move anything
already claimed. Read it back with the `root_claim_type` read.

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

## Parameters [#parameters]

| Parameter    | Type   | Required | Description                                                                                                                                                                                                                       |
| ------------ | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `claim_type` | string | no       | How root alpha emission is claimed. One of: Swap, Keep, KeepSubnets. Swap converts all alpha emission to TAO, Keep keeps everything as alpha, KeepSubnets keeps alpha only on the subnets given via --subnets and swaps the rest. |
| `subnets`    | array  | no       | Netuids to keep alpha on; required for KeepSubnets, invalid otherwise.                                                                                                                                                            |

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-root-claim-type --dry-run
btcli tx set-root-claim-type -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.SetRootClaimType()

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

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

`SubtensorModule.set_root_claim_type` — [`pallets/subtensor/src/macros/dispatches.rs#L1918`](/code/pallets/subtensor/src/macros/dispatches.rs#L1916-L1932):

```rust
#[pallet::call_index(122)]
#[pallet::weight(<T as crate::pallet::Config>::WeightInfo::set_root_claim_type())]
pub fn set_root_claim_type(
    origin: OriginFor<T>,
    new_root_claim_type: RootClaimTypeEnum,
) -> DispatchResult {
    let coldkey: T::AccountId = ensure_signed(origin)?;

    if let RootClaimTypeEnum::KeepSubnets { subnets } = &new_root_claim_type {
        ensure!(!subnets.is_empty(), Error::<T>::InvalidSubnetNumber);
    }

    Self::maybe_add_coldkey_index(&coldkey);

    Self::change_root_claim_type(&coldkey, new_root_claim_type);
    Ok(())
}
```

Delegates to [`maybe_add_coldkey_index`](/code/pallets/subtensor/src/staking/claim_root.rs#L389), [`change_root_claim_type`](/code/pallets/subtensor/src/staking/claim_root.rs#L450).

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