> ## 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.

# getLargestAccounts 사용 방법

> getLargestAccounts 사용 사례, 코드 예시, 요청 매개변수, 응답 구조 및 팁을 학습합니다.

[`getLargestAccounts`](https://www.helius.dev/docs/api-reference/rpc/http/getlargestaccounts) RPC 메서드는 람포트 잔액에 따라 순위가 매겨진 Solana 네트워크의 상위 20개 계정을 반환합니다. 이 메서드는 네트워크 분석, 부의 분포 이해, SOL의 주요 소유자 식별에 유용할 수 있습니다.

이 메서드의 결과는 최대 2시간 동안 RPC 노드에 의해 캐시될 수 있습니다.

## 일반 사용 사례

* **네트워크 상태 모니터링:** 가장 큰 계정에서 SOL의 농도를 관찰합니다.
* **경제 분석:** Solana 네트워크의 부의 분포를 연구합니다.
* **고래 식별:** 상당한 양의 SOL을 보유한 계정을 찾습니다.

## 요청 매개변수

이 메서드는 다음 매개변수를 가진 구성 객체를 선택적으로 받을 수 있습니다:

* **`commitment`** (string, optional): 원장을 조회할 때 사용할 [commitment level](https://www.helius.dev/blog/solana-commitment-levels)을 지정합니다. 제공되지 않으면 노드의 기본 커밋먼트가 사용됩니다.
* **`filter`** (string, optional): 계정 유형별로 결과를 필터링합니다. 허용되는 값은 다음과 같습니다:
  * `circulating`: 유통 공급의 일부인 가장 큰 계정을 반환합니다.
  * `nonCirculating`: 유통 공급의 일부가 아닌 가장 큰 계정을 반환합니다 (예: 잠긴 계정, 재단 계정).
    생략하면 이 특정 필터 없이 모든 계정이 고려됩니다.

## 응답 구조

JSON-RPC 응답의 `result` 필드는 `RpcResponse` 객체가 됩니다. 이 객체 내에 있는 `value` 필드는 최대 20개의 계정 객체 배열이며, 각 객체는 다음을 포함합니다:

* **`address`** (string): 계정의 base-58로 인코딩된 공개 키입니다.
* **`lamports`** (u64): 람포트 단위로 된 계정의 잔액입니다.

응답에는 정보가 검색된 시점을 포함한 `context` 객체도 포함됩니다.

## 예시

### 1. 상위 20개 가장 큰 계정 가져오기 (필터 없음)

이 예시는 공급 필터 없이 람포트 잔액에 따른 상위 20개 가장 큰 계정을 가져옵니다.

<CodeGroup>
  ```bash cURL theme={"system"}
  # Replace <api-key> with your Helius API key
  curl https://mainnet.helius-rpc.com/?api-key=<api-key> -X POST -H "Content-Type: application/json" -d \
    '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getLargestAccounts"
    }'
  ```

  ```javascript JavaScript (using @solana/web3.js) theme={"system"}
  // Replace <api-key> with your Helius API key
  const { Connection } = require('@solana/web3.js');

  async function logLargestAccounts() {
    const connection = new Connection('https://mainnet.helius-rpc.com/?api-key=<api-key>');
    try {
      const largestAccounts = await connection.getLargestAccounts();
      console.log(`Largest Accounts (Slot: ${largestAccounts.context.slot}):`);
      largestAccounts.value.forEach((account, index) => {
        console.log(
          `  ${index + 1}. Address: ${account.address}, Balance: ${account.lamports / 10**9} SOL`
        );
      });
      // For full raw details:
      // console.log(JSON.stringify(largestAccounts, null, 2));
    } catch (error) {
      console.error('Error fetching largest accounts:', error);
    }
  }

  logLargestAccounts();
  ```
</CodeGroup>

### 2. 상위 20개 유통 계정 가져오기

이 예시는 유통 공급의 일부로 간주되는 상위 20개 가장 큰 계정을 가져옵니다.

<CodeGroup>
  ```bash cURL theme={"system"}
  # Replace <api-key> with your Helius API key
  curl https://mainnet.helius-rpc.com/?api-key=<api-key> -X POST -H "Content-Type: application/json" -d \
    '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getLargestAccounts",
      "params": [{ "filter": "circulating" }]
    }'
  ```

  ```javascript JavaScript (using @solana/web3.js) theme={"system"}
  // Replace <api-key> with your Helius API key
  const { Connection } = require('@solana/web3.js');

  async function logLargestCirculatingAccounts() {
    const connection = new Connection('https://mainnet.helius-rpc.com/?api-key=<api-key>');
    try {
      const largestAccounts = await connection.getLargestAccounts({ filter: 'circulating' });
      console.log(`Largest Circulating Accounts (Slot: ${largestAccounts.context.slot}):`);
      largestAccounts.value.forEach((account, index) => {
        console.log(
          `  ${index + 1}. Address: ${account.address}, Balance: ${account.lamports / 10**9} SOL`
        );
      });
      // console.log(JSON.stringify(largestAccounts, null, 2));
    } catch (error) {
      console.error('Error fetching largest circulating accounts:', error);
    }
  }

  logLargestCirculatingAccounts();
  ```
</CodeGroup>

## 개발자 팁

* **데이터 캐시:** 결과는 최대 2시간 동안 RPC 노드에 의해 캐시될 수 있습니다. 이 데이터는 최신 블록에 대한 실시간 데이터가 아닐 수 있습니다.
* **상위 20개로 제한:** 이 메서드는 상위 20개 계정만 반환합니다. 부의 분포에 대한 포괄적인 분석을 위해 다른 데이터 소스나 메서드가 필요할 수 있습니다.
* **필터 동작:** `circulating` 및 `nonCirculating` 필터는 이러한 분류에 대한 RPC 노드의 정의 및 데이터 소스에 따라 달라집니다.

이 가이드는 Solana 네트워크에서 가장 큰 SOL 소유자를 쿼리하기 위해 `getLargestAccounts` RPC 메서드를 사용하는 데 필요한 정보를 제공합니다.
