services
Get a key

library / Use cases / Exchanges, custodians and on-ramps / UC0110

Wallet ownership deposit test

Ask the customer to send a small, unique amount from their wallet to an address you control. The script finds that transfer, checks the signing source, destination, exact lamports and block time, and prints VERIFIED or the reason it did not match.

By Carbium · Exchanges, custodians and on-ramps · UC0110 · updated 2026-11-23

01

What a deposit proves

On Solana a self-custody wallet is a keypair the customer holds: the public key is the account address, and only the private key can sign a transfer out of it. A customer who says such a wallet is theirs has so far only typed an address. Anyone can paste any address, including a stranger's or an exchange's. A signature is the one thing only the key holder can produce, so the test asks the customer to produce one in a form you can find on chain: a small transfer from the claimed wallet to an address you control.

A System Program transfer needs its source account to sign the transaction, and the runtime rejects the transaction when it does not. A confirmed transfer whose source is the claimed wallet therefore shows that the holder of that wallet's key authorised it. You read the result from the chain. No message-signing library and no wallet connection session sits in your stack, which suits an exchange, custodian or on-ramp that must confirm a payout address for customers using any wallet app or hardware device.

Some compliance regimes ask for exactly this evidence before you pay out to a self-hosted wallet. Check which one applies to you; the script produces the on-chain half of the record.

02

Designing the challenge

Three choices make a transfer attributable to one customer and one attempt.

  • Destination: an address you control, issued for this attempt or this customer. A shared address that strangers also pay would let one customer's transfer be claimed by another.
  • Amount: a base amount plus a tail you store with the attempt, for example 1,000,000 lamports plus a number below 10,000. The customer sends the exact total, and no other attempt expects the same figure.
  • Time: the unix second at which you issued the challenge. Only a transfer confirmed after that second counts, so an older transfer of the same size cannot be replayed as proof.

The customer pays the network fee on top of the amount, so tell them the total they will spend and that the test amount is refundable. Your deposit address should already hold the rent-exempt minimum for an empty account, or the challenge amount must cover it, because a transfer that leaves a new account below that minimum fails.

03

Matching the transfer

The script takes the deposit address, the claimed wallet, the challenge amount in lamports and, optionally, the signature the customer pasted. With a signature it reads that one transaction. Without one it lists the newest 10 signatures of the deposit address and reads each. CHALLENGE_SINCE carries the issue time. With no arguments at all it picks a recent transfer from the newest system program signatures, so you can watch a full match run.

Every call goes to the RPC endpoint at confirmed commitment, set on each call. Transactions are read as jsonParsed with maxSupportedTransactionVersion set to 1, so a version 1 transaction comes back parsed instead of answering -32015. The reads run together through Promise.allSettled, and one failing read prints its error while the others finish.

main.ts
// UC0110 · Wallet ownership deposit test// https://carbium.sh/library/usecase/wallet-ownership-deposit-test// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.// SPDX-License-Identifier: MIT// Read-only: checks that a claimed wallet signed a transfer of the challenge amount to your deposit address.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 rpc = createSolanaRpcFromTransport(createDefaultRpcTransport({  url: process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh", headers: { "x-api-key": key } }));const opts = { encoding: "jsonParsed", maxSupportedTransactionVersion: 1, commitment: "confirmed" } as const;type Ix = { program?: string; parsed?: { type?: string; info?: { source?: string; destination?: string; lamports?: number | string } } };const raw = (tx: object) => (tx as { transaction: { message: { instructions: unknown } } }).transaction.message.instructions;const transfers = (ixs: unknown) => (ixs as Ix[])  .filter((i) => i.program === "system" && i.parsed?.type === "transfer").map((i) => i.parsed!.info!);async function check(sig: Signature, deposit: string, claimed: string, lamports: bigint, since: number) {  const tx = await rpc.getTransaction(sig, opts).send();  if (!tx) return "null answer, retry later";  if (tx.meta?.err) return "failed on chain";  if (Number(tx.blockTime ?? 0) < since) return "older than the challenge";  const hit = transfers(raw(tx)).some((t) => t.source === claimed && t.destination === deposit && BigInt(t.lamports ?? -1) === lamports);  return hit ? "match" : "no transfer of that size from the claimed wallet";}// Demo input: the first plain transfer among the newest system program signatures.async function discover(): Promise<string[] | undefined> {  const sigs = await rpc.getSignaturesForAddress(address("11111111111111111111111111111111"), { limit: 20, commitment: "confirmed" }).send();  for (const s of sigs) {    if (s.err) continue;    try {      const tx = await rpc.getTransaction(s.signature, opts).send();      const t = tx ? transfers(raw(tx))[0] : undefined;      if (t) return [t.destination!, t.source!, String(t.lamports), s.signature];    } catch (e) { console.error(`getTransaction ${s.signature}: ${(e as Error).message}`); break; }  }  return undefined;}async function main() {  let [deposit, claimed, amount, sig] = process.argv.slice(2);  if (!deposit || !claimed || !amount) {    const found = await discover();    if (!found) { console.error("Usage: node main.ts <deposit> <claimed wallet> <lamports> [signature]"); process.exit(1); }    [deposit, claimed, amount, sig] = found;    console.log("no arguments: using a transfer from the newest system program signatures");  }  const dep = address(deposit), who = address(claimed), lamports = BigInt(amount);  const since = Number(process.env.CHALLENGE_SINCE ?? 0);  const sigs = sig ? [signature(sig)]    : (await rpc.getSignaturesForAddress(dep, { limit: 10, commitment: "confirmed" }).send()).filter((s) => !s.err).map((s) => s.signature);  const results = await Promise.allSettled(sigs.map((s) => check(s, dep, who, lamports, since)));  results.forEach((r, i) => console.log(sigs[i], r.status === "fulfilled" ? r.value : `error: ${r.reason?.message ?? r.reason}`));  const ok = results.some((r) => r.status === "fulfilled" && r.value === "match");  console.log(ok ? `VERIFIED: ${claimed} signed a transfer of ${amount} lamports to ${deposit}` : `NOT VERIFIED in the newest ${sigs.length} signatures`);}main().catch((e) => { console.error(e instanceof Error ? e.message : e); process.exit(1); });

run: CARBIUM_KEY=$CARBIUM_KEY CHALLENGE_SINCE=<unix seconds> node main.ts [<deposit> <claimed wallet> <lamports> [<signature>]]

A transaction counts only when all of these hold.

CheckWhy it is there
Answer is not nullA listed signature can still come back null from getTransaction, so the script prints a null answer as its own case for you to retry, never as a mismatch
meta.err is emptyA failed transaction moves no lamports
Block time is at or after the issue timeStops an old transfer of the same size from passing
A top-level transfer instruction from the claimed walletThe source of a System Program transfer must have signed
Destination equals your deposit addressThe transfer reached you and not someone else
Lamports equal the challenge amount exactlyTies the transfer to this attempt, not to any dust the wallet sent

The fee payer does not matter. A friend or a relayer can pay the fee, and the transfer still shows the claimed wallet as its source, signed by that wallet's key.

04

Cost of a check

A scan is one getSignaturesForAddress call and up to 10 getTransaction calls. Each of them charges 50 cells, so a full scan is 550 cells. That stays under the 1,024-cell burst a rate class absorbs, so the 10 reads can fire together. On Free and Dev, getTransaction refills at 0.24 and 1.2 calls a second, so a few full scans in a row drain the burst and the next reads get 429 with a retry-after hint. Queue the checks and run them one customer at a time.

The signature path costs one call. When the customer pastes the signature of their transfer, take it: it needs a single read, and it finds the transfer even when your deposit address has gathered more than 10 newer signatures since.

05

Where it ends

  • The test shows who signed at one moment. A person with temporary access to the key passes it, and it settles no question of legal ownership.
  • A custodian signs for its customers. A transfer from an exchange's hot wallet verifies that address and shows the exchange signed. Compare the verified source against addresses you know belong to custodians, and screen it the way you screen any deposit source.
  • The script reads top-level System Program transfers only. A multisig or program wallet moves SOL through an inner instruction, and a transferWithSeed has a derived source, so both show as no match.
  • It covers SOL. A token transfer lists the token accounts and the sender's authority and never the receiving wallet, so a token version of this test must match on the sender's authority and your deposit's token account.
  • The address scan reaches back through the newest signatures only, and the index behind getSignaturesForAddress keeps up to 30 days. A challenge that expires within hours sits far inside that.
  • The refund is a signed transaction that stays in your own signing service. The script moves nothing.

To tie a transfer to an attempt by its memo instead of an exact amount, Memo payment lookup matches transfers on the memo they carry.

06

When it goes wrong

what goes wrongwhat to do
getTransaction answers -32015 when you add your own transaction reads.Set maxSupportedTransactionVersion to 1 on the call. Absent or 0, a version 1 transaction is refused.
The customer says they sent the amount but the script prints no transfer of that size from the claimed wallet.Open the printed signature. The usual causes are a different source wallet, an amount that differs by even one lamport, or a transfer made through a program, which sits in an inner instruction.
The customer's signature prints older than the challenge.That transaction confirmed before the second in CHALLENGE_SINCE, so the script checked nothing else in it. Confirm CHALLENGE_SINCE holds the issue time, then issue a new amount and ask the customer to send again.
Reads fail with 429 when many checks run at once.Wait out the retry-after hint and run the check again. Prefer the signature path, which makes one read, and queue checks instead of firing them together.
A signature that was just listed comes back null.Retry in a few seconds. A null answer is not a failed verification, and the script reports it as its own case.
07

Questions

Why a transfer and not a signed message?

A signed message proves key control too, but not every wallet app exposes message signing, while every wallet can send SOL. The transfer also leaves an on-chain record that you can keep with the customer's file.

Should I wait for finalized before accepting the transfer?

The script reads at confirmed. Since the Alpenglow switch on mainnet, finalized trails processed by 0 to 1 slots of about 200 ms each, so setting commitment to "finalized" in opts adds almost no wait. Use finalized when the check gates a payout.

What stops two customers using the same transfer?

The exact amount. Each attempt gets its own tail and its own issue time, and the check requires both, so a transfer made for one attempt matches no other.

How small can the challenge amount be?

Small enough that losing it costs nothing, but large enough that your deposit address stays at or above the rent-exempt minimum if it is empty. For a system account with no data that minimum is 890,880 lamports. Add your own fee reserve if you refund.