Timeout expired while starting chaincode error when instantiating chaincode - hyperledger-fabric

When I run the example here: fabric e2e examples it fails at instantiating chaincode. You can see a screenshot here of the error:
I can see that the chaincode instance/container was started but exited shortly after.
Any ideas on why this is happening and how to resolve?

I had the same issue while testing fabric-samples balance-transfer and fabcar samples, and fabric PTE testing.
Solved it by setting CORE_PEER_CHAINCODELISTENADDRESS to peer's containername:port in the docker compose file.
eg., CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7052
Issue: Chaincode container (which gets created and killed after certain time) log shows below error, when inspected with docker logs CONTAINER-ID.
UTC [shim] userChaincodeStreamGetter -> ERRO 001 x509: cannot validate certificate for 172.18.0.5 because it doesn't contain any IP SANs
error trying to connect to local peer
github.com/hyperledger/fabric/core/chaincode/shim.userChaincodeStreamGetter
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/chaincode.go:109
github.com/hyperledger/fabric/core/chaincode/shim.Start
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/chaincode.go:148
main.main
/chaincode/input/src/github.com/example_cc/go/example_cc.go:199
runtime.main
/opt/go/src/runtime/proc.go:185
runtime.goexit
/opt/go/src/runtime/asm_amd64.s:2337
2017-12-26 09:59:52.823 UTC [example_cc0] Errorf -> ERRO 002 Error starting Simple chaincode: error trying to connect to local peer: x509: cannot validate certificate for 172.18.0.5 because it doesn't contain any IP SANs

Related

not able to invoke/query chaincode usin fabric Node SDK

I have created a sample HLF network with 3 organizations. I have taken an orderer and a peer from each organization ( total 3 orderers, 3 peers, 3 fabric-CA, 3 CouchDB instances).
I have successfully created the certificates, system channel, channel configuration, application channel and also successfully deployed the chaincode on each peer.
I am able to invoke/query any chaincode using peer binary in docker cli but not able to invoke/query the same chaincode through fabric Node SDK.
I have created the connection profile as per the template provided in the test network and also able to register any user for a specific organization. But whenever I am trying to query any chaincode function I am getting the below error:
[ServiceEndpoint]: Error: Failed to connect before the deadline on
Committer- name: orderer.example.com:7050, url:grpcs://localhost:7050,
connected:false, connectAttempted:true [ServiceEndpoint]: waitForReady
Failed to connect to remote gRPC server orderer.example.com:7050 url:grpcs://localhost:7050 timeout:3000
When I check the orderer logs I found this error:
ServerHandshake -> ERRO 087 Server TLS handshake failed in 2.085859ms
with error EOF server=Orderer remoteaddress=172.23.0.1:45678
**Why I am getting this error?
I am trying to just query so why it's connecting to the orderer?
If there is any TLS issue then why I am able to query it through peer binary?**
This link might help Hyperledger Fabric CA releasing wrong certificates (wrong issuer) to Node SDK when TLS enabled
If you are not running as a test network on your local machine, then you will need to specify the connection option of discovery.asLocalhost as false

Hyperledger Fabric, javascript fabcar chaincode error. Transport: error while dialing: dial tcp 127.0.0.1:7051: connect: connection refused

I am having the same problem with Hyperledger fabric 2.1.1, but I am able to run test network with default options, but when I try to run Fabcar javascript chaincode I get an error:
Error: error getting endorser client for channel: endorser client failed to connect to localhost:7051: failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 127.0.0.1:7051: connect: connection refused"
I have tried everything mentioned in thread Error deploying Fabric test-network fabcar chaincode, removed docker images, ran prune, removed organizations data and fired ./network.sh up createChannel -ca -c mychannel -s couchdb -i 2.1.1, but the error is still there. Also, my RAM is 16Gb, so the problem is not there. Any other suggestion, please ?
This situation is happened because you called a gRPC to 127.0.0.1:7051 server but your call failed to hit the server. This situation may happen for many reasons, but for most of the cases the situation is happened due to server down(server exit or down due to misconfiguration) or for wrong certificate or your call failed to hit the server due to misconfiguration.
Please check the following docker container and ensure that is running properly.

In Hyperledger Fabric v2.1, in the test-network repo sample - Error in channel creation

I'm trying to create a channel from the test-network sample of Hyperledger Fabric v2.1. I have installed all the latest fabric binaries & Docker images. The channel-artifacts, 2 peers and a ordering node were successfully created.
However, the command ./network.sh createChannel gives the following error.
Error: failed to create deliver client for orderer: failed to load config for OrdererClient: unable to load orderer.tls.rootcert.file: open /home/fabric/HLF/fabric-sample: no such file or directory
!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
I believe CreateChannel is roughly 5 steps.
Generate a CreateChannel Transaction
Generate an Anchor peer transaction
Create the channel with the genesis block
Join the peers to the channel and
Update one peer in each organization to Anchor peer.
Any chance you can share the output of ./network.sh createChannel, I'd like to see how far you got before you ran into this error.
I was able to solve this issue by removing the spaces from name of parent directory in which the "fabric-samples" repo were installed. This was the final output was:
2020-05-14 16:56:04.064 IST [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-05-14 16:56:04.130 IST [channelCmd] update -> INFO 002 Successfully submitted channel update
===================== Anchor peers updated for org 'Org2MSP' on channel 'mychannel' =====================
========= Channel successfully joined ===========
In my opinion, The problem is with the directory fabric-samples kindly re-download the binaries and try again.
Download using curl via:
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/release-2.1/scripts/bootstrap.sh | bash -s -- 2.1.0 1.5.2
Hope this helps, otherwise see the directory structures and path exports.

REQUEST_TIMEOUT when trying to start business network

When I try to start my business network app on composer v1.1 I get a timeout after 5 minutes with the following message:
2018-03-31 12:54:39.183 UTC [chaincode] Launch -> ERRO 4c3
launchAndWaitForRegister failed: timeout expired while starting
chaincode
sre-frontend-app:0.0.1(networkid:dev,peerid:peer0.org1.example.com,tx:ab15fb53ed8e1de99ad7253ffa2ab4b68bd787b8a9561c9b422bc203e14fc048)
There is also another error in the logs:
2018-03-31 12:54:39.183 UTC [endorser] simulateProposal -> ERRO 4c5
[composerchannel][ab15fb53] failed to invoke chaincode name:"lscc" ,
error: timeout expired while starting chaincode
sre-frontend-app:0.0.1(networkid:dev,peerid:peer0.org1.example.com,tx:ab15fb53ed8e1de99ad7253ffa2ab4b68bd787b8a9561c9b422bc203e14fc048)
Any idea what might be happening? I have tried changing localhost to 0.0.0.0 when building the PeerAdmin card and even tried changing the listening address of fabric-ca to localhost based on reading other's solutions but these changes did not work for me.
Any other suggestions?? Do I need to extend the timeouts - and how I would do that?
Thanks in advance :)

Failed to deploy business network archive: not found

I'm following the Hyperledger Developer Tutorial and I set up my development environment using the instructions they provided.
After that, these are the steps I followed:
I created the peer admin card, using the fabric tools script.
I installed the composer runtime: composer runtime install --card PeerAdmin#hlfv1 --businessNetworkName e-wallet
I try to deploy the business network archive: composer network start --card PeerAdmin#hlfv1 --networkAdmin admin --networkAdminEnrollSecret adminpw --archiveFile ./e-wallet#0.0.1.bna --file networkadmin.card
But unfortunately this step fails. I receive this error in the client:
Error: Error trying to instantiate composer runtime. Error: Error: Invalid results returned ::NOT_FOUND
Command failed
This is the log output from the peer:
2018-02-12 13:34:24.964 UTC [eventhub_producer] validateEventMessage -> DEBU 22e ValidateEventMessage starts for signed event 0xc42037cf30
2018-02-12 13:34:24.970 UTC [eventhub_producer] registerHandler -> DEBU 22f registering event type: BLOCK
2018-02-12 13:34:25.021 UTC [eventhub_producer] validateEventMessage -> DEBU 230 ValidateEventMessage starts for signed event 0xc42037d380
2018-02-12 13:34:25.023 UTC [eventhub_producer] deRegisterHandler -> DEBU 231 deregistering event type: BLOCK
2018-02-12 13:34:25.036 UTC [eventhub_producer] Chat -> ERRO 232 error during Chat, stopping handler: rpc error: code = Canceled desc = context canceled
I got stuck debugging this at the following questions:
How do I know what "not found" relates to?
What is networkadmin.card, and should that be created already or is this command creating it? I tried to look for this detail in the tutorial but must be missing it.
Many thanks!

Resources