Off-chain API ping command#
| DIP | 160 |
| Title | Off-chain API ping command |
| Author | Xiao Li (@xli) |
| Discussions-to | https://github.com/diem/dip/issues/160 |
| Status | Draft |
| Type | Informational |
| Created | 04/08/2021 |
Summary#
This DIP describes an off-chain API v2 ping command that makes it easier for clients to detect network and protocol problems.
Abstract#
To improve the ability of off-chain service handling network problems and protocol errors, we’d like to introduce a ping command for client to:
- detect dead connections to a remote off-chain service.
- measure the latency to a remote off-chain service.
- detect off-chain protocol errors to a remote off-chain service, for example: an off-chain service responds back with an unexpected compliance key due to key rotation, this can be leveraged to debug and verify the inconsistency.
Specification#
The PingCommand object's definition:
| Field | Type | Required? | Description |
|---|---|---|---|
| _ObjectType | str | Y | The fixed string PingCommand |
An example CommandRequestObject JSON message with PingCommand:
And the response of the PingCommand:
Note, PingCommand does not require a random payload, as the Off-Chain Protocol already has a cid to uniquely distinguish different CommandRequestObject and CommandResponseObject.
This command introduces no new errors outside the scope of DIP-1.
Copyright Notice: This documentation is made available under the Creative Commons Attribution 4.0 International (CC BY 4.0) license (available at https://creativecommons.org/licenses/by/4.0/).