getSlot
Returns the slot that has reached the given or default commitment level
Common use cases
| Timestamp retrieval workflows | Retrieve current slot then call getBlockTime to obtain blockchain timestamp for frontend clock synchronization or event timestamping. |
| Transaction timing measurement | Record slot before transaction submission to calculate confirmation latency by comparing against transaction's finalized slot. |
| RPC node health validation | Poll 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
- JavaScript
- Python
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"
}
]
}'
// Using fetch
const response = await fetch('https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "getSlot",
"params": [
{
"commitment": "finalized"
}
]
})
});
const data = await response.json();
console.log(data);
import requests
import json
url = 'https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY'
headers = {'Content-Type': 'application/json'}
data = {
"jsonrpc": "2.0",
"id": 1,
"method": "getSlot",
"params": [
{
"commitment": "finalized"
}
]
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
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.
Related Methods
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
- Solana Official Documentation
- Solana Commitment Levels - Official documentation explaining processed, confirmed, and finalized commitment levels that affect
getSlotreturn values.