TimelockCommitment
Event v257 → current #1Emitted when an account sets a timelocked commitment .
View events on chainThe 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
Triggers
Emitted by
Preconditions
- Account is registered on the subnet
- Commitment includes timelocked fields with future reveal round
Effects
Storage Modified
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
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
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