2

在 Hyperledger Fabric 中使用 Idemix 提交交易

我一直在探索 hyperledger fabric v2.2 中的 idemix。我尝试通过对等 cli 作为 idemix 身份提交事务,但当链代码使用 Java 或 Javascript 时它返回错误,但在使用 Go 链代码时有效。所以我想知道如果使用 idemix 身份提交交易,对使用的链码语言是否有任何限制。以下是收到的部分日志。

java的错误日志

cli

Error: endorsement failure during invoke. response: status:500 message:"error in simulation: transaction returned with failure: Could not create new client identity"

链码容器

11:42:24:528 SEVERE  org.hyperledger.fabric.Logger error Could not create new client identityorg.hyperledger.fabric.contract.ContractRuntimeException: Could not create new client identity
    at org.hyperledger.fabric.contract.Context.<init>(Context.java:59)
... 11 more
Caused by: java.io.IOException: Empty input
    at java.base/sun.security.provider.X509Factory.engineGenerateCertificate(X509Factory.java:106)
    ... 14 more
caused by ..Could not parse certificate: java.io.IOException: Empty input java.security.cert.CertificateException: Could not parse certificate: java.io.IOException: Empty input
    at java.base/sun.security.provider.X509Factory.engineGenerateCertificate(X509Factory.java:110)
    at java.base/java.security.cert.CertificateFactory.generateCertificate(CertificateFactory.java:355)
...

对等容器

2020-09-21 11:42:24.396 UTC [endorser] callChaincode -> INFO 06b finished chaincode: basic duration: 104ms channel=mychannel txID=5ec99579
2020-09-21 11:42:24.398 UTC [endorser] SimulateProposal -> ERRO 06c failed to invoke chaincode basic, error: transaction returned with failure: Could not create new client identity
github.com/hyperledger/fabric/core/chaincode.processChaincodeExecutionResult
    /go/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:182
...

javascript 的错误日志

cli

Error: endorsement failure during invoke. response: status:500 message:"error in simulation: transaction returned with failure: Error: Failed to find start line or end line of the certificate."

链码容器

2020-09-22T08:41:44.648Z error [c-api:contracts-spi/chaincodefromcontract.js]     [mychannel-a91f4fa4] Error: Failed to find start line or end line of the certificate.
2020-09-22T08:41:44.652Z error [c-api:lib/handler.js]                             [mychannel-a91f4fa4] Calling chaincode Invoke() returned error response [Error: Failed to find start line or end line of the certificate.
    at normalizeX509 (/usr/local/src/node_modules/fabric-shim/lib/chaincode.js:387:15)
    at new ClientIdentity (/usr/local/src/node_modules/fabric-shim/lib/chaincode.js:258:32)
    at ChaincodeFromContract.invokeFunctionality (/usr/local/src/node_modules/fabric-shim/lib/contract-spi/chaincodefromcontract.js:354:35)
    at ChaincodeFromContract.Invoke (/usr/local/src/node_modules/fabric-shim/lib/contract-spi/chaincodefromcontract.js:315:21)
    at handleMessage (/usr/local/src/node_modules/fabric-shim/lib/handler.js:602:47)
    at ChaincodeMessageHandler.handleTransaction (/usr/local/src/node_modules/fabric-shim/lib/handler.js:390:9)
    at ClientDuplexStreamImpl.<anonymous> (/usr/local/src/node_modules/fabric-shim/lib/handler.js:330:30)
    at ClientDuplexStreamImpl.emit (events.js:311:20)
    at addChunk (_stream_readable.js:294:12)
    at readableAddChunk (_stream_readable.js:275:11)]. Sending ERROR message back to peer

对等容器

2020-09-22 08:41:44.658 UTC [endorser] callChaincode -> INFO 06c finished chaincode: basic duration: 25ms channel=mychannel txID=a91f4fa4
2020-09-22 08:41:44.658 UTC [endorser] SimulateProposal -> ERRO 06d failed to invoke chaincode basic, error: transaction returned with failure: Error: Failed to find start line or end line of the certificate.
github.com/hyperledger/fabric/core/chaincode.processChaincodeExecutionResult
    /go/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:182
...

设置信息

  • 面料版本:2.2
  • 使用 idemixgen 工具生成的 idemix 身份
  • 使用 cryptogen 工具生成的 X.509 身份
  • 使用对等链码调用命令调用的链码
  • 链码:资产转移基础
  • 链码语言:java、javascript
  • 织物样本的存储库链接
  • 在 docker compose 上使用结构部署

参考

https://hyperledger-fabric.readthedocs.io/en/release-2.2/idemix.html
https://hyperledger-fabric.readthedocs.io/en/release-2.2/idemixgen.html

4

0 回答 0