All Products
Search
Document Center

Local Execution Interface

Last Updated: May 24, 2019

Local execution means that the transaction is performed only on the connected nodes. The transaction will not be packed into the block or broadcast to other nodes on the blockchain. The smart contract platform provides an operation for local executiongetLocalService(). The parameters of locally executed transaction are identical to the parameters of a real transaction.

The following is an example of deploying a contract locally.

Deploy a contract locally

Example:

  1. ContractParameters contractParameters = new ContractParameters();
  2. MychainBaseResult<CommonTransactionResponse> result = sdk.getLocalService().deployContract(
  3. DeployContractRequest.build(
  4. adminAccount.getIdentity(),
  5. Utils.getIdentityByName("contract_" +System.currentTimeMillis(),env),
  6. contractCode,
  7. VMTypeEnum.EVM,
  8. contractParameters,
  9. new BigInteger("10000"),
  10. null
  11. )
  12. );