TriportRPC

getSlot

Last updated:

getSlot returns the current slot — a single u64 integer — that has reached the requested commitment level. It is the cheapest method on the Solana RPC surface and carries no parameters in its simplest form, which makes it the go-to health check / liveness probe for confirming that your endpoint and API key are working and that the node is keeping up with the cluster.

The value you get back depends on the commitment level. With the default (finalized) you receive the highest slot the cluster has finalized; with confirmed or processed you get a higher, more recent slot that has had less time to settle. Use a lower commitment when you want the freshest possible slot number and a higher one when you need certainty that the slot will not be rolled back.

Pair it with minContextSlot when you want the call to fail fast unless the node has already progressed to at least a given slot — useful for detecting a lagging backend.

Parameters

getSlot parameters
NameTypeRequiredDescription
configCommitmentConfigNo

Returns

getSlot return value
FieldType
resultobject

Examples

curl https://triport.io/sol \
  -X POST -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <api-key>' \
  -d '{"id":1,"method":"getSlot","params":[],"jsonrpc":"2.0"}'
const res = await fetch("https://triport.io/sol", {
  method: "POST",
  headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
  body: JSON.stringify({
  "id": 1,
  "method": "getSlot",
  "params": [],
  "jsonrpc": "2.0"
}),
});
const data = await res.json();
import requests
resp = requests.post(
    "https://triport.io/sol",
    headers={"Authorization": "Bearer <api-key>"},
    json={"id":1,"method":"getSlot","params":[],"jsonrpc":"2.0"},
)
print(resp.json())
{
  "id": 1,
  "result": 427699341,
  "jsonrpc": "2.0"
}

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Networks: mainnet, devnet, testnet.
  3. Credit cost: 1 per call.

FAQ

What does getSlot do?
Returns the slot that has reached the given (or default) commitment level on Solana.
How many credits does getSlot cost?
getSlot costs 1 credit(s) per call on Triport by default.
Is getSlot available over WebSocket?
getSlot is an HTTP JSON-RPC method.