Reconcile Tezos receipts using balance-update buckets
A receipt can describe movements among contract balances, fee or reward buckets and frozen funds. Summing only entries that look like account addresses can leave unexplained differences.
Classify each signed change
Start with a single successful transfer. The illustrative changes below represent one tez leaving a sender and entering a recipient, before separate fees or other effects. Keep the signed integer in mutez.
contract balance change: -1000000 mutez
contract balance change: +1000000 mutez
For a real receipt preserve the update kind, category where present, origin and affected owner. Separate the transfer pair from fee movements. An update moving frozen funds into a liquid bucket changes spendability even if the overall position has the same value.
Respect the scope of metadata
Updates may appear at different levels, including block metadata and operation results. Record the location of each update and avoid charging one fee twice when combining reports. Historical protocols can use different categories, so decode against the active protocol. octez.tezos.com Octez protocol documentation