简体   繁体   中英

Failure to create Genesis Block (Hyperledger fabric)

This is my first post on Stackoverflow. Please bear with me... I am new to basically everything around hyperledger-fabric. While trying to follow the "Writing Your First Application Tutorial" i am unable to generate the genesis block.

I am running:

windows 10

Docker version 18.03.0-ce, build 0520e24302

docker-compose version 1.20.1, build 5d8c71b2

npm 6.1.2

node.js v12.1

python 2.7

I used the curl commands given in the instructions.

When i run ./startFabric.sh javascript at first everything is going ok. I am getting some warnings but starting the Channel seems to work fine. In the next few lines however i am getting an error.

Generate CCP files for Org1 and Org2 /c/Users/Jonathan/Hyperledger_Fabric/fabric-samples/bin/configtxgen Generating Orderer Genesis block CONSENSUS_TYPE=solo + '[' solo == solo ']' + configtxgen -profile TwoOrgsOrdererGenesis -channelID byfn-sys-channel -outputBlock ./channel-artifacts/genesis.block 2019-11-25 10:35:01.676 CET [common.tools.configtxgen] main -> INFO 001 Loading configuration 2019-11-25 10:35:01.677 CET [common.tools.configtxgen.localconfig] Load -> PANI 002 Error reading configuration: Unsupported Config Type "" 2019-11-25 10:35:01.679 CET [common.tools.configtxgen] func1 -> PANI 003 Error reading configuration: Unsupported Config Type "" panic: Error reading configuration: Unsupported Config Type "" [recovered] panic: Error reading configuration: Unsupported Config Type ""

It seems that the configuration is missing/not the right "type". I googled my error and came up with people having similar/the same issue but i havent been able to solve my issue by following the advice they were given (hence why i am here). Similar posts i found:

The people responding to the posts above generally seem to think its an issue regarding the path to the config file which apparently can be fixed with

FABRIC_CFG_PATH=$PWD

But that hasnt worked for me.

Full Console Output: https://pastebin.com/CHxjZ1Uq

Look at the warning at the start: you are missing some prerequisites.

First, use the generate script to generate the crypto-config and artifacts folder. Once you got your certificates you can start fabric.

You should have a generte.sh script or something like that. Essentially it runs the certificate generation for your network using cryptogen.

The code is something like this:

  which cryptogen
  if [ "$?" -ne 0 ]; then
    echo "cryptogen tool not found. exiting"
    exit 1
  fi

  if [ -d "crypto-config" ]; then
    rm -Rf crypto-config
  fi

  set -x
  cryptogen generate --config=./crypto-config.yaml

Once you generated the certificates, you can now generate the genesis block with something like:

 which configtxgen

 if [ -d "config" ]; then
    rm -Rf config
  fi
  mkdir config

  configtxgen -profile OneOrgOrdererGenesis -outputBlock ./config/genesis.block
  configtxgen -profile OneOrgChannel -outputCreateChannelTx ./config/channel.tx -channelID $CHANNEL_NAME
  configtxgen -profile OneOrgChannel -outputAnchorPeersUpdate ./config/${MSP_NAME}anchors.tx -channelID $CHANNEL_NAME -asOrg $MSP_NAME

Obviously replacing with your names and variables.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM