GetSlot

Returns the current slot that the node has processed. Slots are the fundamental time unit on Solana (approximately 400ms each). This is the gRPC equivalent of the JSON-RPC getSlot method.

Use this method to track validator progression, measure latency between your node and the network, and coordinate timing-sensitive operations. For continuous slot monitoring, consider using the Subscribe method with a Slots filter for real-time push updates instead of polling.

Type: Unary (request/response)

Parameters

ParameterTypeRequiredDescription
commitmentCommitmentLevelNoCommitment level: Processed (0), Confirmed (1), or Finalized (2). Default: Finalized

Response

FieldTypeDescription
slotuint64The current slot at the requested commitment level

Code Examples

Node.js

1const grpc = require('@grpc/grpc-js');
2const protoLoader = require('@grpc/proto-loader');
3
4const packageDef = protoLoader.loadSync('geyser.proto', {
5  keepCase: true, longs: String, enums: String, defaults: true, oneofs: true
6});
7const proto = grpc.loadPackageDefinition(packageDef).geyser;
8const client = new proto.Geyser('[IP_ADDRESS]:[PORT]', grpc.credentials.createInsecure());
9
10// Get the latest processed slot (fastest but not yet confirmed)
11client.getSlot({ commitment: 0 }, (err, response) => {
12  if (err) { console.error('gRPC error:', err); return; }
13  console.log('Current slot (processed):', response.slot);
14});
15
16// Get the latest finalized slot (safest for critical operations)
17client.getSlot({ commitment: 2 }, (err, response) => {
18  if (err) { console.error('gRPC error:', err); return; }
19  console.log('Current slot (finalized):', response.slot);
20});

Rust

1use yellowstone_grpc_client::GeyserGrpcClient;
2use yellowstone_grpc_proto::prelude::*;
3
4#[tokio::main]
5async fn main() -> anyhow::Result<()> {
6    let mut client = GeyserGrpcClient::build_from_uri("http://[IP_ADDRESS]:[PORT]")
7        .connect()
8        .await?;
9
10    let response = client
11        .get_slot(Some(CommitmentLevel::Processed as i32))
12        .await?;
13    let result = response.into_inner();
14    println!("Current slot: {}", result.slot);
15
16    Ok(())
17}

Example Response

1{
2  "slot": "250000042"
3}