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.
Related
I followed Hyperledger fabric official tutorial to deploy my first blockchain project. However, I met the problem that I have installed my chaincode named "basic" on channel "mychannel"
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"InitLedger","Args":[]}'
and the feedback is
Error: endorsement failure during invoke. response: status:500 message:"make sure the `chaincode basic has been successfully defined on channel mychannel and try again: chaincode definition for 'basic' exists, but chaincode is not installed"
but the last step I used the coomand
peer lifecycle chaincode querycommitted --channelID mychannel --name basic --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem"
and the feedback is
Committed chaincode definition for chaincode 'basic' on channel 'mychannel':
Version: 1.0, Sequence: 1, Endorsement Plugin: escc, Validation Plugin: vscc, Approvals: [Org1MSP: true, Org2MSP: true]
I think that means I was successful committed "basic" to the channel.
But I cannot invoking the chaincode by following tutorial's steps.
What should I do to fix the problem?
I use ubuntu 20.04. on Windows OS.
I use Mobaxterm to open WSL-Ubuntu-20.04.
Tutorial is enter link description here I met this problem is the first step at “Invoking the chaincode”
the step
If the contracts were commited, you should have 2 extra docker containers on your container list. Do a docker ps command to see if contract containers exist for 7051 and 9051. If the containers do not exist for the contracts, then you do not have a working contract.
Try stopping and starting your network by running the following in the docker folder - grasping at straws here
docker-compose -f docker-compose-couch.yaml -f docker-compose-ca.yaml -f docker-compose-test-net.yaml stop
docker-compose -f docker-compose-couch.yaml -f docker-compose-ca.yaml -f docker-compose-test-net.yaml start
If there is at least one contract container available, try a docker logs command to see if any useful output is available e.g.
docker logs [container Id value here]
Step through the contract loading procedure again, but remember to increase the sequence number and version number. You could set up some environment variables as follows
export CC_PACKAGE_VERSION=1
export CC_PACKAGE_SEQUENCE=1
and then use them on the command line as follows
--version $CC_PACKAGE_VERSION --sequence $CC_PACKAGE_SEQUENCE
By doing it that way, you can install the same contract as many times as it takes to get it working, or for amendments that might come later on.
Sometimes you will have to retrace your installation steps because it is so easy to get things wrong when working by hand. Have a look at the deployCC.sh script as well. But I would recommend that you persevere in getting things working by hand first and then use automation later on.
The output that you provided seems to indicate that everything should be correct, so I can't see what the problem is without seeing the full history from start to finish.
Check the packageId and use localhost instead of peer0.example.com
The HLF Version I use is 2.2
I set up my own network consisting of 3 Orgs, 1 Orderer and 2 Channels. The network is set up and I can call Chaincode Functions responding with 200. So far, so good. The problem is I don't see the worldstate in CouchDB. I think it's related due to the fact the chaincode is not instantiated properly or at all
When I call:
peer chaincode list --instantiated -C examplechannel
It doesn't return anything. But if I try to set the flag --isInit on the first Invoke.
peer chaincode invoke -o localhost:7050 -C examplechannel -n example --peerAddresses localhost:9051 --isInit -c '{"function":"instantiate","Args":[]}'
The response is:
chaincode 'example' does not require initialization but called as init
When I try to instantiate the Chaincode by:
peer chaincode instantiate -o localhost:7050 -C examplechannel -n example -v 1 -c '{"function":"instantiate","Args":[]}'
I get the response:
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg Channel 'examplechannel' has been migrated to the new lifecycle, LSCC is now read-only
Any suggestions?
There is difference in the chaincode installation from Fabric version 2.0 when compare to previous version. Please refer below documentation for more details regarding new chaincode lifecycle
https://hyperledger-fabric.readthedocs.io/en/release-2.2/deploy_chaincode.html
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.
I'm using hyperledger fabric 2.0. I have two orgs. ORGA and ORGB. I'm using "test-network" of fabric-samples repository as my network.
I have edited javascript version of fabcar chaincode by changing the variable names in the init functions and other functions of fabcar.js chaincode.
I have installed my edited chaincode on the peers of two orgs. I have also successfully approved chaincode on 2 orgs. Successfully committed chaincode definition to the channel. But when I'm trying to invoke chaincode using command with function initLedger I'm getting error:
Command:
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls true --cafile ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n deed --peerAddresses localhost:7051 --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses localhost:9051 --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt --isInit -c '{"function":"initLedger","Args":[]}'
I'm getting an error shown below:
Error: endorsement failure during invoke. response: status:500
message:"error in simulation: failed to execute transaction
5b14718ab2408cd29dafc9daf33e193534c7a1262afebd0ca5eae3b0116aeca0:
could not launch chaincode
deed_1:48b197c4e734f589019d61ba1615ad9fc2b0007f478ab92a8b34714bc3c404e0:
chaincode registration failed: container exited with 1"
help me.
Regards,
Satish
Fabric provides monitordocker.sh along with its commercial-paper sample in the Fabric sample (https://hyperledger-fabric.readthedocs.io/en/latest/deploy_chaincode.html#setup-logspout-optional)
Run the below line in a separate PUTTY window to keep monitoring the logs across all containers in docker. Note that "fabric_test" is the name of the network that needs to be monitored.
./monitordocker.sh fabric_test
Now run the fabric command that results in error and you should see details on the log in the other PUTTY window.
The error is telling you that the container hosting the chaincode has exited after the chaincode process terminated with an exit code of 1. If you've configured the peer to stream the chaincode container logs (vm.docker.attachStdout=true / CORE_VM_DOCKER_ATTACHSTDOUT=true), you can look at the peer logs to see any errors produced by the chaincode.
Check your chaincode, their is some typo in your code.
check --> repair --> run following script -->
./startFabric.sh javascript
The name of the invoked chaincode does not match the name of the committed one.
Check it.
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