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. Users have the ability to configure & build Hyperledger Explorer natively on macOS and Ubuntu.

超级账本浏览器是一个简单、强大、易于使用、可维护性强,且开源的浏览器,可用于查看区块链网络的底层活动。用户可在macOS或Ubuntu上本地配置和构建超级账本浏览器。

Table of Contents(目录)

Release Notes

 

Directory Structure(文件夹的结构)

├── 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

Requirements(要求)

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

以下是运行超级账本浏览器的软件依赖性要求

  • nodejs 8.11.x (Note that v9.x is not yet supported)(注意,v9.x版本尚不能支持)
  • PostgreSQL 9.5 or greater(9.5版本或更高版本)
  • Jq [https://stedolan.github.io/jq/]  (jq is a lightweight and flexible command-line JSON processor.   jq是一个轻量、灵活的命令行Json处理器)

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

超级账本浏览器是与Fabric1.3配合工作的。安装以下软件依赖项用以管理fabric网络。

  • docker 17.06.2-ce [https://www.docker.com/community-edition]
  • docker-compose 1.14.0 [https://docs.docker.com/compose/]

Clone Repository

克隆软件仓库

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

使用以下命令克隆此软件仓库,以获得最新版本

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

Database Setup

数据库安装

  • cd blockchain-explorer/app

  • Modify explorerconfig.json to update postgresql properties(修改explorerconfig.json,以便更新postgresql 相关属性)

    • postgreSQL host, port, database, username, password details.
  • "postgreSQL": {

  •   "host": "127.0.0.1",
    
  •   "port": "5432",
    
  •   "database": "fabricexplorer",
    
  •   "username": "hppoc",
    
  •   "passwd": "password"
    
  • }

Another alternative to configure database properties is to use environment variables, example of setting:

另一种配置数据库属性的方法是使用环境变量,例如:

  • export DATABASE_HOST=127.0.0.1
  • export DATABASE_PORT=5432
  • export DATABASE_DATABASE=fabricexplorer
  • export DATABASE_USERNAME=hppoc
  • export DATABASE_PASSWD=pass12345

**Important repeat after every git pull (in some case you may need to apply permission to db/ directory, from blockchain-explorer/app/persistence/fabric/postgreSQL run: chmod -R 775 db/ )

 

Run create database script.

  • cd blockchain-explorer/app/persistence/fabric/postgreSQL/db
  • ./createdb.sh

Run db status commands. Connect to PostgreSQL database.

Ubuntu

  • sudo -u postgres psql

macOS

  • psql postgres

  • \l view created fabricexplorer database

  • \d view created tables

Fabric Network Setup

Setup your own network using Build your network tutorial from Fabric. Once you setup the network, please modify the values in /blockchain-explorer/app/platform/fabric/config.json accordingly.

Fabric Configure Hyperledger Explorer

On another terminal.

  • cd blockchain-explorer/app/platform/fabric
  • Modify config.json to update network-configs.
    • Change "fabric-path" to your fabric network path, example: "/home/user1/workspace/fabric-samples" for the following keys: "tlsCACerts", "adminPrivateKey", "signedCert".
    • Final path for key "tlsCACerts" will be: "/home/user1/workspace/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt".
  • Modify "network-id.clients.client-id.channel" to your default channel for each client

or

Hyperledger Composer Setup

Setup your own network using Composer Build your network from Hyperledger Composer. Once you setup the network, please modify the values in /blockchain-explorer/app/platform/fabric/config.json accordingly.

Composer Configure Hyperledger Explorer

On another terminal.

 

If you are connecting to a non TLS fabric peer, please modify "network-id.clients.client-id.tlsEnable" (true->false) in config.json. Depending on this configuration, the application decides whether to go TLS or non TLS route.

or

Hyperledger Cello Setup

Setup your fabric network using Cello Build your network from Hyperledger Cello. Once you setup the network, please modify the values in /blockchain-explorer/app/platform/fabric/config.json accordingly.

Cello Configure Hyperledger Explorer

On another terminal.

    • git checkout v0.3.5.1
    • cd blockchain-explorer/app/platform/fabric
    • Modify config.json to update network-config.
    • Modify "syncStartDate" to filter data by block timestamp
    • Modify "channel" to your default channel

    If you are connecting to a non TLS fabric peer, please modify "network-id.clients.client-id.tlsEnable" (true->false) in config.json. Depending on this configuration, the application decides whether to go TLS or non TLS route.

    Build Hyperledger Explorer

    **Important repeat after every git pull

    On another terminal.

    Run Hyperledger Explorer

    Sync Process Configuration

    Host (Standalone)

     "sync": {
        "type": "host"
     }

    Local (Run with Explorer)

     "sync": {
        "type": "local"
     }

    From new terminal.

      • git checkout v0.3.5.1
      • cd blockchain-explorer/app/platform/fabric
      • Modify config.json to update network-config.
      • Modify "syncStartDate" to filter data by block timestamp
      • Modify "channel" to your default channel
      • 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
      • cd blockchain-explorer/app
      • Modify explorerconfig.json to update sync properties
        • sync type (local or host), platform, blocksSyncTime(in min) details.
      • Please restart Explorer if any changes made to explorerconfig.json.
      • Ensure same configuration in Explorer explorerconfig.json if sync process is running from different locations

      From new terminal(If Sync Process in Standalone).

      Run Hyperledger Explorer using Docker

      There is also an automated deployment of the Hyperledger Explorer available via docker having next assumptions:

      Non interactive deployment assumptions

      Docker

      Steps to deploy using Docker

      From new terminal.

      From new terminal.

      Note: the example with additional information can be found at examples/net1 folder.

      Joining existing Docker network

      If the Blockchain network is deployed in the Docker, you may pass network name as second parameter to join that network (docker_network in the example below):

      Steps to stop containers

      Steps to remove containers and clean images

      NPM utility scripts to Dockerise application

      Set the DOCKER_REGISTRY variable to the Container Registry you will use and login to that registry if you want to store your container there.

      To build the container (auto-tagged as latest), run:

      npm run docker_build
      

      To tag the container with your registry and the NPM package version, run:

      npm run docker_tag
      

      To push the container to your registry, run:

      npm run docker_push
      

      Hyperledger Explorer Swagger

      Logs

      Troubleshooting

      License

      Hyperledger Explorer Project source code is released under the Apache 2.0 license. The README.md, CONTRIBUTING.md files, and files in the "images", "snapshots" folders are licensed under the Creative Commons Attribution 4.0 International License. You may obtain a copy of the license, titled CC-BY-4.0, at http://creativecommons.org/licenses/by/4.0/.

        • cd blockchain-explorer/
        • ./start.sh (it will have the backend up).
        • Launch the URL http://localhost:8080 on a browser.
        • ./stop.sh (it will stop the node server).
        • cd blockchain-explorer/

        • ./syncstart.sh (it will have the sync node up). [Note : pass network-id and client-id to start specific client sync process, else first network and client will be considered]

        • ./syncstop.sh (it will stop the sync node).

        • If the Hyperledger Explorer was used previously in your browser be sure to clear the cache before relaunching.

        • BASH installed
        • Docker is installed on deployment machine.
        • By default, deployment script uses 192.168.10.0/24 virtual network, and needs to be available with no overlapping IPs (this means you can't have physical computers on that network nor other docker containers running). In case of overlappings, edit the script and change target network and container targets IPs.
        • By default both services (fronted and database) will run on same machine, but script modifications is allowed to run on separate machines just changing target DB IP on frontend container.
        • Crypto material is correctly loaded under examples/$network/crypto
        • Fabric network configuration is correctly set under examples/$network/config.json
        • Hyperledger Explorer docker repository https://hub.docker.com/r/hyperledger/explorer/
        • Hyperledger Explorer PostgreSQL docker repository https://hub.docker.com/r/hyperledger/explorer-db
        • cd blockchain-explorer/
        • Create a new folder (lets call it dockerConfig) to store your hyperledger network configuration under examples (mkdir -p ./examples/dockerConfig)
        • Save your hyperledger network configuration under examples/dockerConfig/config.json.
        • Save your hyperledger network certs data under examples/dockerConfig/crypto.
        • Run the explorer pointing to previously created folder.
        • cd blockchain-explorer/
        • ./deploy_explorer.sh dockerConfig (it will automatically deploy both database and frontend apps using Hyperledger Fabric network configuration stored under examples/dockerConfig folder)
        • ./deploy_explorer.sh dockerConfig docker_network
        • ./deploy_explorer.sh --down
        • ./deploy_explorer.sh --clean
        • Please visit the ./logs/console folder to view the logs relating to console and ./logs/app to view the application logs and visit the ./logs/db to view the database logs.
        • Logs rotate for every 7 days.
        • Please visit the TROUBLESHOOT.md to view the Troubleshooting TechNotes for Hyperledger Explorer.
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值