# getSignaturesForAddress

The `getSignaturesForAddress` RPC method retrieves a list of confirmed transaction signatures involving a specific account, ordered newest first. It’s the primary way to fetch an account’s transaction history on Solana.

***

#### ✅ Common Use Cases

* **Wallet History**\
  Display recent transactions for a user’s wallet. For richer parsing, consider CoinVera’s Enhanced Transactions API.
* **Activity Auditing**\
  Review all transactions tied to a particular smart contract or account.
* **Targeted Lookup**\
  Locate a specific transaction when you only know the involved address.
* **Local Indexing**\
  Build a custom transaction index for faster queries and analytics.

***

#### 🛠 Request Parameters

```json
{
  "address": "<base58AccountPubkey>",  // Required
  "options": {                         // Optional
    "limit": <number>,         // 1–1000 (default 1000)
    "before": "<signature>",   // Fetch signatures before this one
    "until": "<signature>",    // Stop when this signature is reached (exclusive)
    "commitment": "processed|confirmed|finalized",
    "minContextSlot": <u64>
  }
}
```

* **address**: Base‑58 public key of the target account.
* **limit**: Max signatures to return (default and max: 1000).
* **before / until**: Paginate by signature.
* **commitment**: Confirmation level (defaults to the node’s setting).
* **minContextSlot**: Minimum slot the node must have processed to serve this request.

***

#### 📦 Response Structure

Returns an array of objects—each representing one signature:

| Field                | Type           | Description                                            |
| -------------------- | -------------- | ------------------------------------------------------ |
| `signature`          | string         | Base‑58 transaction signature                          |
| `slot`               | u64            | Slot in which the transaction was processed            |
| `err`                | object \| null | Error details if the transaction failed                |
| `memo`               | string \| null | Memo attached to the transaction, if any               |
| `blockTime`          | i64 \| null    | Unix timestamp of the block (seconds since epoch)      |
| `confirmationStatus` | string \| null | “processed”, “confirmed”, or “finalized” (may be null) |

***

#### 💡 Examples

1. **Fetch the Latest Signatures**\
   Retrieve up to 1,000 newest signatures for an address.
2. **Limit the Number of Signatures**\
   Request a specific count (e.g., 100) by setting `limit: 100`.
3. **Paginate Through History**\
   Use `before` with the last signature of the previous batch to page backwards.

***

**Code Examples**

{% tabs %}
{% tab title="Nodejs" %}

```javascript
const fetch = require('node-fetch');

async function getSignaturesForAddress(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getSignaturesForAddress',
        "params": [
            "4UJuvGZ7Ge8H3je63Nsb9ZRNVBAd3CG2ajibnRaVSbw5",
            {
              "limit": 5 
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getSignaturesForAddress(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_signatures_for_address(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getSignaturesForAddress',
                'params': [
                    '4UJuvGZ7Ge8H3je63Nsb9ZRNVBAd3CG2ajibnRaVSbw5',
                    {
                        'limit': 5
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_signatures_for_address(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "result": [
    {
      "blockTime": 1753337914,
      "confirmationStatus": "finalized",
      "err": null,
      "memo": null,
      "signature": "4boe3PE7Z2JvVuJb71MCNHZMRSGpcgMVFtiWADzGNTQkM6aa6b9xZg21Rs4xckLiDfFHfQNcPimMD7AmWkqS8KWC",
      "slot": 355371621
    },
    {
      "blockTime": 1753337729,
      "confirmationStatus": "finalized",
      "err": null,
      "memo": null,
      "signature": "3ec22yxtoMsSZKgEG7yGmLpVqkwQL4mqo4uBJbXJbx3VHAot6zhxLoH9K34hpD5SaeTGc3x4ufFMuA2r8mDJ84eP",
      "slot": 355371148
    },
    {
      "blockTime": 1753336615,
      "confirmationStatus": "finalized",
      "err": null,
      "memo": null,
      "signature": "4sjZcFBuamq26nSEiQeezaHwNzr1zPfaYf4iJXbZ7FHcEJ7jxLkFWp6UMhab3fyq98EQyoym6j8dEHnZR1u5XgU2",
      "slot": 355368317
    },
    {
      "blockTime": 1753336550,
      "confirmationStatus": "finalized",
      "err": null,
      "memo": null,
      "signature": "3ogjKgB5thqU7ENNUTaxnVHnG8eufW4cm8Jx42bofiHGWHamjMMiEm3RdTSThq38mwtcuqDChg6FTaX84TkiZ1aS",
      "slot": 355368149
    },
    {
      "blockTime": 1753335989,
      "confirmationStatus": "finalized",
      "err": null,
      "memo": null,
      "signature": "2iHnTgv2cJvr3EMdFaEoYcjQrtUL9kq7LmBPENKb4YA4ZgA3ZGDvEnmNu6sdnuW6kmQM9Rbc3fsQYhWg6cXGCYqe",
      "slot": 355366716
    }
  ],
  "id": 1
}
```

***

#### 🧠 Developer Tips

* **Pagination Is Essential**\
  To walk an active account’s full history, repeat calls using `before` and adjust `limit`.
* **Watch Rate Limits**\
  Large or frequent history queries can hit RPC provider limits.
* **Ordering Guaranteed**\
  Results always flow from newest to oldest.
* **Use `until` to Stop Early**\
  If you only need transactions up to a known signature, specify `until` to halt the scan.
* **Context Slot Doesn’t Filter**\
  `minContextSlot` sets the node’s ledger state threshold, not a transaction filter.
* **Full Details via `getTransaction`**\
  This method returns only signatures and metadata; retrieve full transaction info by feeding each signature into `getTransaction`.

***

By leveraging `getSignaturesForAddress` with its pagination and filtering options, you can efficiently access and manage any Solana account’s transaction history.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.coinvera.io/integration/solana/rpc/getsignaturesforaddress.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
