IBM/blockchain-application-using-fabric-java-sdk 启动遇到的
2021/10/10 22:44:16
本文主要是介绍IBM/blockchain-application-using-fabric-java-sdk 启动遇到的,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
首先附上github地址:blockchain-application-using-fabric-java-sdk
我安装readme中的步骤来,把区块链网络跑起来之后,创建channel成功了,安装链码也成功了,只是最后在实例化(instantiate)链码的时候一直失败,提示:
could not build chaincode: docker build failed: docker image build failed: docker build failed: Error returned from build: 1 "/chaincode/input/src/github.com/chaincode/farcar.go:37:2: cannot find package “github.com/hyperledger/core/chaincode/shim” in any of:
/usr/local/go/src/github.com/hyperledger/core/chaincode/shim (from $GOROOT)
/chaincode/input/src/github.com/hyperledger/fabric-chaincode-go/shim (from $GOPATH)
/go/src/github.com/hyperledger/fabric-chaincode-go/shim
/chaincode/input/src/github.com/chaincode/pcurd.go:38:6: cannot find package “github.com/hyperledger/fabric/protos/peer” in any of:
/usr/local/go/src/github.com/hyperledger/fabric/protos/peer (from $GOROOT)
/chaincode/input/src/github.com/hyperledger/fabric/protos/peer (from $GOPATH)
/go/src/github.com/hyperledger/fabric/protos/peer"
这里通过2步解决这个问题。
第一步
cd到network_resources/chaincode/src/github.com/fabcar目录下,更改fabcar.go文件import的package,修改后的内容如下:
package main import ( "bytes" "encoding/json" "fmt" "strconv" "github.com/hyperledger/fabric-chaincode-go/shim" sc "github.com/hyperledger/fabric-protos-go/peer" )
第二步
安装go1.13.15,然后执行:
go env -w GO111MODULE=on
把项目clone下来之后,cd到network_resources/chaincode/src/github.com/fabcar目录下,然后执行
go mod init go mod vendor
然后删掉docker容器,重新跑一遍就好了
这篇关于IBM/blockchain-application-using-fabric-java-sdk 启动遇到的的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-23Springboot应用的多环境打包入门
- 2024-11-23Springboot应用的生产发布入门教程
- 2024-11-23Python编程入门指南
- 2024-11-23Java创业入门:从零开始的编程之旅
- 2024-11-23Java创业入门:新手必读的Java编程与创业指南
- 2024-11-23Java对接阿里云智能语音服务入门详解
- 2024-11-23Java对接阿里云智能语音服务入门教程
- 2024-11-23JAVA对接阿里云智能语音服务入门教程
- 2024-11-23Java副业入门:初学者的简单教程
- 2024-11-23JAVA副业入门:初学者的实战指南