Hyperledger Explorer 无法启动,并出现错误“FabricClient - 错误:DiscoveryService:channel1 错误:访问被拒绝”

问题描述 投票:0回答:1

我正在尝试根据“fabric-samples”中提供的示例设置示例 Hyperledger Fabric 网络和 Hyperledger Explorer。

第 1 步:创建网络“test-network”,其中包含 1 个组织“Org1MSP”、1 个订购者“orderer.example.com”、2 个对等节点“peer0.org1.example.com”、“peer0.org2.example.com” ”.

$ ./network.sh up
Using docker and docker-compose
Starting nodes with CLI timeout of '5' tries and CLI delay of '3' seconds and using database 'leveldb' with crypto from 'cryptogen'
LOCAL_VERSION=v2.5.0
DOCKER_IMAGE_VERSION=v2.5.0
/home/xxx/fabric-samples/test-network/../bin/cryptogen
Generating certificates using cryptogen tool
Creating Org1 Identities
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-org1.yaml --output=organizations
org1.example.com
+ res=0
Creating Org2 Identities
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-org2.yaml --output=organizations
org2.example.com
+ res=0
Creating Orderer Org Identities
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-orderer.yaml --output=organizations
+ res=0
Generating CCP files for Org1 and Org2
Creating network "fabric_test" with the default driver
Creating volume "compose_orderer.example.com" with default driver
Creating volume "compose_peer0.org1.example.com" with default driver
Creating volume "compose_peer0.org2.example.com" with default driver
Creating peer0.org1.example.com ... done
Creating orderer.example.com    ... done
Creating peer0.org2.example.com ... done
Creating cli                    ... done
CONTAINER ID   IMAGE                               COMMAND             CREATED                  STATUS                  PORTS                                                                                                                             NAMES
1ab39cf70d5f   hyperledger/fabric-tools:latest     "/bin/bash"         Less than a second ago   Up Less than a second                                                                                                                                     cli
c4abbb9a1532   hyperledger/fabric-peer:latest      "peer node start"   Less than a second ago   Up Less than a second   0.0.0.0:9051->9051/tcp, :::9051->9051/tcp, 7051/tcp, 0.0.0.0:9445->9445/tcp, :::9445->9445/tcp                                    peer0.org2.example.com
13c601be0247   hyperledger/fabric-orderer:latest   "orderer"           Less than a second ago   Up Less than a second   0.0.0.0:7050->7050/tcp, :::7050->7050/tcp, 0.0.0.0:7053->7053/tcp, :::7053->7053/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp   orderer.example.com
9f8086cb1e2d   hyperledger/fabric-peer:latest      "peer node start"   Less than a second ago   Up Less than a second   0.0.0.0:7051->7051/tcp, :::7051->7051/tcp, 0.0.0.0:9444->9444/tcp, :::9444->9444/tcp                                              peer0.org1.example.com

第2步.创建频道“channel1”:

$ ./network.sh createChannel -c channel1
Using docker and docker-compose
Creating channel 'channel1'.
If network is not up, starting nodes with CLI timeout of '5' tries and CLI delay of '3' seconds and using database 'leveldb 
Network Running Already
Using docker and docker-compose
Generating channel genesis block 'channel1.block'
/home/hnadathur/development/blockchain/hyperledger/test-frm-scrtch/fabric-samples/test-network/../bin/configtxgen
+ configtxgen -profile TwoOrgsApplicationGenesis -outputBlock ./channel-artifacts/channel1.block -channelID channel1
2023-07-18 22:32:36.200 CDT 0001 INFO [common.tools.configtxgen] main -> Loading configuration
2023-07-18 22:32:36.206 CDT 0002 INFO [common.tools.configtxgen.localconfig] completeInitialization -> orderer type: etcdraft
2023-07-18 22:32:36.206 CDT 0003 INFO [common.tools.configtxgen.localconfig] completeInitialization -> Orderer.EtcdRaft.Options unset, setting to tick_interval:"500ms" election_tick:10 heartbeat_tick:1 max_inflight_blocks:5 snapshot_interval_size:16777216 
2023-07-18 22:32:36.206 CDT 0004 INFO [common.tools.configtxgen.localconfig] Load -> Loaded configuration: /home/hnadathur/development/blockchain/hyperledger/test-frm-scrtch/fabric-samples/test-network/configtx/configtx.yaml
2023-07-18 22:32:36.207 CDT 0005 INFO [common.tools.configtxgen] doOutputBlock -> Generating genesis block
2023-07-18 22:32:36.207 CDT 0006 INFO [common.tools.configtxgen] doOutputBlock -> Creating application channel genesis block
2023-07-18 22:32:36.207 CDT 0007 INFO [common.tools.configtxgen] doOutputBlock -> Writing genesis block
+ res=0
Creating channel channel1
Using organization 1
+ osnadmin channel join --channelID channel1 --config-block ./channel-artifacts/channel1.block -o localhost:7053 --ca-file /home/hnadathur/development/blockchain/hyperledger/test-frm-scrtch/fabric-samples/test-network/organizations/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem --client-cert /home/hnadathur/development/blockchain/hyperledger/test-frm-scrtch/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt --client-key /home/hnadathur/development/blockchain/hyperledger/test-frm-scrtch/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.key
+ res=0
Status: 201
{
    "name": "channel1",
    "url": "/participation/v1/channels/channel1",
    "consensusRelation": "consenter",
    "status": "active",
    "height": 1
}

Channel 'channel1' created
Joining org1 peer to the channel...
Using organization 1
+ peer channel join -b ./channel-artifacts/channel1.block
+ res=0
2023-07-18 22:32:42.324 CDT 0001 INFO [channelCmd] InitCmdFactory -> Endorser and orderer connections initialized
2023-07-18 22:32:42.364 CDT 0002 INFO [channelCmd] executeJoin -> Successfully submitted proposal to join channel
Joining org2 peer to the channel...
Using organization 2
+ peer channel join -b ./channel-artifacts/channel1.block
+ res=0
2023-07-18 22:32:45.417 CDT 0001 INFO [channelCmd] InitCmdFactory -> Endorser and orderer connections initialized
2023-07-18 22:32:45.467 CDT 0002 INFO [channelCmd] executeJoin -> Successfully submitted proposal to join channel
Setting anchor peer for org1...
Using organization 1
Fetching channel config for channel channel1
Using organization 1
Fetching the most recent configuration block for the channel
+ peer channel fetch config config_block.pb -o orderer.example.com:7050 --ordererTLSHostnameOverride orderer.example.com -c channel1 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem
2023-07-19 03:32:45.618 UTC 0001 INFO [channelCmd] InitCmdFactory -> Endorser and orderer connections initialized
2023-07-19 03:32:45.620 UTC 0002 INFO [cli.common] readBlock -> Received block: 0
2023-07-19 03:32:45.620 UTC 0003 INFO [channelCmd] fetch -> Retrieving last config block: 0
2023-07-19 03:32:45.620 UTC 0004 INFO [cli.common] readBlock -> Received block: 0
Decoding config block to JSON and isolating config to Org1MSPconfig.json
+ configtxlator proto_decode --input config_block.pb --type common.Block --output config_block.json
+ jq '.data.data[0].payload.data.config' config_block.json
Generating anchor peer update transaction for Org1 on channel channel1
+ jq '.channel_group.groups.Application.groups.Org1MSP.values += {"AnchorPeers":{"mod_policy": "Admins","value":{"anchor_peers": [{"host": "peer0.org1.example.com","port": 7051}]},"version": "0"}}' Org1MSPconfig.json
+ configtxlator proto_encode --input Org1MSPconfig.json --type common.Config --output original_config.pb
+ configtxlator proto_encode --input Org1MSPmodified_config.json --type common.Config --output modified_config.pb
+ configtxlator compute_update --channel_id channel1 --original original_config.pb --updated modified_config.pb --output config_update.pb
+ configtxlator proto_decode --input config_update.pb --type common.ConfigUpdate --output config_update.json
+ jq .
++ cat config_update.json
+ echo '{"payload":{"header":{"channel_header":{"channel_id":"channel1", "type":2}},"data":{"config_update":{' '"channel_id":' '"channel1",' '"isolated_data":' '{},' '"read_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org1MSP":' '{' '"groups":' '{},' '"mod_policy":' '"",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '},' '"write_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org1MSP":' '{' '"groups":' '{},' '"mod_policy":' '"Admins",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"AnchorPeers":' '{' '"mod_policy":' '"Admins",' '"value":' '{' '"anchor_peers":' '[' '{' '"host":' '"peer0.org1.example.com",' '"port":' 7051 '}' ']' '},' '"version":' '"0"' '},' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '}}}}'
+ configtxlator proto_encode --input config_update_in_envelope.json --type common.Envelope --output Org1MSPanchors.tx
2023-07-19 03:32:45.801 UTC 0001 INFO [channelCmd] InitCmdFactory -> Endorser and orderer connections initialized
2023-07-19 03:32:45.809 UTC 0002 INFO [channelCmd] update -> Successfully submitted channel update
Anchor peer set for org 'Org1MSP' on channel 'channel1'
Setting anchor peer for org2...
Using organization 2
Fetching channel config for channel channel1
Using organization 2
Fetching the most recent configuration block for the channel
+ peer channel fetch config config_block.pb -o orderer.example.com:7050 --ordererTLSHostnameOverride orderer.example.com -c channel1 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/organizations/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem
2023-07-19 03:32:45.973 UTC 0001 INFO [channelCmd] InitCmdFactory -> Endorser and orderer connections initialized
2023-07-19 03:32:45.975 UTC 0002 INFO [cli.common] readBlock -> Received block: 1
2023-07-19 03:32:45.975 UTC 0003 INFO [channelCmd] fetch -> Retrieving last config block: 1
2023-07-19 03:32:45.976 UTC 0004 INFO [cli.common] readBlock -> Received block: 1
Decoding config block to JSON and isolating config to Org2MSPconfig.json
+ configtxlator proto_decode --input config_block.pb --type common.Block --output config_block.json
+ jq '.data.data[0].payload.data.config' config_block.json
+ jq '.channel_group.groups.Application.groups.Org2MSP.values += {"AnchorPeers":{"mod_policy": "Admins","value":{"anchor_peers": [{"host": "peer0.org2.example.com","port": 9051}]},"version": "0"}}' Org2MSPconfig.json
Generating anchor peer update transaction for Org2 on channel channel1
+ configtxlator proto_encode --input Org2MSPconfig.json --type common.Config --output original_config.pb
+ configtxlator proto_encode --input Org2MSPmodified_config.json --type common.Config --output modified_config.pb
+ configtxlator compute_update --channel_id channel1 --original original_config.pb --updated modified_config.pb --output config_update.pb
+ configtxlator proto_decode --input config_update.pb --type common.ConfigUpdate --output config_update.json
+ jq .
++ cat config_update.json
+ echo '{"payload":{"header":{"channel_header":{"channel_id":"channel1", "type":2}},"data":{"config_update":{' '"channel_id":' '"channel1",' '"isolated_data":' '{},' '"read_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org2MSP":' '{' '"groups":' '{},' '"mod_policy":' '"",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '},' '"write_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org2MSP":' '{' '"groups":' '{},' '"mod_policy":' '"Admins",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Endorsement":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"AnchorPeers":' '{' '"mod_policy":' '"Admins",' '"value":' '{' '"anchor_peers":' '[' '{' '"host":' '"peer0.org2.example.com",' '"port":' 9051 '}' ']' '},' '"version":' '"0"' '},' '"MSP":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '}}}}'
+ configtxlator proto_encode --input config_update_in_envelope.json --type common.Envelope --output Org2MSPanchors.tx
2023-07-19 03:32:46.158 UTC 0001 INFO [channelCmd] InitCmdFactory -> Endorser and orderer connections initialized
2023-07-19 03:32:46.166 UTC 0002 INFO [channelCmd] update -> Successfully submitted channel update
Anchor peer set for org 'Org2MSP' on channel 'channel1'
Channel 'channel1' joined

第 3 步:按照此处提供的设置步骤配置 Hyperledger Explorer:https://github.com/hyperledger-labs/blockchain-explorer/tree/main#quick-start-using-docker

docker-compose.yaml

# SPDX-License-Identifier: Apache-2.0
version: '2.1'

volumes:
  pgdata:
  walletstore:

networks:
  mynetwork.com:
    name: fabric_test

services:

  explorerdb.mynetwork.com:
    image: hyperledger/explorer-db:latest
    container_name: explorerdb.mynetwork.com
    hostname: explorerdb.mynetwork.com
    environment:
      - DATABASE_DATABASE=fabricexplorer
      - DATABASE_USERNAME=hppoc
      - DATABASE_PASSWORD=password
    healthcheck:
      test: "pg_isready -h localhost -p 5432 -q -U postgres"
      interval: 30s
      timeout: 10s
      retries: 5
    volumes:
      - pgdata:/var/lib/postgresql/data
    networks:
      - mynetwork.com

  explorer.mynetwork.com:
    image: hyperledger/explorer:latest
    container_name: explorer.mynetwork.com
    hostname: explorer.mynetwork.com
    environment:
      - DATABASE_HOST=explorerdb.mynetwork.com
      - DATABASE_DATABASE=fabricexplorer
      - DATABASE_USERNAME=hppoc
      - DATABASE_PASSWD=password
      - LOG_LEVEL_APP=info
      - LOG_LEVEL_DB=info
      - LOG_LEVEL_CONSOLE=debug
      - LOG_CONSOLE_STDOUT=true
      - DISCOVERY_AS_LOCALHOST=false
      - PORT=${PORT:-8080}
    volumes:
      - ./config.json:/opt/explorer/app/platform/fabric/config.json
      - ./connection-profile:/opt/explorer/app/platform/fabric/connection-profile
      - ./organizations:/tmp/crypto
      - walletstore:/opt/explorer/wallet
    ports:
      - ${PORT:-8080}:${PORT:-8080}
    depends_on:
      explorerdb.mynetwork.com:
        condition: service_healthy
    networks:
      - mynetwork.com

连接配置文件/test-network.json

{
    "name": "test-network",
    "version": "1.0.0",
    "client": {
        "tlsEnable": true,
        "adminCredential": {
            "id": "exploreradmin",
            "password": "exploreradminpw"
        },
        "enableAuthentication": true,
        "organization": "Org1MSP",
        "connection": {
            "timeout": {
                "peer": {
                    "endorser": "300"
                },
                "orderer": "300"
            }
        }
    },
    "channels": {
        "channel1": {
            "peers": {
                "peer0.org1.example.com": {}
            }
        }
    },
    "organizations": {
        "Org1MSP": {
            "mspid": "Org1MSP",
            "adminPrivateKey": {
                "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/priv_sk"
            },
            "peers": ["peer0.org1.example.com"],
            "signedCert": {
                "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected]"
            }
        }
    },
    "peers": {
        "peer0.org1.example.com": {
            "tlsCACerts": {
                "path": "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
            },
            "url": "grpcs://192.168.176.2:7051",
                        "grpcOptions": {
                            "ssl-target-name-override": "peer0.org1.example.com",
                            "request-timeout": 12000,
                            "grpc.keepalive_time_ms": 600000
                        }
        }
    }
}

我已确保将加密文件从测试网络复制到资源管理器文件夹: cp -r ../测试网络/组织/ .

我运行以下命令来启动资源管理器,但启动失败并显示以下错误消息:

[DiscoveryService]:发送[channel1] - 通道:channel1 收到发现错误:访问被拒绝

运行的Docker容器如下所示:

$ docker ps -a
CONTAINER ID   IMAGE                               COMMAND                  CREATED              STATUS                        PORTS                                                                                                                             NAMES
a05c70be47a2   hyperledger/explorer:latest         "docker-entrypoint.s…"   49 seconds ago       Exited (1) 45 seconds ago                                                                                                                                       explorer.mynetwork.com
647005f40e54   hyperledger/explorer-db:latest      "docker-entrypoint.s…"   About a minute ago   Up About a minute (healthy)   5432/tcp                                                                                                                          explorerdb.mynetwork.com
1ab39cf70d5f   hyperledger/fabric-tools:latest     "/bin/bash"              13 minutes ago       Up 13 minutes                                                                                                                                                   cli
c4abbb9a1532   hyperledger/fabric-peer:latest      "peer node start"        13 minutes ago       Up 13 minutes                 0.0.0.0:9051->9051/tcp, :::9051->9051/tcp, 7051/tcp, 0.0.0.0:9445->9445/tcp, :::9445->9445/tcp                                    peer0.org2.example.com
13c601be0247   hyperledger/fabric-orderer:latest   "orderer"                13 minutes ago       Up 13 minutes                 0.0.0.0:7050->7050/tcp, :::7050->7050/tcp, 0.0.0.0:7053->7053/tcp, :::7053->7053/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp   orderer.example.com
9f8086cb1e2d   hyperledger/fabric-peer:latest      "peer node start"        13 minutes ago       Up 13 minutes                 0.0.0.0:7051->7051/tcp, :::7051->7051/tcp, 0.0.0.0:9444->9444/tcp, :::9444->9444/tcp                                              peer0.org1.example.com

资源管理器日志的输出:

$ docker logs a05c70be47a2 -n 100

> [email protected] app-start /opt/explorer
> ./start.sh

************************************************************************************
**************************** Hyperledger Explorer **********************************
************************************************************************************
[2023-07-19T03:34:37.340] [INFO] PgService - SSL to Postgresql disabled
[2023-07-19T03:34:37.342] [INFO] PgService - connecting to Postgresql postgres://hppoc:******@explorerdb.mynetwork.com:5432/fabricexplorer
[2023-07-19T03:34:37.365] [INFO] Platform -  network_config.id  test-network  network_config.profile  ./connection-profile/test-network.json
[2023-07-19T03:34:37.396] [INFO] Platform - Already registered : admin
[2023-07-19T03:34:37.397] [INFO] FabricConfig - config.client.tlsEnable  true
[2023-07-19T03:34:37.397] [INFO] FabricConfig - FabricConfig, this.config.channels  channel1
2023-07-19T03:34:37.557Z - error: [DiscoveryService]: send[channel1] - Channel:channel1 received discovery error:access denied
[2023-07-19T03:34:37.558] [ERROR] FabricClient - Error: DiscoveryService: channel1 error: access denied
    at DiscoveryService.send (/opt/explorer/node_modules/fabric-common/lib/DiscoveryService.js:363:11)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async NetworkImpl._initializeInternalChannel (/opt/explorer/node_modules/fabric-network/lib/network.js:279:13)
    at async NetworkImpl._initialize (/opt/explorer/node_modules/fabric-network/lib/network.js:231:9)
    at async Gateway.getNetwork (/opt/explorer/node_modules/fabric-network/lib/gateway.js:330:9)
[2023-07-19T03:34:37.558] [INFO] FabricClient - ********* call to initializeDetachClient **********
[2023-07-19T03:34:37.558] [INFO] FabricClient - initializeDetachClient, network config)  {
  name: 'test-network',
  version: '1.0.0',
  client: {
    tlsEnable: true,
    adminCredential: { id: 'exploreradmin', password: 'exploreradminpw' },
    enableAuthentication: true,
    organization: 'Org1MSP',
    connection: { timeout: [Object] }
  },
  channels: { channel1: { peers: [Object] } },
  organizations: {
    Org1MSP: {
      mspid: 'Org1MSP',
      adminPrivateKey: [Object],
      peers: [Array],
      signedCert: [Object]
    }
  },
  peers: {
    'peer0.org1.example.com': {
      tlsCACerts: [Object],
      url: 'grpcs://192.168.176.2:7051',
      grpcOptions: [Object]
    }
  }
}
[2023-07-19T03:34:37.559] [INFO] FabricClient - ************************************* initializeDetachClient *************************************************
[2023-07-19T03:34:37.559] [INFO] FabricClient - Error : Failed to connect client peer, please check the configuration and peer status
[2023-07-19T03:34:37.559] [INFO] FabricClient - Info :  Explorer will continue working with only DB data
[2023-07-19T03:34:37.559] [INFO] FabricClient - ************************************** initializeDetachClient ************************************************
[2023-07-19T03:34:37.561] [INFO] Platform - initializeListener, network_id, network_client  test-network {
  name: 'test-network',
  version: '1.0.0',
  client: {
    tlsEnable: true,
    adminCredential: { id: 'exploreradmin', password: 'exploreradminpw' },
    enableAuthentication: true,
    organization: 'Org1MSP',
    connection: { timeout: [Object] }
  },
  channels: { channel1: { peers: [Object] } },
  organizations: {
    Org1MSP: {
      mspid: 'Org1MSP',
      adminPrivateKey: [Object],
      peers: [Array],
      signedCert: [Object]
    }
  },
  peers: {
    'peer0.org1.example.com': {
      tlsCACerts: [Object],
      url: 'grpcs://192.168.176.2:7051',
      grpcOptions: [Object]
    }
  }
}
[2023-07-19T03:34:37.562] [INFO] main - Please open web browser to access :http://localhost:8080/
[2023-07-19T03:34:37.562] [INFO] main - pid is 20
[2023-07-19T03:34:37.563] [ERROR] main - <<<<<<<<<<<<<<<<<<<<<<<<<< Explorer Error >>>>>>>>>>>>>>>>>>>>>
[2023-07-19T03:34:37.563] [ERROR] main - Error :  [
  'Default client peer is down and no channel details available database'
]
[2023-07-19T03:34:39.563] [INFO] main - Received kill signal, shutting down gracefully
[2023-07-19T03:34:39.566] [INFO] Platform - <<<<<<<<<<<<<<<<<<<<<<<<<< Closing explorer  >>>>>>>>>>>>>>>>>>>>>
[2023-07-19T03:34:39.566] [INFO] main - Closed out connections
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] app-start: `./start.sh`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] app-start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2023-07-19T03_34_39_581Z-debug.log

来自与“peer0.org1.example.com”对应的对等容器的日志条目如下所示:

$ docker logs 9f8086cb1e2d -n 20
2023-07-19 03:32:47.364 UTC 0050 INFO [gossip.channel] reportMembershipChanges -> [[channel1] Membership view has changed. peers went online:  [[peer0.org2.example.com:9051 ]] , current view:  [[peer0.org2.example.com:9051 ]]]
2023-07-19 03:34:37.552 UTC 0051 WARN [policies] SignatureSetToValidIdentities -> invalid identity error="the supplied identity is not valid: x509: certificate signed by unknown authority (possibly because of \"x509: ECDSA verification failure\" while trying to verify candidate authority certificate \"ca.org1.example.com\")" identity="(mspid=Org1MSP [email protected],OU=client,L=San Francisco,ST=California,C=US issuer=CN=ca.org1.example.com,O=org1.example.com,L=San Francisco,ST=California,C=US serialnumber=302167687318362840894181243042446910005)"
2023-07-19 03:34:37.553 UTC 0052 WARN [policies] SignatureSetToValidIdentities -> invalid identity error="the supplied identity is not valid: x509: certificate signed by unknown authority (possibly because of \"x509: ECDSA verification failure\" while trying to verify candidate authority certificate \"ca.org1.example.com\")" identity="(mspid=Org1MSP [email protected],OU=client,L=San Francisco,ST=California,C=US issuer=CN=ca.org1.example.com,O=org1.example.com,L=San Francisco,ST=California,C=US serialnumber=302167687318362840894181243042446910005)"
2023-07-19 03:34:37.553 UTC 0053 WARN [discovery] processQuery -> got query for channel channel1 from 192.168.176.7:56282 but it isn't eligible: implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the 'Writers' sub-policies to be satisfied
2023-07-19 03:34:37.553 UTC 0054 WARN [discovery] processQuery -> got query for channel channel1 from 192.168.176.7:56282 but it isn't eligible: implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the 'Writers' sub-policies to be satisfied
2023-07-19 03:34:37.553 UTC 0055 INFO [comm.grpc.server] 1 -> unary call completed grpc.service=discovery.Discovery grpc.method=Discover grpc.peer_address=192.168.176.7:56282 grpc.peer_subject="CN=fabric-common" grpc.code=OK grpc.call_duration=449.584µs

突出显示以下具体错误消息:

2023-07-19 03:34:37.552 UTC 0051 WARN [策略] SignatureSetToValidIdentities -> 无效身份错误=“提供的身份无效:x509:由未知机构签名的证书(可能是因为“x509:ECDSA 验证失败”在尝试验证候选机构证书“ca.org1.example.com”)“identity=”(mspid=Org1MSP[电子邮件受保护],OU=客户端,L=旧金山,ST=加利福尼亚,C=美国颁发者= CN=ca.org1.example.com,O=org1.example.com,L=旧金山,ST=加利福尼亚,C=US 序列号=302167687318362840894181243042446910005)"

2023-07-19 03:34:37.553 UTC 0053 WARN [discovery] processQuery -> 从 192.168.176.7:56282 获取通道 Channel1 的查询,但不符合条件:隐式策略评估失败 - 满足 0 个子策略,但此政策需要满足“作家”子政策之一

我搜索了这些错误并找到了以下链接,但它们似乎没有解决我的具体情况:

任何解决此问题的帮助将不胜感激。

hyperledger-fabric hyperledger-explorer
1个回答
0
投票

第 1 步。 使用证书颁发机构 (CA) 创建 Hyperledger Fabric 网络。

./network.sh up -ca

第 2 步。 创建频道

./network.sh createChannel -c channel1

docker-compose.yaml:

# SPDX-License-Identifier: Apache-2.0
version: '2.1'

volumes:
  pgdata:
  walletstore:

networks:
  mynetwork.com:
    name: fabric_test

services:

  explorerdb.mynetwork.com:
    image: ghcr.io/hyperledger-labs/explorer-db:latest
    container_name: explorerdb.mynetwork.com
    hostname: explorerdb.mynetwork.com
    environment:
      - DATABASE_DATABASE=fabricexplorer
      - DATABASE_USERNAME=hppoc
      - DATABASE_PASSWORD=password
    healthcheck:
      test: "pg_isready -h localhost -p 5432 -q -U postgres"
      interval: 30s
      timeout: 10s
      retries: 5
    volumes:
      - pgdata:/var/lib/postgresql/data
    networks:
      - mynetwork.com

  explorer.mynetwork.com:
    image: ghcr.io/hyperledger-labs/explorer:latest
    container_name: explorer.mynetwork.com
    hostname: explorer.mynetwork.com
    environment:
      - DATABASE_HOST=explorerdb.mynetwork.com
      - DATABASE_DATABASE=fabricexplorer
      - DATABASE_USERNAME=hppoc
      - DATABASE_PASSWD=password
      - LOG_LEVEL_APP=info
      - LOG_LEVEL_DB=info
      - LOG_LEVEL_CONSOLE=debug
      - LOG_CONSOLE_STDOUT=true
      - DISCOVERY_AS_LOCALHOST=false
      - PORT=${PORT:-8080}
    volumes:
      - ./config.json:/opt/explorer/app/platform/fabric/config.json
      - ./connection-profile:/opt/explorer/app/platform/fabric/connection-profile
      - ./organizations:/tmp/crypto
      - walletstore:/opt/explorer/wallet
    ports:
      - ${PORT:-8080}:${PORT:-8080}
    depends_on:
      explorerdb.mynetwork.com:
        condition: service_healthy
    networks:
      - mynetwork.com

连接配置文件/test-network.json:

{
    "name": "test-network",
    "version": "1.0.0",
    "client": {
        "tlsEnable": true,
        "adminCredential": {
            "id": "exploreradmin",
            "password": "exploreradminpw"
        },
        "enableAuthentication": true,
        "organization": "Org1MSP",
        "connection": {
            "timeout": {
                "peer": {
                    "endorser": "300"
                },
                "orderer": "300"
            }
        }
    },
    "channels": {
        "mychannel": {
            "peers": {
                "peer0.org1.example.com": {}
            }
        }
    },
    "organizations": {
        "Org1MSP": {
            "mspid": "Org1MSP",
            "adminPrivateKey": {
                "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/9e18fa6b36f5823bb485aae73330aa92bf0205937585e9c7383a2c9bc9ab6f9f_sk"
            },
            "peers": ["peer0.org1.example.com"],
            "signedCert": {
                "path": "/tmp/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/cert.pem"
            }
        }
    },
    "peers": {
        "peer0.org1.example.com": {
            "tlsCACerts": {
                "path": "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
            },
            "url": "grpcs://peer0.org1.example.com:7051"
        }
    }
}

第3步。从测试网络复制加密文件。并在connection-profile/test-network.json中设置管理员私钥和signedCert路径。

第 4 步。 启动资源管理器服务

docker-compose up -d
© www.soinside.com 2019 - 2024. All rights reserved.