TriportRPC

getBlockTime

POSThttps://api.triport.io

Returns the estimated production time of a Solana block as a Unix timestamp.

Solanasol_read_rpcfree+ — free 20 / basic 60 / pro 200 / business 600 RPS

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 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

Positional params array — a single required element:

slotintegerrequired
Slot number to look up.

Response

When no estimate is available, result is null:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": null
}
resultinteger | null
Estimated production time of the block, in Unix seconds since the epoch. null if not available for the requested slot.

Errors

CodeMeaningWhen it happens
-32003Rate limit exceededMore than your tier's RPS for sol_read_rpc (free 20 / basic 60 / pro 200 / business 600); a burst up to 2× is allowed before throttling.
-32601Method not recognisedThe method name was misspelled or is not in the Solana catalog.
-32602Invalid paramsslot missing or not an integer.

A slot that simply has no recorded time is not an error — it returns result: null. See the shared errors reference for the full error envelope and the error.data fields.

Examples

JavaScript (fetch)

const res = await fetch("https://api.triport.io", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "getBlockTime",
    params: [348392041],
  }),
});


const { result } = await res.json();
// result is a Unix timestamp in seconds, or null
const when = result === null ? null : new Date(result * 1000);
console.log(when);

TypeScript SDK (@triport/sdk)

import { TriportClient } from "@triport/sdk";


const client = new TriportClient({ apiKey: process.env.TRIPORT_API_KEY! });


const blockTime: number | null = await client.solana.getBlockTime(348392041);
if (blockTime !== null) {
  console.log(new Date(blockTime * 1000).toISOString());
}

Python (triport-sdk)

import os
from datetime import datetime, timezone
from triport import TriportClient


client = TriportClient(api_key=os.environ["TRIPORT_API_KEY"])


block_time = client.solana.get_block_time(348392041)
if block_time is not None:
    print(datetime.fromtimestamp(block_time, tz=timezone.utc).isoformat())

Notes

  • Nullable result: always handle the null case before doing date math — older or skipped slots have no estimate.
  • Estimate accuracy: the timestamp comes from validator vote times and is approximate; treat it as "around when this block was produced," not an exact timestamp.
  • Related methods: getSlot for the current slot, getBlocks to enumerate confirmed slots in a range.
  • Staging: the same request works against https://staging.api.triport.io for testing.