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

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 ?

Related

After writing my smart contract i'm trying to install the chaincode on the default network but I keep receiving an error

I installed minifabric and wrote my own chaincode but when i try to install it on the default channel i get the following error:
non-zero reuturn code
Error: No such container: mysite
My smart contract is the following path: ~/mywork/vars/chaincode/mycc/go

Error while invoking javascript chaincode

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.

Convector Framework CLI returns error when installing chaincode

I am very new to the Hyperledger Fabric and Convector Framework and I have followed this tutorial:
https://worldsibu.github.io/convector/modules/getting_started.html
When I try to use the CLI tool and run the command (test is my chaincode name):
npm run cc:start -- test 1
It gives the following errors:
Installing Chaincode test version 1.0 at org1
Error: Error endorsing chaincode: rpc error: code = Unknown desc = access
denied: channel [] creator org [org1MSP]
...
Installing Chaincode test version 1.0 at org2
Error: error getting endorser client for install: endorser client failed to
connect to localhost:7151: failed to create new connection: context deadline
exceeded
I have not changed the configs and MSPs.
What is going wrong and how should I start to resolve the problem? Any guidance is appreciated!
#shole that documentation is now deprecated, you can use http://docs.worldsibu.com/convector for the latest versions.
About your error that usually happens when the environment gets corrupted and keeps cryptographic materials from a previous installation, try re-running npm run env:restart and try again.

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