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:
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:
Transaction Process
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).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 objectTransaction
.Signing the transaction.
Signing the
transaction_blob
with the private keyskey
to getsign_data
, and the public key ofskey
ispkey
. (Details: Keypair Guide)Submitting the transaction.
Details: HTTP Submit Transaction,Websocket Submit Transaction
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