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 ContractExecutionStatuses and ContractsExecutionEvents methods output the following smart contract data in the response to the query:

  • senderAddress – the address of the participant who sent the smart contract to the blockchain;

  • senderPublicKey – the public key of 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 smart contract execution (if any);

  • message – transaction status message; contains additional information about the status specified in the status field, for example,

    "message": "Smart contract transaction successfully mined";
    
  • timestamp – the Unix Timestamp (in milliseconds), marking the time of the smart contract call;

  • signature – transaction signature.

Note

GET /contracts/status/{id} REST method returns the same information as ContractExecutionStatuses gRPC method.

See also