The blockchain-explorer environment is built and deployed and combined with the Hyperledger Fabric 2.2 network

1. Address path

github source address:

https://github.com/hyperledger/blockchain-explorer.git

gitee speed mirror address:

https://gitee.com/ryou5416/blockchain-explorer.git

2. System environment requirements

operating system RAM CPU Web environment
CentOS7.8 Above 4G 4 cores or more Internet access

Three, basic environment construction

Docker environment construction in centos system

Four, blockchain-explorer and deployment

1.we need:

Use the following command to clone this repository to get the latest version.

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

Database settings

$ cd blockchain-explorer/app
  • Modify app/explorerconfig.jsonto update PostgreSQL database settings.

    " PostgreSQL " : {
         " host " : " 127.0.0.1 " ,
         " port " : " 5432 " ,
         " database " : " fabricexplorer " ,
         " user name " : " hppoc " ,
         " passwd " : " password "  
    }
    • Another way to configure database settings is to use environment variables, such as setting:

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

    Repeat important operations after each git pull (in some cases, you may need to run from blockchain-explorer/app/persistence/fabric/postgreSQL to apply permissions to the db/ directory:chmod -R 775 db/

Update configuration

  • Modify app/platform/fabric/config.jsonto define the network connection configuration file:

    {
          network-configs :{
              first-network :{
                  name  firstnetwork  profile  ./connection-profile/first-network.json  enableAuthentication false
            }
        },
        license Apache-2.0  
    }
    • first-network Is the name of your connection profile and can be changed to any name
    • name Is the name you want to assign to the network, you can only change the value of the key name
    • profile Is the location of your connection profile, you can only change the value of the key profile
  • Modify the connection configuration file in the JSON file app/platform/fabric/connection-profile/first-network.json:

    • fabric-pathChange to the network disk path in the first-network.json file:
    • Provide the full disk path of the adminPrivateKey config option, it usually ends with _sk, for example: /fabric-path/fabric-samples/first-network/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/aaacd899a6362a5c8cc1e6f86d13bfccc777375365bbda9c710bb7119993d71c_sk
    • adminUserAnd adminPasswordis the credentials of the Explorer user to log in to the dashboard
    • enableAuthentication Is a flag used to enable authentication using the login page, set to false will skip authentication.

Run the create database script:

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

Connect to the PostgreSQL database and run the database status command:

sudo -u postgres psql -c ' \ l '

Create Hyperledger Explorer

Important note: Repeat the following steps after each git pull

  • ./main.sh install
    • Install, run tests and build projects
  • ./main.sh clean
    • 清理/ node_modules,client / node_modules,client / build,client / coverage,app / test / node_modules目录

Either

$ cd blockchain-explorer
$ npm install
$ cd client/
$ npm install
$ npm run build

Run Hyperledger Explorer

Use the command: npm start

Or directly: ./start.sh

Stop: ./stop.sh

Precautions:

1. When adminCredential is started for the first time, it will register the user exploreradmin with CA and save it on the client (maintain the directory-walletstore:/opt/explorer/wallet). Please do not register repeatedly (for example, when you remove the container and anonymous volume, you lose the exploreradmin.id file, you need to change the id to register again, or delete the original user in the ca server), otherwise the browser will fail to start! ! !

 "adminCredential": {
                        "id": "exploreradmin",
                        "password": "exploreradminpw",
                        "affiliation": "org1.department1"
                },

Firewall settings

firewall-cmd --zone=public --add-port= 80/tcp –permanent
firewall-cmd --zone=public --add-port= 5432/tcp –permanent
firewall-cmd reload
  •  

 

Visit address: http://localhost:8080

Username: exploreradmin

Password: exploreradminpw

This project is a document storage solution based on the latest version of Hyperledger Fabric v2.2 blockchain. The project mainly includes two parts: chain code and web application. Fabric chain code is developed by JAVA, responsible for maintaining and storing data and transaction data. The background is a web application developed with Java, which is responsible for providing users with an operation interface for accessing documents on the blockchain, such as data query, channel creation, and chain code deployment. And so on. And provide to build the latest version of the blockchain explorer blockchain-explorer v1.1.3 project, you can easily view the data storage on the blockchain.

Typical case:
Vaccine monitoring platform
based on Hyperledger Fabric blockchain technology Electric vehicle charging transaction information record traceability system
based on Hyperledger Fabric blockchain technology Epidemic health information and outgoing record monitoring platform
based on Hyperledger Fabric blockchain technology based on Hyperledger Fabric area Electronic order traceability system
based on blockchain technology Smart logistics information monitoring system
based on Hyperledger Fabric blockchain technology Student achievement information management system
based on Hyperledger Fabric blockchain technology Smart library management system
based on Hyperledger Fabric blockchain technology based on Hyperledger Fabric The agricultural product traceability system of blockchain technology
... etc., you need to contact the blogger

 

The operation effect is as follows:

Guess you like

Origin blog.csdn.net/wzy4510609/article/details/109393064