The first network in hyperrecker
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 finished setting up to http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html#create-join-channel
but when i run
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 like
Error: Unexpected status received: BAD_REQUEST
Searching for the problem I am facing http://hyperledgerdocs.readthedocs.io/en/latest/asset_trouble.html
Hence, I tried using the new channel name as given (old channel name = mychannel), I 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 three I get the error
Error: order service endpoint is invalid or missing Usage: peer channel create [flags]
Also I tried to skip it, assuming the channel has already been created. hence,
peer channel join -b ./mychannel.block
But got
Error: sentence failed (error: error rpc: code = Unknown desc = network code error (status: 500, message: unable to create register from genesis block, because LedgerID already exists))
My OS is Ubuntu 16.04
source to share
Try to make sure you have followed all the steps in the docs .
-
First of all, you need to edit the file
docker-compose-cli.yaml
in the cli section to comment out the line responsible for the automatic channel creation flow and join:command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME}; sleep $TIMEOUT'
eg.
# command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME}; sleep $TIMEOUT'
-
The following is the name of the export channel you are working with:
export CHANNEL_NAME=mychannel
-
Start the network (use the default 60s timeout):
CHANNEL_NAME=$CHANNEL_NAME docker-compose -f docker-compose-cli.yaml up -d
-
Enter the cli container:
docker exec -it cli bash
-
Exporting environment variables:
export CHANNEL_NAME=mychannel
-
Create a 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
-
Join the channel:
peer channel join -b mychannel.block
source to share