getBlockTime
Returns the estimated production time for a block. The time is derived from the stake-weighted mean of validator Vote timestamps recorded on the ledger.
Request
{ "jsonrpc": "2.0", "id": 1, "method": "getBlockTime", "params": [ 377268280 ]}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| slot number | u64 | Yes | Slot number to query, as a u64 integer. |
Response
The method returns one of three shapes depending on whether block time is available, unknown, or the block itself is unavailable.
Available — block time known
{ "jsonrpc": "2.0", "result": 1574721591, "id": 1}result is an i64 Unix timestamp (seconds since the Unix epoch).
Unknown time — block available but time not recorded
{ "jsonrpc": "2.0", "result": null, "id": 1}result is null when the block exists but no timestamp has been recorded for it.
Unavailable — block not found for slot
{ "jsonrpc": "2.0", "error": { "code": -32004, "message": "Block not available for slot 150" }, "id": 1}An error object is returned when the block is not available for the requested slot (error code -32004).
| Field | Type | Description |
|---|---|---|
| result | i64 | Estimated production time as a Unix timestamp (seconds since the Unix epoch). |
| result | null | Returned when the block is available but no block time has been recorded. |
| error | object | Returned when the block is not available for the requested slot. Includes code and message fields. |