yeti labs

field note 004 · 2026-09-22 · onchain, data integrity

our checker agreed with our feed, because it made the same mistake

we built a live USDC balance feed for a client running stablecoin rails on stellar. the row counts matched. the per-ledger sums matched. about 12% of the money was missing anyway, and the only thing that noticed was the chain itself.

events dropped
~12%
checker mismatches
0
accounts read high
3 of 6
escrow drift
+21,276

the setup

the client wanted to know how much USDC (circle's dollar stablecoin) every holder on the network has, kept current block by block. the plan was the boring, correct one: take a snapshot of every balance from the chain's public API, then apply every transfer after it as a debit on one side and a credit on the other.

the snapshot was the easy part. one sweep of the chain's account state took 32 minutes and came back with 2,419,974 trustlines and 654,409 holders, and the small gap against the warehouse copy we already had was just freshness. the transfers come from the USDC contract's own events, which the chain hands us already decoded. a transfer event looks roughly like this, with the amount as a single number:

{"i128": "4508489130"}

so the transformation read that field, wrote a debit and a credit, and moved on. we wrote a verification script alongside it that recounted the events and re-summed them per ledger. everything lined up, to the row.

the second shape

a transfer to a muxed destination (one address with a sub-account id tacked on) carries the amount in a different shape. it's wrapped in a map, next to the sub-account id:

{"map": [{"key": {"symbol": "amount"}, "val": {"i128": "…"}}, {"key": {"symbol": "to_muxed_id"}, …}]}

our transformation looked for the amount in the top-level field, found nothing, and skipped the whole event. both legs, the debit and the credit. on one ledger we sampled, that was 5 of 43 transfer events. across the stream it was about 12%, and they were not the small ones.

the verification script read the same field the same way. so it never saw those events either, and it agreed with the feed every single time.

the checker agreed because it was blind in the same place

USDC transfer events on one sampled ledger, by who was counting

010203040 eventsour feed kept38our checker counted38the chain emitted5435 muxed transfers.both readers skipthat amount shape,so they agree on 38.
source: yeti labs balance feed, its verification script, and the raw contract events for one ledger, 2026-09-22yeti labs · field note 004

what caught it

we reconciled the computed balances against the chain's own account state, read straight from the public API one account at a time. that source never touched our events, so it had no reason to share our mistake. three of the six accounts we checked matched to the cent. the other three read high, all of them, and the worst was an escrow account 21,276 USDC above what the chain said it held.

every miss pointed the same way

computed balance vs the chain's own balance, accounts checked on 2026-09-22

resultaccounts
matched to the cent3
read high3
read low0
worst: the escrow+21,276 USDC

the direction was the tell. when both legs of a transfer vanish, an account that mostly sends money keeps its credits on the books and loses the debits, so it drifts up. an escrow is exactly that kind of account. random noise would scatter both ways. one-sided error in one population of accounts looks like a whole category of events falling out.

the fix was to read the amount from either shape. after it, rows came out at exactly two per event and the amounts matched to about 1e-14 from the first fixed ledger on.

the same week, the same mistake from the other side

the client's dashboard went live on our tables the same day and 10 of its 23 charts returned errors. our parity harness had passed 23 of 23. it ran over a direct database connection with no statement timeout, while the site's API has one, and we'd timed a bare row count (134ms) when the site asks for every column (8.3 seconds). the checker was right about the data and wrong about the path the client actually uses.

why it happens

we wrote the checker from the same understanding of the data as the feed, so whatever we misunderstood went into both. two programs built from one mental model will agree with each other, and that agreement tells you they're consistent. whether they're right is a separate question that only something outside the model can answer.

fwiw, even an independent check has a shelf life. our parity gate for the dashboard compares against a frozen snapshot from mid-september. it's a real third source, but every week it covers less of what's being served, so it gets quietly weaker unless something warns when coverage drops.

what we'd do instead

  1. check a derived feed against something that didn't come from it. for balances that's the chain's own account state, never a re-sum of the events you already decoded.
  2. reconcile a handful of real accounts on day one, and pick the busy ones (escrows, omnibus wallets, anything that mostly sends), because that's where a dropped category shows up first and biggest.
  3. read a one-directional error as a missing category of data. drift goes both ways, and a gap goes one.
  4. test on the client's real path, with the client's real query and role, before calling anything healthy.
got a pipeline that passes all its own checks?

we'll check it against the chain.

talk to the agent →