library / Blockchain ideas / Wallet watchers / BI0062
Fresh wallet detector
A wallet age check for drop gates and sign-up scoring. It pages signatures back with before until a short page, then prints a verdict with the oldest block time. You get the runnable script and its limits.
What age can mean on chain
A wallet is only an address. It exists the moment someone sends it lamports or signs with it, and nothing on chain stores a creation date. In practice, age means the block time of the oldest transaction that touches the address, so a checker has to find that transaction.
Builders ask for it in two places. A drop limits claims to wallets that existed before a snapshot day. A sign-up flow scores a new account by how long its wallet has been around, because a wallet created five minutes ago and funded once is the usual shape of a throwaway. Both need one date, and both need an honest word for the cases where the date is out of reach.
Carbium's address index keeps up to 30 days of signatures per address, and that sets what one read can prove. A wallet whose whole history sits inside the window shows its oldest row. A wallet that was already active before the window shows 30 days of rows and no beginning. A wallet with nothing in the window shows an empty page. The script prints whichever of the three cases it found.
The three verdicts
| Verdict | What the script saw | What you may say |
|---|---|---|
| First seen in the index on a date | A page shorter than 1,000 rows, and the oldest row more than a day inside the window | Nothing older than that date appears in the last 30 days |
| Older than the index | A page shorter than 1,000 rows, and the oldest row within a day of the 30-day edge | The wallet was active at the start of the window, so it is at least about 30 days old |
| No history | The first page is empty | No transaction touched the address in 30 days |
First seen in the index is not the same as created. The index cannot see past 30 days, so a wallet that was busy two months ago, went quiet and woke up yesterday also reads as first seen yesterday. A first-seen date before your snapshot proves the wallet existed by then. A first-seen date after the snapshot proves nothing either way, because a wallet that went quiet before the window opened reads the same as a new one. For a rule of 90 days the date settles even less, and the only fix is to store each wallet's first sighting yourself from now on.
The one-day margin on the second row is the script's own choice. Rows close to the edge may be trimmed as the index rolls, so the script treats them as the edge and reports the wallet as older than the index instead of claiming a date it cannot back.
A fourth outcome exists. When all three pages come back full, the script has read 3,000 rows and still has not reached a short page. It prints undecided with the row count. A failed page also prints undecided, so a network error never turns into a first-seen date.
Paging back with before
getSignaturesForAddress lists newest first. Setting before to the last signature of one page returns the page that follows it, and a page with fewer rows than the limit means the list has ended. Run it as node main.ts [wallet address]. Every call names confirmed, and the file only reads: no key pair, nothing signed or sent.
- Read CARBIUM_KEY and exit with a message when it is unset. Build the RPC client once.
- With no address argument, list the five newest signatures of Jupiter's program, take the first one without an error, read it with getTransaction using jsonParsed and maxSupportedTransactionVersion: 1, and use its first account key, the fee payer. A null answer or a failed call moves on to the next signature.
- Page up to three times at 1,000 signatures a page, each page in its own try. Stop at the first page shorter than 1,000.
- Keep the row count and the block time of the last row of each page, which is the oldest seen so far.
- Print the pages read, the oldest block time and one verdict line.
// BI0062 · Fresh wallet detector// https://carbium.sh/library/blockchainideas/fresh-wallet-detector// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.// SPDX-License-Identifier: MITimport { 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 JUPITER = address('JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4');const PAGES = 3; // page cap: 3 x 1,000 signatures, 50 cells a pageconst PAGE_SIZE = 1000;const DAY = 86400;const msg = (e: unknown) => (e instanceof Error ? e.message : String(e));const iso = (t: number) => new Date(t * 1000).toISOString().slice(0, 10);// No argument: the fee payer of the newest successful Jupiter transaction.async function jupiterFeePayer(): Promise<string> { const recent = await rpc.getSignaturesForAddress(JUPITER, { limit: 5, commitment: 'confirmed' }).send(); for (const r of recent.filter((s) => s.err === null)) { try { const tx = await rpc .getTransaction(r.signature, { commitment: 'confirmed', encoding: 'jsonParsed', maxSupportedTransactionVersion: 1 }) .send(); if (tx) return tx.transaction.message.accountKeys[0].pubkey; } catch (e) { console.error('getTransaction failed:', msg(e)); } } throw new Error('no resolvable Jupiter transaction');}const wallet = address( process.argv[2] ?? (await jupiterFeePayer().catch((e) => { console.error(msg(e)); process.exit(1); })),);const cutoff = Math.floor(Date.now() / 1000) - 30 * DAY;let before: Signature | undefined;let pages = 0;let rows = 0;let oldest = 0;let short = false; // a page shorter than the limit ends the listlet failed = false;while (pages < PAGES && !short && !failed) { try { const page = await rpc.getSignaturesForAddress(wallet, { limit: PAGE_SIZE, before, commitment: 'confirmed' }).send(); pages++; rows += page.length; short = page.length < PAGE_SIZE; before = page.at(-1)?.signature; const t = page.at(-1)?.blockTime; if (t != null) oldest = Number(t); } catch (e) { failed = true; console.error('getSignaturesForAddress failed:', msg(e)); }}let verdict: string;if (failed) verdict = 'undecided, a page failed';else if (rows === 0) verdict = 'no history in the 30-day index';else if (!short) verdict = `undecided, page cap reached with ${rows} rows`;else if (oldest - cutoff < DAY) verdict = 'older than the index, active at its 30-day edge';else verdict = `first seen in the index on ${iso(oldest)}`;console.log(`wallet ${wallet}`);console.log(`pages read ${pages}, rows ${rows}, oldest block time ${oldest ? iso(oldest) : 'none'}`);console.log(`verdict: ${verdict}`);
run: CARBIUM_KEY=<YOUR_KEY> node main.ts [WALLET_ADDRESS]
The cursor walk is the one in Signature history pagination, with a different stop rule: here the walk ends at the first short page or at the cap, and the oldest row is what the caller wants. 30-day wallet recap uses the same window to count activity inside it.
Cost per page and the page cap
Cells are the admission charge per call. A getSignaturesForAddress page costs 50 cells whether it holds 3 rows or 1,000, so full pages are the cheap way to read: three of them are 150 cells. With no address argument the script adds one signature call and one getTransaction call, 50 cells each, to find a wallet to test.
A rate class absorbs bursts up to 1,024 cells or one second of its rate, whichever is larger. On Free and Dev that is 1,024 cells, so about six full checks can run back to back before the rate sets the pace. On Business and Pro one second of the rate is 5,000 and 25,000 cells at 50 cells a call, which is far more than six checks. Once the burst is spent, the plan's getSignaturesForAddress rate decides how fast a queue of wallets drains.
| Plan | getSignaturesForAddress | Three pages once the burst is spent |
|---|---|---|
| Free ($0) | 0.24 req/s | about 12.5 seconds |
| Dev ($20) | 1.2 req/s | about 2.5 seconds |
| Business ($250) | 100 req/s | well under a second |
| Pro ($500) | 500 req/s | well under a second |
The cap of three pages exists because the work per wallet has no natural bound. An exchange hot wallet or a program account can fill thousands of pages inside 30 days, and limits are per account, so one hostile address in a sign-up form could drain the budget every other call shares. Three pages keep the worst case at 150 cells per check. Raise PAGES for an allow-list of busy wallets you care about, and leave it low for anything a stranger can submit.
A sign-up flow should queue checks and store each verdict with the date it was read, since the window moves every day.
Where it ends
- Nothing older than 30 days. An empty page past 30 days is the index's age limit, and the address may have older transactions. A dormant wallet that wakes inside the window reads as first seen in the index.
- The cap cannot tell an old wallet from a busy one. Three full pages look the same for a wallet created a week ago that sent 3,000 transactions and for one that is years old. The script reports the oldest date it reached and calls the result undecided. For a gate, a busy undecided wallet is usually the better risk, but that is your rule to set.
- Every transaction that mentions the address adds a row, including a stranger's dust transfer. A wallet's oldest row can be an unsolicited send, so the date is the first time the address appeared on chain in the window, and its owner may have first acted later.
- A wallet that only receives tokens into a token account it already has may never appear in its own signature list, so such a wallet can read as no history even though it holds tokens.
- Failed transactions count as rows. A wallet whose only history is failed attempts reads as first seen, because the fee payer still appears in them.
- Block times are unix seconds in UTC, and the script prints the date part only.
When it goes wrong
| what goes wrong | what to do |
|---|---|
| Your edited getTransaction call answers -32015. | The call dropped maxSupportedTransactionVersion or set it to 0, and the transaction is v1. Pass 1 on getTransaction. The refusal is uncharged, and the script as shipped catches it per signature, so with the option removed the run would end on no resolvable Jupiter transaction. |
| The no-argument run ends with no resolvable Jupiter transaction. | All five signatures failed or came back null, so none could be read. Run again to pick up newer ones, or pass an address. |
| The verdict says undecided with 3,000 rows. | The cap stopped the walk at three full pages. Raise PAGES knowing each page is 50 cells, or treat the wallet as established and gate on its activity instead of its age. |
| A wallet you know has history gets no history. | Its last transaction is older than 30 days, so the index has nothing for it. Keep your own first-sighting record from now on. |
| The script prints a failed page and an undecided verdict. | One getSignaturesForAddress call failed. Run the check again. The script never reports a date after a failed page, so the answer stays open until a clean run. |
| A call answers 429. | The queue is running faster than the plan allows. Space the checks by the rate table above and retry after the hint. |
Questions
Can it tell me a wallet is older than 90 days?
No. The address index keeps up to 30 days, so the best answer for an old wallet is older than the index. To gate on 90 days, record each wallet's first sighting yourself and let the record grow past the window.
Is the oldest transaction the day the wallet was created?
Not always. Solana stores no creation date, and the oldest row in the window may be a transfer from a stranger or the first sighting after a long quiet spell. It is the oldest activity the index holds.
How many calls does one check make?
At most three signature pages, 50 cells each. With no address argument it adds one signature call for Jupiter's program and one transaction read, 50 cells each, so five calls at most on the happy path.
Why a 1,000-signature page when smaller pages are allowed?
A page costs 50 cells at any size, so a full page buys the most history per cell. The first page of a quiet wallet is short anyway and ends the walk.
Does it need a node of my own or a signing key?
No. Every call is a read on services.carbium.sh with one key, and the script never signs or sends.