Skip to main content

getSlot

Returns the slot that has reached the given or default commitment level

Common use cases
Timestamp retrieval workflowsRetrieve current slot then call getBlockTime to obtain blockchain timestamp for frontend clock synchronization or event timestamping.
Transaction timing measurementRecord slot before transaction submission to calculate confirmation latency by comparing against transaction's finalized slot.
RPC node health validationPoll with short timeout to verify RPC node responsiveness and use with getMaxShredInsertSlot to detect lag behind cluster consensus.

Parameters

config (object, optional)

Configuration object containing the following fields:

Fields:

  • commitment (string): The commitment describes how finalized a block is at that point in time. See Configuring State Commitment.
  • minContextSlot (number): The minimum slot that the request can be evaluated at

Request

curl https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getSlot",
"params": [
{
"commitment": "finalized"
}
]
}'
Network Selection

Replace mainnet with devnet in the URL to query devnet instead.

Response

{
"jsonrpc": "2.0",
"result": 1234,
"id": 1
}

Response Fields

Return value: u64

Current slot

FAQ and Troubleshooting

Why does getSlot return different values when called quickly in succession?

The slot depends on your commitment level. processed returns the latest slot (updates every 400ms), while confirmed and finalized lag by 30-40 and 32+ slots respectively. Specify explicit commitment for consistent behavior.

Should I use getSlot or blockSubscribe for tracking new slots?

Use blockSubscribe websocket method for continuous monitoring. Polling getSlot is acceptable for occasional checks but generates unnecessary RPC load for real-time applications.

Can I use the slot from getSlot immediately with getBlock?

Only if both calls use the same commitment level and the slot has reached that commitment. Use confirmed or finalized commitment for both to avoid "Slot X was skipped, or missing in long-term storage" errors.

getBlockHeight
Returns block height at specified commitment. Use getBlockHeight when you need finalized block count; use getSlot when coordinating with slot-based methods like getBlock or measuring distances.

getBlockTime
Returns Unix timestamp for a specific slot. Pair with getSlot to retrieve current blockchain time: fetch current slot then query its timestamp.

slotSubscribe
Subscribes to real-time slot notifications via websocket. Streaming alternative to polling getSlot; preferred for continuous monitoring or event-driven architectures.

getBlock
Returns block data for a specific slot. Commonly paired with getSlot for bulk data ingestion workflows; ensure consistent commitment levels between both calls.

getHealth
Returns node health status. Use together with getSlot to validate node is current: healthy node should return recent slot matching other RPC providers.

External Resources