0. 配置ssh-server
使用ifconfig
查看IP地址。
使用sudo apt-get install openssh-server
安装远程ssh服务。
使用ps -e | grep ssh
查看开启状态,若输出ssh-agent以及sshd则启动成功,若进输出ssh-agent,则使用/etc/init.d/ssh start
开启服务。
开启后,使用查看IP地址时ens33中inet后的地址来访问Ubuntu。
1. deployCC失败
没有默认参数,使用完整语句
./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go
2. 错误:failed to normalize chaincode path : ‘go list’ failed
完整错误代码:
Error: failed to normalize chaincode path: ‘go list’ failed with: go: github.com/golang/protobuf@v1.3.2: Get
“https://proxy.golang.org/github.com/golang/protobuf/@v/v1.3.2.mod”: dial tcp 172.217.160.81:443:
connect: connection refused: exit status 1
主要是由于无法访问下载地址,通过以下命令解决:
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct
若以上命令无法使用/报错,例如:
go env flag provided but not defined: -w
则可能需要首先更新golang版本(配置时务必注意GOPATH与GOROOT的区别):
点击跳转
3. 错误:ERRO 001 Cannot run peer because error when setting up MSP of type bccsp from directory
完整错误代码:
ERRO 001 Cannot run peer because error when setting up MSP of type bccsp from directory /home/XXX/go/src/github.com/hyperledger/fabric/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp: KeyMaterial not found in SigningIdentityInfo
此错误为权限不够,只需在命令前加’sudo’。
4. 错误:endorsement failure during query. response: status:500
原指令(利用链码查询账本结果):
peer chaincode query -C mychannel -n fabcar -c '{"Args":["queryAllCars"]}'
完整错误代码:
Error: endorsement failure during query. response: status:500 message:“make sure the chaincode fabcar has been successfully defined on channel mychannel and try again: chaincode fabcar not found”
查看错误代码可知应是fabcar链码在通道上没有定义,可以在fabric-samples/fabacar路径下运行:
sudo ./startFabric.sh
此命令将关停网络,从头部署一次,并保证fabcar有定义。再回到test-network路径下执行原指令即可得到结果。