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:

  • Broadcast;

  • BroadcastWithCerts;

  • UtxInfo;

  • TransactionInfo;

  • UnconfirmedTransactionInfo.

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.

Broadcast

The method requires the following query parameters:

  • version – transaction version;

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

  • certificates – certificates chain in bytes in DER format; the parameter is mandatory if the following conditions are simultaneously met:

    • PKI in operating or test mode is enabled (the node configuration file parameter node.crypto.pki.mode is set to ON or TEST),

    • a new user, who is not the node-owner, makes his first transaction.

    In this case, it is necessary to pass the chain of user certificates in the certificates field of the query; in other cases the certificates field is not required.

    Note

    The certificates field in the RegisterNode transaction broadcast request is mandatory when using PKI in operating or test mode (i.e. when the node configuration file node.crypto.pki.mode parameter is set to ON or TEST. In this case, the certificates field must contain a certificate chain that matches the public key in the transaction target field.

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 article Transactions of the blockchain platform.

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.

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