Hyperledger Explorer is empty with Query - Error:

2019-01-26 03:13发布

问题:

I recently installed Hyperledger Explorer. When running Explorer, it returns nothing to the browser and gives the error:

postgres://hppoc:password@127.0.0.1:5432/fabricexplorer
Please open web browser to access :http://localhost:8080/
[2018-04-16 08:15:18.542] [ERROR] Query - Error: No identity has been assigned to this client
    at Client._getSigningIdentity (/home/ubuntu/blockchain-explorer/node_modules/fabric-client/lib/Client.js:1206:11)
    at Channel.queryInfo (/home/ubuntu/blockchain-explorer/node_modules/fabric-client/lib/Channel.js:896:36)
    at helper.getOrgAdmin.then (/home/ubuntu/blockchain-explorer/app/query.js:98:18)
    at <anonymous>

I tried to console.log the output of blockchain-explorer/node_modules/fabric-client/lib/Client.js:1206:11 indeed the admin variable is undefined

It's pretty weird since I installed Composer before this and it runs perfectly fine. All thecrypto-config uses the default settings provided by the Composer example.

Versions (pretty much latest stable version):

  • OS: Ubuntu 16.04 LTS
  • Docker: 18.03.0-ce
  • Node: v8.11.1
  • Hyperledger Fabric: 1.1.0
  • Hyperledger Composer: 0.19

Explorer config.json pretty much default, no TLS:

{
    "network-config": {
            "org1": {
                    "name": "hlfv1",
                    "mspid": "Org1MSP",
                    "peer1": {
                            "requests": "grpc://127.0.0.1:7051",
                            "events": "grpc://127.0.0.1:7053",
                            "server-hostname": "peer0.org1.example.com"
                    },
                    "admin": {
                            "key": "/home/ubuntu/fabric-tools/fabric-scripts/hlfv11/composer/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore",
                            "cert": "/home/ubuntu/fabric-tools/fabric-scripts/hlfv11/composer/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts"
                    }
            }
    },
    "host": "localhost",
    "port": "8080",
    "channel": "composerchannel",
    "keyValueStore": "/tmp/fabric-client-kvs",
    "eventWaitTime": "30000",
    "pg": {
            "host": "127.0.0.1",
            "port": "5432",
            "database": "fabricexplorer",
            "username": "hppoc",
            "passwd": "password"
    },
    "license": "Apache-2.0"
}

Anything I missed / hints? Thanks beforehand.

回答1:

1. Have a look in your "signcerts" folder. Hyperledger explorer will only accept pem file and no x509 certificate (perhaps it has changed in the last version, I dont know, I still use an old version of explorer). To get the PEM file from your certificate, pick only the part from -----BEGIN CERTIFICATE-----\nMII ... till ...1EHbso=\n-----END CERTIFICATE----- and remove all the end of lines (\n) and finally name the file admin.pem.

Probably you will also need to rename your private key file in your "keystore" folder. Remove "-priv" and replace with "_sk".

2. I don't know if it is case sensitive but the identity you use is "admin" and at the same time, in your keystore and certs path, the identity is "Admin".



回答2:

I had the same problem, but my situation was improved by just adding tls_cacerts to peer configuration ( network-config.org1.peer1.tls_cacerts ) on config.json. I still keep getting the same error on log, but now I can see blocks on Hyperledger Explorer.

  • Ubuntu 16.04.1 LTS
  • Docker version 17.05.0-ce, build 89658be
  • Node v8.11.1
  • Hyperledger Fabric 1.1.0
    • TLS disabled
  • Hyperledger Composer: v0.19.1

According to conversation in Hyperledger Explorer chat, it seems to be a bug that ignores peers without tls_cacerts. In my guess the below might be the code brings this bug. https://github.com/hyperledger/blockchain-explorer/blob/master/app/helper.js#L251



回答3:

I had the same problem.

in my case, it's because I forget these steps:

cd client

npm install

npm run build


回答4:

Got this thing working. There were couple of issues actually.

1. It does work only with TLS. Non-tls doesn't work.
2. The node version has to be 8.9.x.
3. There is one more config file apart from the config.json in the main directory. app/platform/fabric/config.json it has the n/w definition only for the sample n/w/. So this will have issues working with n/w which was not started using the byfn script. Changing this config file allows you to connect to any fabric n/w.