set_weights

Call v101 → current #0

Sets validator weights for neurons on a subnet .

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: validatorssubnet ownersdevelopers

The Big Picture

Weight setting is the core job of a validator. You evaluate miners, score their work, and publish those scores as weights. The Yuma consensus aggregates all validators' weights to determine miner rankings and emissions. Good validators set honest weights and earn higher trust scores.

Why This Matters

Your weights directly control where emissions go. By evaluating miners honestly, you help the network reward quality work. Your own earnings depend on agreeing with consensus - validators who set accurate weights earn more.

Example Scenario

Your validator queries 100 miners on subnet 1, scoring their responses. You call set_weights with your evaluation: [UID 5: 0.3, UID 23: 0.5, UID 67: 0.2, ...]. Next epoch, Yuma consensus combines your weights with other validators to rank miners.

Common Questions

How often should I set weights?
As often as the rate limit allows. More frequent updates = more accurate miner rankings = better network performance.
What if my weights differ from consensus?
The Yuma consensus penalizes outliers. If you consistently disagree with the majority, your validator trust decreases and you earn less.

Use Cases

  • Submit miner evaluations after validation
  • Participate in Yuma consensus
  • Influence emission distribution on your subnet
Part of: Weight Management

Input Parameters

#NameTypeDescription
0
netuid
u16 Subnet ID to set weights on
1
dests
Vec<u16> VecTarget neuron UIDs to assign weights to
2
weights
Vec<u16> VecWeight values as u16 (÷65535 for [0,1] range)
3
version_key
u64 Version key to verify validator is up-to-date

Permissions

Origin
Unknown
Required Role
Authorization Checks
  • Hotkey must be registered on the target subnet
  • Hotkey must have a validator permit

Requirements

  • Caller is registered validator on subnet
  • Validator has sufficient stake
  • Weight setting not rate limited
  • Valid weight vector (correct UIDs and values)

Effects

Events Emitted

Storage Modified

Postconditions

  • Validator's weights updated
  • Weight version incremented
  • LastUpdate timestamp updated

Side Effects

  • Affects next epoch's incentive/dividend calculations
  • Impacts ranking and emissions for target neurons

Possible Errors

Code Examples

import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";

const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });

// Build set_weights call
const netuid = 1;
const dests = 0;
const weights = 0;
const version_key = 0;

const call = api.tx[stringCamelCase("SubtensorModule")][stringCamelCase("set_weights")](
  netuid,
  dests,
  weights,
  version_key
);

On-Chain Activity

Usage Frequency
●●●●●● Dominant >10M extrinsics

Highest-volume operations

#1 most used call

Success Rate Moderate

50–80% of submissions succeed

As of block 7,429,232

Runtime Info

View Source
Pallet Index
7
Call Index
0
First Version
v101
Current Version
v393