diff --git a/charts-api-tool.html b/charts-api-tool.html index ecd8d145c1..bbcf1d2bc4 100644 --- a/charts-api-tool.html +++ b/charts-api-tool.html @@ -59,6 +59,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • @@ -152,6 +153,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • diff --git a/charts_api.html b/charts_api.html index 5c8a05489a..43d61f80f1 100644 --- a/charts_api.html +++ b/charts_api.html @@ -86,6 +86,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • @@ -147,6 +148,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • diff --git a/content/paths.md b/content/paths.md new file mode 100644 index 0000000000..1971a54e79 --- /dev/null +++ b/content/paths.md @@ -0,0 +1,72 @@ +# Paths # + +In the Ripple Consensus Ledger, paths define a way for payments to flow through intermediary steps on their way from sender to receiver. Paths enable cross-currency payments and exchanges. A single Payment transaction in the Ripple Consensus Ledger can use multiple paths, combining liquidity from different sources to deliver the desired amount. Thus, a transaction includes a _path set_ of possible paths to take. The paths in a path set must start and end with the same currency, although they could use different issuers. + +Since XRP can be sent directly to any address, an XRP-to-XRP transaction does not use any paths. + +## Path Steps ## + +A path is made of steps that connect the sender to the receiver of the payment. In theory, there are many possible types of steps, but in practice, there are only two: + +* Rippling through another account in the same currency +* Exchanging currency at an order book + +In the case of a currency exchange step, the path step specifies which currency to change to, but does not record the state of the orders in the order book. Since the order of transactions is not finalized until a ledger is validated, it is impossible to determine for certain which offers a transaction will execute, until after the transaction has been validated. Consequently, you cannot know in advance which offers a transaction will take: only which order books the transaction will use. + +Each intermediate account gains and loses equal value: either a balance ripples from a trust line to another trust line in the same currency, or they exchange currencies according to a previously-placed order. + +### Auto-Bridging ### + +In addition to any order books that are explicitly included in a path, any currency exchange between two non-XRP currencies could potentially use XRP as an intermediary currency in a synthetic order book. This is because of auto-bridging, which serves to improve liquidity across all currency pairs by using XRP as a vehicle currency. + + +## Default Paths ## + +In addition to any paths that are specified in the transaction, a transaction can also execute along the _default path_. The default path of a transaction depends on the nature of the payment, but basically, the default path is the simplest possible way to connect the sender and receiver using the information provided. + +The default path could be any of the following: + +* The trust line that connects the source account and destination account +* The trust lines to the `issuer` of the source amount and/or destination amount +* The order book that connects the source amount to the destination amount + +You can use the [`tfNoDirectRipple` flag](transactions.html#payment-flags) to disable the default path. In this case, the transaction can only execute using the paths explicitly included in the transaction. Traders can use this option to take arbitrage opportunities. + + + +# Technical Details # + +## Implied Steps ## + +By convention, the sender and the receiver are implied, rather than included explicitly in a path, even though they are the proper first and last steps. Sometimes the second step and second-to-last step are also implied by the issuers of the currencies to send and receive. More specifically: + +* The first step of a path is always implied to be the sender of the transaction, as defined by the transaction's `Account` field. +* If the transaction includes a `SendMax` field with an `issuer` that is not the sender of the transaction, that issuer is implied to be the second step of the path. +* If the `Amount` field of the transaction includes an `issuer` that is not the same as the `Destination` of the transaction, that issuer is implied to be the second-to-last step of the path. +* Finally, last step of a path is always implied to be the receiver of a transaction, as defined by the transaction's `Destination` field. + + +## Path Specifications ## + +A path set is an array. Each member of the path set is another array that represents an individual _path_. Each member of a path is an object that specifies the step. A step has the following fields: + +| Field | Value | Description | +|-------|-------|-------------| +| type | Integer | The number `48` indicates a change of currency through an order book. The number `1` indicates rippling through another account. | +| type_hex | String | A hexadecimal representation of the `type` field. | +| account | String - Address | (Optional) The address of the account to ripple through. | +| currency | String - currency code | (Optional) The currency code of the currency to convert to | +| issuer | String - Address | (Optional) The issuer of the currency to convert to | + +The `type` field, used for the binary serialization of a path set, is actually constructed through bitwise operations on a single integer. The bits are defined as follows: + +| Value (Hex) | Value (Decimal) | Description | +|-------------|-----------------|-------------| +| 0x01 | 1 | A change of account (rippling): the `account` field is present. | +| 0x10 | 16 | A change of currency: the `currency` field is present. | +| 0x20 | 32 | A change of issuer: the `issuer` field is present. | + + + + + diff --git a/data-api-v2-tool.html b/data-api-v2-tool.html index 5504645c66..ad2e64be93 100644 --- a/data-api-v2-tool.html +++ b/data-api-v2-tool.html @@ -59,6 +59,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • @@ -152,6 +153,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • diff --git a/data_api_v2.html b/data_api_v2.html index edd1378ba9..24fb25d966 100644 --- a/data_api_v2.html +++ b/data_api_v2.html @@ -86,6 +86,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • @@ -147,6 +148,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • diff --git a/gateway_guide.html b/gateway_guide.html index 4b82969d0a..ac53097f89 100644 --- a/gateway_guide.html +++ b/gateway_guide.html @@ -86,6 +86,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • @@ -147,6 +148,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • diff --git a/gateway_services.html b/gateway_services.html index bc57c89091..e35797b9f2 100644 --- a/gateway_services.html +++ b/gateway_services.html @@ -86,6 +86,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • @@ -147,6 +148,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • diff --git a/historical_data.html b/historical_data.html index 83ea12f7df..763ba2b96c 100644 --- a/historical_data.html +++ b/historical_data.html @@ -86,6 +86,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • @@ -147,6 +148,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • diff --git a/historicaldb-api-tool.html b/historicaldb-api-tool.html index e0b9d7059e..a37e50d112 100644 --- a/historicaldb-api-tool.html +++ b/historicaldb-api-tool.html @@ -59,6 +59,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • @@ -152,6 +153,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • diff --git a/index.html b/index.html index bee059d6cb..fafaa23ed9 100644 --- a/index.html +++ b/index.html @@ -72,6 +72,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • @@ -242,6 +243,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • diff --git a/paths.html b/paths.html new file mode 100644 index 0000000000..be2849f86d --- /dev/null +++ b/paths.html @@ -0,0 +1,190 @@ + + + + + + + + Paths - Ripple Developer Portal + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    +
    + + + diff --git a/reliable_tx.html b/reliable_tx.html index a30baa2915..eb0f461971 100644 --- a/reliable_tx.html +++ b/reliable_tx.html @@ -86,6 +86,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • @@ -147,6 +148,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • diff --git a/rest-api-tool.html b/rest-api-tool.html index 1dc9dcabf3..6c2653112b 100644 --- a/rest-api-tool.html +++ b/rest-api-tool.html @@ -59,6 +59,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • @@ -152,6 +153,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • diff --git a/ripple-api-tool.html b/ripple-api-tool.html index d0bec7a1bd..a33e874389 100644 --- a/ripple-api-tool.html +++ b/ripple-api-tool.html @@ -59,6 +59,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • @@ -185,6 +186,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • diff --git a/ripple-ledger.html b/ripple-ledger.html index 236b127f05..4afdbf9c22 100644 --- a/ripple-ledger.html +++ b/ripple-ledger.html @@ -86,6 +86,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • @@ -147,6 +148,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • diff --git a/ripple-rest.html b/ripple-rest.html index 21640ced93..5a0ed1bea8 100644 --- a/ripple-rest.html +++ b/ripple-rest.html @@ -86,6 +86,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • @@ -147,6 +148,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • diff --git a/rippled-apis.html b/rippled-apis.html index d7859820dc..8de1d07190 100644 --- a/rippled-apis.html +++ b/rippled-apis.html @@ -86,6 +86,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • @@ -147,6 +148,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • diff --git a/rippled-setup.html b/rippled-setup.html index abc5895490..f9947cc36e 100644 --- a/rippled-setup.html +++ b/rippled-setup.html @@ -86,6 +86,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • @@ -147,6 +148,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • diff --git a/tool/pages.json b/tool/pages.json index 90f893fb6c..eb0dad22dc 100644 --- a/tool/pages.json +++ b/tool/pages.json @@ -59,6 +59,11 @@ "md":"transferrate.md", "html":"transfer_fees.html" }, + { + "name": "Paths", + "md":"paths.md", + "html":"paths.html" + }, { "name": "Whitepapers", "md":"whitepapers.md", diff --git a/transactions.html b/transactions.html index 65366862b5..2a4ae1c942 100644 --- a/transactions.html +++ b/transactions.html @@ -86,6 +86,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • @@ -147,6 +148,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • diff --git a/transfer_fees.html b/transfer_fees.html index 201a891394..6c591ce6e5 100644 --- a/transfer_fees.html +++ b/transfer_fees.html @@ -86,6 +86,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • @@ -147,6 +148,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • diff --git a/whitepapers.html b/whitepapers.html index 0f4fb825e8..bc386c2290 100644 --- a/whitepapers.html +++ b/whitepapers.html @@ -86,6 +86,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers
  • @@ -147,6 +148,7 @@
  • Ripple Data API v2
  • Gateway Services
  • Transfer Fees
  • +
  • Paths
  • Whitepapers