set_commitment
Call v140 → current #0Stores on-chain commitment data for an account on a specific subnet .
View calls on chainCall Workflow
Click items to navigate. Pan and zoom to explore.
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
Input Parameters
| # | Name | Type | Description |
|---|---|---|---|
| 0 | netuid | u16 | Subnet/network identifier (0-65535) |
| 1 | info | CommitmentInfo | info (CommitmentInfo) |
Permissions
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
Events Emitted
Storage Modified
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
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_commitment call
const netuid = 1;
const info = 0 as any /* CommitmentInfo */;
const call = api.tx[stringCamelCase("Commitments")][stringCamelCase("set_commitment")](
netuid,
info
);On-Chain Activity
Highest-volume operations
#4 most used call
20–50% of submissions succeed
As of block 7,429,232
Runtime Info
View Source- Pallet Index
- 18
- Call Index
- 0
- First Version
- v140
- Current Version
- v393