how to create channels with new orgs in Fabric getting error Attempted to include a member which is not in the consortium

+1 vote

Here is what I need to do in steps:

  1. Create a fabric network with 2 orgs: Org1 and Org2.
  2. Create a channel between them: publicchannel.
  3. now add an Org3. 
  4. Create a new channel: org3org1channel, between org3 and org1.

I'm experiencing problems with step 4, it is returning:

Error: got unexpected status: BAD_REQUEST -- Attempted to include a member which is not in the consortium

when I run:

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

Also, I ensure you all the paths and ENV variables are correct.

Here's my configtx.yaml file:

Organizations:
    - &OrdererOrg
        Name: OrdererOrg
        ID: OrdererMSP
        MSPDir: crypto-config/ordererOrganizations/example.com/msp

    - &Org1
        Name: Org1MSP
        ID: Org1MSP
        MSPDir: crypto-config/peerOrganizations/org1.example.com/msp
        AnchorPeers:
            - Host: peer0.org1.example.com
              Port: 7051

    - &Org2
        Name: Org2MSP
        ID: Org2MSP
        MSPDir: crypto-config/peerOrganizations/bitpay.example.com/msp
        AnchorPeers:
            - Host: peer0.org2.example.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.example.com:7050
    BatchTimeout: 2s
    BatchSize:
        MaxMessageCount: 10
        AbsoluteMaxBytes: 99 MB
        PreferredMaxBytes: 512 KB
    Kafka:
        Brokers:
            - 127.0.0.1:9092
    Organizations:

Profiles:
    ExampleOrdererGenesis:
        Capabilities:
            <<: *ChannelCapabilities
        Orderer:
            <<: *OrdererDefaults
            Organizations:
                - *OrdererOrg
            Capabilities:
                <<: *OrdererCapabilities
        Consortiums:
            ExampleConsortium:
                Organizations:
                    - *Org1
                    - *Org2
    ExampleChannel:
        Consortium: ExampleConsortium
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org1
                - *Org2
            Capabilities:
                <<: *ApplicationCapabilities
    TestChannel:
        Consortium: ExampleConsortium
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org1
                - *Org3
            Capabilities:
                <<: *ApplicationCapabilities

I have created new channels with the new org, using a hack:

  1. I created 2 orgs as part of the consortium: org1, org2, channelcreatororg.
  2. I created a new channel named org3org1channel only consisting of org1.
  3. Make org3 join org3org1channel.

This works! But I think this is a hack because org1 was already in the genesis block definition of ExampleConsortium. Suppose I want to add an org4 to this network and create a channel between org4 and org3. it won't be possible. We should be able to update the consortium definition in genesis block to do so.

We should emphesise on the Profile section of the above file:

Profiles:
    ExampleOrdererGenesis:
        Capabilities:
            <<: *ChannelCapabilities
        Orderer:
            <<: *OrdererDefaults
            Organizations:
                - *OrdererOrg
            Capabilities:
                <<: *OrdererCapabilities
        Consortiums:
            ExampleConsortium:
                Organizations:
                    - *Org1
                    - *Org2
    ExampleChannel:
        Consortium: ExampleConsortium
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org1
                - *Org2
            Capabilities:
                <<: *ApplicationCapabilities
    TestChannel:
        Consortium: ExampleConsortium
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org1
                - *Org3
            Capabilities:
                <<: *ApplicationCapabilities

I think the problem is that the ExampleOrdererGenesis contains a consortium definition and it does not include Org3. Can someone help me with the steps to update it using configtxlator tool?

Jul 22, 2019 in Blockchain by ayusht11
3,207 views
Did you export the channel? I know this question is silly but this is the mistake I made?

1 answer to this question.

+2 votes
$: peer channel fetch config config_block.pb -o orderer.example.com:7050
    -c testchainid

   $: configtxlator proto_decode --input config_block.pb --type common.Block | jq .data.data[0].payload.data.config > config.json

   $: jq -s '.[0] * {"channel_group":{"groups":{"Consortiums":{"groups": {"TestConsortium": {"groups": {"Org3MSP":.[1]}}}}}}}' config.json ./org3.json > modified_config.json

   $: configtxlator proto_encode --input config.json --type common.Config
    --output config.pb

   $: configtxlator proto_encode --input modified_config.json --type common.Config --output modified_config.pb

  $:  configtxlator compute_update --channel_id testchainid --original config.pb --updated modified_config.pb --output org_update.pb

   $: configtxlator proto_decode --input  org_update.pb --type common.ConfigUpdate | jq . > org_update.json

  $:  echo '{"payload":{"header":{"channel_header":{"channel_id":"testchainid", "type":2}},"data":{"config_update":'$(cat org_update.json)'}}}' | jq . > org_update_in_envelope.json

   $: configtxlator proto_encode --input org_update_in_envelope.json --type common.Envelope --output org_update_in_envelope.pb

   $: peer channel signconfigtx -f org_update_in_envelope.pb

   $: peer channel update -f org_update_in_envelope.pb -c testchainid -o orderer.example.com:7050

answered Jul 24, 2019 by Ayush
• 180 points
Hey @Ayush, did the error get solved?

Yes solved it! 

I solved it using this link: https://github.com/rohitadivi/Reconfigure-BYFN/blob/master/Create_channel.md

Make sure you understand what a testchaninid is within the steps of above link. We create a channel for the orderer, when we fire our genesis block transaction using peer command. We are fetching that channel and updating it and not any other channel.

Related Questions In Blockchain

+4 votes
2 answers

How do I create a new block in Hyperledger Fabric?

This link might help you: https://github.com/hyperledger/fabric-sample ...READ MORE

answered Oct 11, 2018 in Blockchain by Sahu
2,654 views
+1 vote
1 answer

I would like to create a blockchain network which will stay at the same level of complexity, is it possible?

You can very easily create a cryptocurrency having a ...READ MORE

answered Apr 4, 2018 in Blockchain by Christine
• 15,790 points
849 views
0 votes
1 answer

In a Blockchain, how difficult is it to modify the third to last block?

Technically, it's not difficult at all, all ...READ MORE

answered Apr 20, 2018 in Blockchain by Christine
• 15,790 points
1,027 views
0 votes
1 answer
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,451 views
0 votes
1 answer

Invalid Batch or signature in Savtooth

This will solve your problem import org.apache.commons.codec.binary.Hex; Transaction txn ...READ MORE

answered Aug 1, 2018 in Blockchain by digger
• 26,740 points
1,004 views
+15 votes
5 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP