一、地址路径
github源码地址:
https://github.com/hyperledger/blockchain-explorer.git
gitee极速镜像地址:
https://gitee.com/ryou5416/blockchain-explorer.git
二、系统环境要求
操作系统 | 内存 | CPU | 网络环境 |
---|---|---|---|
CentOS7.8 | 4G以上 | 4核以上 | 可访问互联网 |
三、基础环境搭建
四、blockchain-explorer并部署
1.we need:
使用以下命令克隆此存储库以获取最新版本。
$ git clone https://github.com/hyperledger/blockchain-explorer.git $ cd blockchain-explorer
数据库设置
$ cd blockchain-explorer/app
-
修改
app/explorerconfig.json
以更新PostgreSQL数据库设置。“ postgreSQL ”:{ “主机”: “ 127.0.0.1 ”, “端口”: “ 5432 ”, “数据库”: “ fabricexplorer ”, “用户名”: “ hppoc ”, “ passwd ”: “密码” }
-
配置数据库设置的另一种方法是使用环境变量,例如设置:
扫描二维码关注公众号,回复: 12088867 查看本文章DATABASE_HOST = 127.0.0.1 DATABASE_PORT = 5432 DATABASE_DATABASE = fabricexplorer DATABASE_USERNAME = hppoc DATABASE_PASSWD = pass12345
在每次git pull之后重复重要的操作(在某些情况下,您可能需要从blockchain-explorer / app / persistence / fabric / postgreSQL运行对db /目录应用权限:
chmod -R 775 db/
-
更新配置
-
修改
app/platform/fabric/config.json
以定义网络连接配置文件:{ “ network-configs ”:{ “ first-network ”:{ “ name ”:“ firstnetwork ”, “ profile ”:“ ./connection-profile/first-network.json ”, “ enableAuthentication ”:false } }, “license”: “ Apache-2.0 ” }
first-network
是您的连接配置文件的名称,可以更改为任何名称name
是您要为网络指定的名称,您只能更改密钥的值name
profile
是您的连接配置文件的位置,您只能更改密钥的值profile
-
修改JSON文件中的连接配置文件
app/platform/fabric/connection-profile/first-network.json
:fabric-path
在first-network.json文件中更改为网络磁盘路径:- 提供adminPrivateKey config选项的完整磁盘路径,它通常以结尾
_sk
,例如:/fabric-path/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/aaacd899a6362a5c8cc1e6f86d13bfccc777375365bbda9c710bb7119993d71c_sk
adminUser
并且adminPassword
是Explorer的用户登录仪表板的凭据enableAuthentication
是用于使用登录页面启用身份验证的标志,设置为false将跳过身份验证。
运行创建数据库脚本:
-
$ cd blockchain-explorer/app/persistence/fabric/postgreSQL/db $ ./createdb.sh
连接到PostgreSQL数据库并运行数据库状态命令:
sudo -u postgres psql -c ' \ l '
建立Hyperledger Explorer
重要提示:每次git pull后重复以下步骤
./main.sh install
- 安装,运行测试和构建项目
./main.sh clean
- 清理/ node_modules,client / node_modules,client / build,client / coverage,app / test / node_modules目录
要么
$ cd blockchain-explorer
$ npm install
$ cd client/
$ npm install
$ npm run build
运行Hyperledger Explorer
使用命令:npm start
或者直接:./start.sh
停止:./stop.sh
注意事项:
1.adminCredential在首次启动时,会向CA注册用户exploreradmin,并在客户端留存(保持目录- walletstore:/opt/explorer/wallet)。请不要重复注册(例如移除容器和匿名卷时,丢失exploreradmin.id文件,此时需要换一个id重新注册,或者在ca服务器中删除原有用户),否则浏览器启动失败!!!
"adminCredential": {
"id": "exploreradmin",
"password": "exploreradminpw",
"affiliation": "org1.department1"
},
firewall-cmd --zone=public --add-port= 80/tcp –permanent
firewall-cmd --zone=public --add-port= 5432/tcp –permanent
firewall-cmd reload
访问地址:http://localhost:8080
用户名:exploreradmin
密码:exploreradminpw
本项目为基于最新版本Hyperledger Fabric v2.2区块链的单据存储解决方案,项目主要包括链码和 Web应用两部分。Fabric链码采用JAVA开发,负责维护和存储数据及交易数据,后台为采用java开发 的Web应用,负责为用户提供访问区块链上单据的操作界面,例如数据查询、创建通道、部署链码等等操作。并提供搭建最新版本区块链浏览器blockchain-explorer v1.1.3项目,可以方便查看区块链上的数据存储情况。
典型案例:
基于Hyperledger Fabric区块链技术的疫苗监控平台
基于Hyperledger Fabric区块链技术的电动汽车充电交易信息记录溯源系统
基于Hyperledger Fabric区块链技术的疫情健康信息及外出记录监控平台
基于Hyperledger Fabric区块链技术的电子订单溯源系统
基于Hyperledger Fabric区块链技术的智慧物流信息监控系统
基于Hyperledger Fabric区块链技术的学生成绩信息管理系统
基于Hyperledger Fabric区块链技术的智慧图书馆管理系统
基于Hyperledger Fabric区块链技术的农产品溯源系统
... ... 等等,需要联系博主
运行效果如下: