All pallets

Commitments docs

Look up any call, event, or storage item with code examples. Runtime v472 · Block #9,197,056

Developer documentation for the Commitments pallet of the Subtensor blockchain, part of the Bittensor decentralized AI network. This page is designed for developers integrating with the chain: look up any call, event, or storage item, copy code examples in TypeScript, Python, or Rust, and filter by your role. For in-depth explanations, version history, and relationships between items, see the Reference section.

Commitments

Set the commitment for a given netuid

Index: 18 22 items

Calls 2

set_commitment

call details

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

Parameters

NameTypeFormatDescription
netuidNetUid—netuid: Subnet ID (u16, 0-65535)
infoCommitmentInfo—info (CommitmentInfo)
// ----------------------------------------------------------------------
// 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,
});

set_max_space

call details

Sets the maximum commitment space per account (sudo only).

Parameters

NameTypeFormatDescription
new_limitu32Integernew_limit (u32)
Modifies: MaxSpace
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_max_space call (typed, named args)
const new_limit = 0;

const tx = api.tx.Commitments.set_max_space({
  new_limit,
});

Events 4

Commitment

event details

Emitted when an account sets a commitment for a subnet.

When it fires

  • Account is registered on the subnet
  • Commitment data within size limits

Fields

NameTypeFormatDescription
netuidNetUid—Subnet ID where commitment was made
accountAccountIdSS58 AddressAccount that set the commitment
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);

// Subscribe to Commitment events
client.finalizedBlock$.subscribe(async (block) => {
  const events = await api.event.Commitments.Commitment.get(block.hash);
  for (const evt of events) {
    console.log("Commitment:", evt.payload);
  }
});

TimelockCommitment

event details

Emitted when an account sets a timelocked commitment.

When it fires

  • Account is registered on the subnet
  • Commitment includes timelocked fields with future reveal round

Fields

NameTypeFormatDescription
netuidNetUid—Subnet ID where timelocked commitment was made
accountAccountIdSS58 AddressAccount that set the timelocked commitment
reveal_roundu64IntegerDrand beacon round when data will auto-reveal
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);

// Subscribe to TimelockCommitment events
client.finalizedBlock$.subscribe(async (block) => {
  const events = await api.event.Commitments.TimelockCommitment.get(block.hash);
  for (const evt of events) {
    console.log("TimelockCommitment:", evt.payload);
  }
});

CommitmentRevealed

event details

Emitted when a timelocked commitment is auto-revealed.

When it fires

  • Timelocked commitment exists for the account/subnet
  • Drand reveal round has been reached
  • Decryption successful with drand beacon entropy

Fields

NameTypeFormatDescription
netuidNetUid—Subnet ID where commitment was revealed
accountAccountIdSS58 AddressAccount whose commitment was revealed
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);

// Subscribe to CommitmentRevealed events
client.finalizedBlock$.subscribe(async (block) => {
  const events = await api.event.Commitments.CommitmentRevealed.get(block.hash);
  for (const evt of events) {
    console.log("CommitmentRevealed:", evt.payload);
  }
});

CommitmentRevealFailed

event details

Emitted when a timelock-encrypted commitment could not be revealed and was left in place.

When it fires

  • A timelocked commitment exists for the account and subnet
  • The runtime attempted the reveal for that drand round
  • Either the drand round has aged past the oldest round the chain still keeps, or decryption of the field failed

Fields

NameTypeFormatDescription
netuidNetUid—netuid: Subnet ID (u16, 0-65535)
whoAccountIdSS58 Addresswho: Account address (32 bytes, SS58-encoded)
reveal_roundu64Integerreveal_round (u64)
errorRevealFailure—error (RevealFailure)
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);

// Subscribe to CommitmentRevealFailed events
client.finalizedBlock$.subscribe(async (block) => {
  const events = await api.event.Commitments.CommitmentRevealFailed.get(block.hash);
  for (const evt of events) {
    console.log("CommitmentRevealFailed:", evt.payload);
  }
});

Storage 8

CommitmentOf

storage details

Stores commitment data for an account on a specific subnet.

Modifier: Optional Keys: 2 Returns: Registration

Keys

NameTypeFormatDescription
key1NetUid——
key2AccountIdSS58 Address—
Modified by: set_commitment
// ----------------------------------------------------------------------
// 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);

// Query CommitmentOf storage
const key1 = undefined as any /* NetUid — replace with real value */;
const key2 = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";

const result = await api.query.Commitments.CommitmentOf.getValue(key1, key2);
console.log("CommitmentOf:", result);

LastBondsReset

storage details

Block number of the last bonds reset for an account on a subnet.

Modifier: Optional Keys: 2 Returns: u32 (Integer)

Keys

NameTypeFormatDescription
key1NetUid——
key2AccountIdSS58 Address—
// ----------------------------------------------------------------------
// 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);

// Query LastBondsReset storage
const key1 = undefined as any /* NetUid — replace with real value */;
const key2 = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";

const result = await api.query.Commitments.LastBondsReset.getValue(key1, key2);
console.log("LastBondsReset:", result);

LastCommitment

storage details

Block number of the last commitment update for an account on a subnet.

Modifier: Optional Keys: 2 Returns: u32 (Integer)

Keys

NameTypeFormatDescription
key1NetUid——
key2AccountIdSS58 Address—
Modified by: set_commitment
// ----------------------------------------------------------------------
// 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);

// Query LastCommitment storage
const key1 = undefined as any /* NetUid — replace with real value */;
const key2 = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";

const result = await api.query.Commitments.LastCommitment.getValue(key1, key2);
console.log("LastCommitment:", result);

MaxSpace

storage details

Maximum commitment space per account per rate limit interval.

Modifier: Default Keys: 0 Returns: u32 (Integer)
Modified by: set_max_space
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);

// Query MaxSpace storage (no keys - plain value)
const result = await api.query.Commitments.MaxSpace.getValue();
console.log("MaxSpace:", result);

RevealedCommitments

storage details

Stores revealed timelocked commitment data after auto-reveal.

Modifier: Optional Keys: 2 Returns: Vec<(Vec<u8>, u64)> (Array of (Vec<u8>, u64))

Keys

NameTypeFormatDescription
key1NetUid——
key2AccountIdSS58 Address—
// ----------------------------------------------------------------------
// 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);

// Query RevealedCommitments storage
const key1 = undefined as any /* NetUid — replace with real value */;
const key2 = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";

const result = await api.query.Commitments.RevealedCommitments.getValue(key1, key2);
console.log("RevealedCommitments:", result);

TimelockedIndex

storage details

Tracks all commitments that have timelocked fields pending reveal.

Modifier: Default Keys: 0 Returns: BTreeSet
Modified by: set_commitment
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);

// Query TimelockedIndex storage (no keys - plain value)
const result = await api.query.Commitments.TimelockedIndex.getValue();
console.log("TimelockedIndex:", result);

TimelockRevealCursor

storage details

Where the last timelock reveal pass stopped when it ran out of decryption budget.

Modifier: Optional Keys: 0 Returns: (NetUid, AccountId)
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);

// Query TimelockRevealCursor storage (no keys - plain value)
const result = await api.query.Commitments.TimelockRevealCursor.getValue();
console.log("TimelockRevealCursor:", result);

UsedSpaceOf

storage details

Tracks commitment space usage for rate limiting.

Modifier: Optional Keys: 2 Returns: UsageTracker

Keys

NameTypeFormatDescription
key1NetUid——
key2AccountIdSS58 Address—
Modified by: set_commitment
// ----------------------------------------------------------------------
// 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);

// Query UsedSpaceOf storage
const key1 = undefined as any /* NetUid — replace with real value */;
const key2 = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";

const result = await api.query.Commitments.UsedSpaceOf.getValue(key1, key2);
console.log("UsedSpaceOf:", result);

Constants 3

FieldDeposit

constant details

Additional deposit per field in commitment.

Type: TaoBalance
Value: "0"
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);

// Query FieldDeposit constant
const value = await api.constants.Commitments.FieldDeposit();
console.log("FieldDeposit:", value);
// Balance: divide by 10^9 for TAO
const tao = value / 1_000_000_000n;

InitialDeposit

constant details

Deposit required to register a commitment identity.

Type: TaoBalance
Value: "0"
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);

// Query InitialDeposit constant
const value = await api.constants.Commitments.InitialDeposit();
console.log("InitialDeposit:", value);
// Balance: divide by 10^9 for TAO
const tao = value / 1_000_000_000n;

MaxFields

constant details

Maximum number of additional fields in a commitment.

Type: u32
Value: 3
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);

// Query MaxFields constant
const value = await api.constants.Commitments.MaxFields();
console.log("MaxFields:", value);

Errors 5

TooManyFieldsInCommitmentInfo

error details #0

Your commitment contains more fields than the maximum allowed.

Common Causes

  • Trying to include too many data fields in commitment
  • Exceeding MaxFields constant

How to Fix

Check Commitments.MaxFields constant for the limit,Reduce the number of fields in your commitment

AccountNotAllowedCommit

error details #1

Your account is not allowed to make commitments to this subnet.

Common Causes

  • Account not registered on the subnet
  • Subnet has commitment restrictions

How to Fix

Register on the subnet first,Check if subnet allows public commitments

SpaceLimitExceeded

error details #2

You've exceeded your commitment space quota for this interval.

Common Causes

  • Committing too much data too quickly
  • Commitment data size exceeds MaxSpace

How to Fix

Wait for rate limit window to reset,Reduce commitment data size,Check UsedSpaceOf for current usage

UnexpectedUnreserveLeftover

error details #3

An internal error occurred when unreserving deposit funds.

Common Causes

  • Rare edge case in deposit accounting
  • Chain state inconsistency

How to Fix

Retry the operation,Report if persistent

TimelockRevealFailedNotAllowed

error details #4

The submitted commitment contains a TimelockRevealFailed field. Only the runtime creates those, so an extrinsic carrying one is rejected.

Common Causes

  • Reading an existing commitment, modifying part of it, and resubmitting the whole structure including a runtime-written failure marker
  • Round-tripping commitment data through a client that treats every Data variant as user-settable

How to Fix

Strip any TimelockRevealFailed field before resubmitting,Build the commitment from the fields you intend to set rather than from a previous read,Submit fresh timelocked data as a TimelockEncrypted field if the earlier reveal failed