I am trying to instantiate the java contact in Commercial Paper Tutorial and get the following error in the monitor.
There is no issue while installing the chain code.
Command run:
docker exec cliMagnetoCorp peer chaincode instantiate -n papercontract -v 0 -l java -c '{"Args":["org.papernet.commercialpaper:instantiate"]}' -C mychannel -P "AND ('Org1MSP.member')"
Error:
peer0.org1.example.com|2019-12-19 00:10:10.220 UTC [endorser] SimulateProposal -> ERRO 045 [mychannel][7cd11866] failed to invoke chaincode name:"lscc" , error: container exited with 1
Please help on what i should do to resolve the error.
Never mind. Fixed the issue.
Changed the build.gradle entry for fabric-chaincode-shim version from 1.4.2 to 1.4.4
compile group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '1.4.4'
Related
I am on Ubuntu 19.10, installed all the pre-requisites and have downloaded the fabric-samples git repository.
I am following the tutorial on this link
I ran the first-network example and it worked fine. Now, when I am trying to run the fabcar example by running the command ./startFabric.sh javascript, I am getting the following error:
...
2020-02-02 23:51:14.534 UTC [msp.identity] Sign -> DEBU 02c Sign: digest: 8A36B905991D6B72A6F487E93C79D468A35F402D6EB4F51E3323152A03A5B64E
2020-02-02 23:53:04.531 UTC [grpc] infof -> DEBU 02d Client received GoAway with http2.ErrCodeEnhanceYourCalm.
2020-02-02 23:53:04.531 UTC [grpc] HandleSubConnStateChange -> DEBU 02e pickfirstBalancer: HandleSubConnStateChange: 0xc0003e1620, CONNECTING
2020-02-02 23:53:04.531 UTC [grpc] infof -> DEBU 02f transport: loopyWriter.run returning. connection error: desc = "transport is closing"
Error: failed to endorse chaincode install: rpc error: code = Unavailable desc = transport is closing
It looks like the error is generated when it executed:
docker exec -e CORE_PEER_LOCALMSPID=Org2MSP -e CORE_PEER_ADDRESS=peer0.org2.example.com:9051 -e CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin#org2.example.com/msp -e CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt cli peer --tls=true --cafile=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --orderer=orderer.example.com:7050 lifecycle chaincode install fabcar.tar.gz
I assume I aam using the latest version of hyperledger-fabric v2.0.0, since I am in the master branch of the fabric-samples repository. What am I doing wrong?
I had/have the same issue. What worked in my case was what I have described in my own question here - Hyperledger Fabric 2.0 byfn.sh error installing chaincode
Basically, even though there is an error (for some reason I do not know), the chaincode installation process is alive in the background and the chaincode does get installed.
I saw this behavior and put in a sleep statement for 10 minutes (600 s). I still do not know why this behavior is there (hence my question) but I have a workaround for now.
You need to open ports in the firewall.
in ubuntu I fix it using :
$ sudo ufw allow 4422/tcp
repeat for each docker container port,
You can view ports via :
$ docker ps
Have you stopped the first-network at first by using ./byfn.sh down before you jump into fabcar ?
Can I see some logs like docker ps -a and docker logs peer0.org1.example.com?
Also the HLF has recommended to use test-network as a replacement for first-network which is deprecated by now.
BTW, I would use the release branch other than master. Afterall the master branch is always under developing.
" I'm new to fabric and trying to install & instantiate a java chaincode in "mychannel" on fabcar network, where the install operation has been completed successfully but while instantiate getting the below error can anyone help on this"
CC_SRC_PATH=/opt/gopath/src/github.com/java
LANGUAGE=${1:-"java"}
Install :
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp" cli peer chaincode install -n CarMileageChaincode -v 1.0 -p "$CC_SRC_PATH" -l "$LANGUAGE"
Instantiate :
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp" cli peer chaincode instantiate -o orderer.example.com:7050 -C mychannel -n CarMileageChaincode -l "$LANGUAGE" -v 1.0 -c '{"Args":[""]}' -P "OR ('Org1MSP.member','Org2MSP.member')"
Install :
2019-05-31 11:10:00.246 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-05-31 11:10:00.246 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2019-05-31 11:10:00.340 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" >
Instantiate :
2019-05-31 12:41:12.690 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-05-31 12:41:12.690 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "Maven build
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/chaincode/input/src). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
I have made my custom chaincode "mycc.js" It is successfully installed on peer. But when i Instantiate this chaincode using
peer chaincode instantiate -l node -n mycc -v v0 -C mychannel -c '{"args":["init","A","100","B","100"]}' -o locahost:7050
command. I got error this error
Any help is appreciated.
It's localhost, not locahost, you are missing "l"
I'm doing this tutorial: https://hyperledger-fabric.readthedocs.io/en/latest/build_network.html
Now I am on my Peer and want to Install & Instantiate Chaincode.
For this I am doing:
root#23096337731b:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode install -n mycc -v 1.0 -p github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/go/
But then I get this output:
2019-01-31 08:01:44.988 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-01-31 08:01:44.988 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: error getting chaincode code mycc: path to chaincode does not exist: /opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/go
Update:
I think it's because I'm doing this:
peer chaincode install -n mycc -v 1.0 -p github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/go/
And the compiler thinks that the github link is a local directory.
The key point is the place where you put the chaincode must be mounted exactly.
In the tutorial source code, when you read the file docker-compose-cli.yaml, you will see this line
volumes
- ./../chaincode/:/opt/gopath/src/github.com/chaincode
./../chaincode is the path to the chaincode folder
One more thing, if you choose golang for the chaincode, the path when you call install chaincode will be shorter (read more):
# this installs the Go chaincode. For go chaincode -p takes the relative path from $GOPATH/src
peer chaincode install -n mycc -v 1.0 -p github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/go/
Node.js version:
# this installs the Node.js chaincode
# make note of the -l flag to indicate "node" chaincode
# for node chaincode -p takes the absolute path to the node.js chaincode
peer chaincode install -n mycc -v 1.0 -l node -p /opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/node/
First you need to check if the chaincode is on that folder. Also the path for a go chaincode has to be relative to the gopath.
I'm using fabric tools provided for composer to deploy fabric network as it deploys 1 peer, 1 orderer, 1 couchdb, & 1 fabric-ca. I am able to install chain code on peer but instantiation fails with following error. I am using command on fabric-peer.
peer chaincode instantiate -o orderer.example.com:7050 -C composerchannel -n test -l node -v 1.0 -c '{"Args":["init","a", "100", "b","200"]}'
Error: could not assemble transaction, err Proposal response was not
successful, error code 500, msg failed to execute transaction
83b806a14ec33d47e11950581357cc0ab05ef51dfb53d35c6b9f00eca7a49051:
timeout expired while starting chaincode test:1.0 for transaction
83b806a14ec33d47e11950581357cc0ab05ef51dfb53d35c6b9f00eca7a49051
And if I check the logs of orderer I get:
2018-09-01 11:09:16.205 UTC [orderer/common/broadcast] Handle -> WARN
973 Error reading from 172.19.0.14:33674: rpc error: code = Canceled
desc = context canceled
in my case (windows 10) I stopped the network, removed all containers then restarted, worked fine:
$ docker stop $(docker ps -a -q)
$ docker ps -qa|xargs docker rm
$ ./startFabric.sh
Check logs on node (VM) which host peer0 with:
docker ps -a
you will find chaincode container ID with exit code.
CONTAINER ID: **718e367bf1db**
IMAGE: dev-peer1-org1-**mycc-0.2**-9c1906
COMMAND: "/bin/sh -c 'cd /usr…"
where mycc-0.2 is you chaincode name and version. Once you find the container ID - you can check the error log with:
docker logs <container_id>
I assume there is a bug in the your chaincode and the application can't start.