getTransactionCount
Learn getTransactionCount use cases, code examples, request parameters, response structure, and tips.
The getTransactionCount
RPC method in CoinVera returns the total number of transactions that have been processed by the Solana ledger since genesis. This provides a high-level view of network throughput and long-term activity.
✅ Common Use Cases
Network Statistics Display the cumulative transaction count as an indicator of network usage and health.
Growth Tracking Monitor how transaction volume grows over time to assess adoption trends.
Blockchain Dashboards Provide a simple, intuitive metric showing the size and history of on-chain activity.
🧾 Request Parameters
[
options?: {
commitment?: string, // Optional – "processed", "confirmed", or "finalized"
minContextSlot?: number // Optional – Only respond if node is caught up to this slot
}
]
commitment (optional): The level of confirmation the node should use.
processed
: Fastest, but not rollback-safe.confirmed
: Voted on by the network.finalized
: Safest, fully confirmed.
minContextSlot (optional): Ensures that the returned result is evaluated at or after a minimum slot.
📦 Response Structure
Returns a single integer value representing the total transaction count:
{
"context": {
"slot": 221446650
},
"value": 1874219342
}
value: The number of transactions processed since network genesis.
🧪 Example
Get Total Transaction Count (Finalized)
{
"jsonrpc": "2.0",
"id": 1,
"method": "getTransactionCount",
"params": [
{
"commitment": "finalized"
}
]
}
Code Examples
const fetch = require('node-fetch');
async function getTransactionCount(rpcUrl) {
try {
const response = await fetch(rpcUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'getTransactionCount',
"params": [
{
"commitment": "confirmed"
}
]
}),
});
const data = await response.json();
// Print the exact full response
console.log('Full RPC Response:');
console.log(JSON.stringify(data, null, 2));
return data;
} catch (error) {
console.error('Error getting health:', error.message);
return null;
}
}
// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';
getTransactionCount(RPC_URL);
Example Response
{
"jsonrpc": "2.0",
"result": 430177731688,
"id": 1
}
💡 Developer Tips
Ledger-Wide Metric This count reflects all transactions since the beginning of the network—not tied to any specific wallet or block.
Monotonically Increasing The value will only increase over time—never decrease.
Commitment Level Impacts Count
processed
will show the most recent value, whilefinalized
reflects a safer, confirmed count.Not TPS This number does not represent Transactions Per Second (TPS) directly. To estimate TPS, measure the delta between two values over time.
The getTransactionCount
method is ideal for tracking long-term usage trends, building visualizations, or reporting total activity on Solana—all with reliable data from CoinVera.
Last updated