Message Format
API format
Two type of API will be documented following.
Wallet Manager API
The API provide by Wallet Manager to receive instructs from merchant. eg. get address, withdraw.
Merchant API
The API provided at merchant side to receive callbacks. eg. deposit and withdraw status.
Both APIs are using same signing mechanism to protest messages being sent not be forged.
Request
Headers are added in request to verify message. Every program is assigned an address in Ethereum format for identification. It’s the program’s responsibilities to protect its private key. All messages should be signed before sending out to other program.
Header
5 additional HTTP headers added.
X-Message-Address
String
An Ethereum address use to identify the sender 0x8F9092CE573e41d72378Cf8c9d3335584e6843F1
X-Message-Timestamp
Long
Timestamp of the message sent
X-Message-Session
String
Snowflake ID generated at program startup.
X-Message-Sequence
String
Sequence of message in this session.
X-Message-Signature
String
ECDSA_Sign(HSA265(X-Message-Timestamp#X-Message-Session#X-Message-Sequence#BODY)) Using secp256k1 curve
Response
Response JSON Message (Similar to the response JSON RPC 2.0)
But only implement two objects in the response json.
result This member is REQUIRED on success. This member MUST NOT exist if there was an error invoking the method. The value of this member is determined by the method invoked on the Server.
error This member is REQUIRED on error. This member MUST NOT exist if there was no error triggered during invocation. The value for this member MUST be an Object.
code A Number that indicates the error type that occurred. This MUST be an integer.
message A String providing a short description of the error. The message SHOULD be limited to a concise single sentence.
data A Primitive or Structured value that contains additional information about the error. This may be omitted. The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.).
Success message
{"result": {"id":19, "value":"abc"}}
Error message
// data is optional
{"error": {"code":21, "message":"Invalid request"}}
// error message with data
{"error": {"code":21, "message":"Invalid request", "data":{"value":"abc"}}}
Last updated