Error while invoking javascript chaincode - hyperledger-fabric

Error: endorsement failure during invoke. response: status:500 message:"make sure the chaincode basic2 has been successfully defined on channel mychannel and try again: chaincode definition for 'basic2' exists, but chaincode is not installed"
It gives me this error whenever I try to invoke chaincode but when I try to install chaincode again it shows that chain code is successfully installed. what should be the meaning of this error?
It also does not create a docker container.
So i try to instantiated with command
COMMAND: peer chaincode instantiate -o orderer.example.com:7050 -C mychannel -l node -n basic2 -v 1 -c '{"Args":["init"]}' -P 'OR ("Org1MSP.member")'
But then i got new error:
Error: error getting broadcast client: orderer client failed to connect to orderer.example.com:7050: failed to create new connection: context deadline exceeded
I check the logs of Orderer then it shows :
Can anyone tell me what is problem and how should i resolve it?

Try enabling the tls using the '--tls' flag. Also, you can refer to this similar question here
Make sure you're following the steps properly. Also, if you're sure about the steps, sometimes it works if you retry without making any changes, just repeat the step where you're facing the error without making any changes, it should work on the 3rd try atmost if everything goes well.

Related

Hyperledger cannot update channel

I am trying to update an existing channel to enable lifecyle.
Official link:
https://hyperledger-fabric.readthedocs.io/en/release-2.2/enable_cc_lifecycle.html
Launching this command on my peer:
peer channel update -f config_update_in_envelope.pb -c channelid -o orderer.domain.com:7050 --cafile /opt/gopath/s
rc/github.com/hyperledger/fabric/crypto-config/peerOrganizations/*******/ca
Error
got unexpected status: BAD_REQUEST -- initializing channelconfig failed: could
not create channel Consortiums sub-group config: setting up the MSP
managerfailed: expected at least one CA certificate
I tried all existing ca certs available on my network and It's not working,
Please help
Thanks
This error was "probably" due to a version mismatch ... one orderer used on my network was still using an 1.4 version, since this orderer has been upgraded it's not possible to reproduce this error again. Even if I do not understand why the error msg is talking about a CA file ...

Not able to install Commercial paper chaincode which is shown in documentation

docker exec cliMagnetoCorp peer chaincode install -n papercontract -v 0 -p /opt/gopath/src/github.com/contract -l node .
above line is mentioned in the fabric documentation https://hyperledger-fabric.readthedocs.io/en/release-1.4/tutorial/commercial_paper.html
when i run this then its giving below error
Error: Error endorsing chaincode: rpc error: code = Unknown desc =
chaincode error (status: 500, message: Error installing chaincode code
papercontract:0(chaincode
/var/hyperledger/production/chaincodes/papercontract.0 exists))
my question is how does /opt/gopath/src/github.com/contract come from in your documentation. its never mentioned anywhere.
Moreover,
./../../../../organization/magnetocorp:/opt/gopath/src/github.com/
its written in docker-composer.yml. how /opt path is related and connected here ?

Hyperledger Fabric Java SDK Error while instantiate java chaincode

Error: could not assemble transaction, err proposal response was not successful, error code 500, msg timeout expired while starting chaincode
Error while instantiating java chaincode
Command :
peer chaincode instantiate -o orderer.example.com:7050 --tls --cafile
/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
-C mychannel -n test -l java -v 1.0 -c '{"Args":["init","a", "100", "b","200"]}' -P "AND ('Org1MSP.peer','Org2MSP.peer')"
Initially it was working fine but once the line of code increase instantiation gets slow down and now it is giving this error while instantiation
unfortunatelly, java chaincode always shows the same error. I had the same issue, please, check that you have the main function in the code. If you can share the code here, that would be awesome.
There can be multiple reasons for this, like if you are in a proxy, include your settings in a gradle.properties file. another can be, check your chaincode for errors if it was working fine then it should now, increase in no. of line doesn't affect instantiation. If you are not in a proxy and still facing the error try to include your chaincode in the question.

Error - chaincode exists

I'm getting this error when trying to start running my chaincode:
Command: composer network start -c adminCardLessor -n block-aviation-network -V 0.0.1 -A admin -C ./credentials/lessor/admin-pub.pem -f delete_me.card
Error: Error trying to start business network. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: 2 UNKNOWN: chaincode error (status: 500, message: chaincode exists block-aviation-network)
I successfully installed my chaincode on each of my peers but can seem to start it due to the above error...
Does anyone have any experience with this error or how to resolve it?
Because the chaincode already exists on the network, you can only upgrade it, because I am assuming the network is not starting because you made some changes. Look toward questions such as How to upgrade a chaincode after modification? and then try starting the network. This should solve your problem.

Error: Error endorsing chaincode: rpc error: code = Unknown desc = Failed to init chaincode(handler not found for chaincode mycc:0)

I'm trying to make the tutorial "Chaincode for Developers" work. But at the section "Terminal 3 - Use the chaincode" I'm stuck trying to run this command
$ peer chaincode instantiate -n mycc -v 0 -c '{"Args":["a","10"]}' -C
myc
It exits with this error :
Error: Error endorsing chaincode: rpc error: code = Unknown desc =
Failed to init chaincode(handler not found for chaincode mycc:0)
I've done some research but I don't know what to do. Could somebody please help me ?
This is solved. There were three primary problems.
As Chris mentioned, the certs are expired. In the future you can easily check a certificate's validity by parsing it. For example openssl x509 -in your_cert.pem -text
The provided artifacts were not configured properly. Namely, the configtx.yaml that the configtxgen utility consumed did not have the orderer address defined correctly.
Lastly, the documented command to start the chaincode used the wrong port for the peer address. Should be 7052 not 7051.
I will push a fix for this shortly

Resources