Slot Subscriptions
Stream slot progression events as the validator processes, confirms, and finalizes slots. Each slot emits multiple updates as it moves through the commitment pipeline: Processed, Confirmed, Finalized, and optionally Rooted. Dead slots (skipped by the leader) also emit an update with an error message.
Slot subscriptions provide the foundation for timing-sensitive applications. Use them to measure validator latency, track confirmation times, detect leader schedule gaps, and coordinate operations that depend on specific commitment levels.
Filter Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
filter_by_commitment | bool | No | If true, only emit updates at the subscription's commitment level. If false, emit all status transitions (Processed, Confirmed, Finalized). |
interleave | bool | No | If true, interleave slot updates with other subscription types in order. |
Update Payload
| Field | Type | Description |
|---|---|---|
slot | uint64 | The slot number |
parent | uint64 | The parent slot number |
status | CommitmentLevel | The new status: Processed (0), Confirmed (1), Finalized (2), or Rooted (3) |
dead_error | string (nullable) | If the slot was dead (skipped), contains the error reason |
Code Examples
Track All Slot Status Transitions (Node.js)
stream.write({
accounts: {},
slots: {
allSlots: {
filter_by_commitment: false // Get all status transitions
}
},
transactions: {},
transactionsStatus: {},
blocks: {},
blocksMeta: {},
commitment: 0, // Processed -- see all updates
entry: {},
accountsDataSlice: [],
ping: null
});
stream.on('data', (update) => {
if (update.slot) {
const slot = update.slot;
const statusNames = ['Processed', 'Confirmed', 'Finalized', 'Rooted'];
console.log('Slot ' + slot.slot + ' -- ' + statusNames[slot.status] + ' (parent: ' + slot.parent + ')');
if (slot.dead_error) {
console.log(' Dead slot:', slot.dead_error);
}
}
});Monitor Slot Progression with Status (Rust)
use yellowstone_grpc_client::GeyserGrpcClient;
use yellowstone_grpc_proto::prelude::*;
use std::collections::HashMap;
use futures::StreamExt;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let mut client = GeyserGrpcClient::build_from_uri("http://88.216.36.108:10001")
.connect()
.await?;
let mut slots = HashMap::new();
slots.insert("allSlots".to_string(), SubscribeRequestFilterSlots {
filter_by_commitment: Some(false),
interleave: None,
});
let request = SubscribeRequest {
accounts: HashMap::new(),
slots,
transactions: HashMap::new(),
transactions_status: HashMap::new(),
blocks: HashMap::new(),
blocks_meta: HashMap::new(),
commitment: Some(CommitmentLevel::Processed as i32),
entry: HashMap::new(),
accounts_data_slice: vec![],
ping: None,
from_slot: None,
};
let (_, mut stream) = client.subscribe_with_request(Some(request)).await?;
while let Some(msg) = stream.next().await {
match msg?.update_oneof {
Some(UpdateOneof::Slot(slot)) => {
let status = match slot.status {
0 => "Processed",
1 => "Confirmed",
2 => "Finalized",
3 => "Rooted",
_ => "Unknown",
};
println!("Slot {} -- {} (parent: {})", slot.slot, status, slot.parent.unwrap_or_default());
if let Some(err) = &slot.dead_error {
println!(" Dead slot: {}", err);
}
}
_ => {}
}
}
Ok(())
}Common Use Cases
| Use Case | Filter Configuration |
|---|---|
| Track all slot transitions | filter_by_commitment: false with commitment Processed |
| Only finalized slots | filter_by_commitment: true with commitment Finalized |
| Measure confirmation latency | Track time between Processed and Confirmed for one slot |
| Detect dead/skipped slots | Check dead_error field for non-null values |
| Validator health monitor | Track slot production rate and gap between processed and finalized |
| Leader schedule tracker | Correlate slot numbers with expected leader schedule |
