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
• 27,620 points
755 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,050 points

selected Apr 29 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 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
1 answer
+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
• 67,140 points
26 views
0 votes
1 answer
0 votes
1 answer