library / AI and blockchain / SI0014
30-day training dataset
Carbium serves up to 30 days of history per address. One script pages an address's signatures into SQLite, adds fee and compute units for the transactions you pick, and leaves a table ready for training.
Where the history comes from
The collector uses two of Carbium's history methods. getSignaturesForAddress returns the signatures that touched one address, newest first, from Carbium's own address index, which keeps up to 30 days. getTransaction returns the full record for one signature. Both go to https://services.carbium.sh with your key in the x-api-key header.
So the dataset is built per address. You pick the addresses your model cares about, such as a program, a mint or a set of wallets you own, and the collector walks each one back through its last 30 days. It is a collector for chosen addresses and does not export a whole chain.
Thirty days covers recent behaviour well: failure rates on a program, transactions per hour around a mint, fee and compute-unit ranges. It does not cover anything seasonal.
What one row holds
| Column | From | Notes |
|---|---|---|
| signature | getSignaturesForAddress | Primary key, so a second run adds no duplicates |
| slot | getSignaturesForAddress | Integer slot of the transaction |
| block_time | getSignaturesForAddress | Unix seconds; null when the node has no time for the slot |
| failed | getSignaturesForAddress | 1 when the answer carries an err, otherwise 0 |
| fee | getTransaction | Lamports paid; null until you fetch the detail |
| compute_units | getTransaction | computeUnitsConsumed from the metadata; null when absent |
Signature rows are the small part and already carry the label most models want, which is whether the transaction failed. Fee and compute units need one getTransaction call per row, so the collector fetches them only for the newest rows you ask for with its third argument. Missing details stay null instead of zero, which keeps a model from learning that unfetched rows were free.
The collector
One file on Node 24, with @solana/kit 8.6.0 and the built-in node:sqlite. Set CARBIUM_KEY first; the file exits with a message when it is missing. CARBIUM_RPC_URL overrides the endpoint. The arguments are the address, the most rows to collect, how many transactions to detail and the database file.
// SI0014 · 30-day training dataset// https://carbium.sh/library/si/30-day-training-dataset// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.// SPDX-License-Identifier: MIT// Collect one address's last 30 days into SQLite. Run: CARBIUM_KEY=... node main.ts <address> [maxRows] [details] [dbFile]import { DatabaseSync } from "node:sqlite";import { address, createDefaultRpcTransport, createSolanaRpcFromTransport, signature, 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 [addr = "", maxArg = "1000", detailArg = "0", file = "history.sqlite"] = process.argv.slice(2);if (!addr) { console.error("Usage: node main.ts <address> [maxRows] [details] [dbFile]"); 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 owner = address(addr);const db = new DatabaseSync(file);db.exec("CREATE TABLE IF NOT EXISTS tx (signature TEXT PRIMARY KEY, slot INTEGER, block_time INTEGER, failed INTEGER, fee INTEGER, compute_units INTEGER)");const put = db.prepare("INSERT OR IGNORE INTO tx (signature, slot, block_time, failed) VALUES (?, ?, ?, ?)");const detail = db.prepare("UPDATE tx SET fee = ?, compute_units = ? WHERE signature = ?");// A call over its rate gets 429 with a retry-after hint: wait that long (at most 10 s), up to three retries.async function retry<T>(call: () => Promise<T>): Promise<T> { for (let n = 0; ; n++) { try { return await call(); } catch (e: any) { if (e?.context?.statusCode !== 429 || n === 3) throw e; const seconds = Math.min(Number(e.context.headers?.get?.("retry-after")) || 1, 10); await new Promise((done) => setTimeout(done, seconds * 1000)); } }}const maxRows = Number(maxArg);let before: Signature | undefined;for (let rows = 0; rows < maxRows; ) { const limit = Math.min(1000, maxRows - rows); const page = await retry(() => rpc.getSignaturesForAddress(owner, { limit, before, commitment: "finalized" }).send()); db.exec("BEGIN"); for (const s of page) put.run(s.signature, Number(s.slot), s.blockTime === null ? null : Number(s.blockTime), s.err ? 1 : 0); db.exec("COMMIT"); rows += page.length; const last = page.at(-1); if (!last) break; before = last.signature; const oldest = last.blockTime === null ? "unknown" : new Date(Number(last.blockTime) * 1000).toISOString(); console.log(`page of ${page.length}, ${rows} total, oldest ${oldest}`); if (page.length < limit) break;}// Mainnet carries v1 transactions: with maxSupportedTransactionVersion absent or 0, getTransaction answers -32015 for one.const todo = db.prepare("SELECT signature FROM tx WHERE fee IS NULL ORDER BY slot DESC LIMIT ?").all(Number(detailArg)) as { signature: string }[];for (const { signature: sig } of todo) { try { const tx: any = await retry(() => rpc.getTransaction(signature(sig), { maxSupportedTransactionVersion: 1, commitment: "finalized", encoding: "json" }).send()); if (!tx?.meta) { console.log(`no detail for ${sig.slice(0, 8)}: getTransaction answered null`); continue; } const units = tx.meta.computeUnitsConsumed; detail.run(Number(tx.meta.fee), units == null ? null : Number(units), sig); } catch (e: any) { console.error(`detail failed for ${sig.slice(0, 8)}: ${e?.message ?? e}`); }}const summary = db.prepare("SELECT COUNT(*) AS rows, SUM(failed) AS failed, MIN(block_time) AS first, MAX(block_time) AS last, COUNT(fee) AS with_fee FROM tx").get() as Record<string, number | null>;console.log(JSON.stringify(summary));db.close();
run: node main.ts <address> 1000 20 history.sqlite
Each page prints one line with the signatures returned, the running total and the oldest block time. The last line is a JSON summary: row count, failed count, first and last block time, and how many rows have a fee. The fourth argument names the database file; the default is history.sqlite.
Mainnet carries v1 transactions, so the detail call passes maxSupportedTransactionVersion: 1. With that option absent or 0, getTransaction answers -32015 for a v1 transaction. A detail call that fails for any reason is printed and skipped, and the row keeps a null fee. A detail call that answers null prints a line too, and that row keeps a null fee as well.
Paging, cost and the rate limit
A page holds up to 1,000 signatures, and the next page starts before the last signature of the previous one. Each page is one getSignaturesForAddress call at 50 cells. A getTransaction call also costs 50 cells and returns one transaction, so detailing rows is where the cost grows: a page of 1,000 signatures costs what a single transaction detail does.
| Plan | `getSignaturesForAddress` req/s | `getTransaction` req/s |
|---|---|---|
| Free | 0.24 | 0.24 |
| Dev | 1.2 | 1.2 |
| Business | 100 | 5 |
| Pro | 500 | 25 |
On Free, 0.24 req/s is one call about every four seconds, so a Free key walks a long address slowly and a short run with a few details is the right size to try. On a 429 the collector waits for the retry-after hint, at most 10 s, and retries up to three times.
Limits are per account, so an account's keys share one budget, and a collector running beside a live service draws from the same budget as that service.
Commitment and time
When a call leaves commitment out, @solana/kit 8.6.0 fills in confirmed. The collector passes finalized on every call instead. Since the Alpenglow switch on mainnet (2026-10-21) finalized sits 0 to 1 slots behind processed, so waiting for it costs almost nothing and a stored row is final.
Time needs more care. A slot is about 200 ms since that switch, so a slot-to-seconds conversion differs across it. A window that starts before 2026-10-21 holds both sides, so read time from block_time and never multiply slots by a constant.
Mainnet blocks also carry no vote transactions since the switch. Any measure built from whole blocks, such as transactions per slot, shifts at the same point. Start your window after 2026-10-21 or add a flag column for which side of it a row falls on.
From rows to training data
Split by time. Train on the oldest rows and test on the newest, because rows close in time look alike and a random split lets the test set peek at the training set. Drop rows with a null block_time before you split.
failed is a ready label. A failed transaction still pays a fee, so fee and compute_units are present for the failed rows you detailed, and you can use them as input columns when you look at why a program call failed.
Extend the window yourself. A rerun walks from the newest signature again and ignores rows already stored. It closes the gap only when its row limit reaches back to the previous run's newest stored row, and the default 1,000 covers minutes on a busy program. A capped rerun on a busy address therefore leaves a time gap you will not see in the row count. Before a rerun, note last from the previous summary. After it, compare that time with the oldest time on the rerun's final page line: the page line should show a time at or before last, or the rerun left a gap. A rerun costs the same calls as the first one, so keep the schedule modest.
For a balance column, read meta.preTokenBalances and postTokenBalances from the same getTransaction call, because they hold the balance at that transaction. A balance read today is present state and would leak the future into old rows; SPL token balance shows how to read current balances. Read-only model tools shows how to keep a model's own Solana tools read-only if an agent will sit next to this data.
Where it ends
- Carbium serves up to 30 days of address history and nothing older. An empty page past that is the index's age limit and says nothing about the address's first transaction, so an old address yields fewer rows than it has had.
- The index reaches below the validator's ledger floor, so getTransaction can answer null for an older signature it lists. The collector prints a line for each and leaves that fee null, and raising the third argument will not fill those rows.
- The window moves. A dataset built today and one built later cover different days, and only the file you keep carries the days that left the index.
- The walk is per address and per call. Nothing here pulls a whole block or every transaction on the chain.
- Rows hold fee and compute units only. The full transaction record also carries logs and balance changes, and this file does not store them; add columns where you call getTransaction.
- Current account state is a separate getAccountInfo read and shows only the present.
- The file only reads: it holds no keypair and never signs or sends.
When it goes wrong
| what goes wrong | what to do |
|---|---|
| The run takes far longer than expected on one address. | The address is busy. Set the second argument before the first run, and start with a quiet address to see the page rate on your plan. |
| A page comes back empty well short of the rows you expected. | Keep the files of earlier runs for rows older than the index holds. |
| A 429 arrives on the detail calls right after a page. | Each getTransaction costs 50 cells and has its own rate: 5 req/s on Business and 25 on Pro, well under the 100 and 500 of the signature pages, which is the usual cause on those plans. Lower the third argument. Limits are per account, so look for other keys spending the same budget. |
| A detail call answers -32015 about the transaction version. | Mainnet carries v1 transactions. Pass maxSupportedTransactionVersion: 1 on getTransaction; absent or 0 it answers -32015 for a v1 transaction, and the call is not charged. |
| Rows from before and after 2026-10-21 train as one regime. | Read time from block_time and never from slot times a constant. Start the window after the switch or add a flag column for the side each row falls on. |
| Most rows have a null fee. | Only the newest rows you asked for are detailed. Raise the third argument, or treat null as missing in training. |
Questions
Where can I get historical Solana data from Carbium?
Per address, through getSignaturesForAddress, which reaches back 30 days at most, and getTransaction for the full record of a signature. Older history is not served.
Can I get more than 30 days?
Not from Carbium, because older history is not served. Run the collector on a schedule and keep the SQLite file, and the file holds days after they leave the index.
How many calls does a 30-day dataset take?
One call per 1,000 signatures at 50 cells, plus one 50-cell call for each transaction you detail. A quiet address takes a handful, and a busy one takes as many as the row limit allows.
Does it need a keypair?
No. Every call is a read, the only secret is your Carbium key in the x-api-key header, and the file never signs or sends.
Why finalized instead of the default?
@solana/kit 8.6.0 fills in confirmed when commitment is left out, while the server default is finalized. A dataset should hold final rows, and since Alpenglow finalized sits 0 to 1 slots behind processed.