From fabric document create-join-channel, when I execute the command
peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/
Got unexpected status: BAD_REQUEST
Unfortunately, this error message can mean many things. FYI, in the upcoming fabric v1.1 release, this message has been enhanced to include additional text.
Most commonly, for channel creation, this status indicates that the submitter does not have channel creation rights (which usually equates to admin authority for an org). However, as mac indicates, if the channel already exists you might also get this error.
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
This command strikes me as the likely culprit. This command should usually be paired with lines like:
export CORE_PEER_MSPCONFIGPATH=`pwd`/crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
export CORE_PEER_LOCALMSPID=PeerOrg1
Which tell the peer command that the channel creation request should be signed using a particular admin's certificate. The default paths for the peer
command's certificate material usually result in a standard user cert being used to sign.
Please make sure that channel name is new one and that there is no existing channel already with that name in the network.
for example, if you already created a channel with CHANNEL_NAME=mychannel
, change the variable before you create another channel, by running something like export CHANNEL_NAME=mychannelanother