区块链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

在这里插入图片描述

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 

在这里插入图片描述
按下图去掉标记行的注释符,保存并退出
在这里插入图片描述

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

在这里插入图片描述
在这里插入图片描述

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

在这里插入图片描述

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

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

在这里插入图片描述
在这里插入图片描述

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

在这里插入图片描述

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

在这里插入图片描述

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

在这里插入图片描述

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

在这里插入图片描述
当出现上述状态显示时,表示你部署成功了!![撒花]
如果有什么问题,欢迎留言,也欢迎指正文章中的错误。
在这里插入图片描述

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值