安装 Hyperledger Explorer及翻译中文

阅读: 评论:0

安装 Hyperledger Explorer及翻译中文

安装 Hyperledger Explorer及翻译中文

Hyperledger Explorer

Hyperledger Explorer is a simple, powerful, easy-to-use, highly maintainable, open source browser for viewing activity on the underlying blockchain network.

Directory Structure

├── app                    fabric GRPC interface
├── db             the mysql script and help class
├── explorer_client        Web Ui
├── first-network   Basic fabric network setup
├── listener               websocket listener
├── metrics                metrics about tx count per minute and block count per minute
├── service                the service 
├── socket         push real time data to front end
├── timer                  Timer to post information periodically  
└── utils                  Various utility scripts 

Requirements

Following are the software dependencies required to install and run hyperledger explorer

  • nodejs 6.9.x (Note that v7.x is not yet supported)
  • mysql 5.7 or greater

Hyperledger Explorer works with Hyperledger Fabric 1.0. Install the following software dependencies to manage fabric network.

  • docker 17.06.2-ce []
  • docker-compose 1.14.0 [/]

Clone Repository

Clone this repository to get the latest using the following command.

  1. git clone .git
  2. cd blockchain-explorer

Database setup

Run the database setup scripts located under db/fabricexplorer.sql

mysql -u -p < db/fabricexplorer.sql

Fabric network setup

Setup your own network using Build your network tutorial from Fabric. Once you setup the network, please modify the values in config.json accordingly.

Running blockchain-explorer

On another terminal,

  1. cd blockchain-explorer
  2. Modify config.json to update network-config
    Change “fabric-path” to your fabric network path, example “/home/user1/workspace/fabric-samples” for the following keys: “tls_cacerts”, “key”, “cert”.
    Final path for key “tls_cacerts” will be “/home/user1/workspace/fabric-samples/first-network/crypto-config/ample/ample/”
  3. Modify config.json to update one of the channel

    • mysql host, username, password details

      “channel”: “mychannel”,
      “mysql”:{
      “host”:”127.0.0.1”,
      “database”:”fabricexplorer”,
      “username”:”root”,
      “passwd”:”123456”
      }

If you are connecting to a non TLS fabric peer, please modify the

protocol (grpcs->grpc) and port (9051-> 9050) in the peer url and remove the tls_cacerts. Depending on this key, the application decides whether to go TLS or non TLS route.

  1. npm install
  2. ./start.sh

Launch the URL localhost:8080 on a browser.

重要的要修改第二步,在config.json中fabric-path改为实际的路径

常见问题集

在ubuntu18下运行正常的blockchain-explorer 可以 通过打包复制到新机器centos7下 避免容易出问题npm install 的地方
TypeError: Cannot read property ‘on’ of undefined 问题

[root@localhost blockchain-explorer]# ./start.sh
/opt/gopath/src/github/hyperledger/blockchain-explorer/main.js:74
('connection', connection => {
^
TypeError: Cannot read property 'on' of undefined
at Object.<anonymous> (/opt/gopath/src/github/hyperledger/blockchain-explorer/main.js:74:8)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3

暂时没找到原因 npm install 通过淘宝镜像 安装 的正常,初步猜测1.npm install 淘宝 的问题,2.fabric的config.json配置问题,再看看

运行在 fabric-samples下的fabcar上引起的问题
[root@localhost blockchain-explorer]# ./start.sh 
postgres://hppoc:password@127.0.0.1:5432/fabricexplorer
(node:4774) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, scandir '/opt/gopath/src/github/hyperledger/fabric-samples/basic-network/crypto-config/ample/users/Admin&#ample/msp/keystore'at addirSync (fs.js:904:18)adAllFiles (/opt/gopath/src/github/hyperledger/blockchain-explorer/app/helper.js:25:18)at Platform.setAdminForClient (/opt/gopath/src/github/hyperledger/blockchain-explorer/app/platform/fabric/Platform.js:78:37)at Platform.initialize (/opt/gopath/src/github/hyperledger/blockchain-explorer/app/platform/fabric/Platform.js:146:18)at <anonymous>
(node:4774) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:4774) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
^CReceived kill signal, shutting down gracefully
Closed out remaining connections

删除fabric的config.json中多余的证书,主意标点符号,别删多了少了,不然会出现 TypeError: Cannot read property ‘on’ of undefined 问题

[root@localhost blockchain-explorer]# ./start.sh 
/opt/gopath/src/github/hyperledger/blockchain-explorer/main.js:74
('connection', connection => {^TypeError: Cannot read property 'on' of undefinedat Object.<anonymous> (/opt/gopath/src/github/hyperledger/blockchain-explorer/main.js:74:8)at Module._compile (module.js:652:30)at Object.Module._extensions..js (module.js:663:10)at Module.load (module.js:565:32)at tryModuleLoad (module.js:505:12)at Function.Module._load (module.js:497:3)at Function.Module.runMain (module.js:693:10)at startup (bootstrap_node.js:191:16)at bootstrap_node.js:612:3
forEach 问题(.5/TROUBLESHOOT.md)
[root@localhost blockchain-explorer]# ./start.sh 
postgres://hppoc:password@127.0.0.1:5432/fabricexplorer
E0903 03:29:13.267101332    4851 ssl_transport_security:989] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
E0903 03:29:14.269565151    4851 ssl_transport_security:989] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
E0903 03:29:16.173519478    4851 ssl_transport_security:989] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
error: [Remote.js]: Error: Failed to connect before the deadline
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: Failed to connect before the deadlineat checkState (/opt/gopath/src/github/hyperledger/blockchain-explorer/node_modules/grpc/src/client.js:838:16)
(node:4851) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'forEach' of undefinedat Platform.setChannels (/opt/gopath/src/github/hyperledger/blockchain-explorer/app/platform/fabric/Platform.js:192:26)at <anonymous>at process._tickCallback (internal/process/next_tick.js:188:7)
(node:4851) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4851) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
E0903 03:29:18.679853789    4851 ssl_transport_security:989] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
^CReceived kill signal, shutting down gracefully
Closed out remaining connections

参考官方的说明,大概就是把config.json中的grpcs 改为grpc就行

最后,版本容易引起问题,release-3.5 使用postgrsql db
db error { error: Ident authentication failed for user “hppoc”
1). 运行下面的命令编辑f文件 sudo vim /etc/postgresql/9.1/main/f2). 将# Database administrative login by Unix domain socketlocal     all      postgres        peer改为 # Database administrative login by Unix domain socketlocal     all     postgres         trust

入乡随俗

初步修改为中文,注意事项:
修改文件为blockchain-explorerclientsrccomponentsHeader 和blockchain-explorerclientsrccomponentsView 等其它的
修改后在blockchain-explorer/client 执行npm run build 才行


断断续续两天, 终于完成了blockchain-explorer 90%的汉化,大致效果如下:




使用的版本是release-3.5,其它的没有测试,总结起来没什么技术含量,需要注意的一点是修改后需要编译才能起作用
汉化代码
还有个事svg文件编译,自行百度Adobe Illustrator吧
如果有翻译的不合适或者有更好的表述,欢迎留言

本文发布于:2024-01-31 15:06:47,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170668480829389.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:中文   Hyperledger   Explorer
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23