HyperLedger Explore 浏览器配置启动教程
Hyperledger Fabric维护的实际上是一个区块链网络。为了能够直观的观察网络上的节点,交易等行为,Hyperledger Explore随之诞生。
本文讲述如何搭建 Hyperledger Explore。
Hyperledger Explorer
源代码链接: https://github.com/hyperledger/blockchain-explorer
目录结构
├── app Application backend root, Explorer configuration
├── rest REST API
├── persistence Persistence layer
├── fabric Persistence API (Hyperledger Fabric)
├── platform Platforms
├── fabric Explorer API (Hyperledger Fabric)
├── test Application backend test
├── client Web UI
├── public Assets
├── src Front end source code
├── components React framework
├── services Request library for API calls
├── state Redux framework
├── static Custom and Assets
浏览器的目的是为了维护网络,所以默认要启动一个fabric网络。默认读者已经部署了一个BYFN网络,如果没有,参考https://hyperledger-fabric.readthedocs.io/en/latest/build_network.html。
准备
首先需要安装:
- nodejs 8.11.x (Note that v9.x is not yet supported)
- PostgreSQL 9.5 or greater
- Jq [https://stedolan.github.io/jq/]
注意对应安装的版本。一般构建完BYFN下面这两个应该都安装了:
- docker 17.06.2-ce [https://www.docker.com/community-edition]
- docker-compose 1.14.0 [https://docs.docker.com/compose/]
下载源码
git上下载源码
git clone https://github.com/hyperledger/blockchain-explorer.git
.cd blockchain-explorer
.
配置/初始化数据库
cd blockchain-explorer/app
这个文件夹下有一个 explorerconfig.json 里面可以配置数据库。
{
"persistence": "postgreSQL",
"platforms": ["fabric"],
"postgreSQL": {
"host": "127.0.0.1",
"port": "",
"database": "fabricexplorer", //数据库名称
"username": "admin123", //用户名
"passwd": "admin123" //密码
},
"sync": {
"type": "local",
"platform": "fabric",
"blocksSyncTime": ""
}
}
后续的初始化脚本会读取这个文件,根据配置的信息登录数据库,执行初始化的创建语句。
执行初始化:
cd blockchain-explorer/app/persistence/fabric/postgreSQL/db
./createdb.sh
这个过程如果报错,需要用户自己登录postgresql 创建对应的数据库 fabricexplorer,用户名 admin123,密码 admin123.
如果出现 Ident authentication failed for user XX错误,修改一下pg_hdconfig的配置就可以了。
执行createdb.sh会执行同一个文件夹的 explorerpg.sql updatepg.sql
设置fabric网络
需要配置浏览器能找到当前fabric网络。
cd blockchain-explorer/app/platform/fabric
vi config.json
搜索config.json中的所有fabric-path。我的fabric-sample安装目录是 /mnt/fabric-samples/ 。所以把fabric-path改成 /mnt/fabric-samples/ 。这样浏览器就能够凭借配置,找到tlsCACerts adminPrivateKey signedCert 来执行网络的查询。
构建Hyperledger Explore
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
在运行test的时候要注意观察是不是所有的mocha的用例都通过了。
启动 Hyperledger Explorer
cd blockchain-explorer/
./start.sh
启动浏览器。这个目录下的脚本 ./stop.sh 用来关闭。 默认的端口是8080
访问对应端口:
最新文章
- [LeetCode] Flatten Binary Tree to Linked List 将二叉树展开成链表
- ubuntu下安装lrzsz
- HTML5的属性
- 奥威软件Speed-BI荣获2016年度中国大数据最佳云平台奖
- spring security防御会话伪造session攻击
- POJ 1251 &;&; HDU 1301	 Jungle Roads (最小生成树)
- c# 中Intern的作用
- ASP.NET 5 Beta8 发布
- centos搭建svn服务器
- ajax不进success,
- 基因探针富集分析(GSEA)&; GO &; pathway
- Sql Server的艺术(三) SQL聚合函数的应用
- nginx 关于client_max_body_size client_body_buffer_size配置
- 数据库【mysql】之pymysql
- 第六章 使用 Bootstrap Typeahead 组件(百度下拉效果)(续)
- HTML和CSS总结
- Spring中的@Async
- grid - 显式网格
- js的JSON
- Storm工作流程
热门文章
- Python基础之字符串操作
- priority_queue用法(转载)
- PHP中怎样让数组以字母为键值来递增
- jQuery 事件 - one() 方法
- torch7 安装中Missing dependencies for nn:moses >= 1错误解决办法
- HDU3037Saving Beans(组合数+lucas定理)
- 经过一年时间的沉淀 再次回首 TCP Socket服务器编程 (二)
- jquery给select赋值
- Poj 1659 Distance on Chessboard(国际象棋的走子规则)
- loadrunner的四个主要部件