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

# getInflationReward 사용 방법

> getInflationReward 사용 사례, 코드 예제, 요청 매개변수, 응답 구조 및 팁을 알아봅니다.

[getInflationReward](https://www.helius.dev/docs/api-reference/rpc/http/getinflationreward) RPC 메서드를 사용하여 특정 에포크에 대한 하나 이상의 주소에 적립된 [인플레이션](https://www.helius.dev/blog/solana-issuance-inflation-schedule) 보상(일반적으로 스테이킹 보상으로 알려져 있음)을 조회할 수 있습니다.

이는 스테이크 계정이나 인플레이션 보상을 받은 계정의 보상을 확인하는 데 유용합니다.

<Warning>
  **성능 향상을 위한 배치 사용 지양**

  배치 아카이브 방법은 대기 시간을 크게 증가시킵니다. 10개 이상의 요청으로 이루어진 배치가 허용되지 않습니다.
</Warning>

## 일반적인 사용 사례

* **스테이킹 보상 확인:** 이전 에포크에 대한 기대 보상을 스테이크 계정이 받았는지 확인합니다.
* **보상 기록 추적:** 여러 에포크의 보상을 조회하여 주소에 대한 기록을 만듭니다.
* **검증자 지급 감사:** 검증자는 이를 사용하여 보상 배포를 확인할 수 있습니다(단, 보상은 검증자 ID가 아닌 스테이크 계정에 지급됩니다).

## 요청 매개변수

이 메서드는 두 가지 주요 매개변수를 사용합니다:

1. **addresses** (문자열 배열): 조회할 계정의 base-58로 인코딩된 공개 키 목록입니다. 허용되는 최대 주소 수는 RPC 제공자에 따라 다를 수 있습니다(예: Helius는 유료 플랜의 경우 최대 1005개까지 허용).
2. **options** (객체, 선택 사항): 다음과 같은 선택적 필드를 포함하는 구성 객체:
   * **commitment** (문자열, 선택 사항): [커밋 수준](https://www.helius.dev/blog/solana-commitment-levels)을 지정합니다. 제공되지 않으면 기본적으로 최고 수준입니다.
   * **epoch** (정수, 선택 사항): 보상을 가져올 에포크 번호입니다. 생략하면 RPC 노드는 일반적으로 배포된 보상이 있는 가장 최근에 완료된 에포크를 사용합니다.
   * **min\_slot** (정수, 선택 사항): 요청이 평가될 수 있는 최소 슬롯입니다. 이를 통해 이 슬롯까지 처리된 원장 상태에 대해 조회가 이루어집니다.

## 응답 구조

JSON-RPC 응답의 result 필드는 입력 addresses 배열에 해당하는 배열이 됩니다. 결과 배열의 각 요소는 다음 중 하나입니다:

* 지정된 에포크에 대한 보상을 받은 주소의 경우 인플레이션 보상 세부 정보를 포함하는 **객체**.
* 그 에포크에 대해 인플레이션 보상을 받지 않았거나 계정이 존재하지 않았던 경우 **null**.

보상 객체는 다음 필드를 포함합니다:

* **epoch** (u64): 이 보상이 적립된 에포크입니다.
* **effectiveSlot** (u64): 보상이 적용되고 효력이 발생한 슬롯입니다.
* **amount** (u64): lamports 단위의 보상 금액입니다.
* **postBalance** (u64): 보상이 적립된 후 계정의 lamports 단위의 잔액입니다.
* **commission** (u8 | undefined): 투표 계정의 경우 보상이 적립될 때 검증자가 취득한 수수료 비율(0-100)입니다. 비투표 계정의 경우 null입니다.

## 예시

### 1. 단일 주소에 대한 인플레이션 보상 가져오기 (이전 에포크)

이 예시는 가장 최근에 완료된 에포크에 대한 특정 주소의 인플레이션 보상을 가져옵니다.

<CodeGroup>
  ```bash cURL theme={"system"}
  # Replace YOUR_VOTE_ACCOUNT_PUBKEY with an actual vote account public key
  # 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": "getInflationReward",
      "params": [
        ["YOUR_VOTE_ACCOUNT_PUBKEY"]
      ]
    }'
  ```

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

  async function checkInflationReward() {
    const connection = new Connection('https://mainnet.helius-rpc.com/?api-key=<api-key>');
    const voteAccountPubkey = new PublicKey('YOUR_VOTE_ACCOUNT_PUBKEY'); // Example: 'Vote111111111111111111111111111111111111111'

    try {
      const rewards = await connection.getInflationReward([voteAccountPubkey]);
      if (rewards && rewards[0]) {
        const rewardInfo = rewards[0];
        console.log(`Reward for Epoch ${rewardInfo.epoch}:`);
        console.log(`  Amount: ${rewardInfo.amount} lamports`);
        console.log(`  Effective Slot: ${rewardInfo.effectiveSlot}`);
        console.log(`  Post Balance: ${rewardInfo.postBalance} lamports`);
        if (rewardInfo.commission !== undefined) {
          console.log(`  Commission: ${rewardInfo.commission}%`);
        }
      } else {
        console.log('No inflation reward found for the address in the previous epoch.');
      }
      // console.log(JSON.stringify(rewards, null, 2));
    } catch (error) {
      console.error('Error fetching inflation reward:', error);
    }
  }

  checkInflationReward();
  ```
</CodeGroup>

### 2. 특정 에포크에 대한 여러 주소에 대한 인플레이션 보상 가져오기

<CodeGroup>
  ```bash cURL theme={"system"}
  # Replace <api-key> with your Helius API key
  # Replace PUBKEY_1 and PUBKEY_2 with actual public keys
  curl https://mainnet.helius-rpc.com/?api-key=<api-key> -X POST -H "Content-Type: application/json" -d \
    '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getInflationReward",
      "params": [
        ["PUBKEY_1", "PUBKEY_2"],
        { "epoch": 450, "commitment": "confirmed" }
      ]
    }'
  ```

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

  async function checkMultipleRewards() {
    const connection = new Connection('https://mainnet.helius-rpc.com/?api-key=<api-key>');
    const address1 = new PublicKey('PUBKEY_1'); 
    const address2 = new PublicKey('PUBKEY_2');
    const specificEpoch = 450;

    try {
      const rewards = await connection.getInflationReward(
        [address1, address2],
        specificEpoch,
        { commitment: 'confirmed' }
      );
      rewards.forEach((rewardInfo, index) => {
        const address = index === 0 ? 'PUBKEY_1' : 'PUBKEY_2';
        if (rewardInfo) {
          console.log(`Reward for ${address} in Epoch ${rewardInfo.epoch}:`);
          console.log(`  Amount: ${rewardInfo.amount} lamports`);
        } else {
          console.log(`No inflation reward found for ${address} in Epoch ${specificEpoch}.`);
        }
      });
      // console.log(JSON.stringify(rewards, null, 2));
    } catch (error) {
      console.error('Error fetching inflation rewards for epoch ', specificEpoch, error);
    }
  }

  checkMultipleRewards();
  ```
</CodeGroup>

## 개발자 팁

* **에포크 명확성:** 보상은 에포크당 한 번 적립됩니다. 올바른 에포크 번호를 조회하고 있는지 확인하십시오.
* **보상의 시기:** 인플레이션 보상은 에포크가 끝날 때 계산되고 다음 에포크 시작 시 적용됩니다. 이는 언제 이 일이 발생하는지를 나타냅니다.
* **null 결과:** 주소에 대한 null 결과는 지정된 에포크에 대해 해당 주소에 대한 보상이 없음을 의미합니다. 이는 계정이 자격이 없었거나(예: 충분히 스테이킹되지 않은 스테이크 계정), 보상이 0이었거나, 해당 시점에 계정이 존재하지 않았기 때문일 수 있습니다.
* **요율 제한:** 많은 수의 주소를 조회할 때 특히 RPC 제공자의 요율 제한을 주의하십시오.

이 가이드는 솔라나 네트워크에서 스테이킹 보상을 정확하게 검색하고 확인하는 데 getInflationReward 메서드를 사용하는 방법을 안내합니다.
