Last updated

Rippling

In the XRP Ledger, "rippling" describes a process of atomic net settlement between multiple connected parties who have trust lines for the same token. Rippling is essential, because it allows users who hold tokens to send those to each other with the issuer as a passive intermediary. In a sense, rippling is like a passive, two-way exchange order with no limit and a 1:1 exchange rate for two tokens with the same currency code but different issuers.

Rippling only occurs along the paths of a payment. Direct XRP-to-XRP payments do not involve rippling.

For non-issuing accounts, rippling can be undesirable because it lets other users shift obligations between tokens with the same currency code but different issuers. The No Ripple Flag disables rippling by default when others open trust lines to your account, unless you enable rippling by default using the Default Ripple flag.

Caution: When you create a trust line, you must explicitly enable the tfSetNoRipple flag to block rippling on your side of that trust line.

Example of Rippling

"Rippling" occurs when more than one trust line is adjusted to make a payment. For example, if Alice owes Charlie money, and Alice also owes Bob money, then you could represent that in the XRP Ledger with trust lines like so:

AliceCharlieBob$10$20

If Bob wants to pay $3 to Charlie, then he could say, "Alice, take $3 of the money you owe me, and pay it to Charlie." Alice transfers some of the debt from Bob to Charlie. In the end, the trust lines work out like so:

AliceCharlieBob$13$17

We call this process, where two addresses pay each other by adjusting the balances of trust lines in between them, "rippling". This is a useful and important feature of the XRP Ledger. Rippling occurs when addresses are linked by trust lines that use the same currency code. The issuer does not need to be the same: in fact, larger chains always involve changing issuers.

The No Ripple Flag

Non-issuing accounts, especially liquidity providers who may hold balances from different issuers with different fees and policies, usually do not want their balances to ripple.

The No Ripple flag is a setting on a trust line. When two trust lines both have No Ripple enabled by the same address, payments from third parties cannot ripple through that address on those trust lines. This protects liquidity providers from having balances shift unexpectedly between different issuers using the same currency code.

An account can disable No Ripple on a single trust line, which can allow rippling through any pair that includes that trust line. The account can also enable rippling by default by enabling the Default Ripple flag.

For example, imagine Emily has money issued by two different financial institutions, like so

DanielGatewayBGatewayACharlieEmily$2$100$10$1

Now Charlie can pay Daniel by rippling through Emily's address. For example, if Charlie pays Daniel $10:

DanielGatewayBGatewayACharlieEmily$12$90$0$11

This may surprise Emily, who does not know Charlie or Daniel. Even worse, if Institution A charges her higher fees to withdraw her money than Institution B, this could cost Emily money. The No Ripple flag exists to avoid this scenario. If Emily sets it on both trust lines, then payments cannot ripple through her address using those two trust lines.

For example:

DanielGatewayBGatewayACharlieEmily$2$100NoRipple$10$1NoRipple

Now the above scenario, where Charlie pays Daniel while rippling through Emily's address, is no longer possible.

Specifics

The No Ripple flag makes certain paths invalid, so that they cannot be used to make payments. A path is considered invalid if and only if it enters and exits an address node through trust lines where No Ripple has been enabled for that address.

This path is validbecause Daniel, butnot Emily, has setthe No Ripple flagon the trust linebetween themValid path(Rippling possible)Valid path(Rippling possible)DanielEmilyGatewayACharlieDanielGatewayBEmilyGatewayACharlieValid path(Rippling possible)DanielGatewayBEmilyGatewayACharlieInvalid path(Cannot ripple)DanielGatewayBGatewayACharlieEmily$100 No Ripple$1 No Ripple$10$2$100$1$10$2$100$1 No Ripple$10$2$100No Ripple .$10$1 No Ripple

The Default Ripple Flag

The Default Ripple flag is an account setting that enables rippling on all incoming trust lines by default. Issuers MUST enable this flag for their customers to be able to send tokens to each other.

The Default Ripple setting of your account does not affect trust lines that you create; only trust lines that others open to you. If you change the Default Ripple setting of your account, trust lines that were created before the change keep their existing No Ripple settings. You can use a TrustSet transaction to change the No Ripple setting of a trust line to match your address's new default.

Using No Ripple

Enabling / Disabling No Ripple

The No Ripple flag can only be enabled on a trust line if the address has a positive or zero balance on that trust line. This is so that the feature cannot be abused to default on the obligation the trust line balance represents. (Of course, you can still default by abandoning the address.)

To enable the No Ripple flag, send a TrustSet transaction with the tfSetNoRipple flag. You can disable the No Ripple flag (that is, allow rippling) with the tfClearNoRipple flag instead.

Looking Up No Ripple Status

In the case of two accounts that mutually trust each other, the No Ripple flag is tracked separately for each account.

Using the HTTP / WebSocket APIs or your preferred client library, look up trust lines with the account_lines method. For each trust line, the no_ripple field shows whether the current address has enabled the No Ripple flag on that trust line, and the no_ripple_peer field shows whether the counterparty has enabled the No Ripple flag.

See Also