0

我最近安装了 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确实是adminundefined

这很奇怪,因为我在此之前安装了 Composer,它运行得非常好。所有crypto-config使用 Composer 示例提供的默认设置。

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

  • 操作系统:Ubuntu 16.04 LTS
  • 码头工人:18.03.0-ce
  • 节点:v8.11.1
  • 超级账本结构:1.1.0
  • 超级账本作曲家:0.19

Explorerconfig.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"
}

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

4

5 回答 5

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

于 2019-05-16T05:28:05.670 回答
0

1. 查看您的“signcerts”文件夹。Hyperledger explorer 将只接受 pem 文件,不接受 x509 证书(可能在上个版本已经改变,我不知道,我仍然使用旧版本的 explorer)。要从您的证书中获取 PEM 文件,请仅选择 -----BEGIN CERTIFICATE-----\nMII ... 直到 ...1EHbso=\n-----END CERTIFICATE---- 的部分- 并删除所有行尾 (\n),最后将文件命名为 admin.pem。

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

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

于 2018-04-24T07:42:06.100 回答
0

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

  • Ubuntu 16.04.1 LTS
  • Docker 版本 17.05.0-ce,构建 89658be
  • 节点 v8.11.1
  • 超级账本结构 1.1.0
    • 禁用 TLS
  • 超级账本作曲家:v0.19.1

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

于 2018-04-20T05:59:19.733 回答
0

我有同样的问题。

就我而言,这是因为我忘记了这些步骤:

cd client

npm install

npm run build
于 2018-04-26T12:21:22.713 回答
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.
于 2018-06-08T04:41:13.847 回答