1、地址路徑java
github源碼地址:node
https://github.com/hyperledger/blockchain-explorer.gitgit
gitee極速鏡像地址:github
https://gitee.com/ryou5416/blockchain-explorer.gitsql
2、系統環境要求
操做系統 | 內存 | CPU | 網絡環境 |
---|---|---|---|
CentOS7.8 | 4G以上 | 4核以上 | 可訪問互聯網 |
3、基礎環境搭建
centos系統中的docker環境搭建docker
4、blockchain-explorer並部署
1.we need:數據庫
使用如下命令克隆此存儲庫以獲取最新版本。npm
$ git clone https://github.com/hyperledger/blockchain-explorer.git $ cd blockchain-explorer
數據庫設置
$ cd blockchain-explorer/app
-
修改
app/explorerconfig.json
以更新PostgreSQL數據庫設置。json「 postgreSQL 」:{ 「主機」: 「 127.0.0.1 」, 「端口」: 「 5432 」, 「數據庫」: 「 fabricexplorer 」, 「用戶名」: 「 hppoc 」, 「 passwd 」: 「密碼」 }
-
配置數據庫設置的另外一種方法是使用環境變量,例如設置:centos
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/Admin@org1.example.com/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區塊鏈技術的農產品溯源系統
... ... 等等,須要聯繫博主
運行效果以下: