4

I am trying to work on my first network in Hyperledger Fabric. Using the following documentation http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html

I have completed the setup till http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html#create-join-channel

but when I run the

peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem

I got error as

Error: Got unexpected status: BAD_REQUEST

Searching for the issue i came across http://hyperledgerdocs.readthedocs.io/en/latest/asset_trouble.html

Hence I've tried to use a new channel name as given(old channel name=mychannel), I've tried below cmds

CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer:7050 peer channel create -c myc1

CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer.example.com:7050 peer channel create -c myc1

CORE_PEER_COMMITTER_LEDGER_ORDERER=172.18.0.2:7050 peer channel create -c myc1

For all the three I am getting error

Error: Ordering service endpoint is not valid or missing Usage: peer channel create [flags]

Also I've tried to skip it assuming the channel is already created. hence ran

peer channel join -b ./mychannel.block

But got

Error: proposal failed (err: rpc error: code = Unknown desc = chaincode error (status: 500, message: Cannot create ledger from genesis block, due to LedgerID already exists))

My OS is Ubuntu 16.04

docker ps Docker ps output Kindly help

Artem Barger
  • 40,769
  • 9
  • 59
  • 81
Katiyman
  • 827
  • 2
  • 12
  • 32
  • Did you try running the out of the box version first to make sure everything is setup correctly: `./byfn.sh -m down` `./byfn.sh -m generate` `./byfn.sh -m up` If this works, then we can try to debug further. If it does not work, it should help provide a clue as to what the issue may be – Gari Singh Aug 01 '17 at 10:20
  • Yes i tried it and it was working... but then i started running the individual commands and got this error. – Katiyman Aug 01 '17 at 10:22
  • Output for out of the box version https://pastebin.com/76nDaA6u – Katiyman Aug 01 '17 at 10:26
  • 1
    You might want to run `./byfn.sh -m down` again to clean up everything? – Gari Singh Aug 01 '17 at 10:26
  • ran the `./byfn.sh -m down` it stopped and removed all the containers but still getting same error – Katiyman Aug 01 '17 at 10:33

1 Answers1

4

Let's try to make sure you run thru all the steps as outlined in docs.

  1. First of all you need to edit your docker-compose-cli.yaml file the cli section to comment out line responsible to run automatic flow of channel creation and join:

    command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME}; sleep $TIMEOUT'
    

E.g.

# command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME}; sleep $TIMEOUT'
  1. Next export channel name you are working with:

    export CHANNEL_NAME=mychannel

  2. Start the network (use default timeout of 60s):

    CHANNEL_NAME=$CHANNEL_NAME docker-compose -f docker-compose-cli.yaml up -d

  3. Enter the cli container:

    docker exec -it cli bash

  4. Export environmental variables:

    export CHANNEL_NAME=mychannel

  5. Create the channel:

    peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
    
  6. Join the channel:

    peer channel join -b mychannel.block
    
Artem Barger
  • 40,769
  • 9
  • 59
  • 81
  • Sorry i missed the # command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME}; sleep $TIMEOUT' hence the error – Katiyman Aug 01 '17 at 11:02
  • No worries, I realized that is the case after read your question second time and saw the " Error: proposal failed (err: rpc error: code = Unknown desc = chaincode error (status: 500, message: Cannot create ledger from genesis block, due to LedgerID already exists))" error message. – Artem Barger Aug 01 '17 at 11:07
  • I'm navigating through this tutorial too and came across this really useful answer! I've ran through these steps and in step 6, I'm seeing the following error - I'd appreciate any help I can get in resolving it!..... Error: got unexpected status: BAD_REQUEST -- error authorizing update: error validating ReadSet: readset expected key [Group] /Channel/Application at version 0, but got version 1 – ponytailPalm Jun 27 '18 at 16:47