4
votes

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

1
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 beGari Singh
Yes i tried it and it was working... but then i started running the individual commands and got this error.Katiyman
Output for out of the box version pastebin.com/76nDaA6uKatiyman
You might want to run ./byfn.sh -m down again to clean up everything?Gari Singh
ran the ./byfn.sh -m down it stopped and removed all the containers but still getting same errorKatiyman

1 Answers

4
votes

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