问题
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.
回答5:
This is because your client _adminSigningIdentity is null. you can check for it by printing the client object by :-
- importing util module (
var util = require('util')
) - printing the client value by
console.log(util.inspect(client))
or by console.log( client.getClientConfig())
If the output is something like this
{ organization: 'org1',
credentialStore:
{ path: '/home/babita/Desktop/My network/fabric-client-kv-org',
wallet: 'wallet-name',
cryptoStore: { path: '/tmp/fabric-client-kv-org' } },
mspid: 'RepackagersMSP' }
Client {
_cryptoSuite:
CryptoSuite_ECDSA_AES {
_keySize: 256,
_hashAlgo: 'SHA2',
_cryptoKeyStore:
CryptoKeyStore {
logger: [Object],
_store: null,
_storeConfig: [Object],
_getKeyStore: [Function] },
_curveName: 'secp256r1',
_ecdsaCurve:
PresetCurve {
curve: [Object],
...
hash: [Object] },
_hashFunction: [Function],
_hashOutputSize: 32,
_ecdsa:
EC {
curve: [Object],
...
hash: [Object] } },
_clientConfigMspid: 'OrgMSP',
_stateStore:
FileKeyValueStore {
_dir: '/home/babita/Desktop/My network/fabric-client-kv-repackagers' },
_userContext: null,
_network_config:
NetworkConfig_1_0 {
_network_config:
{ version: '1.0',
name: 'Network',
'x-type': 'hlfv1',
description: 'your Network',
channels: [Object],
organizations: [Object],
orderers: [Object],
peers: [Object],
certificateAuthorities: [Object],
client: [Object] },
_client_context: [Circular],
_network_config_loc: '/home/babita/Desktop/My network/artifacts/network-config.yaml',
_peers: Map {},
_channel: Map {},
_orderers: Map {} },
_msps: Map {},
_devMode: false,
_adminSigningIdentity: null,
_tls_mutual: {},
_organizations: Map {},
_certificateAuthorities: Map {},
_channels: Map {},
_connection_options: {} }
your _adminSigningIdentity is null
you can fix it by :-
client.setAdminSigningIdentity method (https://fabric-sdk-node.github.io/Client.html#setAdminSigningIdentity)
来源:https://stackoverflow.com/questions/49853848/hyperledger-explorer-is-empty-with-query-error-no-identity-has-been-assigned