信封交易接口

信封交易是指将交易放入一个独立的组中执行从而起到隐私保护的目的。智能合约平台支持部署合约、调用合约、更新合约、查询合约的信封交易。根据不同目的,加密信封交易分成加密信封交易与存证信封交易。

加密信封交易

示例:

  1. MychainParams params = new MychainParams.Builder()
  2. .gas(BigInteger.valueOf(3000000))
  3. .setEnvelopePublicKey("")
  4. .privateKeyList(adminPrivateKeys)
  5. .setGroupId(groupId) //指定 groupId
  6. .setType(EnvelopeType.ENCRYPTION) //指定信封类型:ENCRYPTION
  7. .build();
  8. ContractParameters contractParameters = new ContractParameters();
  9. MychainBaseResult<ReplyTransactionReceipt> result = sdk.getContractService()
  10. .deployContract(
  11. DeployContractRequest.build(adminAccount.getIdentity(),
  12. Utils.getIdentityByName(testContractId), contractCode, VMTypeEnum.EVM,contractParameters, BigInteger.ZERO, params));

存证信封交易

示例:

  1. MychainParams params = new MychainParams.Builder()
  2. .gas(BigInteger.valueOf(3000000))
  3. .setEnvelopePublicKey("")
  4. .privateKeyList(adminPrivateKeys)
  5. .setGroupId(groupId) //指定 groupId
  6. .setType(EnvelopeType.DEPOSIT) //指定信封类型:DEPOSIT
  7. .build();
  8. ContractParameters contractParameters = new ContractParameters();
  9. MychainBaseResult<ReplyTransactionReceipt> result = sdk.getContractService()
  10. .deployContract(
  11. DeployContractRequest.build(adminAccount.getIdentity(),
  12. Utils.getIdentityByName(testContractId), contractCode, VMTypeEnum.EVM,contractParameters, BigInteger.ZERO, params));