Every custodial system carries three answers to the question "how much of this asset do we hold?". The ledger says one number, the custodian's API says another, and the chain says a third. On a good day they agree. Crypto custody reconciliation is the control that proves it, every day, and tells you the same day when they stop agreeing. It is the least glamorous job in the stack and the one I would keep if I had to delete everything else.
I came to engineering from accounting, where reconciliation is not a feature but a habit: the bank statement is matched to the cash book before anyone trusts either. This article is that habit applied to custody. It covers what the three sources actually mean, how the reconciliation job is designed, what explains a difference, which thresholds page someone, and how the same output becomes proof of reserves. It is a deep dive from the crypto custody architecture hub.
Three sources of truth, and only one system of record
Start by being precise about what each number is, because the mistakes begin when people treat them as the same thing.
- The ledger balance. The sum of posted journal entries on a custody asset account: what your books say is held in a given wallet or custodian account for a given asset. It also carries the other side: customer liabilities, held amounts, fees. This is the system of record. A balance changes here or it does not change.
- The custodian balance. What the provider reports through its balances endpoint. It is their view of your account, shaped by their confirmation policy, their fee model and their status machine. Useful, external, and not yours.
- The chain balance. The sum of unspent outputs or the account state at the addresses you control, read from a node or an indexer at a specific block height. The most objective of the three and the slowest to agree with the others, because value in flight is by definition not yet there.
The rule that follows, and that the hub states as the single most useful rule in custody, is that balances live in the ledger and never in the wallet. Reconciliation does not copy the custodian's number into your books when they differ. It records the difference, explains it, and escalates what it cannot explain. If your fix for a break is an UPDATE on a balance column, you do not have a ledger; you have a cache.
What a break is, and what explains one
A break is a difference between two sources at the same point in time that the known in-flight items do not account for. Most differences are not breaks. Before an alert fires, the job must subtract the legitimate timing gaps:
- Deposits observed but not yet credited. The chain shows funds at a deposit address below your confirmation threshold. The ledger correctly shows nothing yet, or an in-transit entry.
- Withdrawals submitted but not yet settled. The ledger holds the amount, the custodian may already have broadcast it, the chain may or may not show it. All three are right at once.
- Sweeps in flight. Funds leaving deposit addresses for the operational pool. Both ends belong to you, so the total across addresses is unchanged, but any per-address comparison will show movement.
- Network fees. A withdrawal of 1.0 leaves the chain balance down by 1.0 plus the fee. If fees are not posted to a fee expense account, every withdrawal is a small permanent break.
- Dust and rounding. Token decimals, provider rounding and your own numeric type disagree at the eighteenth decimal place. Decide a tolerance per asset and record it as data, not as a constant in code.
Everything that remains after those explanations is a real break, and real breaks have a short list of causes: a missed status transition, a webhook that never arrived and no sweeper caught, a mis-mapped decimal in an adapter, an address the ledger does not know it controls, a double-posted deposit after a retry, or, rarely and importantly, funds that moved without your system moving them. The job cannot tell those apart. Its job is to make sure a human looks the same day.
Designing the reconciliation job
The shape that has worked for me is three passes, run on a schedule, each writing an immutable record. The output is itself an append-only table: no row is edited, a later run writes a new row.
for each (custody account, asset):
snapshot = read ledger balances at a cutoff (posted entries only)
external = provider.getBalances(account) -- same cutoff, or note the lag
onchain = node.balanceAt(addresses, block) -- block chosen at or before cutoff
inflight = open in-transit entries at cutoff -- deposits, withdrawals, sweeps
expected = snapshot.custody_asset + inflight.pending_out - inflight.pending_in
write reconciliation_run(account, asset, cutoff,
ledger=snapshot, custodian=external, chain=onchain,
explained=inflight, break_vs_custodian, break_vs_chain,
tolerance, status)
The details that make the difference between a job that runs and a job that is trusted:
- A cutoff, not "now". Reconcile at a fixed instant, and for the chain at a fixed block height. Reading three sources at three slightly different moments manufactures breaks out of normal activity. Ledger entries carry a posted-at timestamp precisely so this cutoff can be applied.
- Posted entries only. Pending or draft entries are not balances. If your ledger has a two-phase post, reconcile against the committed phase.
- Per account and per asset, then rolled up. The pair is the natural unit: it maps to one custodian account and one set of addresses. Totals per asset are derived, so a break can always be traced back to the account that caused it.
- Explain, then compare. Pull the in-transit entries first and compute the expected external balance. Comparing raw numbers and then explaining the gap by hand is how teams end up ignoring the report.
- Record the inputs. Store the custodian response and the block height alongside the result. When the on-call engineer looks at a break six hours later, the inputs have changed; the record must not.
- Idempotent runs. Key each run on (account, asset, cutoff). A re-run after a bug fix produces a new row with the same key and a later run number, never a mutation. That is the same discipline as an idempotency key on a payment: an identifier you generated, so a retry finds the earlier attempt.
On frequency: a daily run at a quiet hour is the floor, because that is what auditors and most custody rulebooks expect to see evidence of. Hot wallets deserve more. An hourly ledger-versus-custodian pass on hot accounts is cheap, since it is one API call per account, and it shortens the time a bad adapter can run unnoticed from a day to an hour. Chain reads are the expensive leg; daily per address, with an intraday total-per-asset check, is a reasonable compromise.
Thresholds and alerts that people do not mute
A reconciliation job that pages on every satoshi is muted within a week, and a muted alert is worse than none because it creates the belief that the control exists. The thresholds that have survived contact with on-call rotations:
- Tolerance per asset, in the asset's own units and in fiat. A break under the tolerance is logged, not alerted. The tolerance is data in the asset registry, reviewed when fees or decimals change. The fiat leg stops a tolerance set for a cheap token from quietly growing into real money when the price moves.
- Unexplained break above tolerance: page within the hour. Not a ticket, a page. A break that is real can be funds moving, and the first hour is when it is cheapest to halt withdrawals for that asset.
- Explained break older than the asset's expected settlement window: ticket. A withdrawal in flight for three days on a chain that settles in ten minutes is not in flight; it is stuck. The sweeper over non-terminal transfers should have caught it, and the reconciliation report is the backstop that proves whether the sweeper works.
- Run did not complete: page. A missing run is a missing control. The job writes a heartbeat row even when it finds nothing, and monitoring alerts on the absence of the row, not on the presence of an error.
- Trend, not just level. A small break that persists across runs at the same value is a posting bug. One that grows is active. Alert on a break that is unchanged for three runs, and separately on one that has grown on consecutive runs.
Alerts carry the account, asset, cutoff, three balances, the explained amount and the residual, with a link to the run record. The on-call engineer should be able to decide "halt this asset or not" from the page itself, without opening a dashboard.
Handling a break without breaking the ledger
When a break is real, the fix is never to edit a balance. The sequence I follow:
- Contain. If the direction of the break could mean funds left without a matching ledger entry, pause withdrawals for that asset and account behind a flag. Deposits can continue; they only add.
- Find the cause. Walk the audit log for the account between the last clean run and this one. Compare the custodian's transfer list for the window against your transfer table, keyed by your own intent identifiers. The missing or doubled row is usually visible within minutes.
- Correct with an entry. Post a journal entry that moves the difference into or out of a reconciliation suspense account, with the run identifier in its reference. The custody asset account now agrees with the external source, and the suspense balance is a visible, dated liability that someone owns.
- Resolve the suspense. When the cause is known, post the real entry (the missed deposit credit, the fee that was never expensed) and reverse the suspense. If the cause is a loss, the entry that recognises it is a decision for finance and compliance, recorded as such.
- Close with evidence. The next run shows a clean result and references the correcting entries. That chain, break to suspense to resolution to clean run, is what an auditor asks for, and it exists without anyone writing a document after the fact.
Nothing in that sequence reverses out of a settled entry, and nothing changes a number without a journal line. That is the same discipline the provider-agnostic custody article applies to transfer status: corrections are new facts, not edits to old ones.
From reconciliation to proof of reserves
Proof of reserves is reconciliation with the customer on the other side of the table. The exchange publishes evidence that on-chain holdings at a snapshot cover customer liabilities at the same snapshot. If the daily job already records ledger liabilities, custodian balances and chain balances at a cutoff with a block height, the reserve proof is a report over data you already keep, plus two additions: a signed message or a demonstrable spend from each address to prove control, and a Merkle tree over customer liabilities so each customer can verify their own balance is included without seeing anyone else's.
Systems that bolt proof of reserves on afterwards struggle because they never kept block-height snapshots and their liabilities were computed from a balance column rather than from entries. Build the daily reconciliation properly and the reserve report is a week of work, not a quarter. Regulators in Dubai and the EU both expect client assets to be segregated and reconcilable on demand; the same records serve both.
A minimal schema
For teams starting from nothing, the tables that need to exist before the first run:
reconciliation_run id, account_id, asset_id, cutoff_at, chain_block, run_no, ledger_balance, custodian_balance, chain_balance, explained_in, explained_out, residual_vs_custodian, residual_vs_chain, tolerance, status (clean | explained | break | failed), custodian_payload (json), created_at reconciliation_item run_id, kind (deposit_pending | withdrawal_pending | sweep | fee | dust), ledger_entry_id, transfer_id, amount asset_registry (existing) + recon_tolerance_units, recon_tolerance_fiat, settlement_window_seconds
Two of those columns do more than they look. run_no with a unique index on (account_id, asset_id, cutoff_at, run_no) makes re-runs explicit and auditable. custodian_payload is what lets you prove, months later, what the provider said at that moment.
What this looked like in practice
On a regulated exchange I worked on, the reconciliation job was the control that caught two classes of problem neither monitoring nor tests had: an adapter that mapped a token's decimals wrongly for one chain, visible as a break on the first day that asset saw a deposit, and a sweep that posted as customer activity, visible as a liability that grew without any customer doing anything. Both were fixed with journal entries and an adapter change, and both would have been support tickets a month later without the job. The case study covers the wider architecture.
The rhythm is simple once it exists: the job runs, the report is clean, nobody reads it, and the one morning it is not clean, somebody does. That is what a control is for.
If you are building or auditing a custody ledger and want a second pair of eyes on the reconciliation design, this is the kind of work I take on.
Written from public vendor documentation, published regulation and general industry practice. It does not describe the architecture, controls or operations of any employer or client. Views are my own.
