You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/concepts/tokens/fungible-tokens/rippling.md
+26-46Lines changed: 26 additions & 46 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,4 @@
1
1
---
2
-
html: rippling.html
3
-
parent: trust-lines-and-issuing.html
4
2
seo:
5
3
description: Rippling is automatic multi-party net settlement of token balances.
6
4
labels:
@@ -9,85 +7,67 @@ labels:
9
7
---
10
8
# Rippling
11
9
12
-
In the XRP Ledger, "rippling" describes a process of atomic net settlement between multiple connected parties who have [trust lines](index.md) for the same token. Rippling is essential, because it enables token holders to transfer funds directly to each other, without any issuer involvement in the debiting and crediting process. In a sense, rippling is like a passive, two-way [exchange order](../decentralized-exchange/offers.md) with no limit and a 1:1 exchange rate for two tokens with the same currency code but different issuers.
10
+
Rippling is the _indirect movement_ of funds that occurs for any payment of fungible tokens (except when an issuing account exchanges tokens directly with another account). This includes when one holder sends tokens to another holder of the same token.
13
11
14
-
Rippling only occurs along the [paths](paths.md) of a payment. [Direct XRP-to-XRP payments](../../payment-types/direct-xrp-payments.md) do not involve rippling.
15
-
16
-
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](#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](#the-default-ripple-flag).
17
-
18
-
{% admonition type="warning" name="Caution" %}When you create a trust line, you must explicitly enable the `tfSetNoRipple` flag to block rippling on your side of that trust line.{% /admonition %}
12
+
Rippling can automatically exchange tokens that have the same currency code, even if they have different issuers. This helps to facilitate longer and more complex payments between accounts.
19
13
20
14
## Example of Rippling
21
15
22
-
"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:
23
-
24
-
[{% inline-svg file="/docs/img/noripple-01.svg" /%}](/docs/img/noripple-01.svg"Charlie --($10)-- Alice -- ($20) -- Bob")
25
-
26
-
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:
27
-
28
-
[{% inline-svg file="/docs/img/noripple-02.svg" /%}](/docs/img/noripple-02.svg"Charlie --($13)-- Alice --($17)-- Bob")
16
+
Issuers distribute currency to holders over trust lines. When a holder creates a trust line to an issuer for a specific token, they are willing to accept payments of that token. For example, in the chart below, Holder A and Holder B both have trust lines to the Issuer of the token USD.
29
17
30
-
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.
18
+
[](/docs/img/cpt-rippling1.png)
31
19
32
-
## The No Ripple Flag
20
+
The Issuer transfers 50 USD to Holder A, and 10 USD to Holder B. For these trust lines, the Issuer has a net balance of -60 USD.
33
21
34
-
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.
22
+
[](/docs/img/cpt-rippling2.png)
35
23
36
-
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.
24
+
Since both accounts are willing to accept payments in USD tokens, Holder A can send a payment of 20 USD to Holder B. This appears to be a single transaction, but it actually involves two steps. Holder A sees their balance go down by 20 USD, Holder B sees their balance go up by 20 USD. Behind the scenes, though, Holder A’s side of the trust line to the Issuer is reduced by 20 USD. The Issuer’s side of the trust line is increased by 20 USD, bringing its net balance to -40 USD.
37
25
38
-
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](#the-default-ripple-flag).
26
+
[](/docs/img/cpt-rippling3.png)
39
27
40
-
For example, imagine Emily has money issued by two different financial institutions, like so
28
+
Then the Issuer side of the trust line to Holder B is reduced by 20 USD, and the account of Holder B is increased by 20 USD.
41
29
42
-
[{% inline-svg file="/docs/img/noripple-03.svg" /%}](/docs/img/noripple-03.svg"Charlie --($10)-- Institution A --($1)-- Emily --($100)-- Institution B --($2)-- Daniel")
30
+
[](/docs/img/cpt-rippling4.png)
43
31
44
-
Now Charlie can pay Daniel by rippling through Emily's address. For example, if Charlie pays Daniel $10:
32
+
The tokens are transferred through the Issuer, but ultimately the Issuer’s balance doesn’t change. This flow of tokens is known as _rippling_. Issuing accounts must allow rippling so that their holders can transfer tokens to one another.
45
33
46
-
[{% inline-svg file="/docs/img/noripple-04.svg" /%}](/docs/img/noripple-04.svg"Charlie --($0)-- Institution A --($11)-- Emily --($90)-- Institution B --($12)-- Daniel")
34
+
Rippling can involve several accounts as the XRP Ledger finds a path to transfer the tokens. For example, the tokens might flow between two issuer accounts that have a trust line between them.
47
35
48
-
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.
36
+
[](/docs/img/cpt-rippling5.png)
49
37
50
-
For example:
38
+
Tokens might also flow through intermediary exchanger accounts to reach a holder.
51
39
52
-
[{% inline-svg file="/docs/img/noripple-05.svg" /%}](/docs/img/noripple-05.svg"Charlie --($10)-- Institution A --($1, No Ripple)-- Emily --($100, No Ripple)-- Institution B --($2)-- Daniel")
40
+
[](/docs/img/cpt-rippling6.png)
53
41
54
-
Now the above scenario, where Charlie pays Daniel while rippling through Emily's address, is no longer possible.
42
+
Other accounts, such as liquidity providers and normal holders, should not allow rippling. Rippling can lead to exploits where balances shift unexpectedly, tokens are allocated at higher rates, and the holder ends up losing value on a transaction where they played no part.
55
43
56
-
### Specifics
44
+
#The Default Ripple Flag
57
45
58
-
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.
46
+
The Default Ripple flag is an account level setting that enables rippling for all incoming trust lines. The default setting of the Default Ripple flag is false. Issuers must enable this flag for their customers to be able to send tokens to one another.
59
47
60
-
[{% inline-svg file="/docs/img/noripple-06.svg" /%}](/docs/img/noripple-06.svg"Diagram demonstrating that No Ripple has to be set on both trust lines by the same address to do anything")
48
+
The Default Ripple setting doesn’t affect trust lines that you create, only trust lines that others open to your account. If you change the setting, 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 account’s new default.
61
49
50
+
# The No Ripple Flag
62
51
63
-
## The Default Ripple Flag
64
-
65
-
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.
66
-
67
-
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.
68
-
52
+
Accounts that do not want to allow rippling can enable the No Ripple flag. If you enable the No Ripple flag on two of your trust lines, other accounts cannot use that pair of trust lines to ripple payments through your account. However, if you have any other trust lines that do not have the No Ripple flag enabled, payments can still ripple through your account as long as _one_ of the trust lines involved does not have No Ripple enabled.
69
53
70
54
## Using No Ripple
71
-
<!--{# TODO: move these things into their own tutorials #}-->
72
-
73
-
### Enabling / Disabling No Ripple
74
-
75
-
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.)
76
55
77
-
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.
56
+
The No Ripple flag can only be enabled on a trust line if the address has a positive or zero balance. This is so that the feature cannot be abused to remove the obligation the trust line balance represents.
78
57
58
+
To enable the No Ripple flag, send a [TrustSet transaction][] with the `tfSetNoRipple` flag. To disable the No Ripple flag, send a TrustSet transaction with the `tfClearNoRipple` flag.
79
59
80
-
###Looking Up No Ripple Status
60
+
## Looking up No Ripple status
81
61
82
62
In the case of two accounts that mutually trust each other, the No Ripple flag is tracked separately for each account.
83
63
84
-
Using the [HTTP / WebSocket APIs](../../../references/http-websocket-apis/index.md) or your preferred [client library](../../../references/client-libraries.md), 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.
64
+
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. The`no_ripple_peer` field shows whether the counterparty has enabled the No Ripple flag.
0 commit comments