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)
1stream.write({
2 accounts: {},
3 slots: {
4 allSlots: {
5 filter_by_commitment: false // Get all status transitions
6 }
7 },
8 transactions: {},
9 transactionsStatus: {},
10 blocks: {},
11 blocksMeta: {},
12 commitment: 0, // Processed -- see all updates
13 entry: {},
14 accountsDataSlice: [],
15 ping: null
16});
17
18stream.on('data', (update) => {
19 if (update.slot) {
20 const slot = update.slot;
21 const statusNames = ['Processed', 'Confirmed', 'Finalized', 'Rooted'];
22 console.log('Slot ' + slot.slot + ' -- ' + statusNames[slot.status] + ' (parent: ' + slot.parent + ')');
23 if (slot.dead_error) {
24 console.log(' Dead slot:', slot.dead_error);
25 }
26 }
27});
Monitor Slot Progression with Status (Rust)
1use yellowstone_grpc_client::GeyserGrpcClient;
2use yellowstone_grpc_proto::prelude::*;
3use std::collections::HashMap;
4use futures::StreamExt;
5
6#[tokio::main]
7async fn main() -> anyhow::Result<()> {
8 let mut client = GeyserGrpcClient::build_from_uri("http://[IP_ADDRESS]:[PORT]")
9 .connect()
10 .await?;
11
12 let mut slots = HashMap::new();
13 slots.insert("allSlots".to_string(), SubscribeRequestFilterSlots {
14 filter_by_commitment: Some(false),
15 interleave: None,
16 });
17
18 let request = SubscribeRequest {
19 accounts: HashMap::new(),
20 slots,
21 transactions: HashMap::new(),
22 transactions_status: HashMap::new(),
23 blocks: HashMap::new(),
24 blocks_meta: HashMap::new(),
25 commitment: Some(CommitmentLevel::Processed as i32),
26 entry: HashMap::new(),
27 accounts_data_slice: vec![],
28 ping: None,
29 from_slot: None,
30 };
31
32 let (_, mut stream) = client.subscribe_with_request(Some(request)).await?;
33
34 while let Some(msg) = stream.next().await {
35 match msg?.update_oneof {
36 Some(UpdateOneof::Slot(slot)) => {
37 let status = match slot.status {
38 0 => "Processed",
39 1 => "Confirmed",
40 2 => "Finalized",
41 3 => "Rooted",
42 _ => "Unknown",
43 };
44 println!("Slot {} -- {} (parent: {})", slot.slot, status, slot.parent.unwrap_or_default());
45 if let Some(err) = &slot.dead_error {
46 println!(" Dead slot: {}", err);
47 }
48 }
49 _ => {}
50 }
51 }
52
53 Ok(())
54}
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 same 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 |