

Reading metadata
Metadata is the receipt. It shows the result and what changed.
Key points
- The receipt shows the result and each entry that changed.
- CreatedNode, ModifiedNode and DeletedNode show what changed and how.
- Credit delivered_amount, never the Amount field of a Payment.
The lesson
A transaction is the request. Metadata is the receipt. The ledger adds it once the transaction is in a ledger.
The receipt says two things:
- The : did it work?
- What changed. A list called
AffectedNodesnames every ledger entry the transaction touched.
Each entry in that list is one of three kinds:
- CreatedNode: something new, such as a new offer.
- ModifiedNode: something changed, with the old and new values. A balance going from 50 to 49 shows up here.
- DeletedNode: something removed, such as a filled offer.
A simple XRP payment changes two accounts: yours and the receiver's.
One field matters most for payments:
delivered_amount. It says what the receiver got. A partial payment can deliver less than itsAmount. So always creditdelivered_amount.
Request a transaction with
tx(or read it fromaccount_tx). Themetaobject holds:TransactionResult: the .TransactionIndex: its position in the ledger, from 0.AffectedNodes: every it created, modified or deleted.delivered_amount: what theDestinationreceived, on aPayment.
Node shapes. Each node names its
LedgerEntryTypeandLedgerIndex.Node Fields CreatedNodeNewFieldsModifiedNodeFinalFields,PreviousFields(only what changed),PreviousTxnID,PreviousTxnLgrSeqDeletedNodeFinalFields, sometimesPreviousFieldsBalance change. For an
AccountRoot, compareFinalFields.BalancewithPreviousFields.Balance. The sender's change includes the burnedFee.Credit the right number.
Amountis what was asked for. WithtfPartialPayment, it can be far more than what arrived. Readdelivered_amountfrom validated metadata. For in ledgers before 2014-01-20, it saysunavailable; readAffectedNodesinstead.A
tecresult has metadata too: the sender'sAccountRootshows the fee taken and theSequenceused.Related: Partial payments, From signed to final.

