From 0f1db4c616eb39a560258da8e362233e952196ea Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Thu, 26 Oct 2017 15:16:56 +0200 Subject: [PATCH] feat: forwarded payments --- .../0003-interledger-protocol.md | 31 +++++++++++++++++-- asn1/InterledgerPacket.asn | 8 +++-- asn1/InterledgerProtocol.asn | 12 +++++++ 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/0003-interledger-protocol/0003-interledger-protocol.md b/0003-interledger-protocol/0003-interledger-protocol.md index fa14b398..471f478d 100644 --- a/0003-interledger-protocol/0003-interledger-protocol.md +++ b/0003-interledger-protocol/0003-interledger-protocol.md @@ -1,6 +1,6 @@ --- title: The Interledger Protocol (ILP) -draft: 6 +draft: 7 --- # Interledger Protocol (ILP) @@ -152,7 +152,12 @@ See below for the [ILP Error Format](#ilp-error-format) and [ILP Error Codes](#i ### ILP Payment Packet Format -Here is a summary of the fields in the ILP payment packet format: +There are two types of payment packets: delivered and forwarded. A delivered payment specifies the amount that should arrive at the destination, a forwarded payment doesn't. +Note that forwarded payments are still experimental, and their definition may change or get deprecated at any time. + +Here is a summary of the fields in the delivered and forwarded ILP payment packet formats: + +#### Delivered Payment Packet | Field | Type | Short Description | |:--|:--|:--| @@ -163,7 +168,7 @@ Here is a summary of the fields in the ILP payment packet format: | data | OCTET STRING | Transport layer data attached to the payment | | extensions | Length Determinant | Always `0` -#### Example +Here's an example: | Type | Length, 8+(1+14)+(1+3)+1=28 | Amount (123,000,000) ... | |:--|:--|:--| @@ -182,6 +187,26 @@ Here is a summary of the fields in the ILP payment packet format: |:--|:--|:--|:--| | 98 | 3 | 4 16 65 | 0 | +### Forwarded Payment Packet (experimental) + +| Field | Type | Short Description | +|:--|:--|:--| +| type | UInt8 | Always `10`, indicates that this ILP packet is an ILP Forwarded Payment Packet (type 10) | +| length | Length Determinant | Indicates how many bytes the rest of the packet has | +| account | Address | Address corresponding to the destination account | +| data | OCTET STRING | Transport layer data attached to the payment | +| extensions | Length Determinant | Always `0` + +Example: + +| Type | Length, (1+14)+(1+3)+1=20 | Length | Address ... ('g.us.nexus.bo') +|:--|:--|:--|:--| +| 10 | 20 | 14 | 103 46 117 115 46 110 101 120 117 115 46 98 111 | + +| ... Address ('b') | length | data | extensions | +|:--|:--|:--|:--| +| 98 | 3 | 4 16 65 | 0 | + Let's look more closely at the three important fields: `amount`, `address`, and `data`. diff --git a/asn1/InterledgerPacket.asn b/asn1/InterledgerPacket.asn index e66564c4..25ee0e51 100644 --- a/asn1/InterledgerPacket.asn +++ b/asn1/InterledgerPacket.asn @@ -9,7 +9,9 @@ IMPORTS FROM GenericTypes InterledgerProtocolPaymentData, - InterledgerProtocolErrorData + ForwardedPaymentData, -- experimental + InterledgerProtocolErrorData, + InterledgerProtocolFulfillmentData FROM InterledgerProtocol QuoteLiquidityRequestData, @@ -34,7 +36,9 @@ PacketSet PACKET ::= { {5 QuoteBySourceAmountResponseData} | {6 QuoteByDestinationAmountRequestData} | {7 QuoteByDestinationAmountResponseData} | - {8 InterledgerProtocolErrorData} + {8 InterledgerProtocolErrorData} | + {9 InterledgerProtocolFulfillmentData } | + {10 ForwardedPaymentData} -- experimental } InterledgerPacket ::= SEQUENCE { diff --git a/asn1/InterledgerProtocol.asn b/asn1/InterledgerProtocol.asn index b2b476ed..7cd08a16 100644 --- a/asn1/InterledgerProtocol.asn +++ b/asn1/InterledgerProtocol.asn @@ -12,6 +12,18 @@ IMPORTS FROM InterledgerTypes ; +-- the following packet type is experimental and may still change +ForwardedPaymentData ::= SEQUENCE { + -- Destination ILP Address + account Address, + -- Information for recipient (transport layer information) + data OCTET STRING (SIZE (0..32767)), + -- Enable ASN.1 Extensibility + extensions SEQUENCE { + ... + } +} + InterledgerProtocolPaymentData ::= SEQUENCE { -- Amount which must be received at the destination amount UInt64,