Why Your Deposit Detection Misses Money

Maciej Lewandowski · July 2026 · Field notes from custody & wallet infrastructure

Deposit detection sounds like the easy part of a custody platform. Watch an address, see an incoming transaction, credit the client. Every tutorial covers it in twenty lines.

Then you run it in production against real chains, real tokens and real users, and you discover that the naive version silently loses money. Not often, and that is exactly the problem: rare enough that you ship it, frequent enough that reconciliation will one day show a hole nobody can explain. These are the paths I have seen break, chain by chain.

ERC-20: the transaction's to field lies to you

The first mistake everyone makes is scanning transactions and checking tx.to. For ERC-20 deposits that field points at the token contract, not at your deposit address. The only reliable primitive is the Transfer event log, filtered by the recipient topic. So far, so standard. The edge cases are where deposits go missing:

Confirmations: crediting is a promise you might have to break

A deposit is not a fact when it appears in a block. It is a probability that increases with depth, and every chain prices that differently. Bitcoin finality is probabilistic (the classic 6 confirmations is a policy choice, not physics). Ethereum has explicit finalized checkpoints. Solana has commitment levels. And chains with fast blocks and probabilistic finality reorg shallowly as a matter of routine, not as a black-swan event.

Two rules kept us honest:

UTXO chains: deposits are outputs, not transactions

On Bitcoin the unit of a deposit is the UTXO, and one transaction can carry several outputs to the same address. Count transactions and you undercount money. Other production lessons from the UTXO side:

Solana: the deposit does not go where you think

SPL token deposits do not credit the client's main address. They credit an Associated Token Account, a separate address derived from the owner, the token program and the mint. The deposit transaction may even create that account on the fly. A scanner built on EVM assumptions, watching the owner address for incoming value, sees nothing at all. You watch token accounts, you resolve their owners, and you pick a commitment level (confirmed vs finalized) with the same care you pick confirmation thresholds elsewhere.

The only real fix: reconciliation as a continuous process

Every mechanism above will still occasionally miss. A provider webhook drops a block. A token does something creative. An engineer whitelists a chain with the wrong threshold. The systems that survive audits are not the ones with the cleverest scanner. They are the ones where an independent process continuously compares the internal ledger against on-chain reality and refuses to stay quiet about drift:

Ledger balance and chain balance are two different measurements of the same claim. Reconciliation is the discipline of checking that claim all day, every day, per asset, per address, with alerting wired to a human. Batch reconciliation at end of day is how you find out about a hole twelve hours late.

And the ledger itself: double-entry, append-only, balances derived as sums of entries. Never UPDATE balance. When (not if) a deposit path misbehaves, an append-only ledger means you can prove exactly what happened and correct it with a compensating entry. A mutable balance column means you get to explain to an auditor why the number is what it is, with no history to back you up.

A checklist, if you are building this

  1. ERC-20 by Transfer logs, native coin by traces, never by tx.to alone.
  2. Credit unknown tokens by balance delta, not event value.
  3. Resolve proxies via EIP-1967; alert on implementation changes.
  4. Per-chain confirmation thresholds; pending vs confirmed as separate balances.
  5. Deposit state machine with backwards transitions for reorgs.
  6. UTXO: track outputs, enforce a dust policy, respect gap limits, model sweeps.
  7. Solana: watch ATAs, not owner addresses.
  8. Continuous reconciliation with human alerting, on an append-only double-entry ledger.

None of this is exotic. All of it is the difference between a demo and a custody platform that a regulated institution can put real balances on.