All Products
Search
Document Center

Local execution interface

Last Updated: May 08, 2020

Local execution means that the system executes some transactions only locally for data queries or calculation, without broadcasting them to the chain. Local execution parameters are the same as chain-based execution parameters. The local transaction API is of the AbstractTransactionRequest attribute, which is the parent class of all transaction requests.

Local transaction

  • Function prototype
  1. // Specify the execution in the highest block on the chain.
  2. public void setLocal()
  3. // Specify the execution in a specific block on the chain.
  4. public void setLocal(BigInteger blockNumber)
  • Example

The following shows a local transaction example of creating an account.

  1. CreateAccountRequest request = new CreateAccountRequest(accountId, account);
  2. request.setLocal();
  3. // Refer to the error message description document to check the returned data.
  4. CreateAccountResponse result = sdk.getAccountService().CreateAccount(request);