All Products
Search
Document Center

Native ledger interface

Last Updated: May 08, 2020

The contract platform provides a native evidence deposit transaction API to facilitate development of evidence deposit scenarios.

Evidence deposit transaction

depositData

This API is called synchronously for evidence deposit transactions.

  • Function prototype
  1. public DepositDataResponse depositData(DepositDataRequest request)
  • Request parameter
Parameter Required Type Description
request true DepositDataRequest The evidence deposit transaction request.
  • Response field
Response field Field type Description
response DepositDataResponse The evidence deposit transaction response.
  • Example
  1. DepositDataRequest request = new DepositDataRequest(senderId, receiverId, depositData, amount);
  2. // Refer to the error message description document to check the returned data.
  3. DepositDataResponse response = sdk.getAccountService().depositData(request);

asyncDepositData

This API is called asynchronously for evidence deposit transactions.

  • Function prototype
  1. public int asyncDepositData(DepositDataRequest request, IAsyncCallback callback)
  • Request parameter
Parameter Required Type Description
request true DepositDataRequest The evidence deposit request.
callback true IAsyncCallback The callback function.
  • Response field
Response field Field type Description
result int The return value.
  • Example
  1. DepositDataRequest request = new DepositDataRequest(senderId, receiverId, depositData, amount);
  2. int result = sdk.getAccountService().asyncDepositData(request, new IAsyncCallback() {
  3. @Override
  4. public void onResponse(int errorCode, Response response) {
  5. // Refer to the error message description document to check the returned data.
  6. System.out.println("async deposit data, errorCode:" + errorCode + ", response: " + response.getErrorCode());
  7. }
  8. });

Evidence deposit transaction request parameters

The following table describes parameters of DepositDataRequest.

Parameter Type Description
senderId Identity The identity of the transaction initiator.
receiverId Identity The identity of the target account.
amount BigInteger The transfer amount.
depositData byte[] The data to be stored. You can customize the data content, serialize it for an evidence deposit, read the data, and then deserialize it.
Note: The size of data for an evidence deposit transaction has an upper limit, which is a configuration option for the contract chain and is 1 MB by default. You can set the value based on the actual contract chain configuration.

Evidence deposit transaction response parameters

The following table describes parameters of DepositDataResponse.

Parameter Type Description
transactionReceipt TransactionReceipt The transaction receipt.
blockNumber BigInteger The block number.