Learn getSlot use cases, code examples, request parameters, response structure, and tips.
getSlot
RPC method returns the current slot that the RPC node considers to have reached a specific commitment level. This is a fundamental method for understanding the current state of the blockchain as perceived by the node.
options
(object
, optional): An optional configuration object with the following fields:
commitment
(string
, optional): Specifies the commitment level for the query. Supported values are finalized
, confirmed
, or processed
. If omitted, the default commitment of the RPC node is used (usually finalized
).
processed
: The node will query its most recent slot. Note that this slot may not be confirmed by the cluster yet and could potentially be skipped.confirmed
: The node will query the most recent slot that has been voted on by a supermajority of the cluster.finalized
: The node will query the most recent slot confirmed by the supermajority of the cluster as having reached maximum lockout (cannot be rolled back).minContextSlot
(number
, optional): The minimum slot that the request can be evaluated at. This sets the minimum slot for the node’s context. If the node’s state is older than this slot, it may return an error or a slot number that reflects its current (older) state relative to this minimum.result
field of the JSON-RPC response is a single u64
(unsigned 64-bit integer) representing the current slot number according to the specified commitment level.
Example Response:
finalized
).
confirmed
commitment.
commitment
level specified. Refer to Solana Commitment Levels for detailed information. processed
will be the highest (most recent) slot the node is aware of, while finalized
will be an older slot that is confirmed by the entire network. Choose the commitment level appropriate for your use case’s need for data finality.processed
and confirmed
levels.minContextSlot
: This parameter ensures that the node processing your request has reached at least the minContextSlot
. If the node is behind this slot, the behavior might vary (e.g., an error or the node’s current highest slot which is less than minContextSlot
). It’s generally used in advanced scenarios where you need to ensure a query is made against a sufficiently recent state.getSlot
is a simple yet essential method for interacting with the Solana blockchain and understanding its current progression.