Where is custom chaincode path Hyperledger Fabric 1 0

+1 vote

I am using windows 7 and trying to install my own custom fabric. I am learning to do this from the hyperledger fabric documentation.

I ran the ./byfn.sh -m up command and now its running and executing the scripts..

To run my custom code, i changed the following code:

peer chaincode install -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02>&log.txt

to this code:

peer chaincode install -n mycc -v 1.0 -p github.com/myuserId/fabrcicV1_chaincodes/mychaincode >&log.txt

now when i execute ./byfn.sh -m up , i get the following error:

2017-08-22 11:01:17.048 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2017-08-22 11:01:17.048 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2017-08-22 11:01:17.048 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
Error: Error getting chaincode code chaincode: path to chaincode does not exist: github.com/myuserId/fabrcicV1_chaincodes/mychaincode
Usage:
  peer chaincode install [flags]

Flags:
  -c, --ctor string      Constructor message for the chaincode in JSON format (default "{}")
  -l, --lang string      Language the chaincode is written in (default "golang")
  -n, --name string      Name of the chaincode
  -p, --path string      Path to chaincode
  -v, --version string   Version of the chaincode specified in install/instantiate/upgrade commands

Global Flags:
      --cafile string              Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoi
      --logging-level string       Default logging level and overrides, see core.yaml for full syntax
  -o, --orderer string             Ordering service endpoint
      --test.coverprofile string   Done (default "coverage.cov")
      --tls                        Use TLS when communicating with the orderer endpoint

!!!!!!!!!!!!!!! Chaincode installation on remote peer PEER0 has Failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========

I have used the same windows 7 image that is present on github.. I don't know where I am going wrong, any help???

Jul 10, 2018 in Blockchain by digger
• 26,740 points
2,723 views

2 answers to this question.

+1 vote
Best answer

You have to have your chaincode at $GOPATH. You can use the following command to use it:

$ go get github.com/myuserId/fabrcicV1_chaincodes/mychaincode

If you are following the hyperledger fabric documentation then you have make sure that your chaincode is in the fabric-samples/chaincode folder.

example of docker-compose-cli.yaml file:

volumes:
    - /var/run/:/host/var/run/
    - ./../chaincode/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go
    - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
    - ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
    - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts

Then, you have to place your chaincode here and mount additional folder within $GOPATH of cli container.

- ./../chaincode/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go
answered Jul 10, 2018 by slayer
• 29,350 points

selected Apr 29, 2019 by Omkar
0 votes

Seems like a problem with Go Path, run the below command first and then run your command

export GOPATH=/opt/gopath

See if this works

answered Apr 29, 2019 by Raj

This worked for me. First I ran this command to check is GO path is set or not:

$ echo $GOPATH

It returned a blank value which meant I hadn't set the path. So setting the path solved the error.

Related Questions In Blockchain

+1 vote
2 answers

Challenge while setting up Hyperledger Fabric 1.0 in Ubuntu 16.04

The rocksdb error you're seeing wouldn't be ...READ MORE

answered Mar 27, 2018 in Blockchain by ned_crew
• 1,610 points

edited Jun 8, 2020 by Sirajul 924 views
+1 vote
1 answer
0 votes
1 answer

Hyperledger Fabric 1.0 how to maintain privacy from OSNs?

Yes, OSNs can see all the transaction ...READ MORE

answered Jul 2, 2018 in Blockchain by Omkar
• 69,210 points
552 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,228 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP