部署环境:
fabric1.1
macOS 10.13.4
git 2.15.2
node v8.11.3
npm v6.1
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(部分不成功,可全局代理)
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.启动区块浏览器
cd blockchain-explorer
node main.js