[区块链]fabric1.0开发环境 安装和调试

搭建Fabric1.0
ubuntu:16.04
go:1.9
docker:18.06
参考:
https://blog.csdn.net/so5418418/article/details/78355868/
http://www.cnblogs.com/studyzy/p/7437157.html
详细配置
https://www.cnblogs.com/studyzy/p/7451276.html
阿里云配置
https://www.jianshu.com/p/6ef2e8425087


1.apt source改为国内

在ubuntu系统里【软件和更新】里选择

2.安装go

这一块在安装是,主要考虑gopath/gosource设定
source ~/.profile

3.docker安装

安装时不用Docker Hub镜像设定也行

4.Docker-Compose的安装

5.Fabric源码下载

有两种方法,官网下载或者从yang-san哪里下载
注意下载时,最好要指定到root用户和root文件夹,个人认为不再root文件夹也可以

6.Fabric Docker镜像的下载

安装说明下载即可

cd ~/go/src/github.com/hyperledger/fabric/examples/e2e_cli/
source download-dockerimages.sh -c x86_64-1.0.0 -f x86_64-1.0.0

7.启动Fabric网络并完成ChainCode的测试

启动fabric:./network_setup.sh up 同时还有 ./network_setup.sh down命令
在此步花费较多时间,遇到下面3个问题

8.手动测试Fabric网络

打开cli控制台:docker exec -it cli bash

查询余额:peer chaincode query -C mychannel -n mycc -c ‘{“Args”:[“query”,”a”]}’

转账:peer chaincode invoke -o orderer.example.com:7050 –tls true –cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n mycc -c ‘{“Args”:[“invoke”,”a”,”b”,”50”]}’

退出exit

停掉网络:cd ~/go/src/github.com/hyperledger/fabric/examples/e2e_cli

./network_setup.sh down


安装

  • 1.从github拉代码
  • 2.安装git
  • 3.make setup
  • 4.make all
    – 出错:
    – 1.使用make cryptogen编译生成cryptogen工具,缺少ltdl.h文件
    https://blog.csdn.net/misshqzzz/article/details/79557018
    –2.e2e_cli启动中出现:CRIT 004 Error on outputBlock:Error writing genesis block:open ./channel-artifacts/get:is a directory
    原因是没有正确生成genesis.block 所以docker在挂载文件时,会自动生成一个genesis.block文件
    直接删除e2e_cli下的channel-artifacts里的genesis.block,重新生成这个文件
    https://blog.csdn.net/yujuan110/article/details/81183739
    –3.[ERROR: for orderer.example.com Cannot start service orderer.example.com: OCI runtime create failed: container_linux.go:348: starting container process caused “process_linux.go:402: container init caused \”rootfs_linux.go:58: mounting \\”/root/go/src/github.com/hyperledger/fabric/examples/e2e_cli/channel-artifacts/genesis.block\\” to rootfs \\”/var/lib/docker/overlay2/ef9deac8092598d60de657aa30fc87faa3e79b29d2fd7fdeb04eed18681195f5/merged\\” at \\”/var/lib/docker/overlay2/ef9deac8092598d60de657aa30fc87faa3e79b29d2fd7fdeb04eed18681195f5/merged/var/hyperledger/orderer/orderer.genesis.block\\” caused \\”not a directory\\”\”“: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
    ERROR: Encountered errors while bringing up the project.
    ERROR !!!! Unable to pull the images ]
    ====>解决办法:
    则执行./network_setup.sh down 清除网络后再启动
    https://www.jianshu.com/p/14c06981882e

==============================
– 1.docker error Couldn’t connect to Docker daemon at http+docker://localunixsocket - is it running?
出错分析
– 2.[fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x63 pc=0x7f45306b460b]]
https://segmentfault.com/q/1010000011451324
– 3.删除docker镜像:
https://www.cnblogs.com/q4486233/p/6482711.html
–4.删除系统自带的docker
https://blog.csdn.net/CSDN_duomaomao/article/details/77683607
https://www.cnblogs.com/wxjnew/p/8024271.html
–5.vi的编辑命令
https://jingyan.baidu.com/article/495ba8410ff14d38b30ede01.html
–6.区块链个链接
https://blog.csdn.net/so5418418/article/details/78954937
–7.环境搭建
https://blog.csdn.net/so5418418/article/details/78355868
https://www.cnblogs.com/studyzy/p/7451276.html
http://www.cnblogs.com/studyzy/p/7437157.html
–8.
https://blog.csdn.net/u013281092/article/details/44928335

发布了27 篇原创文章 · 获赞 8 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/fox3012/article/details/82696146