Unable to setup hyperledger explorer with one node (like basic network example)

只谈情不闲聊 提交于 2019-12-08 10:32:00

问题


Has anyone managed to setup hyperledger explorer with the basic network example (managed to set it up with first network). It wont pick up my peer/channel in this case. The configuration works with four peers and an orderer with two orgs (first-network) but I cant seem to get it to work with just one peer. Any help would be appreciated !

Fabric Version : 1.2 Explorer version : 3.7.1

config.json (The actual file is well formatted) :-

    {
     "network-configs": {
       "network-1": {
         "version": "1.0",
          "clients": {
            "client-1": {
               "tlsEnable": true,
               "organization": "Org1MSP",
               "channel": "myc",
               "credentialStore": {
               "path": "./tmp/credentialStore_Org1/credential",
               "cryptoStore": {
                  "path": "./tmp/credentialStore_Org1/crypto"
                }
      }
    }
  },
  "channels": {
    "myc": {
      "peers": {
        "peer0.org1.example.com": {}
      },
      "connection": {
        "timeout": {
          "peer": {
            "endorser": "6000",
            "eventHub": "6000",
            "eventReg": "6000"
          }
        }
      }
    }
  },
  "organizations": {
    "Org1MSP": {
      "mspid": "Org1MSP",
      "fullpath": false,
      "adminPrivateKey": {
        "path":
          "/fabricsamples/basic-network/crypto-config/org1.example.com/users/Admin@org1.example.com/msp/keystore"
      },
      "signedCert": {
        "path":
          "/fabricsamples/basic-network/crypto-config/org1.example.com/users/Admin@org1.example.com/msp/signcerts"
      }
    },
    "OrdererMSP": {
      "mspid": "OrdererMSP",
      "adminPrivateKey": {
        "path":
          "/fabricsamples/basic-network/crypto-config/ordererOrganizations/example.com/users/Admin@example.com/msp/keystore"
      }
    }
  },
  "peers": {
    "peer0.org1.example.com": {
      "tlsCACerts": {
        "path":
          "/fabricsamples/basic-network/crypto-config/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
      },
      "url": "grpcs://peer0.org1.example.com:7051",
      "eventUrl": "grpcs://peer0.org1.example.com:7053",
      "grpcOptions": {
        "ssl-target-name-override": "peer0.org1.example.com"
      }
    }
  },
  "orderers": {
    "orderer.example.com": {
      "url": "grpcs://orderer.example.com:7050"
    }
  }
}
     },
    "configtxgenToolPath": "/home/ett/go/src/themeSCF/bin",
     "license": "Apache-2.0"
    }

回答1:


Firstly, a few suggestions regarding your config file:

  • tlsEnable should be false - the basic-network example does not use TLS.
  • All URLs should use grpc - grpcs is only used when TLS is enabled.
  • All URLs should use localhost - assuming your path entries are correct, it looks like you are running Explorer locally (i.e. not in a container). In this scenario, all addresses should use localhost.

You also need to edit the docker-compose.yml file used by basic-network to add the following:

services: 
  peer0.org1.example.com: 
      environment:
        - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051

Without this, the peer will reject all connections from outside its own organisation.

With this change applied to docker-compose.yml, I was able to successfully deploy Explorer 3.7 in a docker container by following the instructions here, using a configuration folder named basic-network and the following command:

./deploy_explorer.sh basic-network net_basic

and with the following config.json file in blockchain-explorer/examples/basic-network:

{
  "network-configs": {
    "network-1": {
      "version": "1.0",
      "clients": {
        "client-1": {
          "tlsEnable": false,
          "organization": "Org1MSP",
          "channel": "mychannel",
          "credentialStore": {
            "path": "./tmp/credentialStore_Org1/credential",
            "cryptoStore": {
              "path": "./tmp/credentialStore_Org1/crypto"
            }
          }
        }
      },
      "channels": {
        "mychannel": {
          "peers": {
            "peer0.org1.example.com": {}
          },
          "connection": {
            "timeout": {
              "peer": {
                "endorser": "6000",
                "eventHub": "6000",
                "eventReg": "6000"
              }
            }
          }
        }
      },
      "organizations": {
        "Org1MSP": {
          "mspid": "Org1MSP",
          "fullpath": false,
          "adminPrivateKey": {
            "path":
              "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore"
          },
          "signedCert": {
            "path":
              "/tmp/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts"
          }
        },
        "OrdererMSP": {
          "mspid": "OrdererMSP",
          "adminPrivateKey": {
            "path":
              "/tmp/crypto/ordererOrganizations/example.com/users/Admin@example.com/msp/keystore"
          }
        }
      },
      "peers": {
        "peer0.org1.example.com": {
          "tlsCACerts": {
            "path":
              "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
          },
          "url": "grpc://peer0.org1.example.com:7051",
          "eventUrl": "grpc://peer0.org1.example.com:7053",
          "grpcOptions": {
            "ssl-target-name-override": "peer0.org1.example.com"
          }
        }
      },
      "orderers": {
        "orderer.example.com": {
          "url": "grpc://orderer.example.com:7050"
        }
      }
    }
  },
  "configtxgenToolPath": "/home/fabric-path/workspace/fabric-samples/bin",
  "license": "Apache-2.0"
}

If you're still having trouble after following the instructions above, please post details of any errors reported by Blockchain Explorer, as well as the Blockchain Explorer log file (app.log). These can be viewed using the following commands when using the docker deployment script:

docker logs blockchain-explorer
docker exec -t blockchain-explorer cat /opt/logs/app/app.log


来源:https://stackoverflow.com/questions/53625457/unable-to-setup-hyperledger-explorer-with-one-node-like-basic-network-example

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!