getSlot
The getSlot method returns the current slot number that the node is processing. Slots are the fundamental time unit in Solana, representing fixed periods (approximately 400 milliseconds) during which a designated validator has the opportunity to produce blocks.
Slots are central to Solana's architecture and consensus mechanism. Each slot is assigned to a specific validator who acts as the leader for that period. The slot number continuously increments as time progresses, providing a monotonic clock for the blockchain. Not every slot results in a block (some may be skipped if the leader fails), but the slot number always advances. Understanding the current slot is essential for timing operations, coordinating with network state, and determining data freshness.
This method is used throughout Solana development for various timing purposes: determining if cached data is stale, calculating when blockhashes expire, coordinating multi-step operations, and understanding the current network position. Different commitment levels provide different slot perspectives - processed gives the newest data, while finalized ensures permanence.
Parameters
parameter | type | description |
|---|---|---|
config | object | Optional configuration object |
config.commitment | string | Level of commitment: 'processed', 'confirmed', or 'finalized' (default: 'finalized') |
config.minContextSlot | number | Optional. Minimum slot that the request can be evaluated at |
Return Object
field | type | description |
|---|---|---|
result | number | The current slot number (u64) at the requested commitment level |
Request Example
Response Example
Tip: Slot numbers can have gaps (skipped slots when validators fail to produce blocks), unlike block height which is continuous. With ~400ms per slot, roughly 2.5 slots per second. Use 'processed' commitment for real-time data, 'finalized' for guaranteed permanence. Useful for checking blockhash expiration (valid for ~150 slots).