部署explorer

注意
这里使用的explorer版本为3.9,对应fabric版本为1.4,针对自己使用的软件版本挑选https://github.com/hyperledger/blockchain-explorer

依赖

  • nodejs 8.11.x (Note that v9.x is not yet supported)
  • PostgreSQL 9.5 or greater
  • Jq [https://stedolan.github.io/jq/]
  • docker 17.06.2-ce [https://www.docker.com/community-edition]
  • docker-compose 1.14.0 [https://docs.docker.com/compose/]

http://123.207.166.162:8090/#/

准备工作

克隆区块链浏览器资源

git clone https://github.com/hyperledger/blockchain-explorer.git

数据库

数据库配置

修改 blockchain-explorer/app/explorerconfig.json 与当前的数据库一致

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

或使用环境变量配置方案

export DATABASE_HOST=127.0.0.1
export DATABASE_PORT=5432
export DATABASE_DATABASE=fabricexplorer
export DATABASE_USERNAME=hppoc
export DATABASE_PASSWD=pass12345

初始化PostgreSQL

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

有时候需要配置权限,在blockchain-explorer/app/persistence/fabric/postgreSQL下执行chmod -R 775 db/

区块链网络配置

修改
/Users/qifei/IdeaProjects/blockchain-explorer/app/platform/fabric/config.json

  • fabric-path 修改为fabric网络目录
  • channel 改为默认的channel
  • 如果连接的是一个非TLS的fabric节点,将network-id.clients.client-id.tlsEnable修改为false

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

过程中可能会遇到node err,根据提示进行操作,如

  • npm audit fix
  • npm audit fix --force
  • rm package-lock.json && rm -rf node_modules/*
  • vim package.json 或删除某些node_module

运行

同步配置

"sync": {
    "type": "local",
    "platform": "fabric",
    "blocksSyncTime": "3"
  }
  • type: 同步类型,local 或 host
  • blocksSyncTime:同步时间(分钟)

启动

./start.sh
./stop.sh

后台执行命令,查看日志
tail -f ./logs/sync/console/console-*.log

访问地址:http://localhost:8080

如果端口号占用,修改
blockchain-explorer/appconfig.json

Docker 方式

镜像地址:

hyperledger/explorer
hyperledger/explorer-db
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值