【问题标题】:Error cryptogen tool in Hyperledger FabricHyperledger Fabric 中的错误加密工具
【发布时间】:2023-03-20 07:37:01
【问题描述】:

我正在尝试在 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目录。

发生了什么事?

感谢您的帮助。菲斯坦

【问题讨论】:

    标签: hyperledger


    【解决方案1】:

    虽然您在执行 ./../../$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

    【讨论】:

    • 感谢您的帮助。不幸的是,我收到了与您建议的更改相同的错误。
    【解决方案2】:

    我在 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
    

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

    【讨论】:

      【解决方案3】:

      要解决这个问题,不要这样设置 PATH:

      FABRIC_CFG_PATH=$PWD
      

      您必须像这样导出它:

      export FABRIC_CFG_PATH=$PWD
      

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

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

      【讨论】:

        【解决方案4】:

        我现在得到了答案。 这个问题是由于缺少cryptogen造成的,它确实是一个命令工具。获取它的最简单方法是将特定于平台的二进制文件下载到本地计算机中, 这是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命令测试cryptogen是否存在:

        which cryptogen
        

        【讨论】:

          【解决方案5】:

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

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

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

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多