部署環(huán)境:
fabric1.1
macOS 10.13.4
git 2.15.2
node v8.11.3
npm v6.1
1.配置fabric 基礎(chǔ)環(huán)境(略)
2.啟動網(wǎng)絡(luò)
cd /Users/yunlong/go/src/github.com/hyperledger/fabric-samples/first-network
./byfn.sh -m up
啟動成功得樣子

1.png
3.找到fabric 配置文件路徑(復(fù)制)

2.png
本機:/Users/yunlong/go/src/github.com/hyperledger/fabric-samples/first-network/crypto-config
4.克隆源碼,進入源碼目錄下
https://github.com/hyperledger/blockchain-explorer.git
cd blockchain-explorer
5.安裝postgreSQL 數(shù)據(jù)庫
brew install PostgreSQL
配置環(huán)境變量

3.png
6.鏈接數(shù)據(jù)庫
psql postgres

4.png
7.執(zhí)行創(chuàng)建數(shù)據(jù)庫
\i app/persistance/postgreSQL/db/explorerpg.sql
\i app/persistance/postgreSQL/db/updatepg.sql
8.查看創(chuàng)建數(shù)據(jù)庫
\l view created fabricexplorer database
\d view created tables
9.配置數(shù)據(jù)庫
文件路徑如圖所示(app/persistance/postgreSQL/db/pgconfig.json)

5.png
(注意:可先命令行測試鏈接數(shù)據(jù)庫是否成功,psql postgres://hppoc:password@127.0.0.1:5432/fabricexplorer)
10.將圖中標出路徑本文件全部替換為 第3步 的路徑

6.png
11.另起來一個終端 build hyperledger explorer(部分不成功,可全局代理)
1. cd blockchain-explorer
2. npm install
3. cd blockchain-explorer/app/test
4. npm install
5. npm run test
6. cd client/
7. npm install
8. npm test -- -u --coverage
9. npm run build
12.啟動區(qū)塊瀏覽器
cd blockchain-explorer
node main.js

7.png
13.打開chrome 訪問:http://localhost:8080/

8.png