区块链Fabric——【MiniFabric部署】

区块链Fabric——【MiniFabric部署】

If you like to learn Hyperledger Fabric or develop your smart contract, or just want to get a feel about Hyperledger Fabric, Minifabric is the tool to get you started. Minifabric can stand up a Fabric network on a small machine like a VirtualBox VM but also can deploy Fabric networks cross multiple production grade servers. Minifabric is small but it allows you to experience the full capabilities of Hyperledger Fabric. You will be able to try all Fabric operations such as channel create, channel join, chaincode install, approve, instantiation. It also supports channel update, private data collection, block query etc. All you need to start with is a docker (18.03 or newer) environment. Minifabric works on both OS X and Linux. Windows support is in the works. If you like to read more before jumping in, please read Minifabric User Guide. For those impatient, please follow the steps below to start things off.————摘自Minifabric官方Github自述

下面是博主自己的安装过程,希望可以给大家提供一些借鉴

GitHub网址:

https://github.com/hyperledger-labs/minifabric

1.拉取镜像文件:
git clone https://github.com/hyperledger-labs/minifabric.git

区块链Fabric——【MiniFabric部署】_第1张图片

2.创建两个站点文件夹:
mkdir site1
mkdir site2
3.复制站点文件
cp ./minifabric/minifab ./site1
cp ./minifabric/minifab ./site2
cp ./minifabric/spec.yaml ./site1
cp ./minifabric/spec.yaml ./site2

在这里插入图片描述

4.修改站点site1的spec.yaml文件
cd site1
vi spec.yaml 

在这里插入图片描述
按下图去掉标记行的注释符,保存并退出
区块链Fabric——【MiniFabric部署】_第2张图片

5.启动一个完整的运行Fabric网络
./minifab up -e 7000 -n samplecc -p ''

区块链Fabric——【MiniFabric部署】_第3张图片
区块链Fabric——【MiniFabric部署】_第4张图片

6.重写站点site2的spec.yaml文件
cd ../
cd site2
rm -rf spec.yaml 
vi spec.yaml 

区块链Fabric——【MiniFabric部署】_第5张图片

在打开的文件内输入以下内容,保存并退出

fabric:
        peers:
                - "peer1.org2.example.com"
                - "peer2.org2.example.com"
        goproxy:        "https://goproxy.cn,direct"
7.启动一个只有两个对等节点的新组织
./minifab netup -e 7400 -o org2.example.com

区块链Fabric——【MiniFabric部署】_第6张图片
区块链Fabric——【MiniFabric部署】_第7张图片

8.将org2.example.com加入应用程序渠道
Mcp ./vars/JoinRequest_org2-example-com.json ../site1/vars/NewOrgJoinRequest,json
9.节点导入,加入Fabric网络
cp ./vars/profiles/endpoints.yaml  ../site2/vars
cd ../site2
./minifab nodeimport,join

区块链Fabric——【MiniFabric部署】_第8张图片

10.安装并允许samplecc
./minifab install,approve -n samplecc -p ''

区块链Fabric——【MiniFabric部署】_第9张图片

11.批准org1和org2上的链码
cd ../site1
./minifab approve,commit

区块链Fabric——【MiniFabric部署】_第10张图片

12.在org2上发现并验证链码
cd ../site2
./minifab discover,stats

区块链Fabric——【MiniFabric部署】_第11张图片
当出现上述状态显示时,表示你部署成功了!![撒花]
如果有什么问题,欢迎留言,也欢迎指正文章中的错误。
区块链Fabric——【MiniFabric部署】_第12张图片

你可能感兴趣的:(区块链开发,区块链,fabric,hyperledger,github,blockchain)