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

# SOL-transfer-only history

One TypeScript file lists an account's recent signatures, reads each successful transaction, and keeps only the System Program transfers that touch that account. It prints slot, signature, sender, recipient and lamports. It only reads.

## Why the signature list needs a filter

`getSignaturesForAddress` returns every transaction that names an account, newest first. That covers SOL transfers, SPL token moves, program calls, account creation and failed transactions. The method has no filter by instruction type, so it cannot return only the SOL transfers. A signature says the account took part, and nothing about what it did.

A SOL transfer is an instruction to the System Program, with `source`, `destination` and `lamports` in its parsed form. The only way to see it is to read the transaction. The job therefore has two steps: list the signatures for the account with [signature paging](https://carbium.sh/library/howsolana/signature-history-pagination), then fetch each successful transaction and keep the System Program transfers that name the account as sender or recipient.

Failed transactions go first. A failed transaction moves no SOL apart from its fee, so the file drops every signature whose `err` is set before it spends a call on it.

## The code

Install `@solana/kit` at 8.6.0, export `CARBIUM_KEY` and run the file with Node 24, which strips the types on load. The account is the first argument. Without one, the file reads the newest System Program transactions and uses the sender of the first SOL transfer it finds, so a bare run still prints real rows.

`main.ts` (run: `node main.ts [account-address]`)

```ts
// HS0155 · SOL-transfer-only history
// https://carbium.sh/library/howsolana/sol-transfer-only-history
// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.
// SPDX-License-Identifier: MIT

import { address, createDefaultRpcTransport, createSolanaRpcFromTransport, 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 rpc = createSolanaRpcFromTransport(createDefaultRpcTransport({ url: process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh", headers: { "x-api-key": key } }));

const SYSTEM_PROGRAM = "11111111111111111111111111111111";
const PAGE = 50;
const PAGES = 2;
const MAX_TX = 12;

type Ix = { program?: string; parsed?: { type?: string; info?: { source?: string; destination?: string; lamports?: number | string } } };
type Tx = { meta?: { innerInstructions?: { instructions: unknown[] }[] } | null; transaction: { message: { instructions: unknown[] } } };
type Transfer = { slot: string; sig: string; from: string; to: string; lamports: string; via: string };

async function fetchTx(sig: Signature): Promise<Tx | null> {
  const res = await rpc.getTransaction(sig, { encoding: "jsonParsed", maxSupportedTransactionVersion: 1, commitment: "confirmed" }).send();
  return res as unknown as Tx | null;
}

function systemTransfers(sig: Signature, slot: string, tx: Tx): Transfer[] {
  const out: Transfer[] = [];
  const groups: [string, unknown[]][] = [
    ["top", tx.transaction.message.instructions],
    ["inner", (tx.meta?.innerInstructions ?? []).flatMap((g) => g.instructions)],
  ];
  for (const [via, list] of groups) {
    for (const raw of list) {
      const ix = raw as Ix;
      const info = ix.parsed?.info;
      const type = ix.parsed?.type ?? "";
      if (ix.program !== "system" || !["transfer", "transferWithSeed"].includes(type)) continue;
      if (!info?.source || !info.destination) continue;
      out.push({ slot, sig, from: info.source, to: info.destination, lamports: String(info.lamports ?? 0), via });
    }
  }
  return out;
}

async function signaturesFor(account: string) {
  const out: { signature: Signature; slot: bigint; err: unknown }[] = [];
  let before: Signature | undefined;
  for (let p = 0; p < PAGES; p++) {
    const page = await rpc
      .getSignaturesForAddress(address(account), { limit: PAGE, before, commitment: "confirmed" })
      .send();
    if (page.length === 0) break;
    out.push(...page);
    before = page[page.length - 1].signature;
  }
  return out;
}

async function discover(): Promise<string> {
  const recent = await rpc.getSignaturesForAddress(address(SYSTEM_PROGRAM), { limit: 10, commitment: "confirmed" }).send();
  for (const s of recent) {
    if (s.err !== null) continue;
    const tx = await fetchTx(s.signature);
    const found = tx ? systemTransfers(s.signature, String(s.slot), tx) : [];
    if (found.length > 0) return found[0].from;
  }
  throw new Error("no SOL transfer among the newest System Program transactions");
}

const account = process.argv[2] ?? (await discover());
const sigs = await signaturesFor(account);
const ok = sigs.filter((s) => s.err === null);
const checked = ok.slice(0, MAX_TX);
console.log(`account ${account}`);
console.log(`${sigs.length} signatures listed, ${ok.length} succeeded, reading the newest ${checked.length}`);

const hits: Transfer[] = [];
let unanswered = 0;
for (const s of checked) {
  try {
    const tx = await fetchTx(s.signature);
    if (!tx) { unanswered++; continue; }
    hits.push(...systemTransfers(s.signature, String(s.slot), tx).filter((t) => t.from === account || t.to === account));
  } catch (e) {
    unanswered++;
    console.error(`${s.signature}: ${e instanceof Error ? e.message : String(e)}`);
  }
}
for (const t of hits) console.log(`slot ${t.slot} ${t.sig} ${t.from} -> ${t.to} ${t.lamports} lamports (${t.via})`);
console.log(`${hits.length} SOL transfers involving ${account}; ${unanswered} transactions unanswered`);
```

The RPC client is created once. It sends the key in the `x-api-key` header to `https://services.carbium.sh`, or to `CARBIUM_RPC_URL` when that is set. The transaction call passes `maxSupportedTransactionVersion: 1`, because mainnet carries v1 transactions and the node answers -32015 for them when that value is absent or 0. The file reads at most two pages of 50 signatures and then checks the newest 12 successful ones, so one run makes a bounded number of calls.

Transfers come from two places in each transaction. Top-level instructions hold the transfers the sender made directly. Inner instructions hold the transfers a program made through a cross-program call, such as a payout a program forwards. The file reads both and labels each row `top` or `inner`.

## Reading each row

| Field | Meaning |
|---|---|
| slot | The slot the transaction landed in. The file uses it for order and does not convert it to a time. |
| sig | The transaction signature. Open it in an explorer to see the full instruction list. |
| from | The `source` of the System Program transfer. |
| to | The `destination` of the transfer. A row is kept when the account is either side. |
| lamports | The amount in lamports. 1 SOL is 1,000,000,000 lamports. |
| via | `top` for a direct instruction, `inner` for a transfer a program made. |

The `lamports` value arrives as a JSON number, and a JSON number past 2^53 loses its last digits. That is about 9 million SOL, far above a routine transfer, but a total over many rows can pass it. Keep the value as text for storage, and add amounts with `BigInt` when a sum matters.

> These rows carry only native SOL. A token transfer or a wrapped SOL transfer runs through the token program, so it does not appear here.

## What a run costs on Carbium

`getSignaturesForAddress` costs 50 cells per call, and `getTransaction` costs 50 cells per call. A run with an account argument makes at most two signature calls and 12 transaction calls, which is 700 cells. With no argument the file first reads up to 10 System Program transactions to find an account, which adds at most 550 cells, so the worst case is 1,250 cells. [Rate limits](https://carbium.sh/docs/limits) follow the plan of the key.

The signature method runs at 0.24 calls per second on Free, 1.2 on Dev, 100 on Business and 500 on Pro. A Free key therefore waits on the limit between calls, and a long run on Free takes a while. Use a plan with more calls per second for regular work, or lower `MAX_TX` for a quick check.

## Where it ends

The list reaches back 30 days at most. Carbium's signature pages come from an address index that keeps up to 30 days, so an empty page past 30 days marks the index's age limit, not an empty history. An account with older transfers needs another source for that older history.

`getTransaction` can answer null for a signature the list still shows, when the transaction sits below the validator's ledger floor. The file counts those as unanswered and moves on, and the last line of output says how many. A count of zero unanswered transactions does not prove the account made no transfers.

The file reads the newest 12 successful transactions, not all of them. The second line of output gives the number listed, the number that succeeded and the number read. A busy account can hold far more transfers than one run covers. Raise `MAX_TX` on a plan with more calls per second, or page further back with the `before` cursor.

Only System Program transfers count. A transfer of wrapped SOL through the token program does not appear, and neither does a balance change that comes with no transfer instruction. For the full picture of balance movement, read `meta.preBalances` and `meta.postBalances` from each transaction, which also include fees and rent.

## When it goes wrong

| What goes wrong | What to do |
|---|---|
| The list is empty for an account that is clearly active. | The address index keeps 30 days. Check the age of the newest signature you expect. An empty page past 30 days marks the index's limit, so use another source for older history. |
| The summary shows zero transfers, but the account received SOL. | The payment may be wrapped SOL or a token move, or it may sit in a transaction past the newest 12. Raise `MAX_TX`, and compare the succeeded count in the second output line with the transactions read. |
| A transaction is counted as unanswered. | The signature is listed, but the validator no longer holds that transaction. Skip it and keep the count in your report. Do not retry it in a loop. |
| Error -32015 from `getTransaction`. | Pass `maxSupportedTransactionVersion: 1` with an encoding. Mainnet carries v1 transactions, and a value of 0 or none gets -32015 for them. |
| HTTP 429 on a long run, or a run that stalls on the rate limit. | Lower `MAX_TX`, or move to a plan with more calls per second for these two methods. The unanswered count on the last line shows how many transactions were lost to the limit. |
| The file exits at once with a message about CARBIUM_KEY. | Export `CARBIUM_KEY` with your Carbium key in the shell that runs the file. The file makes no call before the key is set. |

## Questions

### Can the RPC return only the SOL transfers for an account?

No method filters by instruction type. You list the signatures, read each transaction and keep the System Program transfers yourself, as this file does.

### Can I use balance changes instead of parsing transfers?

Yes. `meta.preBalances` and `meta.postBalances` give each account's lamport change in one transaction, including fees and rent. They do not name the counterparty, so use them when the amount matters and the other side does not.

### How far back does this go?

30 days, from Carbium's address index. Older signatures may exist for the account, but the list does not serve them.

### Do transfers that a program makes show up?

Yes, from the inner instructions, labelled `inner` in the output. A transfer made through a cross-program call still names the account as source or destination.

## Related

- [Signature history pagination](https://carbium.sh/library/howsolana/signature-history-pagination) (How to use Solana, HS0034)
- [Wallet journal entries export](https://carbium.sh/library/usecase/wallet-journal-entries-export) (Use cases, UC0037)
- [carbium.sh/docs/rpc](https://carbium.sh/docs/rpc)
- [carbium.sh/docs/limits](https://carbium.sh/docs/limits)
- [carbium.sh/docs/errors](https://carbium.sh/docs/errors)
- [carbium.sh/docs/auth](https://carbium.sh/docs/auth)
