Skip to main content

getTransactionCount

Returns the current Transaction count from the ledger

Common use cases
Network activity monitoringTrack cumulative transaction throughput by polling at intervals to verify the ledger is processing transactions and measure network activity over time.
Load balancer health checksVerify RPC node liveness by confirming transaction count increases between requests, indicating the node is synced and processing ledger updates.
Transactions per block calculationCombine with getBlockHeight at matching commitment levels to derive average transactions per block by dividing transaction count by block height.

Parameters

config (object, optional)

Configuration object containing the following fields:

Fields:

  • commitment (string): The commitment describes how finalized a block is at that point in time. See Configuring State Commitment.
  • minContextSlot (number): The minimum slot that the request can be evaluated at

Request

curl https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getTransactionCount",
"params": [
{
"commitment": "finalized"
}
]
}'
Network Selection

Replace mainnet with devnet in the URL to query devnet instead.

Response

{
"jsonrpc": "2.0",
"result": 268,
"id": 1
}

Response Fields

Return value: u64

The current Transaction count from the ledger

FAQ and Troubleshooting

Why does getTransactionCount sometimes return smaller numbers than previous calls?

You're hitting different RPC nodes with varying sync states. Use minContextSlot to ensure the RPC has caught up to at least a specific slot.

Does getTransactionCount return transactions for a specific slot?

No, it returns the cumulative total of all transactions processed since genesis. For per-slot counts, poll at each slot and calculate the difference.

What does the minContextSlot parameter do?

It ensures the RPC node has caught up to at least that slot before responding. It doesn't filter transactions by slot—the method always returns the cumulative total at the specified commitment level.

How do I calculate transactions per block?

Call getTransactionCount and getBlockHeight with the same commitment level, then divide transaction count by block height for the average.

getBlockHeight
Returns current block height at specified commitment. Pair with getTransactionCount to calculate average transactions per block by dividing counts.

getSlot
Returns current slot number at specified commitment. Use as minContextSlot parameter to ensure RPC sync state when querying transaction count.

getHealth
Returns node health status (ok or error). Combine with increasing transaction counts to verify node is both healthy and actively syncing.

External Resources