Overview
Last updated
Last updated
In order to facilitate users to use the Zetrix blockchain, therefore, Zetrix provides API interfaces, including HTTP interfaces and Websocket interfaces.
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:
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 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:
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 object Transaction
.
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)
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.