reveal_weights

Call v151 → v277, v290 → current #97

Reveals previously committed weights .

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: validatorsdevelopers

The Big Picture

The second half of commit-reveal. After committing your weight hash and waiting for the reveal window, you now publish the actual weights. The chain verifies they match your commit, then applies them like set_weights. This ensures you can't change your mind after seeing others' commits.

Why This Matters

Your reveal must exactly match your commit. If the hash doesn't verify, your reveal fails. This is the enforcement mechanism - you're locked into whatever you committed.

Example Scenario

You committed hash for weights [0.3, 0.5, 0.2] with salt 'random123'. The reveal window opens. Call reveal_weights(netuid=18, uids=[5,23,67], weights=[0.3,0.5,0.2], salt='random123'). Chain computes hash, verifies match, applies weights.

Common Questions

What if I lose my salt?
You can't reveal without it - the hash won't match. Store salt securely until reveal. Most validator software handles this automatically.
Can I reveal early?
No. Reveal is only valid during the reveal window. Too early = rejected. This prevents validators from seeing early reveals and adjusting.
What if the reveal window passes?
Your commit expires unused. No penalty, but your weights aren't counted for that epoch. Make sure your reveal transaction lands in time.

Use Cases

  • Complete the commit-reveal weight submission process
  • Publish weights after the commit window closes
  • Participate in MEV-resistant consensus

From Chain Metadata

- Used to reveal the weights for a previously committed hash.

Part of: Weight Management

Input Parameters

#NameTypeDescription
0
netuid
u16 NetUidnetuid: Subnet ID (u16, 0-65535)
1
uids
Vec<u16> Vec uids (Vec<u16>)
2
values
Vec<u16> Vec values (Vec<u16>)
3
salt
Vec<u16> Vec salt (Vec<u16>)
4
version_key
u64 version_key (u64)

Permissions

Origin
Signed
Required Role
Authorization Checks
  • Hotkey must be registered on the target subnet

Requirements

  • Commitment exists for this validator
  • Reveal matches commitment hash
  • Reveal within allowed time window

Effects

Postconditions

  • Weights applied (same as set_weights)
  • Commitment cleared

Side Effects

  • Same as set_weights

Possible Errors

Code Examples

import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443

const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);

// Build reveal_weights call (typed, named args)
const netuid = 1;
const uids = [] as [];
const values = [] as [];
const salt = [] as [];
const version_key = 0n;

const tx = api.tx.SubtensorModule.reveal_weights({
  netuid,
  uids,
  values,
  salt,
  version_key,
});

On-Chain Activity

Usage Frequency
●●●●○○ Active 100K–1M extrinsics

Significant regular use

#33 most used call

Success Rate Competitive

5–20% of submissions succeed — expect frequent failures

As of block 7,429,232

Version History

v151 block 3,157,274 5 args
v290 block 5,947,548 5 args Current

Runtime Info

View Source
Pallet Index
7
Call Index
97
First Version
v151
Current Version
v411