Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work with Hyperledger Fabric Chaincode Development Tools #4415

Closed
ffffffffffk opened this issue Dec 26, 2019 · 6 comments
Closed

Work with Hyperledger Fabric Chaincode Development Tools #4415

ffffffffffk opened this issue Dec 26, 2019 · 6 comments
Assignees

Comments

@ffffffffffk
Copy link

Tutorial URL: https://developers.sap.com/tutorials/blockchain-hlf-chaincode-tools.html

Please specify the step you are referring to

I have encountered the following errors in the tutorial:

C:\Users\xxxxxx>go get github.com/hyperledger/fabric/core/chaincode/shim
package github.com/hyperledger/fabric/core/chaincode/shim: cannot find package "github.com/hyperledger/fabric/core/chaincode/shim" in any of:
c:\go\src\github.com\hyperledger\fabric\core\chaincode\shim (from $GOROOT)
C:\Users\i350156\go\src\github.com\hyperledger\fabric\core\chaincode\shim (from $GOPATH)

C:\Users\xxxxxx>go get github.com/hyperledger/fabric/protos/peer
package github.com/hyperledger/fabric/protos/peer: cannot find package "github.com/hyperledger/fabric/protos/peer" in any of:
c:\go\src\github.com\hyperledger\fabric\protos\peer (from $GOROOT)
C:\Users\i350156\go\src\github.com\hyperledger\fabric\protos\peer (from $GOPATH)

@heytombeck
Copy link
Contributor

Hi - I've just looked at the github for Hyperledger Fabric and it appears that they've changed the structure / what's available. I've raised this with one of our developers and I'll see if there's an alternative.

@heytombeck
Copy link
Contributor

Unfortunately all three of my Hyperledger Fabric developers are showing an out of office until January 2nd, so it might take some time. While waiting, you can access the full HLF github profile here: https://github.com/hyperledger/fabric

@heytombeck
Copy link
Contributor

Hello - I've heard back from the developers now and we'll edit the tutorial to fit around the new structure. The instructions will then be:

Initialize GO Modules
go mod init chaincode

Install Hyperledger Fabric packages
go get github.com/hyperledger/fabric/common/util@v1.4

go get github.com/hyperledger/fabric/core/chaincode/shim@v1.4

go get github.com/hyperledger/fabric/protos/peer@v1.4

@thecodester
Copy link
Contributor

Thank you for your feedback. The issue seems to be resolved, so I am closing the issue.

#4423

If you still have questions, feel free to reopen the issue.

@ebthecyberelf
Copy link

ebthecyberelf commented Jan 31, 2020

Hi, I'm having a similar issue where when trying to do the above go get installs I'm getting the messages:

go get github.com/hyperledger/fabric/core/chaincode/shim: module github.com/hyperledger/fabric@upgrade found (v2.0.0+incompatible), but does not contain package github.com/hyperledger/fabric/core/chaincode/shim

go get github.com/hyperledger/fabric/common/util@v1.4: module github.com/hyperledger/fabric@v1.4 found (v1.4.4), but does not contain package github.com/hyperledger/fabric/common/util

go get github.com/hyperledger/fabric/protos/peer: module github.com/hyperledger/fabric@upgrade found (v2.0.0+incompatible), but does not contain package github.com/hyperledger/fabric/protos/peer

Resolution:

Shim: go get github.com/hyperledger/fabric-chaincode-go/shim
Peer: go get github.com/hyperledger/fabric/core/peer
Util: go get github.com/hyperledger/fabric/common/util

@chrisfries
Copy link

Hi Erika,

your solution will not work because the peer dependency is not the required proto definition. Please use the following package for that github.com/hyperledger/fabric-protos-go/peer.

Then use go build --tags nopkcs11 to see if it compiles.

However, you will have to vendor those dependencies (go mod vendor ) when using the SAP Hyperledger Fabric service. For hyperledger fabric 2.0.0 the chaincode shim and fabric protos where moved to extra repositories. SAP's Hyperledger Fabric service is running on version 1.4.4 and has those new repositories not available during the instantiation of the chaincode.

This is the reason why we came up with the solution to initialize go modules and to get the modules of version 1.4 which is not possible with go get if you don't have go modules initalized.
In the error messages you specified I can see that you run go get without specifying the version. This will fail because in the latest version (2.0.0) the packages were moved.

To sum up you have two options:

  • Get the dependencies in version 1.4 (see Tom's post)
  • Use the new packages and vendor the dependencies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants