Installation and usage of the platform
gRPC: transfer of confidential smart contract data¶
The gRPC ContractPublicService is used to transfer confidential smart contracts data.
Следующие методы сервиса описаны в protobuf-файле confidential_contract_service.proto:
ConfidentialCall,
ConfidentialTx.
Important
The field data types for requests and responses are specified in the protobuf file.
Important
Вызов методов ConfidentialCall и ConfidentialTx доступен только при использовании oAuth токена с ролью ConfidentialContractUser или специального api-key.
ConfidentialCall¶
The ConfidentialCall method accepts the ConfidentialCalRequest containing the following fields:
broadcast
– the flag that marks the need to broadcast the generated CallContract transaction; the field defaults totrue
; thefalse
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 tofalse
; iffalse
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.
ConfidentialTx¶
Метод возвращает транзакцию записи результата исполнения конфиденциального смарт-контракта в его стейт (105.ExecutedContract версии 4), конфиденциальные входные данные для запуска контракта (ConfidentialInput) и конфиденциальные результаты исполнения контракта (ConfidentialOutput) участникам соответствующей политики (группы авторизации).
В свою очередь, транзакция 105.ExecutedContract содержит все поля транзакций 103. CreateContract, 104. CallContract, 107. UpdateContract смарт-контракта.
Note
REST метод GET /confidential-contracts/tx/{executable-tx-id} аналогичен gRPC методу ConfidentialTx.