Whose balance is it? Reading an XRPL trust line from either end
A reconciliation job imports trust lines from two accounts. Seeing +25 USD on one side and −25 USD on the other can be consistent with a single obligation. The account used for the lookup sets the sign convention.
Choose the account whose books you are reconciling
Send the following message over an XRP Ledger WebSocket connection. In each element of result.lines, account identifies the counterparty. Preserve the requested address as a separate field when you flatten the response. Keep the currency and counterparty together, because unrelated issuers can use the same currency code.
{"command":"account_lines","account":"r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59","ledger_index":"validated"}
Reconcile one obligation at one ledger
Suppose A reports balance: "25" against B. From A’s perspective B owes A 25 units. Looking up B at the same validated ledger can show "-25" against A. Adding the absolute values would double the exposure. Record ledger_hash so the reverse lookup cannot cross a payment that changes the balance. Follow the response marker if the expected line is missing from the first page.