This is command that am using
docker exec cli\
peer chaincode upgrade \
-o orderer.pk.snowshadow.me:7050 \
-C mychannel -n mycc -c '{"Args": []}'\
-p "basic-network/chaincode" \
-v 1.3 \
>&upgrade.log
this is what am getting in upgrade.log
2018-11-19 13:47:41.501 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001[0m Using default escc
2018-11-19 13:47:41.501 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002[0m Using default vscc
Error: could not assemble transaction, err Proposal response was not successful, error code 500, msg cannot get package for chaincode (mycc:1.3)
Did you install the new version of your chaincode before upgrade?
If you did't, try this before the upgrade command:
peer chaincode install -n mycc -v 1.3 -p basic-network/chaincode
If you did so, the error may be for some of this reasons:
1- The path parameter must be passed on the instalation I never used it in an upgrade operation, and I also don't use quotation marks on them.
2- Try passing the args like this: '{"Args":[""]}'
Related
I'm trying to update a chaincode with a 3 nodes blockchain using Hyperledger Fabric 1.4.4, raft and multi ordering.
I'm using ansible to deploy the BC : https://github.com/Altoros/Ansible-Fabric-Starter
What I'm trying to do is upgrading the chaincode.
I first log in the cli container in a node:
ubuntu#ip-172-31-46-199:~$ docker exec -it cli.org0.domain bash
root#56e6868e66a0:/etc/hyperledger/artifacts# export CORE_PEER_ADDRESS=peer0.org0.domain:7051 && peer chaincode install -n main -v 1.0.1 -p main -l golang
2021-03-18 16:54:45.475 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2021-03-18 16:54:45.475 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2021-03-18 16:54:47.599 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" >
root#56e6868e66a0:/etc/hyperledger/artifacts# export CORE_PEER_ADDRESS=peer0.org0.domain:7051 && peer chaincode upgrade -n main -v 1.0.1 -c "{\"Args\":[\"GetMeasuresBetween\",\"2019-03-29T12:00:00Z\", \"2019-03-29T14:00:00Z\"]}" -o orderer2.domain:7050 -C org0 --tls --cafile /etc/hyperledger/artifacts/crypto-config/ordererOrganizations/domain/tlsca/tlsca.domain-cert.pem
2021-03-18 17:03:09.896 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2021-03-18 17:03:09.897 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Everything seems to be working.
But when I try to invoke the chaincode where I changed a debug message
peer chaincode invoke --cafile /etc/hyperledger/artifacts/crypto-config/ordererOrganizations/domain/tlsca/tlsca.domain-cert.pem --tls -o orderer2.domain:7050 -C org0 -n main -c "{\"Args\":[\"AddMeasure\",\"ACC00000000\",\"23547901584620111112\",\"Conso\",\"BASE\",\"1010\",\"2019-11-01T08:30:01Z\"]}"
it is also working well, but I cannot see in the logs the new debug message, only seeing old one.
Is it something I am missing ? When invoking the chaincode, will it always take the latest version ?
After you install the new version on each peer, you need to then perform an upgrade operation (analogous to doing install and instantiate when you deployed the initial version of the chaincode).
Problem:
I have set up a Hyperledger Fabric network. When I try to install a chaincode it is only installed in the first peer. But when I try to install chaincode on other peers it was failed by saying that chaincode does not exist.
This is the command I issued on the first peer.
peer chaincode install -n fabcar -v 1.0.0 -l node -p /opt/gopath/src/github.com/chaincode/fabcar/javascript-low-level
This is the output after the command.
2020-03-01 07:27:26.245 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-03-01 07:27:26.245 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2020-03-01 07:27:26.705 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:
This is the command I issued on the second peer.
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/doctor.hrm.com/users/Admin#doctor.hrm.com/msp CORE_PEER_ADDRESS=peer1.doctor.hrm.com:10051 CORE_PEER_LOCALMSPID="DoctorMSP" CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/doctor.hrm.com/peers/peer1.doctor.hrm.com/tls/ca.crt peer chaincode install -n fabcar -v 1.0.0 -l node -p /opt/gopath/src/github.com/fabcar/javascript-low-level
This is the error that was given to me.
2020-03-01 07:34:28.268 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-03-01 07:34:28.268 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: error getting chaincode code fabcar: path to chaincode does not exist: /opt/gopath/src/github.com/fabcar/javascript-low-level
Can someone help me with this to find the issue?
Check your GOPATH set in cli container docker-compose.yaml file.
If GOPATH=/opt/gopath then you should give path inside src folder. So you should give path in peer chaincode install as github.com/fabcar/javascript-low-level
so your command will be
peer chaincode install -n fabcar -v 1.0.0 -l node -p github.com/chaincode/fabcar/javascript-low-level
so check your GOPATH set in cli container of docker-compose.yaml and accordingly set the path in peer chaincode install command
" 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 am getting
Error: could not send: EOF
on instantiating chaincode in HF. I followed the correct steps for installing binaries, images etc.
After installation I used following command in the first-network directory to install and instantiate chaincode:
./byfn.sh generate
./byfn.sh up
docker exec -it cli bash
peer chaincode install -n fabcar -v 1.0 -p github.com/chaincode/fabcar/javascript -l node
On executing last command this is the output that I got:
2019-03-28 09:22:04.047 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-03-28 09:22:04.048 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2019-03-28 09:22:04.950 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" >
then I used the command to instantiate chaincode which is:
peer chaincode instantiate -n fabcar -v 1.0 -C mychannel -c '{"Args":[]}' -l node
And the output was an error like this:
2019-03-28 09:23:25.743 UTC [chaincodeCmd] InitCmdFactory -> INFO 001 Retrieved channel (mychannel) orderer endpoint: orderer.example.com:7050
2019-03-28 09:23:25.747 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default escc
2019-03-28 09:23:25.747 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default vscc
Error: could not send: EOF
I think I missed something but I am not sure.
Can anyone tell where I went wrong. Thanks in advance.
I found that adding the TLS certificate options to the instantiate command worked for me. I am using Golang for my chaincode language
Install: (for reference)
peer chaincode install \
-n mycc \
-v 1.0 \
-p myorg/chaincode
Instantiate:
peer chaincode instantiate \
-C mychannel \
-n mycc \
-v 1.0 \
-c '{"Args":["wallet","123"]}' \
--tls true \
--cafile /myorg/hyperledger/fabric/peer/crypto-config/ordererOrganizations/myorg.org/orderers/orderer.myorg.org/msp/tlscacerts/tlsca.myorg.org-cert.pem
I didn't have to specify the following options though including them did not break anything:
-P "OR ('MYORGMSP.peer')" \
-l golang \
I changed the CLI container to mount my crypto material at /myorg/hyperledger/fabric/peer/crypto-config which differs from the default location used by other examples.
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.