Installation and usage of the platform

gRPC: obtaining information on the results of the execution of a smart contract call

To obtain information on the results of a smart contract call use the ContractStatusService gRPC service.

The service has two methods described in the util_contract_status_service.proto protobuf file:

  • ContractExecutionStatuses,

  • ContractsExecutionEvents.

Important

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

Use the ContractExecutionStatuses method to retrieve information on the execution results of a particular smart contract call. The method accepts the ContractExecutionRequest query that requires the tx_id parameter – the ID of the transaction that calls the smart contract whose status information you want to retrieve.

Use the ContractsExecutionEvents method to subscribe to a stream with the results of all the smart contracts calls execution. The method requires no input parameters.

Information on the results of the execution of a smart contract call

Both methods output the following smart contract data in the response to the query:

  • sender – the participant who sent the smart contract to the blockchain;

  • tx_id – smart contract call transaction ID;

  • Status – smart contract state:

    • 0 – successfully executed (SUCCESS);

    • ‘’1’’ – business error, the contract is not executed, the call is rejected (ERROR);

    • 2 – system error during the execution of the smart contract (FAILURE).

  • code – code of an error that occurred during the execution of the smart contract;

  • message – error message;

  • timestamp – time of the smart contract call;

  • signature – smart contract signature.