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

# getTokenLargestAccounts 사용 방법

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

[`getTokenLargestAccounts`](https://www.helius.dev/docs/api-reference/rpc/http/gettokenlargestaccounts) RPC 메서드는 주어진 SPL 토큰 민트에 대해 가장 큰 20개의 토큰 계정 목록을 반환합니다. 이는 토큰 분배를 분석하거나 특정 토큰의 주요 보유자를 식별하는 데 유용합니다.

## 일반 사용 사례

* **토큰 분배 분석:** 토큰의 공급이 보유자들 사이에 어떻게 분배되는지 이해하기.
* **고래 식별:** 특정 토큰을 대량으로 보유한 계정 찾기.
* **시장 조사:** 토큰 소유 집중도 측정.
* **상위 보유자 표시:** 토큰 탐색기 또는 대시보드에서 가장 큰 계정 목록 표시.

## 요청 매개변수

1. **`mintAddress`** (string, 필수): 가장 큰 계정을 찾고자 하는 토큰 민트의 base-58로 인코딩된 공개 키입니다.

2. **`options`** (object, 선택 사항): 포함할 수 있는 선택적 구성 객체:
   * **`commitment`** (string, 선택 사항): 쿼리를 위한 [커밋 수준](https://www.helius.dev/blog/solana-commitment-levels)을 지정합니다 (예: `"finalized"`, `"confirmed"`, `"processed"`).

## 응답 구조

JSON-RPC 응답의 `result.value` 필드는 최대 20개의 객체로 구성된 배열입니다. 각 객체는 가장 큰 토큰 계정 중 하나를 나타내며 다음 필드를 포함합니다:

* **`address`** (string): 토큰 계정의 base-58로 인코딩된 공개 키입니다.
* **`amount`** (string): 토큰 계정의 원시 잔액을 문자열로 나타내며, 이 값은 소숫점으로 조정되지 않았습니다.
* **`decimals`** (u8): 이 토큰 민트를 위해 정의된 소숫점 자리 수입니다.
* **`uiAmount`** (number | null): 소숫점으로 조정된 부동 소수점 형식의 토큰 잔액. 이 필드는 사용되지 않거나 신뢰도가 낮을 수 있으며 `uiAmountString`가 선호됩니다.
* **`uiAmountString`** (string): 소숫점으로 조정된 문자열 형식의 토큰 잔액으로, 사용자 친화적인 잔액 표현입니다.

**예시 응답:**

```json theme={"system"}
{
  "jsonrpc": "2.0",
  "result": {
    "context": { "slot": 123456789 },
    "value": [
      {
        "address": "TokenAccountPubkey1...",
        "amount": "1000000000000", // e.g., 1,000,000 tokens with 6 decimals
        "decimals": 6,
        "uiAmount": 1000000.0,
        "uiAmountString": "1000000.0"
      },
      {
        "address": "TokenAccountPubkey2...",
        "amount": "500000000000",  // e.g., 500,000 tokens with 6 decimals
        "decimals": 6,
        "uiAmount": 500000.0,
        "uiAmountString": "500000.0"
      }
      // ... up to 18 more accounts
    ]
  },
  "id": 1
}
```

## 코드 예제

<CodeGroup>
  ```bash cURL theme={"system"}
  # Replace <TOKEN_MINT_PUBKEY> with the actual mint address
  curl -X POST -H "Content-Type: application/json" -d \
    '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getTokenLargestAccounts",
      "params": [
        "<TOKEN_MINT_PUBKEY>"
      ]
    }' \
    <YOUR_RPC_URL>

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

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

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

    try {
      const largestAccounts = await connection.getTokenLargestAccounts(mintPublicKey);
      console.log(`Largest accounts for mint ${mintAddress}:`);
      largestAccounts.value.forEach(account => {
        console.log(`  Address: ${account.address}`);
        console.log(`    UI Amount: ${account.uiAmountString}`);
        console.log(`    Raw Amount: ${account.amount}`);
        console.log(`    Decimals: ${account.decimals}`);
      });
      // For full details:
      // console.log(JSON.stringify(largestAccounts, null, 2));
    } catch (error) {
      console.error(`Error fetching largest token accounts for mint ${mintAddress}:`, error);
    }
  }

  // Replace with the actual token mint public key you want to query
  const exampleTokenMint = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'; // USDC mint
  getLargestTokenHolders(exampleTokenMint);

  // Example with a different mint (e.g., Raydium)
  // const raydiumMint = '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R';
  // getLargestTokenHolders(raydiumMint);
  ```
</CodeGroup>

## 개발자 팁

* **고정 제한:** 이 메서드는 항상 최대 20개의 가장 큰 계정을 반환합니다. 페이징 또는 20개 이상의 계정 요청을 지원하지 않습니다.
* **데이터 정확성:** 데이터는 지정된 커밋 수준에 의해 결정된 슬롯에서의 원장 상태를 반영합니다.
* **토큰 민트 전용:** 결과는 요청에서 제공된 단일 토큰 민트에 한정됩니다.
* **성능:** 이는 타겟 쿼리로 일반적으로 성능이 좋습니다. 그러나 과도한 폴링은 피해야 합니다.

이 가이드는 Solana의 모든 SPL 토큰에서 주요 보유자를 발견하기 위해 `getTokenLargestAccounts` RPC 메서드를 사용하는 방법을 안내합니다.
