Hyperledger Explorer 安装文档

亦凉 2022-05-26 07:52 343阅读 0赞

安装PostgreSQL参考 在Mac OS X上安装PostgreSQL

在linux 上安装PostgreSQL参考CentOS7安装并配置PostgreSQL
安装成功之后查看版本信息

  1. baimumanagesvr psql --version
  2. psql (PostgreSQL) 10.3

获取blockchain-explorer代码

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

安装数据

  1. blockchain-explorer git:(master) createuser postgres -P
  2. Enter password for new role:
  3. Enter it again:
  4. blockchain-explorer git:(master) sudo psql postgresql://postgres:postgres@localhost:5432/
  5. psql (10.3)
  6. Type "help" for help.
  7. postgres=> \du
  8. List of roles
  9. Role name | Attributes | Member of
  10. -----------+------------------------------------------------------------+-----------
  11. postgres | | {}
  12. xinzhiyun | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
  13. postgres=> help
  14. You are using psql, the command-line interface to PostgreSQL.
  15. Type: \copyright for distribution terms
  16. \h for help with SQL commands
  17. \? for help with psql commands
  18. \g or terminate with semicolon to execute query
  19. \q to quit
  20. postgres=> \c - xinzhiyun //切换角色,不然报没有权限
  21. fabricexplorer=# \l //查看数据库
  22. List of databases
  23. Name | Owner | Encoding | Collate | Ctype | Access privileges
  24. ----------------+-----------+----------+-------------+-------------+-------------------------
  25. fabricexplorer | hppoc | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
  26. postgres | xinzhiyun | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
  27. template0 | xinzhiyun | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/xinzhiyun +
  28. | | | | | xinzhiyun=CTc/xinzhiyun
  29. template1 | xinzhiyun | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/xinzhiyun +
  30. | | | | | xinzhiyun=CTc/xinzhiyun
  31. (4 rows)
  32. fabricexplorer=# \d //查看表
  33. List of relations
  34. Schema | Name | Type | Owner
  35. --------+---------------------------+----------+-------
  36. public | blocks | table | hppoc
  37. public | blocks_id_seq | sequence | hppoc
  38. public | chaincodes | table | hppoc
  39. public | chaincodes_id_seq | sequence | hppoc
  40. public | channel | table | hppoc
  41. public | channel_id_seq | sequence | hppoc
  42. public | peer | table | hppoc
  43. public | peer_id_seq | sequence | hppoc
  44. public | peer_ref_channel | table | hppoc
  45. public | peer_ref_channel_id_seq | sequence | hppoc
  46. public | transaction | table | hppoc
  47. public | transaction_id_seq | sequence | hppoc
  48. public | write_lock | table | hppoc
  49. public | write_lock_write_lock_seq | sequence | hppoc
  50. (14 rows)

修改config.json中的值

  1. {
  2. "network-config": {
  3. "orgsaler": { //此处必须是org开头
  4. "name": "saler",
  5. "mspid": "saler",
  6. "peer1": {
  7. "requests": "grpc://peer0.saler.ennblock.cn:7051",
  8. "events": "grpc://peer0.saler.ennblock.cn:7053",
  9. "server-hostname": "peer0.org1.example.com",
  10. "tls_cacerts": "/Users/xinzhiyun/workspace/src/source.enncloud.cn/Enn-BlockChain/blockchain-explorer/peer/fabric/peer/tls/ca.crt"
  11. },
  12. "admin": {
  13. "key": "/Users/xinzhiyun/workspace/src/source.enncloud.cn/Enn-BlockChain/blockchain-explorer/user/msp/keystore",
  14. "cert": "/Users/xinzhiyun/workspace/src/source.enncloud.cn/Enn-BlockChain/blockchain-explorer/user/msp/signcerts"
  15. }
  16. }
  17. },
  18. "host": "0.0.0.0",
  19. "port": "8080",
  20. "channel": "mychannel",
  21. "keyValueStore": "/tmp/fabric-client-kvs",
  22. "eventWaitTime": "30000",
  23. "pg": {
  24. "host": "127.0.0.1",
  25. "port": "5432",
  26. "database": "fabricexplorer",
  27. "username": "hppoc",
  28. "passwd": "password"
  29. },
  30. "license": "Apache-2.0"
  31. }

编译

  1. cd blockchain-explorer/app/test
  2. npm install
  3. npm run test
  4. cd blockchain-explorer
  5. npm install
  6. cd client/
  7. npm install
  8. npm test -- -u --coverage
  9. npm run build

运行

  1. d blockchain-explorer/
  2. ./start.sh (it will have the backend up).
  3. tail -f log.log (view log)

之后访问localhost:8080就可以访问
这里写图片描述

参考
blockchain-explorer
在Mac OS X上安装PostgreSQL
CentOS7安装并配置PostgreSQL

发表评论

表情:
评论列表 (有 0 条评论,343人围观)

还没有评论,来说两句吧...

相关阅读