Shannon Vaz
Shannon Vaz

Reputation: 31

Is there any restriction on chaincode language for using Idemix in Hyperledger Fabric?

Using Idemix in Hyperledger Fabric to submit transactions

I have been exploring idemix in hyperledger fabric v2.2. I tried submitting transactions via peer cli as idemix identity but it returns me an error when chaincode is in Java or Javascript, but works when Go chaincode is used. So I want to know if there are any restrictions on the chaincode language to be used if idemix identities are used to submit transactions. Following are sections of logs received.

Error logs for java

Cli

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

Chaincode container

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)
...

Peer container

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
...

Error logs for 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."

Chaincode container

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

Peer container

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
...

Setup Info

References

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

Upvotes: 3

Views: 251

Answers (1)

Oussema
Oussema

Reputation: 25

Yes, For the moment you can only use Idemix with go based chaincodes. As you wan see on the documentations of hyperledger fabric Idemix ,

The cid (Client Identity) library (for Go only) has been extended to support the GetAttributeValue function when an Idemix credential is used

Upvotes: 0

Related Questions