Reconcile Partner Payout Records Against Validated Ledger Transactions

Last updated: November 29, 2026

Quick Overview

Given a table of payouts Ripple instructed for a day and a table of validated ledger transactions to its operational accounts, write SQL that lists every break: payouts missing on ledger, failed on ledger, with currency or amount mismatches, and ledger transactions with no matching payout.

Ripple
Data Manipulation (SQL/Python)
Data Engineer
Ripple
November 29, 2026
Data Engineer
Technical Screen
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


Given a table of payouts Ripple instructed for a day and a table of validated ledger transactions to its operational accounts, write SQL that lists every break: payouts missing on ledger, failed on ledger, with currency or amount mismatches, and ledger transactions with no matching payout.

Reconciliation between internal payment records and on-chain truth is daily work for Ripple's data and treasury teams, and breaks must be found before funds are reported to partners. The interviewer is checking join semantics (especially anti-joins for both sides), careful status precedence, and awareness of time-window and ledger result-code traps.

What the Interviewer Expects
  • Use a left join from payouts plus an anti-join from ledger transactions (or a full outer join)
  • Order the CASE conditions so the most fundamental break wins
  • Treat non-success result codes as failures even though they are on the ledger
  • Compare amounts in integer minor units
  • Call out midnight boundary effects between created_at and close_time
Key Topics to Cover
Left Join
Anti-Join
CASE Expressions
Reconciliation
Data Quality
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • How would you tolerate a payout that settles a few seconds after midnight?
  • Partial payments can deliver less than the stated amount; which field must you compare?
  • How would you make this an incremental daily job with an aging report for unresolved breaks?
  • How would you speed this up on a billion-row ledger table?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

payouts(payout_id, partner, currency, amount_minor, tx_hash, created_at) is our instruction record with the hash we submitted. `ledger_txs(tx_hash, destination, currency, delivered_minor, result_cod...

Approach

Two sides. From payouts, left join to the ledger by hash and classify: no row is MISSING_ON_LEDGER; a row whose result is not tesSUCCESS is FAILED_ON_LEDGER (fee-claiming failures still land in ...


Submit Your Answer
Markdown supported

Related Questions