Why does the same trust line on the XRP Ledger show a positive balance on one side and a negative balance on the other?
account_lines returns trust line balances from the perspective of the account in the request. The official documentation specifies that a positive number means the queried account holds value, while a negative number means the queried account owes value. For the same on-ledger state, querying from the other end of the trust line shows the opposite accounting direction.
For example, when checking the balance between an issuing account and a holding account, the holding side shows a positive value, while the issuing side shows an equal negative value. These two queries describe the same trust line. When preparing reports across accounts, converting both sides to absolute values and adding them would count the balance twice. To reconcile them, you can first pin the verified ledger, use both addresses and the currency to identify the trust line, and then record the sign from a single consistent perspective.
If the report aims to measure an issuer’s liabilities, clearly use the issuer-side perspective and examine each trust line separately. This refers to token balances on trust lines; the account’s native XRP balance is recorded in other fields.
$XRP #XRPL
Reference: https://xrpl.org/docs/references/http-websocket-apis/public-api-methods/account-methods/account_lines