# set-root-weights (/docs/tx/set-root-weights)

Declares the root validator's dividend distribution vector: each epoch
the chain sells the validator's root alpha dividend for TAO and splits it
across the listed subnets in proportion to these weights, buying each
subnet's alpha into the validator's basket — the escrowed
per-validator index fund that root stakers redeem with
`claim_root_with_hotkey` (or coldkey-wide `claim_root`).
Netuid 0 is a valid destination: that share is held as TAO (root stake)
instead of subnet alpha, letting a validator keep part of the basket out
of subnet exposure. Weights are relative; they are max-upscaled and
quantized to u16 before submission, and zero weights are dropped. Signed
by the hotkey, which must be registered on the root network and hold the
minimum stake to set weights; the root weights rate limit applies, and
every destination must be netuid 0 or an existing subnet. At least 8
positive destinations are required (softened when fewer networks exist).
Validators with no stored root weights accumulate dividends in place —
each subnet's dividend stays in that subnet's alpha, trade-free; setting
this vector is what turns on the sell-and-redeploy engine.
Weight setting launched gated off network-wide (every call fails with
`RootWeightSettingDisabled` until governance or a later upgrade enables
it), so all funds start on the null accumulate strategy.
Read it back with the `validator_root_weights` read.

| Signer   | Origin                                 | Pallet          | Wraps                                                                                           |
| -------- | -------------------------------------- | --------------- | ----------------------------------------------------------------------------------------------- |
| `hotkey` | signed account (pallet role may apply) | SubtensorModule | [`SubtensorModule.set_root_weights`](/code/pallets/subtensor/src/macros/dispatches.rs#L92-L100) |

## Parameters [#parameters]

| Parameter | Type             | Required | Description                                                                                                                                                                  |
| --------- | ---------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `netuids` | array of integer | no       | Destination subnets, as a list parallel to weights (0 = hold as TAO / root stake). Omit when weights is given as a netuid-to-weight mapping.                                 |
| `weights` | array of number  | no       | Relative weight per destination subnet: either a JSON object mapping netuid to weight, or a list parallel to netuids. Values are normalized and quantized before submission. |

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-weights --dry-run
btcli tx set-root-weights -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.SetRootWeights()

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

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

`SubtensorModule.set_root_weights` — [`pallets/subtensor/src/macros/dispatches.rs#L94`](/code/pallets/subtensor/src/macros/dispatches.rs#L92-L100):

```rust
#[pallet::call_index(146)]
#[pallet::weight((<T as crate::pallet::Config>::WeightInfo::set_weights(), DispatchClass::Normal, Pays::No))]
pub fn set_root_weights(
    origin: OriginFor<T>,
    dests: Vec<u16>,
    weights: Vec<u16>,
) -> DispatchResult {
    Self::do_set_root_weights(origin, dests, weights)
}
```

Delegates to [`do_set_root_weights`](/code/pallets/subtensor/src/subnets/weights.rs#L881).

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