RPC Guides
How to Use getTransactionCount
Learn getTransactionCount use cases, code examples, request parameters, response structure, and tips.
The getTransactionCount
RPC method returns the current total number of transactions processed by the Solana ledger since genesis, at a specified commitment level.
Common Use Cases
- Network Statistics: Displaying the overall transaction volume on the network as a general health or activity indicator.
- Growth Tracking: Monitoring the increase in transaction count over time to observe network adoption and usage trends.
- Dashboard Metrics: Providing a high-level overview of blockchain activity.
Request Parameters
This method has one optional parameter:
options
(object, optional): An optional configuration object that can include:commitment
(string, optional): Specifies the commitment level for the query (e.g.,"finalized"
,"confirmed"
,"processed"
). If not provided, the node’s default commitment is used.minContextSlot
(u64, optional): The minimum slot that the request can be evaluated at.
Response Structure
The result
field in the JSON-RPC response is a single u64
number representing the total transaction count from the ledger up to the slot determined by the commitment level.
Example Response:
Code Examples
Developer Tips
- Ledger-Wide Count: This count represents all transactions processed on the ledger since its inception, not just for a specific account or block.
- Increasing Value: The transaction count is a monotonically increasing value.
- Commitment Level: The returned count depends on the chosen
commitment
level. Aprocessed
commitment will likely yield a higher, more up-to-the-second count thanfinalized
, butfinalized
offers a guarantee against rollbacks. - Not a TPS Metric: While related to network activity, this single value doesn’t directly translate to Transactions Per Second (TPS) without comparing counts over a defined time period.
This guide explains how to use the getTransactionCount
RPC method to retrieve the total number of transactions on the Solana network.