- 搭建过程
- 问题
- Linux下的问题
- 1. ./network.sh deployCC 相关
- 1.1 执行```sudo ./network.sh deployCC```时
- 1.2 执行```sudo ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go```
- 1.3 执行 ```./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go```
- 2. peer相关
- 2.1 执行```peer chaincode query -C mychannel -n fabcar -c '{"Args":["queryAllCars"]}'```
- · 执行 ```peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses localhost:9051 --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{"function":"InitLedger","Args":[]}'```
- Mac下的问题
- 执行```./network.sh up -ca```时,
- 后期,因为需要更换版本1.4.3
- 1.版本问题
- Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: Post http://unix.sock/containers/create?name=dev-peer0.org2.example.com-mycc-1.0: dial unix /host/var/run/docker.sock: connect: no such file or directory
在搭建过程中主要参考了两篇:①https://blog.csdn.net/glclh/article/details/108184471
这一篇 *** 作讲的很细致,但是是1.4.0版的,我先是按着这个直接把版本号替换了,但是后面发现1.4.0和2.2.1在后续配置上有差别,就按照下面那两篇了
②https://blog.csdn.net/qq_43681877/article/details/110896678
③https://blog.csdn.net/zekdot/article/details/106977734
搭好环境后遇到了一下 *** 作问题:
Linux下的问题 1. ./network.sh deployCC 相关 1.1 执行sudo ./network.sh deployCC
时
- 报错
No chaincode name was provided
解决:
./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go
这个可能也会报错,往下看,有相关问题
1.2 执行sudo ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go
- 报错
Error: failed to normalize chaincode path: failed to determine module root: exec: "go": executable file not found in $PATH Chaincode packaging has failed Deploying chaincode failed
解决:
./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go
或者看看是不是go没安好,解决方法:
go version #检查一下安装好没
如果显示了版本号还有这个错误,就
sudo bash
go version
看看这时候安装好没,好了的话就直接再输入
./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go
如果sudo bash了之后发现没有版本号(或者一开始就没有版本号),
这时候就再输入
#这个只是让他重新生效一下,如果安装go的时候没有修改这个,可以去搜一下,文章的第一个参考链接里就有
source /etc/profile
之后在执行
./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go
1.3 执行 ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go
- 报错①
2021-12-06 17:30:26.683 CST [main] InitCmd -> ERRO 001 Cannot run peer because error when setting up MSP of type bccsp from directory /home/monk/go/src/github.com/hyperledger/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp: KeyMaterial not found in SigningIdentityInfo Chaincode installation on peer0.org1 has failed Deploying chaincode failed
解决:
sudo bash
./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go
- 报错②
Error: failed to normalize chaincode path: failed to determine module root: exec: "go": executable file not found in $PATH Chaincode packaging has failed Deploying chaincode failed
解决方法同第二个里面的go安装问题
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"
解决:
//在fabric-samples/fabacar路径下运行
sudo ./startFabric.sh
//回到test-network运行
peer chaincode query -C mychannel -n fabcar -c '{"Args":["queryAllCars"]}'
· 执行 peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses localhost:9051 --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{"function":"InitLedger","Args":[]}'
- 报错
2021-12-06 18:12:57.562 CST [main] InitCmd -> ERRO 001 Cannot run peer because error when setting up MSP of type bccsp from directory /home/monk/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp: KeyMaterial not found in SigningIdentityInfo
解决:
sudo bash
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses localhost:9051 --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{"function":"InitLedger","Args":[]}'
此时,又遇到报错:
Command ‘peer’ not found, did you mean:
command ‘seer’ from deb seer
command ‘pee’ from deb moreutils
command ‘beer’ from deb gerstensaft
command ‘pear’ from deb php-pear
command ‘peet’ from deb pipexec
Try: apt install
暂未解决
但是一般再弄一下环境变量或者重启就没事了 不知道什么原因
./network.sh up -ca
时,
- 报错
no matching manifest for linux/arm64/v8 in the manifest list entries
这个问题是因为docker上的image没有适配M1芯片的,直接运行
//缺哪个image就拉哪个,image的名称就是hyperledger/fabric-ca这部分
docker pull --platform linux/x86_64 hyperledger/fabric-ca
后期,因为需要更换版本1.4.3
1.版本问题
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: Post http://unix.sock/containers/create?name=dev-peer0.org2.example.com-mycc-1.0: dial unix /host/var/run/docker.sock: connect: no such file or directory
!!! Chaincode instantiation on peer0.org2 on channel ‘mychannel’ failed !!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========
ERROR !!! Test failed
解决:此问题是由适用于macOS的Docker Desktop的较新版本引起的。
要解决此问题,请在Docker Desktop首选项中,取消选中该框Use gRPC FUSE for file sharing, 以使用旧版osxfs文件共享,然后单击Apply&**Restart
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)