Installation and usage of the platform

gRPC: handling transactions

Use the TransactionPublicService gRPC service to handle transactions.

The TransactionPublicService service has the following methods, described in the transaction_public_service.proto protobuf file:

Important

The field data types for the request and response are specified in the protobuf files.

Sending transactions into the blockchain

Choose the appropriate method for your task to send transactions to the blockchain:

  • BroadcastWithCerts – to send the RegisterNode transaction;

  • Broadcast – to send all other transactions.

Note

You can also use the POST /transactions/broadcast and POST /transactions/signAndBroadcast REST methods to send transactions to the blockchain.

Broadcast

The method requires the following query parameters:

  • version – transaction version;

  • transaction – the name of the transaction along with the set of parameters intended for it.

For each transaction, there is a separate protobuf file describing the request and response fields. These fields are universal for gRPC and REST API queries and are given in the Transactions of the blockchain platform article.

Note

You can also use the POST /transactions/broadcast and POST /transactions/signAndBroadcast REST methods to send transactions to the blockchain.

BroadcastWithCerts

The method is used to broadcast the RegisterNode transaction and requires the same set of incoming parameters as the Broadcast method.

The certificates field is mandatory and must contain the certificates chain that corresponds to the public key in the transaction target field.

Note

You can also use the POST /transactions/broadcast and POST /transactions/signAndBroadcast REST methods to send transactions to the blockchain.

Retrieving data from a transaction

Use the TransactionInfo method to retrieve transaction data.

The method requires the following query parameter:

  • tx_id – ID of the transaction on which information is being requested.

The TransactionInfo method response contains the following transaction data:

  • height – the blockchain height on which the transaction was made;

  • transaction – transaction name;

as well as the transaction data similar to that in the Broadcast method response.

Retrieving data from a transaction that is in the UTX pool

Use the UnconfirmedTransactionInfo method to retrieve data of the transaction held in the UTX pool. The method response contains transaction data similar to the Broadcast method response.

See also