getTransactionCount
Last updated:
`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
| Name | Type | Required | Description |
|---|---|---|---|
| config | CommitmentConfig | No |
Returns
| Field | Type |
|---|---|
| result | integer |
Examples
curl https://<your-endpoint>/ \
-X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"getTransactionCount","params":["<config>"]}'const res = await fetch("https://<your-endpoint>/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"id": 1,
"method": "getTransactionCount",
"params": [
"<config>"
],
"jsonrpc": "2.0"
}),
});
const data = await res.json();import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"getTransactionCount","params":["<config>"],"jsonrpc":"2.0"})
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Networks: mainnet, devnet, testnet.
- Credit cost: 1 per call.
FAQ
- What does getTransactionCount do?
- Returns the total number of transactions processed by the Solana ledger as a single integer.
- How many credits does getTransactionCount cost?
- getTransactionCount costs 1 credit(s) per call on Triport by default.
- Is getTransactionCount available over WebSocket?
- getTransactionCount is an HTTP JSON-RPC method.