Transactions

commit-weight-hash

Submit a legacy salt-based weight hash for one subnet mechanism.

View as Markdown

Use this only with the legacy commit/reveal protocol, followed by RevealWeights with the same mechanism, uids, values, salt, and version key. Most validators should use CommitWeights for a timelocked commit or SetWeights to select the subnet's configured path automatically. With for_hotkey, the signing hotkey must be that validator's authorized delegate on this mechanism; the delegate pays the normal transaction fee.

SignerOriginPalletWraps
hotkeysigned account (pallet role may apply)SubtensorModuleSubtensorModule.commit_mechanism_weights, SubtensorModule.commit_mechanism_weights_for

Parameters

ParameterTypeRequiredDescription
netuidintegeryesSubnet whose miners the weights score.
commit_hashstringyesLegacy weight commit hash (0x-prefixed H256).
mechidintegernoMechanism index within the subnet. 0 is the default (and for most subnets the only) mechanism.
for_hotkeystringnoValidator hotkey to act for. Requires the hotkey to have authorized the signing hotkey as its weight delegate on this netuid and mechanism; normal transaction fees are paid by the delegate.

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-weight-hash \
  --netuid <int> \
  --commit-hash <value> --dry-run
btcli tx commit-weight-hash \
  --netuid <int> \
  --commit-hash <value> -w my_coldkey

Python

import bittensor as bt
from bittensor.wallet import Wallet

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

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

On-chain implementation

SubtensorModule.commit_mechanism_weights — pallets/subtensor/src/macros/dispatches.rs#L214:

#[pallet::call_index(115)]
#[pallet::weight((<T as Config>::WeightInfo::commit_mechanism_weights(), DispatchClass::Normal, Pays::No))]
pub fn commit_mechanism_weights(
    origin: OriginFor<T>,
    netuid: NetUid,
    mecid: MechId,
    commit_hash: H256,
) -> DispatchResult {
    Self::do_commit_mechanism_weights(origin, netuid, mecid, commit_hash)
}

Delegates to do_commit_mechanism_weights.

SubtensorModule.commit_mechanism_weights_for — pallets/subtensor/src/macros/dispatches.rs#L3320:

#[pallet::call_index(172)]
#[pallet::weight((<T as Config>::WeightInfo::commit_mechanism_weights().saturating_add(T::DbWeight::get().reads(4)), DispatchClass::Normal, Pays::Yes))]
pub fn commit_mechanism_weights_for(
    origin: OriginFor<T>,
    netuid: NetUid,
    mecid: MechId,
    hotkey: T::AccountId,
    commit_hash: H256,
) -> DispatchResult {
    Self::do_commit_mechanism_weights_for(origin, netuid, mecid, hotkey, commit_hash)
}

Delegates to do_commit_mechanism_weights_for.

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