services
Get a key

library / Use cases / Analytics and research / UC0123

Date-range transaction query

A list of every transaction signature an address touched between two dates, built by paging newest first and stopping at the start date, with the fee for the newest three and a flag when the page cap cut the range short.

By Carbium · Analytics and research · UC0123 · updated 2026-11-23

01

The job

A finance analyst, a support engineer and an auditor all ask the same thing in different words: every transaction that touched this address between the first and the last day of the month. Solana RPC has no call that takes two dates. The node gives you a signature list for one address, newest first, and each entry carries the Unix time of its block.

A date range query is therefore a walk down that list. You read a page, keep the entries whose time falls inside the range, skip the ones that are too new, and stop at the first entry that is older than the start date. The work is a plain loop, and its cost follows the number of entries between now and the start of the range. A quiet address over a month can cost less than a busy one over an hour.

That also means the walk always begins at the newest signature. A range that ended three weeks ago still pays for the three weeks in between, because the pages cannot be entered in the middle by date. Teams that run this every month usually store the last signature they saw and resume from it, which Signature history pagination covers on its own.

02

Walking the signature list

getSignaturesForAddress returns up to 1000 entries per call for every transaction that lists the address among its accounts, newest first. Each entry holds the signature, the slot, an err field that is null for a success, a memo, and blockTime in Unix seconds. To read the next page, pass the last signature of the previous page as before. A page shorter than the limit, or an empty one, means the list has ended.

  • The range is half open: the start is inclusive and the end is exclusive. Two adjacent ranges then never share a transaction and never drop one at the seam.
  • blockTime is UTC seconds. Parse the dates as UTC, and write them with a trailing Z so the machine's zone cannot shift them.
  • An entry newer than the end is skipped and the walk continues. The first entry older than the start ends the walk, because the list runs newest first and block time does not go backward as slots advance.
  • A failed transaction still appears with a non-null err. It paid a fee, so a fee report keeps it, and a transfer report filters it out.
  • blockTime can be null. The script leaves those entries out of the result and prints how many it saw.

The script names finalized on the list call. The server's default is finalized, and @solana/kit 8.6.0 fills in confirmed when a call leaves commitment out, so naming it keeps the answer the same on any client. Finalized now sits 0 to 1 slots behind processed, so a range that ends now loses little to the wait.

03

The range script

Install the one dependency with npm i @solana/[email protected]. The script reads CARBIUM_KEY and exits with a message when it is unset. The arguments are the address, then an optional start and an optional end as ISO dates. With neither, the range is the last ten minutes. A cap of five pages of 200 entries keeps a first run cheap, and the CARBIUM_RPC_URL variable overrides the endpoint.

main.ts
// UC0123 · Date-range transaction query// https://carbium.sh/library/usecase/date-range-transaction-query// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.// SPDX-License-Identifier: MIT// Read-only: lists an address's transactions inside a date range by paging getSignaturesForAddress newest first, then reads the newest few.import { address, createDefaultRpcTransport, createSolanaRpcFromTransport } from "@solana/kit";import 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 [addr, sinceArg, untilArg] = process.argv.slice(2);const until = untilArg ? Date.parse(untilArg) / 1000 : Math.floor(Date.now() / 1000);const since = sinceArg ? Date.parse(sinceArg) / 1000 : until - 600;if (!addr || !(since < until)) { console.error("Usage: node main.ts <address> [since ISO] [until ISO], with since before until."); process.exit(1); }if (since < Date.now() / 1000 - 30 * 86400) console.log("warning: the range starts beyond the 30 day address index");const rpc = createSolanaRpcFromTransport(createDefaultRpcTransport({ url, headers: { "x-api-key": key } }));const owner = address(addr);const PAGE = 200, MAX_PAGES = 5;const iso = (t: number) => new Date(t * 1000).toISOString();const found: { signature: Signature; time: number; failed: boolean }[] = [];let before: Signature | undefined;let pages = 0, unknown = 0;let reachedStart = false;try {  while (!reachedStart && pages < MAX_PAGES) {    const page = await rpc.getSignaturesForAddress(owner, { limit: PAGE, before, commitment: "finalized" }).send();    pages++;    for (const s of page) {      if (s.blockTime === null) { unknown++; continue; }      const time = Number(s.blockTime);      if (time < since) { reachedStart = true; break; } // older than the range: the walk is over      if (time < until) found.push({ signature: s.signature, time, failed: s.err !== null });    }    if (page.length < PAGE) reachedStart = true;    before = page[page.length - 1]?.signature;  }} catch (e) { console.log("paging stopped:", e instanceof Error ? e.message : e); }console.log(`${found.length} transactions in [${iso(since)}, ${iso(until)}) from ${pages} pages, ${found.filter((f) => f.failed).length} failed, ${unknown} without a block time`);if (!reachedStart) console.log(`range start not reached: the oldest time kept is ${found.length ? iso(found[found.length - 1].time) : "none"}, so the list is partial`);const settled = await Promise.allSettled(found.slice(0, 3).map(async (f) => {  const tx = await rpc.getTransaction(f.signature, { encoding: "json", commitment: "finalized", maxSupportedTransactionVersion: 1 }).send();  const head = `${f.signature.slice(0, 12)} ${iso(f.time)}`;  return tx === null ? `${head} no transaction served` : `${head} fee ${tx.meta?.fee ?? "unknown"} lamports`;}));for (const r of settled) console.log(r.status === "fulfilled" ? r.value : `getTransaction failed: ${r.reason instanceof Error ? r.reason.message : r.reason}`);

run: CARBIUM_KEY=$CARBIUM_KEY node main.ts EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v

A run prints how many transactions fell in the range, how many pages it took, how many failed and how many had no block time. When the page cap ended the walk before the start date, the next line says so and names the oldest time it did read, so a partial list never passes for a full one. The last lines show the signature, time and fee in lamports for the three newest transactions.

04

What a range costs

Both calls in the script cost 50 cells. The table gives each method's sustained rate per plan, in calls per second.

MethodCellsFreeDevBusinessPro
getSignaturesForAddress500.241.2100500
getTransaction500.241.2525

A page is one call, so a walk of 10 pages costs 500 cells. On a Free key 0.24 calls a second is about one call every four seconds once the burst of 1,024 cells is spent, so a long range wants a paid plan or a patient loop. Reading the details is the slower half on Business: at 5 calls a second, 1,000 transactions take 200 seconds, while listing the same 1,000 signatures is a single call at a limit of 1,000.

A batch of up to 100 calls goes out as one request, which saves round trips. Each call inside keeps its own cell charge. For a large range, list first, decide which signatures you need in full, and fetch only those. A count by day or a failure rate needs no getTransaction call at all, because the list already holds the time and the success flag. A fee total does, since the list carries no fee.

05

Fetching the transactions

getTransaction takes a signature and returns the message, the balance changes and the logs. Mainnet carries v1 transactions, and a call without maxSupportedTransactionVersion set to 1 answers -32015 for one of them. The script sends 1, which @solana/kit 8.6.0 accepts without a cast when the value sits inside the call. If you keep the config in a variable, add as const. The -32015 note covers the error on its own.

The fee comes from meta.fee in lamports as a bigint. Amounts moved need more work: the balance arrays in meta give the change per account, and the decoded instructions give the reason. The script prints only the fee, since the range query is the point and a decoder is a separate job.

A signature in the list can come back as null from getTransaction. The script prints that and goes on. The three lookups run together through Promise.allSettled, so one failure never hides the other two.

For output, Wallet transaction CSV export turns a signature list into a file an accountant can open, and Slot to timestamp conversion explains where the block time in each entry comes from.

06

Where it ends

  • The list reaches back 30 days at most, because its pages come from the address index. An empty page past 30 days marks the index's age limit, and the address may have older transactions. A range that starts earlier gets a warning from the script and an honest short result.
  • getTransaction can answer null for an older signature the list returns, since the index reaches below the validator's ledger floor. The details step handles null, and the list step does not depend on it.
  • The page cap is a safety limit. A busy address fills it long before the start date, and the script then reports a partial result with the oldest time read. Raise the cap only when you have counted the cells it can spend.
  • The list shows transactions that include the address in their accounts, as a signer, a writable account or a read-only one. It does not say whether SOL or a token moved. That answer sits in the transaction's balance changes.
07

When it goes wrong

what goes wrongwhat to do
The result is empty for a range that clearly had activity.The range lies older than the 30-day address index, or the page cap ran out before the walk reached it. Read the printed warning and the partial-result line, then raise the page cap or move the range inside the window.
A page fails with 429.The call went over the rate for the method on your plan. The script stops paging at the error and prints the partial-result line with what it read. Wait for the retry-after hint and run it again, or pace the loop to your plan's rate.
getTransaction answers -32015.The transaction is a v1 transaction and the call left maxSupportedTransactionVersion at 0 or unset. Send 1 with an encoding on every transaction read.
getTransaction answers null for a signature the list gave you.The list index reaches below the ledger floor, so an old signature can be listed without a transaction behind it. Treat null as a missing detail and keep the list entry.
Counts differ by one between two adjacent ranges.One side treated the end as inclusive. Keep the start inclusive and the end exclusive on every range, and a transaction at the seam lands in exactly one of them.
08

Questions

Can the RPC filter by date on the server?

No. The list takes a cursor and a limit, and the date test happens in your loop against blockTime. Stopping at the first entry older than the start keeps the walk as short as it can be.

Why does a range from last month cost so much?

The walk starts at the newest signature and moves backward, so every page between now and the end of the range is read before the first useful entry. Store the last signature of each run to resume without paying twice.

How far back can I query?

30 days at most, because the signature pages come from the address index. An empty page past that limit marks the age of the index, and the address may have older transactions that this call does not serve.

Does the list include failed transactions?

Yes. A failed transaction has a non-null err and still paid its fee. Keep it for fee totals and drop it for transfer reports.