Note
|
RFC-Number: 002 Status: Draft + Created on: 2018-12-28 |
This RFC serves two purposes:
-
Introduce terminology used to describe the exchange of assets.
-
Define a REQUEST/RESPONSE message pair for two parties to negotiate such an exchange via the COMIT messaging protocol.
To describe the elements of an exchange, we use the terms Ledger
, Asset
, Alpha
and Beta
.
The terms alpha and beta are used to unambiguously identify assets and ledgers in an exchange. Such an exchange can thus be described as:
-
Transferring the ownership of the alpha-asset on the alpha-ledger from party A to party B.
-
Transferring the ownership of the beta-asset on the beta-ledger from party B to party A.
This terminology has several advantages:
-
It does not imply an order (compared to a terminology like first/second).
-
It is not subjective to any of the parties (compared to terminology like source/target, incoming/outgoing or local/remote).
The messages to negotiate such an exchange consist of a REQUEST
frame and a corresponding RESPONSE
frame.
A SWAP REQUEST message is a FRAME
of type REQUEST
.
As per definition in RFC001
, a REQUEST
FRAME
has a type
that defines its semantics.
For the SWAP REQUEST message, this type is SWAP
.
To express all the information for an exchange, a SWAP REQUEST MUST include the following headers:
Header | Value (Link to registry section) | Description |
---|---|---|
|
The ledger the alpha-asset is tracked on. |
|
|
The ledger the beta-asset is tracked on. |
|
|
The asset whose ownership will be transferred on the |
|
|
The asset whose ownership will be transferred on the |
|
|
The protocol that is used to transfer the ownership of the assets. |
This RFC only defines these headers. The actual definition of ledgers, assets and protocols is not subject to this RFC.
A frame of type REQUEST
implies a RESPONSE
.
We will refer to the response of a SWAP REQUEST as SWAP RESPONSE.
A SWAP RESPONSE contains the decision made by the other peer.
The response MUST contain the decision
header.
The decision
header is defined as follows:
-
value
:accepted
ORdeclined
. -
parameters
: None
The content of the body
depends on the values of the headers.
The following diagram illustrates the process:
The DeclineBody
is an object with two properties:
-
reason
: An identifying string that briefly describes why the request was declined. -
details
: An object containing further, relevant details. The object-shape depends on the givenreason
.
See the Registry extensions-section for examples of a DeclineBody
.
This section contains examples of SWAP REQUEST/RESPONSE frames. Elements not relevant for this RFC or which are subject to later definition are filled in with "…".
{
"type": "REQUEST",
"id": 0,
"payload": {
"type": "SWAP",
"headers": {
"alpha_ledger": {
"value": "...",
"parameters": { ... }
},
"beta_ledger": {
"value": "...",
"parameters": { ... }
},
"alpha_asset": {
"value": "...",
"parameters": { ... }
},
"beta_asset": {
"value": "...",
"parameters": { ... }
},
"protocol": "...",
},
"body": { ... },
}
}
This RFC extends the registry with the following elements:
A section "Ledgers" is added to the registry which tracks all currently defined ledger types. Subsequent RFCs can refer to this type if they want to define a particular ledger.
A section "Assets" is added to the registry which tracks all currently defined asset types. Subsequent RFCs can refer to this type if they want to define a particular asset.
A section "SWAP Protocols" is added to the registry which tracks all currently defined protocols. Subsequent RFCs can refer to this type if they want to define a particular swap protocol.
A section "DeclineBody" is added to the registry which tracks all currently defined reasons. Subsequent RFCs can refer to this type if they want to define new reasons for declining SWAP REQUESTs.
The following DeclineBody`s are added to the list.
Each heading represents a `reason
.
The rate of alpha_asset
to beta_asset
is not satisfactory to the receiver.
The protocol specified in the protocol
header is not known to the receiving party.
The ledger-asset combination specified in the SWAP request is not supported by the receiving party.
This can mean that: 1. The ledger is unknown 2. The asset is unknown 3. Ledger and asset are unknown
This error can be extended to a more complex unknown-asset
and unknown-ledger
in the future.
The error cases for these variants have to be properly defined first.
A mandatory header expected by the receiving party is not properly specified by the sending party.