Overview

Overview of Zetrix API

​In order to facilitate users to use the Zetrix blockchain, therefore, Zetrix provides API interfaces, including HTTP interfaces and Websocket interfaces.

HTTP Interface Overview

​The request data and response data in the HTTP interface are in JSON format.

The configuration items of the HTTP interface are configured under the webserver file in the config directory. The configuration contents are as follows:

"webserver": {
  "listen_addresses": "0.0.0.0:36002" // Listen IP and PORT
}

Websocket Interface Overview

​The request data and response data in the Websocket interface are both in protocol buffer 3 format. Protocol buffer 3 is a data serialization protocol launched by Google. If you do not understand protocol buffer 3, please click proto3 Learn more.

​The configuration items of the Websocket interface are configured under the wsserver file in the config directory. The configuration contents are as follows:

"wsserver": {
    "listen_address": "0.0.0.0:36003" // Listen IP and PORT
}

Transaction Process

  1. Assembling the transaction object.

    Assembling the transaction object Transaction according to your requiremment. Different transactions have different data structures; HTTP interface assembly JSON format transaction, Websocket interface assembly Protobuf format transaction).

  2. Serializing the transaction.

    The transaction object is serialized into a byte stream transaction_blob, The HTTP interface is implemented by the method getTransactionBlob, and the Websocket interface is implemented by the serialized method of the Protobuf object Transaction.

  3. Signing the transaction.

    Signing the transaction_blob with the private key skey to get sign_data, and the public key of skey is pkey. (Details: Keypair Guide)

  4. Submitting the transaction.

    Details: HTTP Submit Transaction,Websocket Submit Transaction

  5. Checking if the transaction is executed successfully.

    The HTTP interface is queried by the method getTransactionHistory, and the Websocket interface is queried by the response message of the submitted transaction.

Last updated