> ## Documentation Index
> Fetch the complete documentation index at: https://www.helius.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# getTransactionCount 사용 방법

> getTransactionCount 사용 사례, 코드 예제, 요청 매개변수, 응답 구조 및 팁을 배워보세요.

[`getTransactionCount`](https://www.helius.dev/docs/api-reference/rpc/http/gettransactioncount) RPC 메서드는 지정된 커밋 수준에서 제네시스 이후 Solana 원장에서 처리된 현재 총 거래 수를 반환합니다.

## 일반적인 사용 사례

* **네트워크 통계:** 네트워크의 전반적인 거래량을 일반적인 상태 또는 활동 지표로 표시합니다.
* **성장 추적:** 네트워크 도입 및 사용 추세를 관찰하기 위해 시간이 지남에 따라 거래 수 증가를 모니터링합니다.
* **대시보드 메트릭:** 블록체인 활동의 높은 수준의 개요를 제공합니다.

## 요청 매개변수

이 메서드는 하나의 선택적 매개변수를 가지고 있습니다:

1. **`options`** (object, optional): 다음을 포함할 수 있는 선택적 구성 객체:
   * **`commitment`** (string, optional): 쿼리에 대한 [커밋 수준](https://www.helius.dev/blog/solana-commitment-levels)을 지정합니다 (예: `"finalized"`, `"confirmed"`, `"processed"`). 제공되지 않으면 노드의 기본 커밋이 사용됩니다.
   * **`minContextSlot`** (u64, optional): 요청이 평가될 수 있는 최소 슬롯입니다.

## 응답 구조

JSON-RPC 응답의 `result` 필드는 커밋 수준에 의해 결정된 슬롯까지 원장에서의 총 거래 수를 나타내는 단일 `u64` 번호입니다.

**응답 예시:**

```json theme={"system"}
{
  "jsonrpc": "2.0",
  "result": 398146706879,
  "id": 1
}
```

## 코드 예제

<CodeGroup>
  ```bash cURL theme={"system"}
  # Basic Request (uses default commitment of the RPC node):
  curl -X POST -H "Content-Type: application/json" -d \
    '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getTransactionCount"
    }' \
    <YOUR_RPC_URL>

  # Request with a specific commitment level:
  curl -X POST -H "Content-Type: application/json" -d \
    '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getTransactionCount",
      "params": [
        {
          "commitment": "confirmed"
        }
      ]
    }' \
    <YOUR_RPC_URL>
  ```

  ```javascript JavaScript (using @solana/web3.js) theme={"system"}
  const { Connection } = require('@solana/web3.js');

  async function getCurrentTransactionCount() {
    // Replace with your RPC endpoint
    const connection = new Connection('https://mainnet.helius-rpc.com/?api-key=<api-key>');

    try {
      const transactionCount = await connection.getTransactionCount();
      console.log(`Current ledger transaction count: ${transactionCount}`);

      // Example with commitment
      const confirmedTransactionCount = await connection.getTransactionCount('confirmed');
      console.log(`Current ledger transaction count (confirmed): ${confirmedTransactionCount}`);

    } catch (error) {
      console.error('Error fetching transaction count:', error);
    }
  }

  getCurrentTransactionCount();
  ```
</CodeGroup>

## 개발자 팁

* **원장 전역 수치:** 이 수치는 특정 계정이나 블록이 아니라 원장에서 처리된 모든 거래를 나타냅니다.
* **증가하는 값:** 거래 수는 단조롭게 증가하는 값입니다.
* **커밋 수준:** 반환된 수치는 선택한 `commitment` 수준에 따라 결정됩니다. `processed` 커밋은 아마도 `finalized`보다 더 높고 즉각적인 수치를 제공하지만, `finalized`는 롤백에 대한 보장을 제공합니다.
* **TPS 지표가 아님:** 네트워크 활동과 관련이 있지만, 이 단일 값은 정의된 시간 기간 동안의 수치를 비교하지 않으면 초당 거래 수(TPS)로 직접 변환되지 않습니다.

이 가이드는 Solana 네트워크에서 총 거래 수를 검색하기 위해 `getTransactionCount` RPC 메서드를 사용하는 방법을 설명합니다.
