# getTransactionCount

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

```ts
[
  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:

```json
{
  "context": {
    "slot": 221446650
  },
  "value": 1874219342
}
```

* **value**: The number of transactions processed since network genesis.

***

#### 🧪 Example

**Get Total Transaction Count (Finalized)**

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getTransactionCount",
  "params": [
    {
      "commitment": "finalized"
    }
  ]
}
```

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
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);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_transaction_count(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getTransactionCount',
                'params': [
                    {
                        'commitment': 'confirmed'
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_transaction_count(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "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, while `finalized` 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**.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.coinvera.io/integration/solana/rpc/gettransactioncount.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
