How a transaction works· 4 of 4

Reading metadata

Metadata is the receipt. It shows the result and what changed.

4 minMedium

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

  1. A transaction is the request. Metadata is the receipt. The ledger adds it once the transaction is in a ledger.

  2. The receipt says two things:

    • The : did it work?
    • What changed. A list called AffectedNodes names every ledger entry the transaction touched.
  3. 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.
  4. A simple XRP payment changes two accounts: yours and the receiver's.

  5. One field matters most for payments: delivered_amount. It says what the receiver got. A partial payment can deliver less than its Amount. So always credit delivered_amount.

Check yourself3 questions
1. Where do you find what a transaction changed?
2. A ModifiedNode shows an AccountRoot. Where is the old balance?
3. A Payment says Amount 100. What do you credit the customer?
Next moduleTrust lines and issued tokens