TimelockCommitment

Event v257 → current #1

Emitted when an account sets a timelocked commitment .

View events on chain
Useful for: validatorsdevelopersanalytics

The Big Picture

Timelocked commitments use drand randomness to encrypt data that auto-decrypts at a future block. This enables trustless commit-reveal schemes where data is verifiably hidden until a predetermined time. The event signals encrypted data has been submitted.

Why This Matters

Timelocked commitments are the 'commit' phase of commit-reveal. When you see this event, encrypted data has been submitted that will automatically decrypt at the specified round. This is crucial for applications that need to verify timing fairness.

Example Scenario

A validator commits to their weights using timelocked encryption. TimelockCommitment fires with (netuid=1, who=validator, reveal_round=12345). At round 12345, the drand beacon provides the decryption key, and CommitmentRevealed will fire with the plaintext.

Common Questions

What is a reveal round?
The reveal_round corresponds to a future drand beacon round. When that round completes, the beacon provides entropy that enables decryption of the timelocked data.
Can the submitter reveal early?
No, the decryption key is only available after the drand beacon produces the round. This is what makes commit-reveal trustless - nobody can reveal early.
What if the reveal fails?
If the drand beacon round is reached but decryption fails (malformed data), the commitment remains encrypted. The submitter would need to resubmit correctly.

Use Cases

  • Track commit-reveal scheme submissions
  • Monitor for timelocked data that will auto-reveal
  • Build services that process revealed commitments
  • Audit commit-reveal timing for fairness

How to Use This Event

  • Track timelocked commitments to watch for upcoming reveals
  • Subscribe to specific accounts to monitor their commit activity
  • Build reveal prediction services based on reveal_round
  • Index for commit-reveal scheme analytics

From Chain Metadata

A timelock-encrypted commitment was set

Part of: On-Chain Commitments

Triggers

Emitted by

Preconditions

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

Effects

Postconditions

  • Commitment stored with timelocked data
  • TimelockedIndex updated to track this commitment

Side Effects

  • Commitment auto-reveals when drand reveal round is reached

Event Data

#NameTypeDescription
0
netuid
u16 Subnet ID where timelocked commitment was made
1
who
→ account
AccountId Account that set the timelocked commitment (hex -> SS58)
2
reveal_round
u64 Drand beacon round when data will auto-reveal

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 });

// Subscribe to TimelockCommitment events
api.query.system.events((events) => {
  events
    .filter(({ event }) =>
      event.section === stringCamelCase("Commitments") &&
      event.method === "TimelockCommitment"
    )
    .forEach(({ event }) => {
      console.log("TimelockCommitment:", event.data.toHuman());
    });
});

On-Chain Activity

Emission Frequency
●●○○○○ Moderate 10K–100K emissions

Occasional use

#45 most emitted event

As of block 7,429,232

Runtime Info

View Source
Pallet Index
18
Event Index
1
First Version
v257
Current Version
v393