DIP161
TitleOptional Result Field in Off-Chain Protocol
AuthorSunmi Lee (@sunmilee), David Wolinsky (@davidiw)
StatusLastCall
TypeInformational
Created04/08/2020

Overview#

This DIP describes an optional result field in Off-Chain command response, and is an extension of DIP-1.

Both the Off-Chain Protocol and Travel Rule Exchange (or PaymentCommand) are defined in DIP-1. The Off-Chain Protocol in its current definition lacks a way to return a complex result outside of a success or a failure. Many types of communication benefit from having richer information in responses that may prevent the need for another message exchange, leading to simpler protocol and reduced latency.

In order to support this, the CommandResponseObject can leverage an optional result field. The result field, if defined, must contain _ObjectType that uniquely defines other fields within the result.

Here's an example from DIP-10:

{
"_ObjectType": "CommandResponseObject",
"status": "success",
"result": {
"_ObjectType": "ReferenceIDCommandResponse",
"receiver_address": "dm1p7ujcndcl7nudzwt8fglhx6wxn08kgs5tm6mz4us2vfufk",
},
"cid": "12ce83f6-6d18-0d6e-08b6-c00fdbbf085a",
}

CommandResponseObject:

FieldTypeRequired?Description
_ObjectTypestrYThe fixed string CommandResponseObject.
statusstrYEither success or failure.
errorOffChainErrorObjectNDetails of the error when status == "failure"
resultObjectNAn optional JSON object that may be defined when status == "success".
cidstrNThe Command identifier to which this is a response. Must be a UUID according to RFC4122 with "-"'s included and must match the 'cid' of the CommandRequestObject. This field must be set unless the request to which this is responding is unparseable.