首页 文章

Hyperledger Fabric中的cryptogen工具错误

提问于
浏览
5

我正在尝试在OSX上安装和运行Hyperledger Fabric . 安装似乎进展顺利 . 但是,当我运行cryptogen工具时,我收到以下警告:

Apples-MacBook-Pro:e2e mycomputer$ ./../../$os_arch/bin/cryptogen generate --config=./crypto-config.yaml
org1.example.com
2017-04-27 15:46:27.940 PDT [bccsp] GetDefault -> WARN 001 Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.963 PDT [bccsp] GetDefault -> WARN 002 Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.966 PDT [bccsp] GetDefault -> WARN 003 Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.967 PDT [bccsp] GetDefault -> WARN 004 Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.969 PDT [bccsp] GetDefault -> WARN 005 Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
org2.example.com
2017-04-27 15:46:27.973 PDT [bccsp] GetDefault -> WARN 006 Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.975 PDT [bccsp] GetDefault -> WARN 007 Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.977 PDT [bccsp] GetDefault -> WARN 008 Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.979 PDT [bccsp] GetDefault -> WARN 009 Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.980 PDT [bccsp] GetDefault -> WARN 00a Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.984 PDT [bccsp] GetDefault -> WARN 00b Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.989 PDT [bccsp] GetDefault -> WARN 00c Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.
2017-04-27 15:46:27.992 PDT [bccsp] GetDefault -> WARN 00d Before using BCCSP, please call InitFactories(). Falling back to bootBCCSP.

然后在运行configtxgen工具时生成以下错误:

2017-04-27 12:23:57.202 PDT [common/configtx/tool] main -> INFO 001 Loading configuration
2017-04-27 12:23:57.203 PDT [configtx/tool/localconfig] Load -> CRIT 002 Error reading configuration: Unsupported Config Type ""
panic: Error reading configuration: Unsupported Config Type ""

goroutine 1 [running]:
panic(0x490d00, 0xc420175f50)
    /opt/go/go1.7.linux.amd64/src/runtime/panic.go:500 +0x1a1
github.com/hyperledger/fabric/vendor/github.com/op/go-logging.(*Logger).Panicf(0xc4201da240, 0x5663ea, 0x1f, 0xc420175e70, 0x1, 0x1)
    /w/workspace/fabric-verify-x86_64_1/gopath/src/github.com/hyperledger/fabric/vendor/github.com/op/go-logging/logger.go:194 +0x127
github.com/hyperledger/fabric/common/configtx/tool/localconfig.Load(0x7fff5fbffbfe, 0x7, 0x0)
    /w/workspace/fabric-verify-x86_64_1/gopath/src/github.com/hyperledger/fabric/common/configtx/tool/localconfig/config.go:195 +0x79c
main.main()
    /w/workspace/fabric-verify-x86_64_1/gopath/src/github.com/hyperledger/fabric/common/configtx/tool/configtxgen/main.go:204 +0x405

结果是没有orderer.block输出到e2e目录 .

到底是怎么回事?

谢谢您的帮助 . philstan

5 回答

  • 6

    虽然在执行 ./../../$os_arch/bin/cryptogen generate --config=./crypto-config.yaml 时收到警告消息,但是证书是在ee文件夹的crypto_config文件夹中创建的 .

    至于第二部分,创建一个创世块你需要这样做

    Do not pass ORDERER_CFG_PATH=$PWD
        instead, pass the following: FABRIC_CFG_PATH=$PWD
    
        In the network_setup.sh script, make the same change.
        It should be: export FABRIC_CFG_PATH=$PWD
    

    有关详细信息,请参阅此链接https://jira.hyperledger.org/browse/FAB-3467

  • 0

    要解决这个问题, don't 设置PATH就像这样:

    FABRIC_CFG_PATH=$PWD
    

    相反,你必须 export 它像这样:

    export FABRIC_CFG_PATH=$PWD
    

    否则你将在命令的开头添加PATH,例如:

    FABRIC_CFG_PATH=$PWD ./bin/configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
    
  • 0

    我在Windows上遇到了同样的错误 . 如下设置环境变量无法解决问题 .

    $ FABRIC_CFG_PATH=$PWD
    
    $ ./bin/configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block
    2017-05-24 15:48:42.109 IST [common/configtx/tool] main -> INFO 001 Loading configuration
    2017-05-24 15:48:42.113 IST [common/configtx/tool/localconfig] Load -> CRIT 002 Error reading config
    uration:  Unsupported Config Type ""
    panic: Error reading configuration: Unsupported Config Type ""
    
    goroutine 1 [running]:
    panic(0x8a3e60, 0xc0421ee9f0)
            /opt/go/go1.7.linux.amd64/src/runtime/panic.go:500 +0x1af
    github.com/hyperledger/fabric/vendor/github.com/op/go-logging.(*Logger).Panic(0xc04216dad0, 0xc04219
    7c60, 0x2, 0x2)
            /w/workspace/fabric-binaries-x86_64-1/gopath/src/github.com/hyperledger/fabric/vendor/github
    .com/op/go-logging/logger.go:188 +0xd7
    github.com/hyperledger/fabric/common/configtx/tool/localconfig.Load(0xc042040400, 0x15, 0x0)
            /w/workspace/fabric-binaries-x86_64-1/gopath/src/github.com/hyperledger/fabric/common/config
    tx/tool/localconfig/config.go:180 +0xa95
    main.main()
            /w/workspace/fabric-binaries-x86_64-1/gopath/src/github.com/hyperledger/fabric/common/config
    tx/tool/configtxgen/main.go:328 +0x501
    

    在命令执行的同一行上传递相同的环境变量工作正常 .

    $ FABRIC_CFG_PATH=$PWD ./bin/configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-arti
    facts/genesis.block
    2017-05-24 15:56:29.811 IST [common/configtx/tool] main -> INFO 001 Loading configuration
    2017-05-24 15:56:29.831 IST [msp] getMspConfig -> INFO 002 intermediate certs folder not found at [D
    :\test\fabric-alpha2\release\windows-amd64\crypto-config\ordererOrganizations\example.com\msp\interm
    ediatecerts]. Skipping.: [GetFileAttributesEx D:\test\fabric-alpha2\release\windows-amd64\crypto-con
    fig\ordererOrganizations\example.com\msp\intermediatecerts: The system cannot find the file specifie
    d.]
    2017-05-24 15:56:29.855 IST [msp] getMspConfig -> INFO 003 crls folder not found at [D:\test\fabric-
    alpha2\release\windows-amd64\crypto-config\ordererOrganizations\example.com\msp\intermediatecerts].
    Skipping.: [GetFileAttributesEx D:\test\fabric-alpha2\release\windows-amd64\crypto-config\ordererOrg
    anizations\example.com\msp\crls: The system cannot find the file specified.]
    2017-05-24 15:56:29.860 IST [msp] getMspConfig -> INFO 004 MSP configuration file not found at [D:\t
    est\fabric-alpha2\release\windows-amd64\crypto-config\ordererOrganizations\example.com\msp\config.ya
    ml]: [GetFileAttributesEx D:\test\fabric-alpha2\release\windows-amd64\crypto-config\ordererOrganizat
    ions\example.com\msp\config.yaml: The system cannot find the file specified.]
    2017-05-24 15:56:29.892 IST [msp] getMspConfig -> INFO 005 intermediate certs folder not found at [D
    :\test\fabric-alpha2\release\windows-amd64\crypto-config\peerOrganizations\org1.example.com\msp\inte
    rmediatecerts]. Skipping.: [GetFileAttributesEx D:\test\fabric-alpha2\release\windows-amd64\crypto-c
    onfig\peerOrganizations\org1.example.com\msp\intermediatecerts: The system cannot find the file spec
    ified.]
    2017-05-24 15:56:29.897 IST [msp] getMspConfig -> INFO 006 crls folder not found at [D:\test\fabric-
    alpha2\release\windows-amd64\crypto-config\peerOrganizations\org1.example.com\msp\intermediatecerts]
    . Skipping.: [GetFileAttributesEx D:\test\fabric-alpha2\release\windows-amd64\crypto-config\peerOrga
    nizations\org1.example.com\msp\crls: The system cannot find the file specified.]
    2017-05-24 15:56:29.904 IST [msp] getMspConfig -> INFO 007 MSP configuration file not found at [D:\t
    est\fabric-alpha2\release\windows-amd64\crypto-config\peerOrganizations\org1.example.com\msp\config.
    yaml]: [GetFileAttributesEx D:\test\fabric-alpha2\release\windows-amd64\crypto-config\peerOrganizati
    ons\org1.example.com\msp\config.yaml: The system cannot find the file specified.]
    2017-05-24 15:56:29.918 IST [msp] getMspConfig -> INFO 008 intermediate certs folder not found at [D
    :\test\fabric-alpha2\release\windows-amd64\crypto-config\peerOrganizations\org2.example.com\msp\inte
    rmediatecerts]. Skipping.: [GetFileAttributesEx D:\test\fabric-alpha2\release\windows-amd64\crypto-c
    onfig\peerOrganizations\org2.example.com\msp\intermediatecerts: The system cannot find the file spec
    ified.]
    2017-05-24 15:56:29.924 IST [msp] getMspConfig -> INFO 009 crls folder not found at [D:\test\fabric-
    alpha2\release\windows-amd64\crypto-config\peerOrganizations\org2.example.com\msp\intermediatecerts]
    . Skipping.: [GetFileAttributesEx D:\test\fabric-alpha2\release\windows-amd64\crypto-config\peerOrga
    nizations\org2.example.com\msp\crls: The system cannot find the file specified.]
    2017-05-24 15:56:29.928 IST [msp] getMspConfig -> INFO 00a MSP configuration file not found at [D:\t
    est\fabric-alpha2\release\windows-amd64\crypto-config\peerOrganizations\org2.example.com\msp\config.
    yaml]: [GetFileAttributesEx D:\test\fabric-alpha2\release\windows-amd64\crypto-config\peerOrganizati
    ons\org2.example.com\msp\config.yaml: The system cannot find the file specified.]
    2017-05-24 15:56:29.936 IST [common/configtx/tool] doOutputBlock -> INFO 00b Generating genesis bloc
    k
    2017-05-24 15:56:29.941 IST [common/configtx/tool] doOutputBlock -> INFO 00c Writing genesis block
    

    Genesis块已创建(如文档中所述,我们需要忽略有关中间证书的日志 .

  • 1

    我现在得到了答案 . 这个问题是由于缺乏密码,这确实是一个命令工具 . 获得它的最简单方法是将特定于平台的二进制文件下载到本地计算机,这是sh:

    curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap-1.0.1.sh | bash
    

    这个sh会下载一个bash文件,它会提取最新的Fabric docker镜像和平台专用工具,其内容如下:

    #!/bin/bash
    #
    # Copyright IBM Corp. All Rights Reserved.
    #
    # SPDX-License-Identifier: Apache-2.0
    #
    
    export VERSION=1.0.1
    export ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}')
    #Set MARCH variable i.e ppc64le,s390x,x86_64,i386
    MARCH=`uname -m`
    
    dockerFabricPull() {
      local FABRIC_TAG=$1
      for IMAGES in peer orderer couchdb ccenv javaenv kafka zookeeper tools; do
          echo "==> FABRIC IMAGE: $IMAGES"
          echo
          docker pull hyperledger/fabric-$IMAGES:$FABRIC_TAG
          docker tag hyperledger/fabric-$IMAGES:$FABRIC_TAG hyperledger/fabric-$IMAGES
      done
    }
    
    dockerCaPull() {
          local CA_TAG=$1
          echo "==> FABRIC CA IMAGE"
          echo
          docker pull hyperledger/fabric-ca:$CA_TAG
          docker tag hyperledger/fabric-ca:$CA_TAG hyperledger/fabric-ca
    }
    
    : ${CA_TAG:="$MARCH-$VERSION"}
    : ${FABRIC_TAG:="$MARCH-$VERSION"}
    
    echo "===> Downloading platform binaries"
    curl https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/${ARCH}-${VERSION}/hyperledger-fabric-${ARCH}-${VERSION}.tar.gz | tar xz
    
    echo "===> Pulling fabric Images"
    dockerFabricPull ${FABRIC_TAG}
    
    echo "===> Pulling fabric ca Image"
    dockerCaPull ${CA_TAG}
    echo
    echo "===> List out hyperledger docker images"
    docker images | grep hyperledger*
    

    现在它基于Fabric 1.0.1,你可以从这里找到这个bash的最新版本:http://hyperledger-fabric.readthedocs.io/en/latest/samples.html

    sh执行完成后,当前目录中会有一个名为bin的文件夹,然后将该文件夹下的文件复制到可搜索的文件夹中,例如

    cp ./bin/*  $GOROOT/bin
    

    然后你可以通过type命令测试加密是否存在:

    which cryptogen
    
  • 0

    我实施新网络后遇到了同样的问题 . 在我的情况下,解决方案是将.bashrc中的PATH路径更改为我的加密工具所在的新文件夹 . 例:

    export PATH=$PATH:~/fabric-samples/network
    

    实现第一个网络时,该工具位于bin文件夹中,但在我的新网络中,该工具是另一个文件夹 . 然后重新启动并使用'which cryptogen'检查是否选择了正确的文件夹 .

相关问题