在 Win7 环境使用 hyperledger fabric source code 模拟 IBM Bluemix Blockchain Service

在 Win7 环境使用 hyperledger/fabric source code 模拟 IBM Bluemix Blockchain Service

作者:陳兆麟 Email:chenlin2@ms9.hinet.net

当美国联准会(Fed)主席叶伦力挺区块链 (blockchain) 后,区块链如野火燎原般风靡了整个地球,它将改变人类传统生活习惯;唯一 IBM bluemix所提供的 bloclcahain service 最近几乎塞到爆,常出现用量超出负荷的讯息,幸好IBM佛心提供了4 万行 hyperledger/fabric source code如果没有这些 source code, 区块链的应用将会被口袋深的大厂把持;目前企业只要有支持 Docker 云端平台都可以自行开发区块链的应用系统,有兴趣的企业可私讯联系共同开发。以下范例是以 hyperledger/fabric source code在local machine 仿真 IBM Bluemix bloclcahain service 的功能,也就是不必登录至 IBM bluemix 就可以执行IBM 所提供的範例blockchain marbles。

開發環境:Win7 (64 bit, RAM >=8G) , vagrant , blockchain, docker,golang

1. win7 安装 cygwin (https://cygwin.com/install.html)

将安装之执行文件目录 (C:\cygwin64\bin) 设定在控制台系统 path 变量
win7 安装 virtualbox (VirtualBox-5.1.6-110634-Win.exe) (https://www.virtualbox.org/)
win7 安装 git (https://git-scm.com/downloads)

2.建立 github账号

登入github 建立账号 (https://github.com/ 纪录 username 及 password)

fork hyperledger/fabric

浏览器入以下网址:
https://github.com/hyperledger/fabric/blob/master/docs/Gerrit/gerrit.md#Working-with-a-local-clone-of-the-repository

(点选 fork )

3. 确认 fabric 安装至你的 guthub repository,

4.将 xxxxxx/fabric clone 至 Win7 local machine

进入Win7 command shell:

$mkdir -p d:\GoProjects\src\github.com\hyperledger
$cd d:\GoProjects\src\github.com\hyperledger
$git clone https://github.com/xxxxxxx/fabric
$cd d:\GoProjects\src\github.com\hyperledger\fabric\devenv

修正 Vagrantfile (D:\GoProjects\src\github.com\hyperledger\fabric\devenv)
新增 :
config.vm.network “forwarded_port”, guest: 22, host: 22
config.vm.network “forwarded_port”, guest: 3000, host: 3000

$vagrant up (第一次在 virtual box 产生虚拟机器 hyperledger需要一段时间)

5.使用 putty (附录 1) 登录 hyperledger VM

(username: vagrant,password:vagrant)

6.在hyperledger VM 使用 nvm 安装 node 最新版 (参考附录 2)

$ nvm use 6.7.0 (选择 node 版本)
$ node -v
  v6.7.0
$ npm -v
  3.10.3
7. 验证hyperledger已挂载 Win7 目录

hyperledger挂载点 ($GOPATH/src/github.com/hyperledger/fabric)
已挂载 win 7 local machine目录(d:\GoProjects\src\github.com\hyperledger\fabric)
可用 touch 指令新增 empty file (例如 touch abcd) 测试是否挂载成功

8. 下载编辑 marbles 范例相关档案

将 marbles 范例安装至local machine (https://github.com/IBM-Blockchain/marbles)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值