信封交易是指将交易放入一个独立的组中执行从而起到隐私保护的目的。智能合约平台支持部署合约、调用合约、更新合约、查询合约的信封交易。根据不同目的,加密信封交易分成加密信封交易与存证信封交易。
加密信封交易
示例:
MychainParams params = new MychainParams.Builder()
.gas(BigInteger.valueOf(3000000))
.setEnvelopePublicKey("")
.privateKeyList(adminPrivateKeys)
.setGroupId(groupId) //指定 groupId
.setType(EnvelopeType.ENCRYPTION) //指定信封类型:ENCRYPTION
.build();
ContractParameters contractParameters = new ContractParameters();
MychainBaseResult<ReplyTransactionReceipt> result = sdk.getContractService()
.deployContract(
DeployContractRequest.build(adminAccount.getIdentity(),
Utils.getIdentityByName(testContractId), contractCode, VMTypeEnum.EVM,contractParameters, BigInteger.ZERO, params));
存证信封交易
示例:
MychainParams params = new MychainParams.Builder()
.gas(BigInteger.valueOf(3000000))
.setEnvelopePublicKey("")
.privateKeyList(adminPrivateKeys)
.setGroupId(groupId) //指定 groupId
.setType(EnvelopeType.DEPOSIT) //指定信封类型:DEPOSIT
.build();
ContractParameters contractParameters = new ContractParameters();
MychainBaseResult<ReplyTransactionReceipt> result = sdk.getContractService()
.deployContract(
DeployContractRequest.build(adminAccount.getIdentity(),
Utils.getIdentityByName(testContractId), contractCode, VMTypeEnum.EVM,contractParameters, BigInteger.ZERO, params));
文档内容是否对您有帮助?