reveal_weights

Call v151 → 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 Subnet/network identifier (0-65535)
1
uids
Vec<u16> Vecuids (Vec<u16>)
2
values
Vec<u16> Vecvalues (Vec<u16>)
3
salt
Vec<u16> Vecsalt (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 { 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 reveal_weights call
const netuid = 1;
const uids = 0;
const values = 0;
const salt = 0;
const version_key = 0;

const call = api.tx[stringCamelCase("SubtensorModule")][stringCamelCase("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

Runtime Info

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