# commit-weights (/docs/tx/commit-weights)

Encrypts the weights with drand timelock encryption and submits the
ciphertext; the weights stay hidden until the chain auto-decrypts and
applies them at the reveal round (no separate reveal call is needed).
Hiding weights until the round closes prevents other validators from
copying them. Signed by the hotkey, with the same preflight, conforming,
and rate-limit behavior as `set_weights`. Use `set_weights` instead
unless you need to force the commit path regardless of the subnet's
commit-reveal setting.

| Signer   | Pallet          | Wraps                                                 |
| -------- | --------------- | ----------------------------------------------------- |
| `hotkey` | SubtensorModule | `SubtensorModule.commit_timelocked_mechanism_weights` |

## Parameters [#parameters]

| Parameter               | Type             | Required | Description                                                                                                                                                                                                                           |
| ----------------------- | ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `netuid`                | integer          | yes      | Subnet whose miners the weights score.                                                                                                                                                                                                |
| `uids`                  | array of integer | no       | Miner UIDs being weighted, as a list parallel to weights. Omit when weights is given as a uid-to-weight mapping.                                                                                                                      |
| `weights`               | array of number  | no       | Relative weight per miner: either a JSON object mapping uid to weight, or a list parallel to uids. Values are relative, not absolute; they are clipped to the subnet's max-weight limit, normalized, and quantized before submission. |
| `mechid`                | integer          | no       | Mechanism index within the subnet. 0 is the default (and for most subnets the only) mechanism.                                                                                                                                        |
| `version_key`           | integer          | no       | Weights version key checked against the subnet's required version. Leave 0 unless the subnet owner requires a specific value.                                                                                                         |
| `commit_reveal_version` | integer          | no       | Commit-reveal protocol version to tag the commit with. Keep the default unless the subnet requires an older protocol.                                                                                                                 |

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 commit-weights \
  --netuid <int> --dry-run
btcli tx commit-weights \
  --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.CommitWeights(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("commit_weights", {...}, wallet)
```
