Overview
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:"webserver": {
"listen_addresses": "0.0.0.0:36002" // Listen IP and PORT
}
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
}
In order to facilitate users to be familiar with the Zetrix blockchain, therefore, an experience environment is provided.
URL:baas.zetrix.com
- 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 objectTransaction
. - 3.Signing the transaction.Signing the
transaction_blob
with the private keyskey
to getsign_data
, and the public key ofskey
ispkey
. (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 modified 2d ago