ExchangePublishingRoutingMethod
Ripple Protocol Routing Method: Exchange Publishing
See Routing Methods.
Routing by published exchanges.
Routing Method Name
This routing method is called exchange-publishing
.
Exchanges
Hubs publish the exchanges they are willing to make at (hub URL)/exchanges/
:
GET (hub URL)/exchanges/ HTTP/1.x Accept: application/x-ripple-exchanges+json; version=0.6
The response is:
HTTP/1.x 200 OK Content-Type: application/x-ripple-exchanges+json; version=0.6 Signature: h=content-type,from,date,content-length; ... [ {"exchange_id": "(uuid)", "src": "(IOU source hub URL)", "rate": (buy rate), "fee": (flat fee), "limit": (max buy amount - optional), "commit_methods": [(commit methods)] }, (etc.) ]
If the limit for a particular exchange is not given, the hub will accept an unlimited amount of IOUs from the source hub at the specified rate.
Each exchange offer specifies one or more commit methods for which the specified exchange rate applies.
Routing Method-Specific Data
Where routing method-specific data is required, use the following:
"routing": { "method": "exchange-publishing", "incoming_promises": [ {"exchange_id": "(uuid)", "amount": (promise amount), "rate": (buy rate), "fee": (flat fee) }, (etc.) ], "outgoing_promises": [ {"promisee": "(promisee hub URL)", "amount": (promise amount), }, (etc.) ],
Outgoing promises can be omitted when passing routing data to the payment recipient.
Transactions
Payment Initiation
The payment initiation method has routing information so the recipient can know how it is going to received the payment.
"routing": {"method": (routing method), (method-specific data) },
Exchange Request
While the payer is initiating payment with the recipient, it contacts intermediary hubs it wishes to use to route the payment to the recipient by a sequence of exchanges. The payer tells each intermediary where to route Promises with an Exchange Request:
POST (intermediary hub URL)/exchangerequests/ HTTP/1.x Content-Type: application/x-ripple-exchange-request+json; version=0.6 {"payment_id": "(uuid)", "routing": {"method": "exchange-publishing", (method-specific data) ], "commit": {"method": (commit method), (method-specific data) } }
Response if successful:
HTTP/1.x 201 Created Location: (exchange request URL)
The exchange request is merely informational -- the intermediaries do not reserve any credit at this point. If the deadline passes with no Promises received, the Exchange Request can be discarded.
The exchange request URL can receive payment status requests from the payer.
Payment Status Query
In order to help determine why a payment stalled or otherwise failed, and help determine another route, the payer can ask the other participants for the status of the payment at their server.
GET (exchange request URL/payment URL) HTTP/1.x Accept: application/x-ripple-status+json; version=0.6
HTTP/1.x 200 OK Content-Type: application/x-ripple-status+json; version=0.6 {"payment_id": "(uuid)", "payment_status": "(payment status)" "incoming_promises": [ {"promisor": "(promisor hub URL)", "promise_status": "(promise status)" }, (etc.) ], "outgoing_promises": [ {"promisee": "(promisee hub URL)", "promise_status": "(promise status)" }, (etc.) ] }
Payment Statuses:
waiting_for_promises
cancelled_insufficient_credit
cancelled_by_promisee
promises_ok
Promise Statuses:
waiting
promise_ok
promise_rejected