getBlockTime
Last updated:
getBlockTime returns the estimated production time of the block at a
given slot, expressed as a Unix timestamp (whole seconds since the epoch). The
estimate is derived from validator vote timestamps, so it is an approximation
rather than an exact clock reading.
Use it when you have a slot (for example from getSlot or from
a transaction's slot field) and need a wall-clock time to display or to
correlate on-chain activity with off-chain events.
Gotchas
- The result is
nullwhen the block time is not available — most commonly for slots older than the network's retained history, or for a slot that was skipped / not yet rooted.- Timestamps are estimates and can differ by a few seconds from any other time source. Do not use them for ordering within a single block.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| slot | Slot | Yes |
Returns
| Field | Type |
|---|---|
| result | integer |
Examples
curl https://triport.io/sol \
-X POST -H 'Content-Type: application/json' \
-H 'Authorization: Bearer <api-key>' \
-d '{"id":1,"method":"getBlockTime","params":["<slot>"],"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": "getBlockTime",
"params": [
"<slot>"
],
"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":"getBlockTime","params":["<slot>"],"jsonrpc":"2.0"},
)
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Networks: mainnet, devnet, testnet.
- Credit cost: 1 per call.
FAQ
- What does getBlockTime do?
- Returns the estimated production time of a Solana block as a Unix timestamp.
- How many credits does getBlockTime cost?
- getBlockTime costs 1 credit(s) per call on Triport by default.
- Is getBlockTime available over WebSocket?
- getBlockTime is an HTTP JSON-RPC method.