getRecentPerformanceSamples
https://api.triport.io/v1/solReturns a list of recent cluster performance samples, in reverse slot order.
getRecentPerformanceSamples returns a list of recent performance samples taken
across the cluster. Each sample summarizes the number of transactions and slots
that occurred over a fixed samplePeriodSecs window (typically 60 seconds), and
is taken roughly once per sample period.
This is the canonical way to estimate recent throughput — transactions per
second (TPS) and non-vote TPS — without polling individual slots. Divide a
sample's numTransactions (or numNonVoteTransactions) by samplePeriodSecs
to get the average TPS for that window.
Samples are returned newest-first, ordered by slot descending. Use the
optional limit parameter to request fewer than the maximum number of samples.
Parameters
JSON-RPC params is a positional array: [limit?].
limitintegeroptional720 (the most recent ~12 hours at one 60-second sample per minute).Response
Response fields
result is an array of PerformanceSample objects, ordered by slot
descending. Each element has the following fields:
| Field | Type | Description |
|---|---|---|
slot | integer | The slot in which the sample was taken. |
numTransactions | integer | Total number of transactions processed during the sample period. |
numNonVoteTransactions | integer | Number of non-vote transactions processed during the sample period. |
numSlots | integer | Number of slots completed during the sample period. |
samplePeriodSecs | integer | Length of the sample window, in seconds. |
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 | limit is not an integer or is out of range (must be 1–720). |
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: "getRecentPerformanceSamples",
params: [4],
}),
});
const { result } = await res.json();
const latest = result[0];
const tps = latest.numTransactions / latest.samplePeriodSecs;
console.log(`Recent TPS at slot ${latest.slot}: ${tps.toFixed(0)}`);TypeScript SDK (@triport/sdk)
import { TriportClient } from "@triport/sdk";
const client = new TriportClient({ apiKey: process.env.TRIPORT_API_KEY });
const samples = await client.solana.getRecentPerformanceSamples(4);
const latest = samples[0];
const tps = latest.numTransactions / latest.samplePeriodSecs;
console.log(`Recent TPS at slot ${latest.slot}: ${tps.toFixed(0)}`);Python (triport-sdk)
import os
from triport import TriportClient
client = TriportClient(api_key=os.environ["TRIPORT_API_KEY"])
samples = client.solana.get_recent_performance_samples(limit=4)
latest = samples[0]
tps = latest["numTransactions"] / latest["samplePeriodSecs"]
print(f"Recent TPS at slot {latest['slot']}: {tps:.0f}")Notes
- Ordering: samples are returned newest-first (
slotdescending), soresult[0]is always the most recent window. - Computing TPS: divide
numTransactionsbysamplePeriodSecsfor total TPS, or usenumNonVoteTransactionsto exclude consensus vote traffic — the latter is usually the more meaningful measure of user activity. limitis a maximum: the cluster retains a bounded history, so fewer than the requested number of samples may be returned if not enough have accumulated.- Related methods: use
getSlotto read the current slot andgetRecentPrioritizationFeesto estimate the priority fee needed to land a transaction during periods of high throughput.