user2842256
user2842256

Reputation: 81

Hyperledger Crashing while querying on Chaincode

I am using Hyperledger Fabric v1.0 and I am facing error while trying to use the sample project fabcar on the following git repository: git clone https://github.com/hyperledger/fabric-samples.git

I am able to start all the containers using the following shell script:

./startFabric.sh

The peers and the channels are created but when I use the command

node query.js

It crashes with the following error: Create a client and set the wallet location

Set wallet path, and associate user PeerAdmin with application Check user is enrolled, and set a query URL in the network Make query Assigning transaction_id: 27d48de27350bbeeb3adae69ec5e783d3af1c42af03230877f71c3343bfbc905 error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: Failed to deserialize creator identity, err The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org1.example.com") at /home/eres_admin/hyperledger/fabric-samples/fabcar/node_modules/grpc/src/node/src/client.js:554:15 returned from query Query result count = 1 error from query = { Error: Failed to deserialize creator identity, err The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org1.example.com") at /home/eres_admin/hyperledger/fabric-samples/fabcar/node_modules/grpc/src/node/src/client.js:554:15 code: 2, metadata: Metadata { _internal_repr: {} } } Response is Error: Failed to deserialize creator identity, err The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org1.example.com")

I am using the node version 6.11.4 do I need to use any other version for this or the error is due to something else.

Upvotes: 0

Views: 358

Answers (1)

Marcelo Odin
Marcelo Odin

Reputation: 11

TL;DR chances are the docker compose you are using has harcoded the name of the CA key, but you regenerated the crypto material, thus changing the key and the file name.

I had exactly the same error and found this error happens because basic-network/docker-compose.yaml has CA key hardcoded. If you re-generate the cryptomaterial (for instance, in basic-network, you do generate.sh), the key file name changes. Thus the CA fails to find the key.

After you regenerate the crypto material you should change the FABRIC_CA_SERVER_CA_KEYFILE

...
services:
  ca.example.com:
    image: hyperledger/fabric-ca
    environment:
      - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
      - FABRIC_CA_SERVER_CA_NAME=ca.example.com
      - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem
      - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/4239aa0dcd76daeeb8ba0cda701851d14504d31aad1b2ddddbac6a57365e497c_sk
...

After this, query.js will work just fine.

Upvotes: 1

Related Questions