Hyperledger Explorer部署

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

一、环境要求

  • nodejs 8.11.x(nodejs 9.x不支持)
  • Postgresql 9.5以及更新版本
  • Jq ubuntn安装
sudoapt-get install jq

Hyperledger Explorer工作在Hyperledger Fabric1.3,需要安装两个依赖软件

  • docker 17.06.2-ce
  • docker-compose 1.14.0

二、Clone 仓库

# cd ~/go/src/github.com/hyperledger/
# git clone https://github.com/hyperledger/blockchain-explorer.git.
# cd blockchain-explorer.

三、更新数据库配置

cd blockchain-explorer/app

更改explorerconfig.json更新postgresql属性

"postgreSQL": {
	"host": "127.0.0.1",
	"port": "5432",
	"database": "fabricexplorer",
	"username": "hppoc",
	"passwd": "password"
}

执行创建数据库脚本

# cd blockchain-explorer/app/persistence/fabric/postgreSQL/db
# ./createdb.sh

如果提示permission denied,那么更改/root文件夹权限

chmod +x /root

四、启动Fabric Network

参考https://hyperledger-fabric.readthedocs.io/en/latest/build_network.html

五、配置Hyperledger Explorer

打开另一个终端

cd blockchain-explorer/app/platform/fabric

更改config.json更新网络配置

更改“fabric-path"为你的fabric网络中的路径,比如:
以下key: "tlsCACerts", "adminPrivateKey", "signedCert"中的 "/home/user1/workspace/fabric-samples"更改为"/root/go/src/github.com/hyperledger/fabric-samples"

更改 “network-id.clients.client-id.channel” 为你的默认通道,一般是mychannel。

六、构建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

七、运行Hyperledger Explorer

# cd blockchain-explorer/
# ./start.sh
# ./stop.sh (it will stop the node server).

然后就可以在浏览器中打开http://IP:8080进行访问。

猜你喜欢

转载自blog.csdn.net/weixin_44150643/article/details/86289476