Transactions

commit-weights

Timelock-encrypt and commit weights, forcing the commit-reveal path.

View as Markdown

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.

SignerOriginPalletWraps
hotkeysigned account (pallet role may apply)SubtensorModuleSubtensorModule.commit_timelocked_mechanism_weights

Parameters

ParameterTypeRequiredDescription
netuidintegeryesSubnet whose miners the weights score.
uidsarray of integernoMiner UIDs being weighted, as a list parallel to weights. Omit when weights is given as a uid-to-weight mapping.
weightsarray of numbernoRelative 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.
mechidintegernoMechanism index within the subnet. 0 is the default (and for most subnets the only) mechanism.
version_keyintegernoWeights version key checked against the subnet's required version. Leave 0 unless the subnet owner requires a specific value.
commit_reveal_versionintegernoCommit-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

Preview with --dry-run (shows fee, effects, and policy result without submitting), then submit:

btcli tx commit-weights \
  --netuid <int> --dry-run
btcli tx commit-weights \
  --netuid <int> -w my_coldkey

Python

import bittensor as bt
from bittensor.wallet import Wallet

wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = bt.CommitWeights(netuid=1)

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.) Or build the intent by op name, as an agent would:

result = sub.execute_tool("commit_weights", {...}, wallet)

On-chain implementation

SubtensorModule.commit_timelocked_mechanism_weightspallets/subtensor/src/macros/dispatches.rs#L1852:

#[pallet::call_index(118)]
#[pallet::weight((<T as Config>::WeightInfo::commit_timelocked_mechanism_weights(), DispatchClass::Normal, Pays::No))]
pub fn commit_timelocked_mechanism_weights(
    origin: OriginFor<T>,
    netuid: NetUid,
    mecid: MechId,
    commit: BoundedVec<u8, ConstU32<MAX_CRV3_COMMIT_SIZE_BYTES>>,
    reveal_round: u64,
    commit_reveal_version: u16,
) -> DispatchResult {
    Self::do_commit_timelocked_mechanism_weights(
        origin,
        netuid,
        mecid,
        commit,
        reveal_round,
        commit_reveal_version,
    )
}

Delegates to do_commit_timelocked_mechanism_weights.

Every file is browsable under /code exactly as built into the runtime, or as plain text under /code/raw/<path> (index: /code/index.json).