githubEdit

getTransactionCount - Solana

The Web3 getTransactionCount JSON-RPC method retrieves the total number of transactions confirmed on the Solana network up to the latest block.

circle-check

This method supports commitment parameters to determine data finality. Unlike Ethereum’s eth_getTransactionCount (which may trigger errors like AttributeError: 'Eth' object has no attribute 'gettransactioncount'), Solana’s implementation focuses on network-wide totals rather than per-account transactions.

Supported Networks

This method is accessible via Solana API endpoints:

  • Mainnet

Parameters

  • commitment (string, optional): Specifies the confirmation level. Supported values:

    • finalized (default): Returns data from fully confirmed blocks.

    • confirmed: Uses the latest confirmed block.

    • processed: Not supported for this method.

  • minContextSlot (number, optional): The minimum slot at which the request can be evaluated. This ensures that data is only considered if the node has reached the specified slot.

Request

API Endpoint:

https://go.getblock.io/<ACCESS-TOKEN>/

getTransactionCount example Request (cURL):

Response

A successful response returns the total transaction count as an integer value.

Example Response:

Response Parameters:

  • result: Total number of transactions confirmed up to the specified block.

Error Handling

Common getTransactionCount error scenarios include:

  • Using unsupported commitment levels like processed.

  • Invalid API key or incorrect endpoints.

  • Ethereum-specific errors (e.g., AttributeError: 'Eth' object has no attribute 'gettransactioncount' when using the Solana API).

Example Error Response:

Use Cases

The getTransactionCount RPC method is ideal for:

  • Network dashboards displaying real-time transaction throughput;

  • Analytics platforms calculating TPS (transactions per second);

  • Developers monitoring blockchain health and activity;

  • Auditors verifying historical block data completeness.

Code getTransactionCount Example – Web3 Integration

Integration with Web3

Integrate the getTransactionCount RPC Solana method into Web3 applications to track network scalability and performance metrics. By combining this method with block or transaction-specific queries, developers gain holistic insights into Solana’s value as a high-throughput blockchain.

\

Last updated

Was this helpful?