set_commitment

Call v140 → v277, v290 → current #0

Stores on-chain commitment data for an account on a specific subnet .

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: validatorsminersdevelopers

The Big Picture

The Commitments pallet provides on-chain storage for arbitrary account metadata. Unlike identity which is global, commitments are per-subnet, allowing miners and validators to publish subnet-specific information. This is commonly used for serving endpoints, public keys, or other metadata that participants need to discover each other.

Why This Matters

How do clients find your miner? How do validators know where to query you? Commitments store this discovery information on-chain, ensuring anyone can find it without centralized infrastructure.

Example Scenario

You run a miner on subnet 3 and want validators to find your axon endpoint. You call set_commitment(netuid=3, info={...endpoint data...}). Now anyone can query CommitmentOf for your account on subnet 3 to discover your endpoint.

Common Questions

What's the difference between commitments and identity?
Identity is global account metadata. Commitments are per-subnet, allowing different info for different subnets you participate in.
Is there a size limit?
Yes, MaxSpace limits total bytes per account per interval. MaxFields limits the number of fields. This prevents spam and ensures fair chain resource usage.
What are timelocked commitments?
You can include encrypted data that auto-decrypts at a future block using drand randomness. Useful for commit-reveal schemes where you want to hide data until a specific time.

Use Cases

  • Store metadata that identifies a validator or miner
  • Commit to data that will be revealed later (commit-reveal schemes)
  • Attach timelocked encrypted data for future decryption
  • Store serving endpoints or configuration metadata

From Chain Metadata

Set the commitment for a given netuid

Part of: On-Chain Commitments

Input Parameters

#NameTypeDescription
0
netuid
u16 NetUidnetuid: Subnet ID (u16, 0-65535)
1
info
CommitmentInfo info (CommitmentInfo)

Permissions

Origin
Unknown
Required Role

Permission data inferred from metadata. May be incomplete.

Requirements

  • Signer is registered on the specified subnet
  • Commitment info has at most MaxFields additional fields
  • Used space doesn't exceed MaxSpace limit for the current interval

Effects

Postconditions

  • Commitment is stored in CommitmentOf storage
  • LastCommitment block number is updated
  • UsedSpaceOf tracks bytes used for rate limiting

Side Effects

  • May overwrite previous commitment for same account/subnet
  • TimelockedIndex updated if commitment has timelocked fields

Code Examples

// ----------------------------------------------------------------------
// HEADS UP: 1 arg below has a complex type with no usable default.
// Look for `undefined as any` and replace it with real value
// before running — the snippet compiles, but will fail at runtime as-is.
// ----------------------------------------------------------------------
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 set_commitment call (typed, named args)
const netuid = 1;
const info = undefined as any /* CommitmentInfo — replace with real value */;

const tx = api.tx.Commitments.set_commitment({
  netuid,
  info,
});

On-Chain Activity

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

Highest-volume operations

#4 most used call

Success Rate Challenging

20–50% of submissions succeed

As of block 7,429,232

Version History

v140 block 1,929,216 2 args
v290 block 5,947,548 2 args Current

Runtime Info

View Source
Pallet Index
18
Call Index
0
First Version
v140
Current Version
v411