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`](./getSlot.md) 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 `null` when 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://<your-endpoint>/ \
-X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"getBlockTime","params":["<slot>"]}'const res = await fetch("https://<your-endpoint>/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"id": 1,
"method": "getBlockTime",
"params": [
"<slot>"
],
"jsonrpc": "2.0"
}),
});
const data = await res.json();import requests
resp = requests.post("https://<your-endpoint>/", 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.