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

  目前我的虛擬機的軟件版本如下:(基本上都是不低於官網文檔要求的版本)  

 

   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/

   否則,根據提示繼續修改錯誤

    正常如下面所示:

 

 

  

 

  

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章