nukul
nukul

Reputation: 123

Unable to create channel - Attempted to include a member which is not in the consortium

I am facing an issue on creation of channel:

Channel 1 consortium - Org 1, Org2, Org4, Org5 Channel 2 consortium - Org2, Org3, Org4, Org5 Orderer Genesis consortium - Org1, Org2, Org3, Org4, Org5.

From Cli peer ( Org2) - when i am trying to create channel 1 or 2, i am getting below issue:

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


2018-07-15 01:13:08.240 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser 
and orderer connections initialized
Error: got unexpected status: BAD_REQUEST -- Attempted to include a member 
which is not in the consortium

configtx.yaml File

Organizations:
- &OrdererOrg
    # DefaultOrg defines the organization which is used in the sampleconfig
    # of the fabric.git development environment
    Name: OrdererOrg

    # ID to load the MSP definition as
    ID: OrdererMSP

    # MSPDir is the filesystem path which contains the MSP configuration
    MSPDir: crypto-config/ordererOrganizations/clm.com/msp
    AdminPrincipal: Role.MEMBER

- &Org2
    Name: Bdc1MSP
    ID: Bdc1MSP
    MSPDir: crypto-config/peerOrganizations/bdc1.clm.com/msp
    AdminPrincipal: Role.MEMBER
    AnchorPeers:
        - Host: peer0.bdc1.clm.com
          Port: 7051


- &Org1
    # DefaultOrg defines the organization which is used in the sampleconfig
    # of the fabric.git development environment
    Name: Cp1MSP

    # ID to load the MSP definition as
    ID: Cp1MSP

    MSPDir: crypto-config/peerOrganizations/cp1.clm.com/msp
    AdminPrincipal: Role.MEMBER
    AnchorPeers:
        # AnchorPeers defines the location of peers which can be used
        # for cross org gossip communication.  Note, this value is only
        # encoded in the genesis block in the Application section context
        - Host: peer0.cp1.clm.com
          Port: 7051

- &Org3
    Name: Adp1MSP
    ID: Adp1MSP
    MSPDir: crypto-config/peerOrganizations/adp1.clm.com/msp
    AdminPrincipal: Role.MEMBER
    AnchorPeers:
        - Host: peer0.adp1.clm.com
          Port: 7051
- &Org4
    Name: Ottp1MSP
    ID: Ottp1MSP
    MSPDir: crypto-config/peerOrganizations/ottp1.clm.com/msp
    AdminPrincipal: Role.MEMBER
    AnchorPeers:
        - Host: peer0.ottp1.clm.com
          Port: 7051
- &Org5
        Name: RegMSP
        ID: RegMSP
        MSPDir: crypto-config/peerOrganizations/reg.clm.com/msp
        AdminPrincipal: Role.MEMBER
        AnchorPeers:
            - Host: peer0.reg.clm.com
              Port: 7051
Capabilities:
    Global: &ChannelCapabilities
        V1_1: true
    Orderer: &OrdererCapabilities
        V1_1: true
    Application: &ApplicationCapabilities
        V1_2: true


Application: &ApplicationDefaults


    Organizations:


Orderer: &OrdererDefaults


OrdererType: solo

Addresses:
    - orderer.clm.com:7050

# Batch Timeout: The amount of time to wait before creating a batch
BatchTimeout: 2s

# Batch Size: Controls the number of messages batched into a block
BatchSize:

    # Max Message Count: The maximum number of messages to permit in a batch
    MaxMessageCount: 10

    # Absolute Max Bytes: The absolute maximum number of bytes allowed for
    # the serialized messages in a batch.
    AbsoluteMaxBytes: 99 MB

    # Preferred Max Bytes: The preferred maximum number of bytes allowed for
    # the serialized messages in a batch. A message larger than the preferred
    # max bytes will result in a batch larger than preferred max bytes.
    PreferredMaxBytes: 512 KB

Kafka:
    # Brokers: A list of Kafka brokers to which the orderer connects
    # NOTE: Use IP:port notation
    Brokers:
        - 127.0.0.1:9092


Organizations:


Profiles:

    FiveOrgsOrdererGenesis:
        Capabilities:
            <<: *ChannelCapabilities
        Orderer:
            <<: *OrdererDefaults
            Organizations:
                - *OrdererOrg
            Capabilities:
                <<: *OrdererCapabilities
        Consortiums:
            SampleConsortium:
                Organizations:
                    - *Org2
                    - *Org1
                    - *Org3
                    - *Org4
                    - *Org5
    ChannelOne:
        Consortium: SampleConsortium
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org2
                - *Org1
                - *Org5
                - *Org4
            Capabilities:
                <<: *ApplicationCapabilities
    ChannelTwo:
        Consortium: SampleConsortium
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org2
                - *Org3
                - *Org5
                - *Org4
            Capabilities:
                <<: *ApplicationCapabilities

docker compose cli

cli:
container_name: cli
image: hyperledger/fabric-tools:$IMAGE_TAG
tty: true
stdin_open: true
environment:
  - GOPATH=/opt/gopath
  - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
  #- CORE_LOGGING_LEVEL=DEBUG
  - CORE_LOGGING_LEVEL=INFO
  - CORE_PEER_ID=cli
  - CORE_PEER_ADDRESS=peer0.bdc1.clm.com:7051
  - CORE_PEER_LOCALMSPID=Bdc1MSP
  - CORE_PEER_TLS_ENABLED=true
  - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/bdc1.clm.com/peers/peer0.bdc1.clm.com/tls/server.crt
  - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/bdc1.clm.com/peers/peer0.bdc1.clm.com/tls/server.key
  - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/bdc1.clm.com/peers/peer0.bdc1.clm.com/tls/ca.crt
  - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/bdc1.clm.com/users/[email protected]/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: /bin/bash
volumes:
    - /var/run/:/host/var/run/
    - ./../chaincode/:/opt/gopath/src/github.com/chaincode
    - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
    - ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
    - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
depends_on:
  - orderer.clm.com
  - peer0.bdc1.clm.com
networks:
  - byfn

Env variables from CLI container :

root@6a67b1de8f57:/opt/gopath/src/github.com/hyperledger/fabric/peer# env
HOSTNAME=6a67b1de8f57
TERM=xterm





CORE_PEER_TLS_ROOTCERT_FILE=
/opt/gopath/src/github.com/hyperledger/
fabric/peer/crypto/peerOrganizations/bdc1.clm.com/peers/
peer0.bdc1.clm.com/tls/ca.crt    
CORE_PEER_TLS_KEY_FILE=
/opt/gopath/src/github.com/hyperledger/fabric/peer/
crypto/peerOrganizations/bdc1.clm.com/peers/
peer0.bdc1.clm.com/tls/server.key
LS_COLORS=REMOVED
CORE_PEER_LOCALMSPID=Bdc1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/
fabric/peer/crypto/peerOrganizations/
bdc1.clm.com/peers/peer0.bdc1.clm.com/tls/server.crt
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
:/sbin:/bin:/opt/go/bin:/opt/gopath/bin
PWD=/opt/gopath/src/github.com/hyperledger/fabric/peer
CORE_PEER_TLS_ENABLED=true



CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/
fabric/peer/crypto/peerOrganizations/
bdc1.clm.com/users/[email protected]/msp    
CORE_PEER_ID=cli
SHLVL=1
HOME=/root
GOROOT=/opt/go
CORE_LOGGING_LEVEL=INFO
FABRIC_CFG_PATH=/etc/hyperledger/fabric
CORE_PEER_ADDRESS=peer0.bdc1.clm.com:7051
LESSOPEN=| /usr/bin/lesspipe %s
GOPATH=/opt/gopath
CHANNEL_ONE_NAME=channelone
LESSCLOSE=/usr/bin/lesspipe %s %s

_=/usr/bin/env

Upvotes: 2

Views: 3428

Answers (5)

Aurobindo Nayak
Aurobindo Nayak

Reputation: 44

I faced the same issue today. After a while i found why this happens. Turns out if the channelXXXXXX.tx and anchorXXXX.tx files are not in the same folder this will error out even if everything you have done is correct as its not able to link to the anchor peers.

In my case i had multiple channels defined with their individual folders. I was making the mistake of placing the channelXXXXXX.tx outside its folder and got the error.

enter image description here

Upvotes: 1

Shubham Chadokar
Shubham Chadokar

Reputation: 2763

I experienced this error in Node-SDK while creating a new channel.
Whenever we update the consortium we must generate the new transaction file for the channel.

In my case, I forgot to generate the respective one and hence got the error.
I generated a new transaction file mychannel.tx

And it resolved my issue.

Upvotes: 0

quanta
quanta

Reputation: 4530

In my case, I forgot to export CHANNEL_NAME:

root@e8daa001f461:/opt/gopath/src/github.com/hyperledger/fabric/peer# echo $CHANNEL_NAME

root@e8daa001f461:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2018-12-07 18:07:18.375 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2018-12-07 18:07:18.636 UTC [common/tools/configtxgen/localconfig] Load -> INFO 002 Loaded configuration: /etc/hyperledger/fabric/configtx.yaml
Error: got unexpected status: BAD_REQUEST -- Attempted to include a member which is not in the consortium

After exporting:

root@e8daa001f461:/opt/gopath/src/github.com/hyperledger/fabric/peer# export CHANNEL_NAME=mychannel

root@e8daa001f461:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2018-12-07 18:03:29.985 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2018-12-07 18:03:30.028 UTC [cli/common] readBlock -> INFO 002 Received block: 0

Upvotes: 7

nukul
nukul

Reputation: 123

@arnabkaycee Looks like shutting down docket containers with removal of volumes and orphans , resolved. I recreated cryptos, channel artifacts again, which resolved it. Not sure, if any of my previous work had a conflict with it. Still clueless but resolved :)

Upvotes: 1

arnabkaycee
arnabkaycee

Reputation: 1644

This generally occurs when a member is not in the consortium is added to the channel. Please post your configtx.yaml for more details.

You can refer to this answer for more details.

How can I add two orderers to the same channel?

EDIT

Check your environment in cli container :

$ env

Then check these variables are exported properly, if not, do them.

export CORE_PEER_LOCALMSPID="Org2MSP"
export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
export CORE_PEER_ADDRESS=peer0.org2.example.com:7051

Upvotes: 0

Related Questions