---
id: UC0111
title: "Support desk deposit lookup"
url: https://carbium.sh/library/usecase/support-desk-deposit-lookup
collection: Use cases
category: Exchanges, custodians and on-ramps
revision: 1
updated: 2026-11-23
author: Carbium
code: MIT (LICENSE in the zip); text: all rights reserved, Carbium Corporation
---

# Support desk deposit lookup

Turn the hash a customer pastes into a support answer: did it land, did it succeed, and did it pay their deposit address. A Node script reads the transaction and prints the SOL and token change for one wallet.

## What a hash gives the desk

A customer who writes that a deposit is missing usually sends one thing, a transaction hash. On Solana that is the transaction's signature, a base58 string of about 88 characters. One `getTransaction` call by signature returns what a support agent needs: whether the transaction landed, whether it succeeded, its slot and block time, the fee, and the balance of every account before and after.

The balance arrays answer the deposit question directly. A token transfer into an existing token account lists the token accounts and the sender's authority, never the receiving wallet, so reading the instructions to find who was paid goes wrong. The `preTokenBalances` and `postTokenBalances` arrays carry an `owner` for each token account instead. The desk compares that owner with the customer's deposit address and sums the change per mint. For SOL, the post balance minus the pre balance of the deposit address does the same job.

A wallet can own more than one token account for a mint, so the sum runs per owner and mint, not per token account. A customer who deposited into an older account and a newer one still gets one correct total.

## The lookup in one file

The script reads your key from `CARBIUM_KEY` and sends every call to the [Carbium endpoint](https://carbium.sh/docs/endpoints), or to `CARBIUM_RPC_URL` when you set it. The first argument is the hash from the ticket and the second is the deposit address, the wallet that owns the receiving accounts. With no hash it takes the newest successful signature on a busy program, and with no deposit address it reports the first account that gained SOL, so the whole path runs before you have a ticket to test with.

`main.ts` (run: `CARBIUM_KEY=$CARBIUM_KEY node main.ts <transaction hash> <deposit address>`)

```ts
// UC0111 · Support desk deposit lookup
// https://carbium.sh/library/usecase/support-desk-deposit-lookup
// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.
// SPDX-License-Identifier: MIT

// Read-only deposit lookup: read a customer's transaction hash and report what it did to a deposit address.
import { address, createDefaultRpcTransport, createSolanaRpcFromTransport, 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";
let deposit: string | undefined = process.argv[3]; // the wallet that owns the customer's deposit accounts
const commitment = "finalized";
const rpc = createSolanaRpcFromTransport(createDefaultRpcTransport({ url, headers: { "x-api-key": key } }));
const show = (v: unknown) => JSON.stringify(v, (_k, x) => (typeof x === "bigint" ? x.toString() : x));

try {
  let hash: string | undefined = process.argv[2];
  if (!hash) { // no ticket yet: take the newest successful signature on a busy program
    const rows = await rpc.getSignaturesForAddress(address("JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"), { limit: 20, commitment }).send();
    hash = rows.find((r) => r.err === null)?.signature;
    if (!hash) throw new Error("no recent signature found");
    console.log("no hash given, using", hash);
  }
  const sig = signature(hash);
  // version 1: mainnet carries v1 transactions, and a lower value answers -32015 for one
  const tx = await rpc.getTransaction(sig, { encoding: "json", maxSupportedTransactionVersion: 1, commitment }).send();
  if (!tx?.meta) {
    const st = (await rpc.getSignatureStatuses([sig]).send()).value[0];
    console.error(st ? `known at ${st.confirmationStatus}, not readable at ${commitment}` : "unknown to the node: not sent, dropped, mistyped or too old");
    process.exit(3);
  }
  const meta = tx.meta;
  const when = tx.blockTime ? new Date(Number(tx.blockTime) * 1000).toISOString() : "unknown time";
  console.log(`${meta.err === null ? "succeeded" : `FAILED ${show(meta.err)}`} in slot ${tx.slot} at ${when}, fee ${meta.fee} lamports`);
  const loaded = meta.loadedAddresses; // accounts pulled in through lookup tables
  const keys: string[] = [...tx.transaction.message.accountKeys, ...(loaded?.writable ?? []), ...(loaded?.readonly ?? [])];
  const moved = keys.map((k, i) => ({ k, d: meta.postBalances[i]! - meta.preBalances[i]! })).filter((x) => x.d !== 0n);
  for (const m of moved.slice(0, 6)) console.log(`SOL ${m.k} ${m.d > 0n ? "+" : ""}${m.d} lamports`);
  deposit ??= moved.find((m) => m.d > 0n)?.k; // no address given: report the first account that gained SOL
  if (deposit) {
    // token balances name the owner wallet, which the instructions do not
    const sum = (rows: typeof meta.preTokenBalances) => {
      const out = new Map<string, bigint>();
      for (const r of rows ?? []) if (r.owner === deposit) out.set(r.mint, (out.get(r.mint) ?? 0n) + BigInt(r.uiTokenAmount.amount));
      return out;
    };
    const pre = sum(meta.preTokenBalances);
    const post = sum(meta.postTokenBalances);
    console.log(`deposit ${deposit}: SOL ${moved.find((m) => m.k === deposit)?.d ?? 0n} lamports`);
    for (const mint of new Set([...pre.keys(), ...post.keys()])) {
      console.log(`  token ${mint}: ${(post.get(mint) ?? 0n) - (pre.get(mint) ?? 0n)} raw units`);
    }
  }
  process.exit(0);
} catch (e) {
  console.error("Lookup failed:", e instanceof Error ? e.message : e);
  process.exit(1);
}
```

Both reads ask for finalized commitment. The client library fills in confirmed when a call leaves commitment out, so the script names it. Since the Alpenglow switch, finalized trails processed by 0 to 1 slots, so a finalized hit is a final answer that costs the desk almost no extra wait.

The read passes `maxSupportedTransactionVersion: 1`, because mainnet carries v1 transactions and the RPC answers -32015 for one when the value is absent or 0. A transaction that uses address lookup tables lists only some of its accounts in the message, so the script appends the loaded addresses before it lines the keys up with the balance arrays. Without that step the deltas land on the wrong accounts.

When `getTransaction` answers null the script asks `getSignatureStatuses` what the node knows about the hash and exits 3. Exit code 0 means the transaction was read, 1 means a missing key, a hash that does not decode, or a failed call.

## What to tell the customer

The output maps to a small set of replies, and the agent can pick one without reading raw JSON.

| What the script shows | What it means | Reply |
|---|---|---|
| Null, status processed or confirmed | The transaction is on chain but not final yet | Ask again in a few seconds; the answer usually settles at once. |
| Null, no status | The node does not know the hash: never sent, dropped, mistyped, or older than the node keeps | Ask for the sending wallet's address and look at its recent history. |
| FAILED with an error | The transaction ran and failed, so only the fee was taken and nothing reached your address | Tell the customer the funds are still in their wallet. |
| Succeeded, deposit change above zero | The deposit is on chain | Match the amount and mint to your ledger and credit it. |
| Succeeded, deposit change zero | The transaction paid someone else | Ask which address the customer sent to. |

A failed transaction is the case that most often looks like a loss from the customer's side. The hash resolves, the explorer shows a red mark, and the balance did not move. The error object in the output names the cause, such as an instruction that ran out of compute or an account with too little balance.

## Cost and rate

One lookup is one [getTransaction](https://carbium.sh/docs/rpc) call at 50 cells. The rates below are calls per second, and all keys on an account [share one budget](https://carbium.sh/docs/limits).

| Call | Cells | Free req/s | Dev req/s | Business req/s | Pro req/s |
|---|---|---|---|---|---|
| getTransaction | 50 | 0.24 | 1.2 | 5 | 25 |
| getSignaturesForAddress | 50 | 0.24 | 1.2 | 100 | 500 |

A rate class absorbs a burst of at least 1,024 cells, about 20 of these calls, so up to about 20 tickets opened together fit on any plan. A sustained load past the plan's rate gets 429 with a retry-after hint.

A transaction read at finalized never changes, so store the result against the ticket the first time it is final. A second agent opening the same ticket reads your database, and the repeat visits cost the desk no cells.

## When the customer has no hash

Some customers send only their wallet and an amount. List the signatures of the deposit address with `getSignaturesForAddress`, newest first, and read the ones near the time they name. For a token deposit, list the token account for that mint, since a transfer into it names the token account and not the wallet. A wallet with several token accounts for one mint needs one list per account.

Each page is 50 cells, and the [exchange deposit alerts](https://carbium.sh/library/usecase/exchange-deposit-alerts) pattern avoids the manual search entirely by watching the address as deposits arrive. [Transaction status check](https://carbium.sh/library/howsolana/transaction-status-check) covers the single-hash status read on its own.

## Where it ends

- The address index behind `getSignaturesForAddress` keeps up to 30 days, and an empty page past that is its [age limit](https://carbium.sh/docs/migrate). A deposit older than that cannot be found from the address alone.
- The signature list can name transactions older than the ones the node still stores in full, so `getTransaction` can answer null for an older hash. Keep the signature you recorded when the deposit first arrived.
- The SOL change of the fee payer includes the fee. When the deposit address itself signed and paid for the transaction, add back the fee printed on the first line before you match the amount.
- The script reads one wallet. A deposit routed through a program that moves funds to a different owner shows up under that owner, and you need that address to see it.
- It reads and reports. It does not credit the account, hold funds or sign anything.

## When it goes wrong

| What goes wrong | What to do |
|---|---|
| The script throws on the customer's hash before any call goes out. | The string did not decode as a signature. Ask for the hash again from the wallet or explorer, since pasted hashes often carry a space or a missing character. |
| The read fails with -32015. | Pass `maxSupportedTransactionVersion: 1` with an encoding. A v1 transaction is refused when the value is absent or 0. |
| `getTransaction` answers null for a hash the customer sent a minute ago. | The hash may still be at processed or confirmed. Check `getSignatureStatuses`, wait, and read again at finalized. |
| `getTransaction` answers null for an older signature that the address list showed. | The address index lists transactions older than the node stores in full. Treat null as unreadable, keep the recorded signature, and test the code on recent ones. |
| A deposit shows a zero change although the customer paid. | Check the owner. A token transfer lands in a token account, so match the wallet in the `owner` field of the balance arrays, and look at the other token accounts of the same wallet. |
| A busy desk gets 429 on lookups. | Read once per ticket, store the final result, and sleep for the retry-after value before the next call. An unknown key answers 401, and the fix there is to attach the whole key. |

## Questions

### Is a transaction hash the same as a signature?

Yes. The hash a wallet or explorer shows is the first signature of the transaction, and `getTransaction` takes it as the lookup key.

### Why does the deposit show up under the owner and not the token account?

The token balance arrays list both the token account index and its owner wallet. The owner is the field a support desk compares with a customer's address.

### Should the desk read at confirmed or finalized?

Finalized. It sits 0 to 1 slots behind processed, so it adds almost no wait and a deposit credited from it is final.

### What does one lookup cost?

One getTransaction call is 50 cells. Free and Dev plans allow 0.24 and 1.2 calls per second for it, Business 5 and Pro 25.

## Related

- [Transaction status check](https://carbium.sh/library/howsolana/transaction-status-check) (How to use Solana, HS0008)
- [Exchange deposit alerts](https://carbium.sh/library/usecase/exchange-deposit-alerts) (Use cases, UC0006)
- [carbium.sh/docs/rpc](https://carbium.sh/docs/rpc)
- [carbium.sh/docs/limits](https://carbium.sh/docs/limits)
- [carbium.sh/docs/endpoints](https://carbium.sh/docs/endpoints)
- [carbium.sh/docs/migrate](https://carbium.sh/docs/migrate)
- [carbium.sh/docs/errors](https://carbium.sh/docs/errors)
