Documentation index

GetSlot

Returns the current slot that the node has processed. Slots are the fundamental time unit on Solana (approximately 200ms 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

JavaScript
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');

const packageDef = protoLoader.loadSync('geyser.proto', {
  keepCase: true, longs: String, enums: String, defaults: true, oneofs: true
});
const proto = grpc.loadPackageDefinition(packageDef).geyser;
const client = new proto.Geyser('88.216.36.108:10001', grpc.credentials.createInsecure());

// Get the latest processed slot (earliest, but not yet confirmed)
client.getSlot({ commitment: 0 }, (err, response) => {
  if (err) { console.error('gRPC error:', err); return; }
  console.log('Current slot (processed):', response.slot);
});

// Get the latest finalized slot (safest for critical operations)
client.getSlot({ commitment: 2 }, (err, response) => {
  if (err) { console.error('gRPC error:', err); return; }
  console.log('Current slot (finalized):', response.slot);
});

Rust

Rust
use yellowstone_grpc_client::GeyserGrpcClient;
use yellowstone_grpc_proto::prelude::*;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let mut client = GeyserGrpcClient::build_from_uri("http://88.216.36.108:10001")
        .connect()
        .await?;

    let response = client
        .get_slot(Some(CommitmentLevel::Processed as i32))
        .await?;
    let result = response.into_inner();
    println!("Current slot: {}", result.slot);

    Ok(())
}

Example Response

JSON
{
  "slot": "250000042"
}