CreditRelationshipExample

There is a basic explanation of the credit relationship concept at definitions.

In this extended example, we look at the accounting for a credit relationship as it evolves over time.

The credit relationship

Ryan and Thomas represent two neighbor nodes with a credit relationship between each other that has been registered with some Ripple server.

Ryan has a 500 USD (U.S. Dollars) line of credit with Thomas, and Thomas has a 1,000 USD line of credit with Ryan.

Ryan wants to limit himself to going no more than $1,000 in debt with Thomas, and Thomas wants to limit himself to going no more than $5,000 in debt with Ryan.

So, for practical purposes, Ryan starts with $500 available credit from Thomas, and Thomas has $1,000 available credit with Ryan.

The balance

Initially, neither node has used any of its line of credit.

  Ryan-Thomas USD credit relationship

  Ryan (values that Ryan can change)
    Thomas's credit limit: 1,000
    Ryan's issuance limit: 1,000 (could be set to unlimited if Ryan wants no issuance limit)
  Thomas (values that Thomas can change)
    Ryan's credit limit: 500
    Thomas's issuance limit: 5,000

  Result: 
    Balance of payments: 0 
    Ryan's available credit with Thomas: 500 (smaller of 500 and 1,000) 
    Thomas's available credit with Ryan: 1,000 (smaller of 1,000 and 5,000)

Time passes, and Thomas uses $200 of his available credit with Ryan to purchase a guitar -- which means the same thing as "Thomas makes a $200 Ripple payment to Ryan". The credit relationship now is as follows:

  Credit/issuance limits unchanged.

  Balance of payments:
    -$200 (from Thomas's point of view)
    +$200 (from Ryan's point of view) 

  Ryan's available credit with Thomas: 700 (smaller of (500+200) and 1,000) 
  Thomas's available credit with Ryan: 800 (smaller of (1,000-200) and 5,000)

More time passes, and Thomas buys a bed from Ryan with a $700 ripple payment. The credit relationship now is as follows

  Credit/issuance limits unchanged

  Balance of payments:
  -900 (from Thomas's point of view)
  +900 (from Ryan's point of view)

  Ryan's available credit with Thomas: 1,000 (smaller of (500+900) and 1,000)
  Thomas's available credit with Ryan: 100 (smaller of 1,000-900) and 5,000)

Notice how the balance from both of their perspectives remains the same size but in opposite directions. Ryan and Thomas are tracking the balance of credit in their relationship.

Running into limits

Ryan would now like to buy a laptop from Thomas, which Thomas is selling for $1,200.

Initially he can't do this because he set his own issuance limit at $1,000.

So, Ryan adjusts his issuance payment upward to $1,300 in order to make the payment. We now have:

  Ryan's available credit with Thomas: 1,300 (smaller of (500+900) and 1,300, the new issuance limit)

Ryan then purchases the laptop for $1,200, and we have:

  Result: 
    Balance of payments:
    +300 (from Thomas's point of view)
    -300 (from Ryan's point of view)

    Ryan's available credit with Thomas: 200 (smaller of 500-300 and 1,300) 
    Thomas's available credit with Ryan: 1,300 (smaller of 1,000 + 300 and 5,000)

An illustration of Ripple credit relationships. Right-click and view or save image to see full detail.