部署環境:
fabric1
macOS
git
node v8
npm v6
1.配置fabric 基礎環境(略)
2.啟動網絡
cd /Users/yunlong/go/src/github.com/hyperledger/fabric-samples/first-network
./byfn.sh -m up
啟動成功得樣子
3.找到fabric 配置檔案路徑(複制)
本機:/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 資料庫
brew install PostgreSQL
配置環境變量
![這裡寫圖檔描述](https://img-blog.csdn.net/20180710151043915?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3UwMTM3MzczMzY=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
6.連結資料庫
psql postgres
7.執行建立資料庫
\i app/persistance/postgreSQL/db/explorerpg.sql
\i app/persistance/postgreSQL/db/updatepg.sql
8.檢視建立資料庫
\l view created fabricexplorer database
\d view created tables
9.配置資料庫
檔案路徑如圖所示(app/persistance/postgreSQL/db/pgconfig.json)
(注意:可先指令行測試連結資料庫是否成功,psql postgres://hppoc:[email protected]:5432/fabricexplorer)
10.将圖中标出路徑本檔案全部替換為 第3步 的路徑
11.另起來一個終端 build hyperledger explorer(部分不成功,可全局代理)
cd blockchain-explorer
npm install
cd blockchain-explorer/app/test
npm install
npm run test
cd client/
npm install
npm test -- -u --coverage
npm run build
12.啟動區塊浏覽器
cd blockchain-explorer
node main.js