ExchangePublishingRoutingMethod

Protocol.ExchangePublishingRoutingMethod History

Hide minor edits - Show changes to output

August 11, 2012, at 09:32 PM by ryan - Add exchange request and payment status query from core protocol
Added lines 67-153:


!! 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]]
!!! 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@@

July 25, 2012, at 08:53 PM by ryan - update to match more-routing-abstracted core protocol
Added lines 5-12:
Routing by published exchanges.

!! Routing Method Name

This routing method is called @@exchange-publishing@@.

!! Exchanges

Added line 31:
"fee": (flat fee),
Added lines 42-66:

!! 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.
Added lines 1-32:
! Ripple Protocol Routing Method: Exchange Publishing

See [[Protocol/Protocol06#routing-methods | Routing Methods]].

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),
"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 [[Protocol/Protocol06#commit-methods | commit methods]] for which the specified exchange rate applies.