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

# getSignaturesForAddress 사용 방법

> getSignaturesForAddress 사용 사례, 코드 예제, 요청 매개변수, 응답 구조 및 팁을 배웁니다.

[`getSignaturesForAddress`](https://www.helius.dev/docs/api-reference/rpc/http/getsignaturesforaddress) RPC 메서드는 특정 계정 주소와 관련된 확인된 거래 서명을 목록으로 가져올 수 있게 해줍니다. 이는 계정의 거래 내역을 가져오는 데 유용합니다. 서명은 최신순(가장 최근 항목 우선)으로 반환됩니다.

<Tip>
  고급 필터링, 정렬 및 토큰 계정 기록에 대해서는 [`getTransactionsForAddress`](/docs/ko/rpc/gettransactionsforaddress)를 대신 사용하세요. `getSignaturesForAddress`는 관련 토큰 계정을 포함한 거래를 포함하지 않습니다.
</Tip>

## 일반적인 사용 사례

* **계정 거래 내역:** 사용자의 지갑에 대한 과거 거래를 표시합니다. 거래 내역을 더 자세히 분석하려면 Helius의 [강화된 거래 API](https://www.helius.dev/docs/enhanced-transactions)를 사용하는 것이 좋습니다.
* **활동 감사:** 특정 스마트 계약 또는 계정과 관련된 모든 거래 검토.
* **특정 거래 조회:** 관련 주소만 알려진 경우 계정의 내역을 반복하여 특정 거래 찾기.
* **데이터 색인화:** 더 빠른 쿼리 및 분석을 위해 로컬화된 거래 색인 구축.

## 요청 매개변수

1. **`address`** (`string`): (필수) 거래 서명을 검색할 계정의 base-58로 인코딩된 공개 키입니다.
2. **`options`** (`object`, 선택적): 다음 필드를 포함하는 선택적 구성 객체:
   * **`limit`** (`number`, 선택적): 반환할 서명의 최대 수입니다. 기본값은 1000이며 최대 허용치는 1000입니다.
   * **`before`** (`string`, 선택적): base-58로 인코딩된 거래 서명. 제공되는 경우 이 서명 이전의 거래를 검색합니다.
   * **`until`** (`string`, 선택적): base-58로 인코딩된 거래 서명. 제공되는 경우 이 서명까지(독점적) 거래를 검색합니다.
   * **`commitment`** (`string`, 선택적): 쿼리에 사용할 [커밋 수준](https://www.helius.dev/blog/solana-commitment-levels)을 지정합니다. 지원되는 값은 `finalized` 또는 `confirmed`입니다. `processed` 커밋은 지원되지 않습니다. 생략할 경우 RPC 노드의 기본 커밋이 사용됩니다(보통 `finalized`).
   * **`minContextSlot`** (`number`, 선택적): 요청을 평가할 수 있는 최소 슬롯입니다. 이는 과거 거래에 대한 필터가 아니며 노드의 컨텍스트에 대한 최소 슬롯을 설정합니다.

<Warning>
  **일괄 처리 지원 안 함**

  이 아카이브 메서드는 일괄 처리를 지원하지 않습니다. 개별 요청만 하십시오.
</Warning>

## 응답 구조

JSON-RPC 응답의 `result` 필드는 서명 정보 객체 배열입니다. 각 객체는 다음과 같은 구조를 가지고 있습니다:

* **`signature`** (`string`): base-58로 인코딩된 거래 서명입니다.
* **`slot`** (`u64`): 거래가 처리된 슬롯입니다.
* **`err`** (`object` | `null`): 거래가 실패한 경우 오류 객체, 성공한 경우 `null`.
* **`memo`** (`string` | `null`): 거래와 관련된 메모(있는 경우).
* **`blockTime`** (`i64` | `null`): 거래를 포함한 블록의 예상 생성 시간(Unix 타임스탬프, epoch 이후 초 단위). `null`는 사용 가능하지 않은 경우.
* **`confirmationStatus`** (`string` | `null`): 거래의 확인 상태(예: `processed`, `confirmed`, `finalized`). old Helius 응답의 경우 사용할 수 없는 경우 `null`.

## 예제

### 1. 주소에 대한 최신 서명 가져오기

이 예제는 주어진 주소에 대한 가장 최근(최대 1000) 거래 서명을 가져옵니다.

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

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

  async function getLatestSignatures() {
    const connection = new Connection('https://mainnet.helius-rpc.com/?api-key=<api-key>');
    // Replace with the public key you want to query
    const address = new PublicKey('11111111111111111111111111111111'); 

    try {
      const signatures = await connection.getSignaturesForAddress(address);
      if (signatures && signatures.length > 0) {
        console.log(`Found ${signatures.length} signatures:`);
        signatures.forEach((sigInfo, index) => {
          console.log(`--- Signature ${index + 1} ---`);
          console.log(`  Signature: ${sigInfo.signature}`);
          console.log(`  Slot: ${sigInfo.slot}`);
          console.log(`  Block Time: ${sigInfo.blockTime ? new Date(sigInfo.blockTime * 1000).toLocaleString() : 'N/A'}`);
          console.log(`  Error: ${JSON.stringify(sigInfo.err)}`);
          console.log(`  Memo: ${sigInfo.memo || 'N/A'}`);
          console.log(`  Confirmation Status: ${sigInfo.confirmationStatus || 'N/A'}`);
        });
      } else {
        console.log('No signatures found for this address.');
      }
    } catch (error) {
      console.error('Error fetching signatures:', error);
    }
  }

  getLatestSignatures();
  ```
</CodeGroup>

### 2. 제한된 서명 가져오기

이 예제는 주소에 대한 최근 거래 서명의 지정된 수를 가져옵니다.

<CodeGroup>
  ```bash cURL theme={"system"}
  # Replace <api-key> with your Helius API key
  # Replace TARGET_ACCOUNT_ADDRESS with the address you want to query
  curl https://mainnet.helius-rpc.com/?api-key=<api-key> -X POST -H "Content-Type: application/json" -d \
    '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getSignaturesForAddress",
      "params": [
        "TARGET_ACCOUNT_ADDRESS",
        {
          "limit": 5 
        }
      ]
    }'
  ```

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

  async function getLimitedSignatures() {
    const connection = new Connection('https://mainnet.helius-rpc.com/?api-key=<api-key>');
    // Replace with the public key you want to query
    const address = new PublicKey('Vote111111111111111111111111111111111111111'); 
    const limit = 5;

    try {
      const signatures = await connection.getSignaturesForAddress(address, { limit });
      console.log(`Fetched up to ${limit} signatures:`);
      signatures.forEach((sigInfo, index) => {
        console.log(`${index + 1}. Signature: ${sigInfo.signature}, Slot: ${sigInfo.slot}`);
      });
    } catch (error) {
      console.error(`Error fetching limited signatures for ${address.toBase58()}:`, error);
    }
  }

  getLimitedSignatures();
  ```
</CodeGroup>

### 3. 거래 내역을 통한 페이지 매김

이 예제는 `before` 매개변수를 사용하여 배치로 거래 내역을 가져오는 방법을 설명합니다.

<CodeGroup>
  ```bash cURL theme={"system"}
  # Initial request (get the latest 2)
  # Replace <api-key> with your Helius API key
  # Replace TARGET_ACCOUNT_ADDRESS with the address you want to query
  curl https://mainnet.helius-rpc.com/?api-key=<api-key> -X POST -H "Content-Type: application/json" -d \
    '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getSignaturesForAddress",
      "params": [
        "TARGET_ACCOUNT_ADDRESS",
        { "limit": 2 }
      ]
    }'

  # Suppose the last signature from the above response was LAST_SIGNATURE_FROM_PREVIOUS_BATCH
  # Fetch the next 2 transactions before that one
  curl https://mainnet.helius-rpc.com/?api-key=<api-key> -X POST -H "Content-Type: application/json" -d \
    '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getSignaturesForAddress",
      "params": [
        "TARGET_ACCOUNT_ADDRESS",
        { 
          "limit": 2,
          "before": "LAST_SIGNATURE_FROM_PREVIOUS_BATCH" 
        }
      ]
    }'
  ```

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

  async function paginateSignatures() {
    const connection = new Connection('https://mainnet.helius-rpc.com/?api-key=<api-key>');
    // Replace with the public key you want to query - e.g. a known active address
    const address = new PublicKey('Vote111111111111111111111111111111111111111'); 
    const batchSize = 2;
    let lastSignature = null;
    let allSignatures = [];
    const maxPages = 3; // Limit how many pages we fetch for this example

    try {
      for (let i = 0; i < maxPages; i++) {
        console.log(`Fetching page ${i + 1}...`);
        const options = { limit: batchSize };
        if (lastSignature) {
          options.before = lastSignature;
        }

        const signatures = await connection.getSignaturesForAddress(address, options);
        
        if (signatures.length === 0) {
          console.log('No more signatures found.');
          break;
        }

        signatures.forEach(sigInfo => {
          allSignatures.push(sigInfo.signature);
          console.log(`  Found: ${sigInfo.signature} in slot ${sigInfo.slot}`);
        });
        
        lastSignature = signatures[signatures.length - 1]?.signature;

        if (signatures.length < batchSize || !lastSignature) {
           console.log('Fetched all available signatures or reached end of page.');
           break;
        }
        // Optional: Add a small delay if making many sequential requests
        // await new Promise(resolve => setTimeout(resolve, 200)); 
      }
      console.log(`
  Total signatures fetched (${allSignatures.length}):`);
      allSignatures.forEach((sig, idx) => console.log(`${idx + 1}. ${sig}`));

    } catch (error) {
      console.error('Error paginating signatures:', error);
    }
  }

  paginateSignatures();
  ```
</CodeGroup>

## 개발자 팁

* **페이지 매김:** 활성 계정에 대한 전체 거래 내역을 얻으려면 `before` 매개변수를 사용하여 여러 번의 요청을 해야 할 가능성이 큽니다. 이전 배치에서 받은 마지막 서명과 함께 `limit`를 사용하십시오.
* **속도 제한:** 광범위한 거래 내역을 가져올 때 RPC 노드 속도 제한을 주의하십시오.
* **정렬:** 서명은 항상 최신순으로 반환됩니다.
* **`limit` 매개변수:** `limit` 매개변수는 1에서 1000 사이가 될 수 있습니다. 지정하지 않을 경우 기본값은 1000입니다.
* **`until` 매개변수:** 이 매개변수는 특정 지점까지의 거래만 필요할 때 알려진 오래된 서명에 도달하면 서명 가져오기를 중지하는 데 사용할 수 있습니다.
* **`minContextSlot`:** 이 매개변수는 역사적 거래를 필터링하지 않습니다. 요청 평가 시 RPC 노드가 사용할 컨텍스트의 최소 슬롯을 지정합니다. 노드의 상태가 이 슬롯보다 오래된 경우 오류를 반환할 수 있습니다.
* **거래 세부 사항:** 이 메서드는 서명과 기본 정보만 반환합니다. 전체 거래 세부 정보를 얻으려면 각 서명에 대해 `getTransaction` 메서드를 사용해야 합니다.
* **토큰 계정 제한:** 이 메서드는 제공된 주소를 직접 참조하는 거래만 반환합니다. 주소가 소유한 토큰 계정과 관련된 거래는 포함하지 않습니다. 관련 토큰 계정을 포함한 전체 토큰 기록을 위해 [`getTransactionsForAddress`](/docs/ko/rpc/gettransactionsforaddress)를 `tokenAccounts` 필터와 함께 사용하십시오.

`getSignaturesForAddress`와 그의 페이지 매김 옵션을 사용하여 솔라나 주소에 대한 거래 내역을 효과적으로 검색하고 관리할 수 있습니다.

## 관련 메서드

<CardGroup cols={2}>
  <Card title="getTransactionsForAddress" href="/docs/ko/rpc/gettransactionsforaddress">
    고급 필터링, 정렬 및 토큰 계정 내역
  </Card>

  <Card title="getTransaction" href="/docs/ko/api-reference/rpc/http/gettransaction">
    서명에서 전체 거래 세부 정보 가져오기
  </Card>
</CardGroup>
