---
id: HS0034
title: "Signature history pagination"
url: https://carbium.sh/library/howsolana/signature-history-pagination
collection: How to use Solana
category: History and parsing
revision: 1
updated: 2026-11-22
author: Carbium
code: MIT (LICENSE in the zip); text: all rights reserved, Carbium Corporation
---

# Signature history pagination

One TypeScript file walks an address's signature history page by page with a before cursor, counts the failures, then reads the newest transactions in small parallel groups. It is read-only and needs no keypair.

## How the cursor works

A busy address can have millions of transactions, and no single call returns them all. `getSignaturesForAddress` returns one page, newest first, with up to 1,000 rows. Each row carries the signature, the slot, a `blockTime`, a `confirmationStatus` and an `err` field that is `null` for a success. To go further back, pass the last signature of the page as `before`, and the next call starts just below it.

Because the cursor is a signature, transactions that land at the top while you page downward cannot shift a page boundary. No row repeats and none goes missing between two calls. Keep the last signature you reached and a later run can resume from the same spot.

Listing and reading cost differently per signature. A page is one call that covers up to 1,000 signatures. The transaction behind each signature is a separate `getTransaction` call. Crawl the list first, filter it with what the rows already tell you (the slot, the time, whether it failed), and fetch full transactions only for the rows you need.

## The code

Install `@solana/kit` at 8.6.0, export `CARBIUM_KEY` and run the file with Node 24, which strips TypeScript types on load. It takes an address, a page count (3 by default) and the number of transactions to read in full (5 by default). The defaults keep a first run short, and you raise them once you have seen the output.

`main.ts` (run: `node main.ts <address> [pages] [transactions to read]`)

```ts
// HS0034 · Signature history pagination
// https://carbium.sh/library/howsolana/signature-history-pagination
// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.
// SPDX-License-Identifier: MIT

import { setTimeout as sleep } from "node:timers/promises";
import {
  address,
  createDefaultRpcTransport,
  createSolanaRpcFromTransport,
  isSolanaError,
  SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR,
  type Signature,
} from "@solana/kit";

const key = process.env.CARBIUM_KEY;
if (!key) {
  console.error("Set CARBIUM_KEY to your Carbium API key.");
  process.exit(1);
}
const url = process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh";
const rpc = createSolanaRpcFromTransport(
  createDefaultRpcTransport({ url, headers: { "x-api-key": key } }),
);

const [addr, pagesArg = "3", readArg = "5"] = process.argv.slice(2);
const pages = Number(pagesArg);
const toRead = Number(readArg);
if (!addr || !Number.isInteger(pages) || pages < 1 || !Number.isInteger(toRead) || toRead < 1) {
  console.error("Usage: node main.ts <address> [pages] [transactions to read]  (both counts positive integers)");
  process.exit(1);
}
const owner = address(addr);

// One retry on HTTP 429, after the number of seconds the door asks for.
async function withRetry<T>(call: () => Promise<T>): Promise<T> {
  try {
    return await call();
  } catch (e) {
    if (!isSolanaError(e, SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR) || e.context.statusCode !== 429) throw e;
    const seconds = Number(e.context.headers.get("retry-after")) || 1;
    console.error(`429: waiting ${seconds}s, then one more try`);
    await sleep(seconds * 1000);
    return call();
  }
}

// Walk down the history: each page starts below the last signature of the one before.
const rows: { signature: Signature; slot: bigint; err: unknown }[] = [];
let before: Signature | undefined;
for (let p = 1; p <= pages; p++) {
  const page = await withRetry(() =>
    rpc.getSignaturesForAddress(owner, { limit: 1000, before, commitment: "confirmed" }).send(),
  );
  console.log(`page ${p}: ${page.length} signatures`);
  if (page.length === 0) break;
  rows.push(...page);
  before = page[page.length - 1].signature;
}
if (rows.length === 0) {
  console.log("No signatures in the index for this address.");
  process.exit(0);
}
const failed = rows.filter((r) => r.err !== null).length;
console.log(`${rows.length} signatures, ${failed} failed on chain, slots ${rows[rows.length - 1].slot} to ${rows[0].slot}`);

// Read the newest rows in full, 5 at a time; one failing call does not stop the group.
const picked = rows.slice(0, toRead);
for (let i = 0; i < picked.length; i += 5) {
  const group = picked.slice(i, i + 5);
  const results = await Promise.allSettled(
    group.map((r) =>
      withRetry(() =>
        rpc
          .getTransaction(r.signature, { commitment: "confirmed", encoding: "json", maxSupportedTransactionVersion: 1 })
          .send(),
      ),
    ),
  );
  results.forEach((res, j) => {
    const sig = group[j].signature;
    if (res.status === "rejected") console.log(`  ${sig} failed: ${String(res.reason).slice(0, 80)}`);
    else if (res.value === null) console.log(`  ${sig} null (older than the ledger)`);
    else console.log(`  ${sig} slot=${res.value.slot} fee=${res.value.meta?.fee}`);
  });
}
```

The loop asks for 1,000 rows a page, sets `before` to the last signature it received and stops on an empty page or when the page budget is spent. An empty page is the only end signal the file trusts. Both calls run at `confirmed` commitment.

The reading step works through the newest rows in groups of 5. Each group runs under `Promise.allSettled`, so one failing call prints its reason and the rest of the group still reports. A `null` answer prints as `null` and the loop moves on.

## Reading the transactions

Both calls cost 50 cells, but their rates in calls per second differ a great deal on Business and Pro, and the rate of the transaction call sets the pace of a large job.

| Method | Cells per call | Free (req/s) | Dev (req/s) | Business (req/s) | Pro (req/s) |
|---|---|---|---|---|---|
| getSignaturesForAddress | 50 | 0.24 | 1.2 | 100 | 500 |
| getTransaction | 50 | 0.24 | 1.2 | 5 | 25 |

At 5 req/s, 1,000 transactions need 200 seconds of calls. At 25 req/s the same list needs 40. The same 1,000 signatures arrive in a single page call. So filter before you fetch: drop rows whose `err` is set when you only want successful activity, and cut by `blockTime` or slot when you only want one window.

Pass `maxSupportedTransactionVersion: 1` with an `encoding` on every `getTransaction`. Mainnet carries v1 transactions, and without the option, or with 0, a v1 transaction answers -32015. The [-32015 entry](https://carbium.sh/library/howsolana/transaction-version-error-32015) walks through that error. In `@solana/kit` 8.6.0 the value is typed as `'legacy' | 0 | 1`, so 1 needs no cast.

A JSON-RPC batch of up to 100 calls is available when round trips matter more than simplicity. Plan against the per-method rates in the table either way.

## On Carbium

A [rate class](https://carbium.sh/docs#limits) absorbs a burst of up to 1,024 cells or one second of its rate, whichever is larger. A page call [costs 50 cells](https://carbium.sh/docs#rpc), so a crawl of 20 pages fits inside one burst on any plan, and the pages after that run at the plan's rate.

A crawl that keeps drawing 429 needs fewer parallel reads or a plan with a higher rate for the method.

## Where it ends

On Carbium, `getSignaturesForAddress` reads from an address index that keeps up to 30 days. An empty page past that is the index's age limit, and the address may have older transactions. A crawl that runs to an empty page has reached the oldest day the index holds, which is not always the first transaction of the address.

The pages reach below the validator's ledger floor, so `getTransaction` can answer `null` for an older signature that the list shows. The file prints those and carries on. If a job needs every body in the window, count the `null` answers and treat them as a gap in the data.

One call covers one address. Passing a program id as the address lists the transactions that invoke that program, and a job spanning several addresses needs a crawl per address. A row holds a status, a slot and a time, and says nothing about what the transaction did. Reading instructions, balances or logs needs `getTransaction` for each signature.

A full 30-day crawl of a very busy address is many pages. At 50 cells a page, work out the cell budget and the time to the end before you start a long run.

## When it goes wrong

| What goes wrong | What to do |
|---|---|
| The crawl prints the same signatures twice. | The cursor was set to the first signature of a page instead of its last. Take `before` from the final row of the page you just received. |
| `getTransaction` answers `null` for a signature the list returned. | The signature is older than the ledger the validator still holds. The list reaches further back than the ledger. Skip it, or count it as a gap. |
| Error -32015 on some transactions. | Add `maxSupportedTransactionVersion: 1` and an `encoding` to the `getTransaction` config. Without it a v1 transaction is refused. |
| HTTP 429 with a retry-after hint during the reading step. | Transaction reads run at 5 req/s on Business and 25 on Pro. Read fewer transactions per run, or reduce the group size. |
| The file throws on the first argument before any request leaves. | The argument is not a valid base58 address. An address is 32 to 44 characters long, while a transaction signature runs to about 88 and is refused. |
| An empty first page for an address you know is active. | Check that the address belongs to mainnet and that it has had activity in the last 30 days. An address that is quiet for longer than that has nothing in the index. |

## Questions

### How many signatures does one call return?

Up to 1,000. Set `limit` to 1,000 and page with `before` until a page comes back empty.

### How do I pick up only the new transactions on the next run?

Keep the newest signature from the last run. Each call still stops at 1,000 rows, so the next run passes that signature as `until` on every page and pages with `before` until a page comes back empty. Passing it on the first page alone loses the rows just above it on a busy address.

### Why not read blocks instead?

A block holds every transaction in its slot, so you would read all of them to find the few that touch your address. The signature list is already filtered to the address.

### Which order do the rows come in?

Newest first, within a page and across pages. The last row of each page is the oldest one so far.

## Related

- [Transaction status check](https://carbium.sh/library/howsolana/transaction-status-check) (How to use Solana, HS0008)
- [Wallet activity tracker](https://carbium.sh/library/blockchainideas/wallet-activity-tracker) (Blockchain ideas, BI0005)
- [carbium.sh/docs#rpc](https://carbium.sh/docs#rpc)
- [carbium.sh/docs#limits](https://carbium.sh/docs#limits)
- [carbium.sh/docs#migrate](https://carbium.sh/docs#migrate)
- [carbium.sh/docs#errors](https://carbium.sh/docs#errors)
