library / Integrations / Document and key-value stores / I0169
DynamoDB signature status table
getSignatureStatuses answers null for a signature the node has no status for under the search it ran. The reader stores each status it gets in a signature-keyed table and asks the misses again with history search.
Why the first read comes back null
getSignatureStatuses returns one entry per signature you pass, in the same order, and each entry is either a status object or null. A null is the node's answer for that call. It means the node has no status for the signature under the search the call ran. Unless you ask otherwise, that search covers the node's recent status cache, so a transaction that landed some time ago can come back null even though it succeeded. The call takes at most 256 signatures in one request.
Tables that fill with nothing usually trace back to this. The read asks about signatures old enough to have left the cache, and the code stores each null as a row. The reader does three things: it reads the newest signatures first, stores only the answers that arrive, and sends the misses again with searchTransactionHistory set to true. A null that survives that retry is the node's last answer for the call, and its row should stay out of the table. For the single-signature version of this read, see transaction status check.
Four causes account for almost every null. Each has its own symptom, so check the symptom before you change code.
| Cause | What you see | Check |
|---|---|---|
| Signature outside the recent cache | Old signatures answer null, new ones answer | Retry the nulls with searchTransactionHistory: true |
| Signature typed or encoded wrong | Every value is null, the newest included | Pass the strings from getSignaturesForAddress as they are |
| Transaction never landed | null for a transaction you built and sent | Look again after its blockhash has expired; a dropped transaction stays null |
| Table lookup misses | The RPC answers, but the table finds no row | Write and read with the same string key |
The last cause sits in your own code. A write that stores a null as a row, and a read that treats any row as an answer, makes the table repeat that null on every later read. Keeping nulls out of the table keeps the retry list current.
The status table keyed by signature
Each row holds one signature and the status the node gave for it. The signature is the primary key. In DynamoDB the same field is the partition key, and a read by that key returns the stored status, while an absent item means the reader has no answer yet. Keep that difference in the schema: absence is an open question, and a stored answer is a closed one.
The reader writes a SQLite file in the directory it runs from. It needs no AWS account and makes no AWS call, so it runs with nothing else around it. The columns and the key are what move to a DynamoDB table, and the writes and reads keep their shape with a different client.
A row keeps the slot, the error as JSON text when the transaction failed, the confirmation level the node reported, and the time the row was written. The write uses INSERT OR REPLACE on the signature, so a later read that reports a higher confirmation level overwrites the earlier row and leaves the other rows alone.
The reader
The reader takes an optional program address and defaults to the SPL Token program, which has a steady stream of new signatures. Pass another address as the first argument to read a different stream. It lists the newest 20 signatures on the rpc page, asks for their statuses in one call, and retries the misses once with history search.
// I0169 · DynamoDB signature status table// https://carbium.sh/library/integrate/dynamodb-signature-status-table// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.// SPDX-License-Identifier: MITimport { address, createDefaultRpcTransport, createSolanaRpcFromTransport, type Signature,} from "@solana/kit";import { DatabaseSync } from "node:sqlite";const key = process.env.CARBIUM_KEY;if (!key) { console.error("Set CARBIUM_KEY to your Carbium key."); process.exit(1);}const rpc = createSolanaRpcFromTransport( createDefaultRpcTransport({ url: process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh", headers: { "x-api-key": key }, }),);const program = address(process.argv[2] ?? "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");const db = new DatabaseSync("signatures.sqlite");db.exec(`CREATE TABLE IF NOT EXISTS signature_status ( signature TEXT PRIMARY KEY, slot INTEGER NOT NULL, err TEXT, confirmation_status TEXT, seen_at TEXT NOT NULL)`);const put = db.prepare("INSERT OR REPLACE INTO signature_status VALUES (?, ?, ?, ?, ?)");const seenAt = new Date().toISOString();type Answer = { slot: bigint; err: unknown; confirmationStatus?: string | null };function store(sig: Signature, st: Answer): void { const err = st.err ? JSON.stringify(st.err, (_k, v: unknown) => (typeof v === "bigint" ? v.toString() : v)) : null; put.run(sig, Number(st.slot), err, st.confirmationStatus ?? null, seenAt);}try { const page = await rpc.getSignaturesForAddress(program, { limit: 20 }).send(); const sigs = page.map((row) => row.signature); const first = await rpc.getSignatureStatuses(sigs).send(); const misses: Signature[] = []; let stored = 0; first.value.forEach((st, i) => { if (st === null) misses.push(sigs[i]); else { store(sigs[i], st); stored++; } }); let rescued = 0; if (misses.length > 0) { const again = await rpc.getSignatureStatuses(misses, { searchTransactionHistory: true }).send(); again.value.forEach((st, i) => { if (st !== null) { store(misses[i], st); rescued++; } }); } const rows = db.prepare("SELECT COUNT(*) AS n FROM signature_status").get(); console.log(`listed ${sigs.length} signatures for ${program}`); console.log(`first read: ${stored} with a status, ${misses.length} null`); console.log(`history retry: ${rescued} found, ${misses.length - rescued} still null`); console.log("rows in signatures.sqlite:", rows?.n);} catch (err) { console.error("read failed:", err instanceof Error ? err.message : err); process.exitCode = 1;} finally { db.close();}
run: node main.ts
The status call takes no commitment argument. Each answer carries a confirmationStatus field, so the row records the level the node reported at that read. The listing call uses the confirmed commitment that @solana/kit fills in when a call leaves it out. A listing costs 50 cells, so one listing per run is the whole read cost of finding the signatures.
Run it and read the counts
Install the one dependency with npm install @solana/[email protected], set "type": "module" in package.json, and run node main.ts with CARBIUM_KEY in the environment. The run prints three counts: the signatures listed, the first read split into stored and null, and the history retry split into found and still null. Check that most of the first read is stored. A page where most answers are null points at one of the causes in the table.
Run it a second time against the same program and the row count stays the same for signatures already stored, because the key is the signature. New signatures add rows. Pick a program with activity in the last few minutes, so the newest page holds answers to read.
Where it ends
- The table holds only the signatures in one listing page. It does not backfill history, and a later listing adds rows only for what it lists.
- A null after the history retry is the node's result for that signature. The address index keeps up to 30 days, and an older signature can be listed while the node gives no status for it, so handle that null as the answer for that signature.
- The reader reads once per run. A status that changes after the read, such as a later confirmation, stays in its row until the next run reads it again.
- Each run makes one listing and up to two status calls. Limits are per account, so a busy page of misses spends the same budget as the rest of your app.
- SQLite stands in for DynamoDB here. The key and columns carry over, and the code calls no AWS service.
When it goes wrong
| what goes wrong | what to do |
|---|---|
| Every status is null, including the newest signatures from the listing. | Pass the signature strings from getSignaturesForAddress as they are. A hex form, a Buffer or a trimmed copy does not match the signature the node stores. |
| The first read returns statuses, but the lookup in the table finds no row. | Write and read the same key, the signature string from the listing. Do not store a wrapper object as the key, and do not write a row from a different array index than the one you read. |
| The run exits with a 401 and the message names the key. | The key is refused at the door as UNKNOWN_KEY. Attach the whole key from your Carbium account, as errors describes. |
| The run stops with a 429 on a listing or status call. | A call over its rate waits once and is served if its cells refill within 1 s. Past that it gets 429 with a retry-after hint. Wait the hinted time and run again; rows already stored stay in place. |
| A listed signature answers null even with history search. | Treat that null as the result for the signature. It can be older than what the node keeps, so keep it out of the table and move on. |
Questions
Why does getSignatureStatuses return null for a transaction I can see in an explorer?
The node that answered your call holds no status for it under the search you ran. Retry the null with searchTransactionHistory set to true before you decide the signature is missing.
Should I store the null so I do not ask again?
No. A stored null reads back as an answer and hides a signature that has a status now. Store only the non-null answers and keep the misses in a list you retry.
Does the status call need a commitment?
No, the call has no commitment argument. Each answer carries confirmationStatus, so record that field as the level the node reported at the read.
Can this table hold a 30-day history?
Only what the listing pages return. The address index keeps up to 30 days, and an older signature can answer null, so the table records what you read and is not a backfill.