如何在composer中使用invokeChaincode()函数,composer中的“事务”是否等于链码“ invoke”中的func?

时间:2018-09-20 09:24:22

标签: hyperledger-fabric hyperledger-composer

我们可以在chaincode的“调用”功能中定义很多东西。我们还可以在超级账本编辑器网络中定义很多“交易”。此外,这两个概念可以改变账本声明。

如果我可以使用getNativeAPI()。invokeChaincode()调用“另一个网络中的交易?例如,如果我有交易:

在cto

participant ValifyParticipant identified by valifiedId {
  o String valifiedId
  o String organization
  o Double validRate
  o Double passRate
}

@returns(String)
transaction ValifyTransaction {
  o String detail
  o String valid
  --> ValifyParticipant valifyParticipant
  --> Participant Participant
}

在logic.js中:

/**
 * Sample valify manual transaction fuction
 * @param {org.example.com.ValifyTransaction} vct the sample valify manual submit transaction instance.
 * @returns {String}(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string) The string.
 * @transaction
 */
async function ValifyCompoundTransaction(vct) {
  ....
}

如何在另一个具有功能ValifyCompoundTransaction的网络中调用getNativeAPI().invokeChaincode()

我已按照本教程进行操作:

  

https://hyperledger.github.io/composer/latest/tutorials/invoke-composer-network

使用getNative()。invokechaincode()执行以下功能:

 const otherNetworkData = await getNativeAPI().invokeChaincode('example-test-network',['getResourceInRegistry','Participant','org.example.com.Participant','1'],'firstchannel');

但是失败了,并得到以下原因:

2018-09-21 02:31:00.211 UTC [committer/txvalidator] validateTx -> ERRO 03c VSCCValidateTx for transaction txId = 60730ff6a58440f3a59322ca9590d2eeff933c23b074e73611dfc4ff9b6f8322 returned error: VSCC error: endorsement policy failure, err: signature set did not satisfy policy
2018-09-21 02:31:28.273 UTC [chaincode] HandleTransaction -> ERRO 042 [e2243000] Failed to handle INVOKE_CHAINCODE. error: could not get valid transaction

但是当我删除上面的invokeChaincode()时,效果很好

0 个答案:

没有答案