超级账本Fabric中的加密工具错误

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

结果是e2e目录中没有输出orderer.block文件。
发生了什么?
谢谢你的帮助。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

该链接提供了有关此事的更多信息。

感谢您的帮助。不幸的是,我在您建议的更改后仍然收到了相同的错误。 - philstan

1

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

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

1
为了解决这个问题,请不要像这样设置路径:

不要 这样设置PATH:

FABRIC_CFG_PATH=$PWD

相反,您必须像这样导出它:

export FABRIC_CFG_PATH=$PWD

否则,您将在命令开头添加PATH,例如:
FABRIC_CFG_PATH=$PWD ./bin/configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block

0

我现在得到了答案。这个问题是由于缺少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

接下来,您可以通过输入以下命令来测试 cryptogen 是否存在:

which cryptogen

0

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

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

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


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接