Installation and usage of the platform

gRPC: transfer of confidential smart contract data

The gRPC ConfidentialContractService is used to transfer confidential smart contracts data.

The following service methods are described in the confidential_contract_service.proto protobuf file:

  • ConfidentialCall,

  • ConfidentialExecutedTxByExecutableTxId,

  • GetContractKeys.

Important

The field data types for requests and responses are specified in the protobuf file.

Important

The ConfidentialCall, ConfidentialExecutedTxByExecutableTxId, GetContractKeys methods call is only available when you use an oAuth token with ConfidentialContractUser role or a special api-key.

ConfidentialCall

The ConfidentialCall method accepts the ConfidentialCallRequest containing the following fields:

  • broadcast – the flag that marks the need to broadcast the generated CallContract transaction; the field defaults to true; the false value is used to form an atomic container;

  • commitmentVerification – the flag that marks the necessity of input data commitment reconciliation and the need for the user to provide a key for commitment generation; the field defaults to false; if false is set, the node generates the key randomly and calculates the commitment;

  • sender – the address of the sender of the confidential smart contract data;

  • contractId – the confidential smart contract identifier;

  • contractVersion – the confidential smart contract version;

  • params – when working with CallContract transaction, the field holds input data of the confidential smart contract, represented as an array of objects; data is entered using the following fields:

    • key – the parameter key;

    • type – the parameter data type;

    • value – the parameter value.

  • timestamp – a timestamp in Unix Timestamp format (in milliseconds) marking the time when the smart contract was invoked;

  • atomicBadge – the flag that marks if the transaction can be included in an atomic transaction;

  • fee – the transaction fee;

  • feeAssetId – fee token identifier;

  • commitment – commitment;

  • commitmentKey – the commitment key.

The ConfidentialCall method takes all the data needed to send a CallContract transaction, sends it, and returns a protobuf that includes the CallContract version 6 transaction and the confidentialInput of the confidential smart contract in the response.

Note

The POST /confidential-contracts/call REST method is similar to the ConfidentialCall gRPC method.

ConfidentialExecutedTxByExecutableTxId

The ConfidentialExecutedTxByExecutableTxId method accepts a request containing the transaction_id transaction identifier of the confidential smart contract call transaction.

The method returns the transaction of writing the execution result of a confidential smart contract to its state (105.ExecutedContract version 4), the confidential input data to run the contract (ConfidentialInput) and the confidential results of the contract execution (ConfidentialOutput) to the participants of the corresponding policy (authorization group).

In turn, 105.ExecutedContract transaction contains all the fields of 103. CreateContract, 104. CallContract, 107. UpdateContract transactions of the smart contract.

Note

The GET /confidential-contracts/tx/{executable-tx-id} REST method is similar to the ConfidentialExecutedTxByExecutableTxId gRPC method.

Note

There is a REST method similar to ConfidentialExecutedTxByExecutableTxId, but for regular (non-confidential) smart contracts: GET /contracts/executed-tx-for/{id}.

GetContractKeys

The method returns the values of the selected keys from the confidential smart contract state to the members of the corresponding policy (authorization group). The result of the smart contract execution is returned as key-value pairs as an array of objects with data type indication.

Note

There is a REST method similar to the GetContractKeys method: GET /confidential-contracts/{contractId}.

Note

There is a gRPC method similar to the GetContractKeys method but for regular (non-confidential) smart contracts: GetContractKeys.

See also