StakeLocked
Event v411 → v422, v423 → v424, v432 → v440, v441 → current #132Emitted when a coldkey locks alpha stake on a hotkey /subnet .
View events on chainUseful for: stakerssubnet ownersvalidatorsanalyticswallets
The Big Picture
StakeLocked is the on-chain trail of the conviction system. Every lock_stake call emits one of these. Aggregating them tells you who's committing for the long term and on which subnets.
Use Cases
- Confirm a lock_stake transaction settled
- Build dashboards of locked stake per validator or per subnet
- Track conviction-building activity over time
How to Use This Event
- → Indexers track this to compute per-validator locked alpha
- → Dashboards filter by netuid to show subnet conviction trends
From Chain Metadata
Stake has been locked to a hotkey on a subnet.
Migration Notes
v424 v432 Breaking
netuid changed from u16 to NetUid; amount changed from u64 to AlphaBalance
Update decoders: SCALE encoding is positional, so any signature change (added, removed, or type-changed fields, or storage shape changes) shifts byte offsets and existing decoders will misparse this item. Re-derive types from the new metadata.
Triggers
Emitted by
Preconditions
- lock_stake call succeeded
- Hotkey is registered on root
- Coldkey-hotkey association valid
May fail with
NotEnoughStaketoWithdrawNotEnoughStakeNotEnoughStakeToWithdrawNotEnoughStakeToSetWeightsStakeToWithdrawIsZeroNotEnoughStakeToSetChildkeysNotEnoughBalanceToStakeStakeAlreadyAddedStakeRateLimitExceededUnstakeRateLimitExceededStakeTooLowForRootBelowStakeThresholdNomStakeBelowMinimumThresholdCannotUnstakeLockStakeUnavailableZeroMaxStakeAmountKeepStakeBlockedByCollateralSameAutoStakeHotkeyAlreadySetAddStakeBurnRateLimitExceededInsufficientStakeForLockRootStakeLocked
Effects
Postconditions
- Lock storage updated for (coldkey, subnet, hotkey)
- HotkeyLock storage updated
- Locked alpha is no longer available for unstaking
Side Effects
- Conviction begins accruing against the locked amount
Event Data
| # | Name | Type | Description |
|---|---|---|---|
| 0 | coldkey | AccountId | Coldkey that locked the stake (hex -> SS58) |
| 1 | hotkey | AccountId | Hotkey the stake is locked to (hex -> SS58) |
| 2 | netuid | NetUid | Subnet the lock is on |
| 3 | amount → alpha_amount | AlphaBalance | Alpha amount locked (in alpha-RAO; 1 alpha = 10^9 alpha-RAO) |
Code Examples
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 StakeLocked events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.SubtensorModule.StakeLocked.get(block.hash);
for (const evt of events) {
console.log("StakeLocked:", evt.payload);
}
});On-Chain Activity
Emission Frequency
●●○○○○ Moderate 10K–100K emissions
Occasional use
#54 most emitted event
As of block 9,385,000
Version History
v411 block 8,283,784 4 args
v423 block 8,486,593 4 args
v432 block 8,636,190 4 args
v441 block 8,765,683 4 args Current
Runtime Info
View Source- Pallet Index
- 7
- Event Index
- 132
- First Version
- v411
- Current Version
- v490