fabric explorer浏览器环境搭建

Blockchain-explorer环境搭建教程

参考官方文档:https://github.com/hyperledger/blockchain-explorer

1:首先安装所需要的软件:

a. Nodejs 6.9x

b. Mysql 5.7 or greater

c. Docker 17.06.2-ce

d. Docker-compose 1.14.0

  目前我的虚拟机的软件版本如下:(基本上都是不低于官网文档要求的版本)  

 fabric explorer浏览器环境搭建

   Mysql5.7.2版本的

 

2:下载浏览器源码

  执行: git clone https://github.com/hyperledger/blockchain-explorer.git

cd blockchain-explorer

  进入到该浏览器代码的目录下面

  (注意:如果公司无法访问该网站,可以直接下载下来拷贝进去是一样可以使用的)

 

3:数据库设置

   进入到该浏览器代码的目录下面:

   执行:mysql -u<username> -p < db/fabricexplorer.sql

   通过自带的脚本进行建表和数据库操作

 

4:fabric网络启动

   进入到该浏览器代码的目录下面的first-network目录下:

1.首先查看是否有一个crypto-config的文件夹(这个文件夹在完整的fabric-sample文件夹下面的first-network中有),我在后面启动的时候出现错误,后来发现他这个浏览器下面的first-network例子并不完整,需要自己添加上。

  (如果你没有下载fabric-sample, 这是云盘链接:https://pan.baidu.com/s/1bozQxA3 密码:llm3

2.执行下面的命令启动网络;

   cd first-network

./bootstrap-1.0.2.sh - This is going to download the necessary binaries and hyperledger docker images.

mkdir -p ./channel-artifacts

./byfn.sh -m generate -c mychannel

./byfn.sh -m up -c mychannel

  执行完以后,和以前的first-network启动是一样的

5:启动区块链浏览器

   启动另外一个终端:

1.cd blockchain-explorer  进入到浏览器目录下面

2.更改config.json中的配置mysql host, username, password details

     

 "channel":"mychannel",

 "mysql":{

      "host":"127.0.0.1",

      "database":"fabricexplorer",  

      "username":"root",  

      "passwd":"123456"  (自己的数据库密码)

   }

 

  官方文档中说:If you are connecting to a non TLS fabric peer, please modify the protocol (grpcs->grpc) and port (9051-> 9050) in the peer url and remove the tls_cacerts. Depending on this key, the application decides whether to go TLS or non TLS route.(是否是TLS节点,需要修改(grpcs->grpc)(9051-> 9050)并将证书删掉),实验证明,first-network中是有TLS节点的,所以这些不需要做任何的改动。

3.npm install

4../start.sh

5:在浏览器中输入: http://localhost:8080进行浏览

 

6:如果出现显示不正常,看日志

   错误信息都会在浏览器目录下面log.log中打印日志

   如果正常,则log.log内容只显示一行:Please open Internet explorer to accesshttp://localhost:8080/

   否则,根据提示继续修改错误

    正常如下面所示:

 fabric explorer浏览器环境搭建