Hyperledger Explorer为空,查询 - 错误:未向此客户端分配任何身份

时间:2018-04-16 09:25:52

标签: hyperledger hyperledger-explorer

我最近安装了Hyperledger Explorer。运行资源管理器时,它不向浏览器返回任何内容并给出错误:

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>

我尝试console.log blockchain-explorer/node_modules/fabric-client/lib/Client.js:1206:11的输出确实admin变量为undefined

自从我在此之前安装Composer之后,它非常奇怪,它运行得非常好。所有crypto-config都使用Composer示例提供的默认设置。

版本(几乎是最新的稳定版本):

  • 操作系统:Ubuntu 16.04 LTS
  • Docker:18.03.0-ce
  • 节点:v8.11.1
  • Hyperledger Fabric:1.1.0
  • Hyperledger Composer:0.19

资源管理器config.json几乎默认,没有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"
}

我错过了什么/提示?先谢谢。

5 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,但只是在config.json上将tls_cacerts添加到对等配置(network-config.org1.peer1.tls_cacerts),我的情况得到了改善。我仍然在日志中遇到相同的错误,但现在我可以看到Hyperledger Explorer上的块。

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

根据Hyperledger Explorer聊天中的对话,似乎是一个在没有tls_cacerts的情况下忽略对等的错误。 在我的猜测下面可能是代码带来了这个bug。 https://github.com/hyperledger/blockchain-explorer/blob/master/app/helper.js#L251

答案 1 :(得分:0)

1。 看看你的&#34; signcerts&#34;夹。 Hyperledger资源管理器只接受pem文件,没有x509证书(也许它在上一版本中有所改变,我不知道,我仍然使用旧版本的资源管理器)。 要从证书中获取PEM文件,只选择----- BEGIN CERTIFICATE ----- \ nMII ...中的部分......直到... 1EHbso = \ n ----- END CERTIFICATE ---- - 并删除所有行的末尾(\ n),最后将文件命名为admin.pem。

您可能还需要在&#34; keystore&#34;中重命名您的私钥文件。夹。删除&#34; -priv&#34;并替换为&#34; _sk&#34;。

2。 我不知道它是否区分大小写,但您使用的身份是&#34; admin&#34;同时,在您的密钥库和证书路径中,标识是&#34; Admin&#34;。

答案 2 :(得分:0)

我遇到了同样的问题。

在我的情况下,这是因为我忘了这些步骤:

cd client

npm install

npm run build

答案 3 :(得分:0)

让这件事有效。实际上有几个问题。

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.

答案 4 :(得分:0)

这是因为您的客户端_adminSigningIdentity为空。 您可以通过以下方式打印客户端对象来进行检查:-

  1. 导入util模块(var util = require('util')
  2. 通过console.log(util.inspect(client))打印客户价值或 通过console.log ( client.getClientConfig())

如果输出是这样的


{ 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: {} }


您的_adminSigningIdentity为空

您可以通过:-

对其进行修复

client.setAdminSigningIdentity方法(https://fabric-sdk-node.github.io/Client.html#setAdminSigningIdentity