getEpochInfo
https://api.triport.io/v1/solReturns information about the current epoch on the Solana cluster.
getEpochInfo returns a snapshot of the cluster's current epoch: which epoch
is active, how far through it the cluster is, and the related slot and block
heights. Use it to display network progress, estimate time until the next
epoch boundary, or as a lightweight liveness probe that also reports the
node's current absoluteSlot and blockHeight.
slotIndex is the cluster's position within the current epoch, while
slotsInEpoch is that epoch's total length — so slotsInEpoch - slotIndex
slots remain before the epoch rolls over. absoluteSlot is the slot count
since genesis (it keeps climbing across epochs), and blockHeight is the
number of confirmed blocks beneath the current one.
The reading is taken relative to a slot governed by the optional commitment
config. Pass minContextSlot to require that the serving node has already
reached at least a given slot before it answers.
Parameters
JSON-RPC params is a positional array: [config?]. The single argument is
optional — omit it (send params: []) to use the node defaults.
configobjectoptionalcommitmentstringoptionalprocessed, confirmed, or finalized.minContextSlotintegeroptionalResponse
Response fields
| Field | Type | Description |
|---|---|---|
result | object | EpochInfo object. |
result.epoch | integer | The current epoch number. |
result.slotIndex | integer | The cluster's slot position relative to the start of the current epoch. |
result.slotsInEpoch | integer | The total number of slots in the current epoch. |
result.absoluteSlot | integer | The current slot, counted from genesis. |
result.blockHeight | integer | The number of confirmed blocks beneath the current block. |
result.transactionCount | integer | The total number of transactions processed by the cluster since genesis. |
Errors
Errors are returned in the standard JSON-RPC error envelope. See the shared errors reference for the full envelope shape and shared codes.
| Code | Meaning | When it happens |
|---|---|---|
-32602 | Invalid params | config is malformed (e.g. an unknown commitment value). |
401 | Unauthorized | Missing or invalid Authorization: Bearer key. |
429 | Rate limited | More than your tier's RPS for sol_read_rpc (20 / 60 / 200 / 600). |
Examples
JavaScript (fetch)
const res = await fetch("https://api.triport.io/v1/sol", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "getEpochInfo",
params: [],
}),
});
const { result } = await res.json();
const remaining = result.slotsInEpoch - result.slotIndex;
console.log(`Epoch ${result.epoch}: ${remaining} slots remaining`);TypeScript SDK (@triport/sdk)
import { TriportClient } from "@triport/sdk";
const client = new TriportClient({ apiKey: process.env.TRIPORT_API_KEY });
const info = await client.solana.getEpochInfo({ commitment: "finalized" });
const remaining = info.slotsInEpoch - info.slotIndex;
console.log(`Epoch ${info.epoch}: ${remaining} slots remaining (slot ${info.absoluteSlot})`);Python (triport-sdk)
import os
from triport import TriportClient
client = TriportClient(api_key=os.environ["TRIPORT_API_KEY"])
info = client.solana.get_epoch_info(commitment="finalized")
remaining = info["slotsInEpoch"] - info["slotIndex"]
print(f"Epoch {info['epoch']}: {remaining} slots remaining (slot {info['absoluteSlot']})")Notes
- Slots remaining:
slotsInEpoch - slotIndexgives the slots left in the current epoch. At roughly 400 ms per slot you can estimate the time to the next epoch boundary. absoluteSlotvsslotIndex:absoluteSlotis monotonic since genesis and never resets;slotIndexresets to0at each epoch boundary.- Commitment defaults: when
commitmentis omitted, the node's default commitment applies. Passfinalizedfor the strongest consistency guarantee. - Related methods: use
getEpochSchedulefor the cluster's static epoch layout (slots per epoch, warmup), andgetBlock/getSlotto inspect specific slots and blocks.