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

Pays out the signing coldkey's accrued root-stake dividends from the listed
subnets. What the payout looks like depends on the coldkey's root claim
type (see `set_root_claim_type`): swapped to TAO, kept as subnet alpha,
or a per-subnet mix. At most 5 subnets per call — an empty or longer list
fails with `InvalidSubnetNumber`. Subnets whose accrued dividends are
below the per-subnet claim threshold (default 500,000 rao; adjustable by
the subnet owner or root) are silently skipped while the transaction
still succeeds. Unclaimed dividends simply keep accruing — there is no
deadline — but each call pays out only the subnets listed.

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

## Parameters [#parameters]

| Parameter | Type             | Required | Description                                                           |
| --------- | ---------------- | -------- | --------------------------------------------------------------------- |
| `subnets` | array of integer | yes      | Netuids to claim accumulated root dividends from; at most 5 per call. |

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 claim-root \
  --subnets <a,b,c> --dry-run
btcli tx claim-root \
  --subnets <a,b,c> -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.ClaimRoot(subnets=[...])

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

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

`SubtensorModule.claim_root` — [`pallets/subtensor/src/macros/dispatches.rs#L1891`](/code/pallets/subtensor/src/macros/dispatches.rs#L1889-L1907):

```rust
#[pallet::call_index(121)]
#[pallet::weight(<T as crate::pallet::Config>::WeightInfo::claim_root())]
pub fn claim_root(
    origin: OriginFor<T>,
    subnets: BTreeSet<NetUid>,
) -> DispatchResultWithPostInfo {
    let coldkey: T::AccountId = ensure_signed(origin)?;

    ensure!(!subnets.is_empty(), Error::<T>::InvalidSubnetNumber);
    ensure!(
        subnets.len() <= MAX_SUBNET_CLAIMS,
        Error::<T>::InvalidSubnetNumber
    );

    Self::maybe_add_coldkey_index(&coldkey);

    let weight = Self::do_root_claim(coldkey, Some(subnets))?;
    Ok((Some(weight), Pays::Yes).into())
}
```

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

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