TriportRPC

getTransactionCount

POSThttps://api.triport.io/

Returns the total number of transactions processed by the Solana ledger as a single integer.

Solanafree+ — 20 rps (free) · 60 rps (basic) · 200 rps (pro) · 600 rps (business)

getTransactionCount returns the current transaction count from the ledger — a single u64 integer representing the total number of transactions the cluster has processed since genesis. The number only ever increases, so it is useful as a monotonic, cluster-wide activity counter.

The value you get back depends on the commitment level. With the default (finalized) you receive the count as of the highest finalized slot; with confirmed or processed you get a higher, more recent count that has had less time to settle. Because the counter is global and grows continuously, treat the result as a snapshot at the moment of the call rather than a stable value — consecutive calls will normally return larger numbers.

Pair it with minContextSlot when you want the call to fail fast unless the node has already progressed to at least a given slot, which avoids reading a stale count from a lagging backend.

Parameters

A single optional positional parameter: a config object.

configobjectoptional
Configuration object (see fields below). Omit it entirely to use defaults.
config fieldsobject
commitmentstringoptional
Commitment level: processed, confirmed, or finalized. Defaults to finalized. Determines the slot the count is evaluated at.
minContextSlotintegeroptional
Minimum slot the request should be evaluated at. If the node has not yet reached this slot, the request returns an error instead of a stale result.

Response

Response fields

FieldTypeDescription
resultinteger (u64)Total number of transactions processed by the ledger at the requested commitment level.

Errors

getTransactionCount uses the standard JSON-RPC error envelope. See errors for the full structure.

CodeMeaningWhen it happens
-32602Invalid paramscommitment is not one of processed / confirmed / finalized, or config is malformed.
-32016Minimum context slot not reachedminContextSlot is higher than the node's current slot.
401UnauthorizedMissing or invalid Authorization: Bearer token.
429Rate limitedYou exceeded your tier's RPS for sol_read_rpc.

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: "getTransactionCount",
    params: [],
  }),
});


const { result } = await res.json();
console.log("transactions processed:", result); // 268134591842

TypeScript SDK (@triport/sdk)

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


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


const count: number = await client.solana.getTransactionCount({ commitment: "confirmed" });
console.log("transactions processed:", count);

Python (triport-sdk)

import os
from triport import TriportClient


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


count = client.solana.get_transaction_count(commitment="confirmed")
print("transactions processed:", count)

Notes

  • Monotonic counter. The result is cluster-wide and only increases. Two successive calls will normally return different (larger) values — don't treat it as a stable identifier.
  • Commitment matters. A processed count is ≥ a confirmed count, which is ≥ a finalized count. Don't compare counts taken at different commitment levels.
  • Related methods: getSlot (current slot at a commitment level), getBlockHeight, and getEpochInfo, which also surfaces a transactionCount field scoped to the epoch context.