title: Create Channel failed in Hyperledger Fabric
body: <p>When I run the e2e-2Orgs demo in fabric-sdk-java-master, everything seemed ok. 
  <strong>docker-compose.yaml:</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>#
  # Copyright IBM Corp. All Rights Reserved.
  #
  # SPDX-License-Identifier: Apache-2.0
  #
  version: '2'
  
  services:
    ca0:
      image: hyperledger/fabric-ca${IMAGE_TAG_FABRIC_CA}
      environment:
        - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
      ports:
        - "7054:7054"
      command: sh -c 'fabric-ca-server start -n ca0 --registry.maxenrollments -1 --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/fcf776b02a05600408d0be9d9752afc59f64950b721cacb363b5b95a0fea6216_sk -b admin:adminpw ${ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_CA_TLS} --tls.certfile /etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem --tls.keyfile /etc/hyperledger/fabric-ca-server-config/fcf776b02a05600408d0be9d9752afc59f64950b721cacb363b5b95a0fea6216_sk -d'
      volumes:
        - ./e2e-2Orgs/channel/crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config:ro
      container_name: ca_peerOrg1
  
    ca1:
      image: hyperledger/fabric-ca${IMAGE_TAG_FABRIC_CA}
      environment:
        - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
      ports:
        - "8054:7054"
      command: sh -c 'fabric-ca-server start --registry.maxenrollments -1 --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/b59bba37975dafcc4a93984aa01d3d29b64894617db9e0c9a2d486b5273cbd27_sk -b admin:adminpw ${ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_CA_TLS} --tls.certfile /etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem --tls.keyfile /etc/hyperledger/fabric-ca-server-config/b59bba37975dafcc4a93984aa01d3d29b64894617db9e0c9a2d486b5273cbd27_sk -d'
      volumes:
        - ./e2e-2Orgs/channel/crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config:ro
      container_name: ca_peerOrg2
  
  
    orderer.example.com:
      container_name: orderer.example.com
      image: hyperledger/fabric-orderer${IMAGE_TAG_FABRIC}
      environment:
        - ORDERER_GENERAL_LOGLEVEL=debug
        - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
        - ORDERER_GENERAL_GENESISMETHOD=file
        - ORDERER_GENERAL_GENESISFILE=/etc/hyperledger/configtx/orderer.block
        - ORDERER_GENERAL_LOCALMSPID=OrdererMSP
        - ORDERER_GENERAL_LOCALMSPDIR=/etc/hyperledger/msp/orderer/msp
        - ORDERER_GENERAL_TLS_ENABLED=${ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_TLS}
        - ORDERER_GENERAL_TLS_PRIVATEKEY=/etc/hyperledger/msp/orderer/tls/server.key
        - ORDERER_GENERAL_TLS_CERTIFICATE=/etc/hyperledger/msp/orderer/tls/server.crt
        - ORDERER_GENERAL_TLS_ROOTCAS=[/etc/hyperledger/msp/orderer/tls/ca.crt]
  #      - ORDERER_GENERAL_TLS_ROOTCAS=[/etc/hyperledger/msp/orderer/tls/ca.crt, /etc/hyperledger/msp/peer0Org1/tls/ca.crt, /etc/hyperledger/msp/peer1Org1/tls/ca.crt, /etc/hyperledger/msp/peer0Org2/tls/ca.crt, /etc/hyperledger/msp/peer1Org2/tls/ca.crt]
        - GRPC_TRACE=all=true,
        - GRPC_VERBOSITY=debug
      working_dir: /opt/gopath/src/github.com/hyperledger/fabric
      command: orderer
      volumes:
       - ./e2e-2Orgs/channel:/etc/hyperledger/configtx:ro
       - ./e2e-2Orgs/channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/:/etc/hyperledger/msp/orderer:ro
      ports:
        - 7050:7050
  
    peer0.org1.example.com:
      container_name: peer0.org1.example.com
      extends:
        file: peer-base/peer-base.yaml
        service: peer-base
      environment:
        - CORE_PEER_ID=peer0.org1.example.com
        - CORE_PEER_ADDRESS=peer0.org1.example.com:7051
        - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
  #      - CORE_PEER_GOSSIP_ORGLEADER=true
        - CORE_PEER_LOCALMSPID=Org1MSP
      volumes:
        - /var/run/:/host/var/run/
        - ./e2e-2Orgs/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/:/etc/hyperledger/msp/peer:ro
      ports:
        - 7051:7051
        - 7053:7053
      depends_on:
        - orderer.example.com
  
    peer1.org1.example.com:
      container_name: peer1.org1.example.com
      extends:
        file: peer-base/peer-base.yaml
        service: peer-base
      environment:
        - CORE_PEER_ID=peer1.org1.example.com
        - CORE_PEER_ADDRESS=peer1.org1.example.com:7051
        - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7051
  #      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051
        - CORE_PEER_LOCALMSPID=Org1MSP
      volumes:
           - /var/run/:/host/var/run/
           - ./e2e-2Orgs/channel/crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/:/etc/hyperledger/msp/peer:ro
      ports:
         - 7056:7051
         - 7058:7053
      depends_on:
         - orderer.example.com
         - peer0.org1.example.com
  
    peer0.org2.example.com:
      container_name: peer0.org2.example.com
      extends:
        file: peer-base/peer-base.yaml
        service: peer-base
      environment:
        - CORE_PEER_ID=peer0.org2.example.com
        - CORE_PEER_ADDRESS=peer0.org2.example.com:7051
        - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:8051
  #      - CORE_PEER_GOSSIP_ORGLEADER=true
        - CORE_PEER_LOCALMSPID=Org2MSP
      volumes:
        - /var/run/:/host/var/run/
        - ./e2e-2Orgs/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/:/etc/hyperledger/msp/peer:ro
      ports:
        - 8051:7051
        - 8053:7053
      depends_on:
        - orderer.example.com
  
    peer1.org2.example.com:
      container_name: peer1.org2.example.com
      extends:
        file: peer-base/peer-base.yaml
        service: peer-base
      environment:
        - CORE_PEER_ID=peer1.org2.example.com
        - CORE_PEER_ADDRESS=peer1.org2.example.com:7051
        - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:8051
  #      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:8051
        - CORE_PEER_LOCALMSPID=Org2MSP
      volumes:
           - /var/run/:/host/var/run/
           - ./e2e-2Orgs/channel/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/:/etc/hyperledger/msp/peer:ro
      ports:
         - 8056:7051
         - 8058:7053
      depends_on:
         - orderer.example.com
         - peer0.org2.example.com
  
    configtxlator:
        image: hyperledger/fabric-tools${IMAGE_TAG_FABRIC}
        ports:
          - "7059:7059"
        command: /usr/local/bin/configtxlator start
        container_name: configtxlator
  
    ccenv:
      image: hyperledger/fabric-ccenv${IMAGE_TAG_FABRIC}</code></pre>
  </div>
  </div>
  
  configtx.yaml:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code># Copyright IBM Corp. All Rights Reserved.
  #
  # SPDX-License-Identifier: Apache-2.0
  #
  
  ---
  ################################################################################
  #
  #   Profile
  #
  #   - Different configuration profiles may be encoded here to be specified
  #   as parameters to the configtxgen tool
  #
  ################################################################################
  Profiles:
  
      TwoOrgsOrdererGenesis:
          Orderer:
              &lt;&lt;: *OrdererDefaults
              Organizations:
                  - *OrdererOrg
          Consortiums:
              SampleConsortium:
                  Organizations:
                      - *Org1
                      - *Org2
      TwoOrgsChannel:
          Consortium: SampleConsortium
          Application:
              &lt;&lt;: *ApplicationDefaults
              Organizations:
                  - *Org1
                  - *Org2
  
  ################################################################################
  #
  #   Section: Organizations
  #
  #   - This section defines the different organizational identities which will
  #   be referenced later in the configuration.
  #
  ################################################################################
  Organizations:
  
      # SampleOrg defines an MSP using the sampleconfig.  It should never be used
      # in production but may be used as a template for other definitions
      - &amp;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/example.com/msp
  
      - &amp;Org1
          # DefaultOrg defines the organization which is used in the sampleconfig
          # of the fabric.git development environment
          Name: Org1MSP
  
          # ID to load the MSP definition as
          ID: Org1MSP
  
          MSPDir: crypto-config/peerOrganizations/org1.example.com/msp
  
          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.org1.example.com
                Port: 7051
  
      - &amp;Org2
          # DefaultOrg defines the organization which is used in the sampleconfig
          # of the fabric.git development environment
          Name: Org2MSP
  
          # ID to load the MSP definition as
          ID: Org2MSP
  
          MSPDir: crypto-config/peerOrganizations/org2.example.com/msp
  
          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.org2.example.com
                Port: 7051
  
  ################################################################################
  #
  #   SECTION: Orderer
  #
  #   - This section defines the values to encode into a config transaction or
  #   genesis block for orderer related parameters
  #
  ################################################################################
  Orderer: &amp;OrdererDefaults
  
      # Orderer Type: The orderer implementation to start
      # Available types are "solo" and "kafka"
      OrdererType: solo
  
      Addresses:
          - orderer.example.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: 98 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 is the list of orgs which are defined as participants on
      # the orderer side of the network
      Organizations:
  
  ################################################################################
  #
  #   SECTION: Application
  #
  #   - This section defines the values to encode into a config transaction or
  #   genesis block for application related parameters
  #
  ################################################################################
  Application: &amp;ApplicationDefaults
  
      # Organizations is the list of orgs which are defined as participants on
      # the application side of the network
      Organizations:</code></pre>
  </div>
  </div>
  
  <strong>crypto-config.yaml:</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>#
  # Copyright IBM Corp. All Rights Reserved.
  #
  # SPDX-License-Identifier: Apache-2.0
  #
  # ---------------------------------------------------------------------------
  # "OrdererOrgs" - Definition of organizations managing orderer nodes
  # ---------------------------------------------------------------------------
  OrdererOrgs:
    # ---------------------------------------------------------------------------
    # Orderer
    # ---------------------------------------------------------------------------
    - Name: Orderer
      Domain: example.com
  
      # ---------------------------------------------------------------------------
      # "Specs" - See PeerOrgs below for complete description
      # ---------------------------------------------------------------------------
      Specs:
        - Hostname: orderer
  
  # ---------------------------------------------------------------------------
  # "PeerOrgs" - Definition of organizations managing peer nodes
  # ---------------------------------------------------------------------------
  PeerOrgs:
    # ---------------------------------------------------------------------------
    # Org1
    # ---------------------------------------------------------------------------
    - Name: Org1
      Domain: org1.example.com
  
      # ---------------------------------------------------------------------------
      # "Specs"
      # ---------------------------------------------------------------------------
      # Uncomment this section to enable the explicit definition of hosts in your
      # configuration.  Most users will want to use Template, below
      #
      # Specs is an array of Spec entries.  Each Spec entry consists of two fields:
      #   - Hostname:   (Required) The desired hostname, sans the domain.
      #   - CommonName: (Optional) Specifies the template or explicit override for
      #                 the CN.  By default, this is the template:
      #
      #                              "{{.Hostname}}.{{.Domain}}"
      #
      #                 which obtains its values from the Spec.Hostname and
      #                 Org.Domain, respectively.
      # ---------------------------------------------------------------------------
      # Specs:
      #   - Hostname: foo # implicitly "foo.org1.example.com"
      #     CommonName: foo27.org5.example.com # overrides Hostname-based FQDN set above
      #   - Hostname: bar
      #   - Hostname: baz
  
      # ---------------------------------------------------------------------------
      # "Template"
      # ---------------------------------------------------------------------------
      # Allows for the definition of 1 or more hosts that are created sequentially
      # from a template. By default, this looks like "peer%d" from 0 to Count-1.
      # You may override the number of nodes (Count), the starting index (Start)
      # or the template used to construct the name (Hostname).
      #
      # Note: Template and Specs are not mutually exclusive.  You may define both
      # sections and the aggregate nodes will be created for you.  Take care with
      # name collisions
      # ---------------------------------------------------------------------------
      Template:
        Count: 2
        # Start: 5
        # Hostname: {{.Prefix}}{{.Index}} # default
  
      # ---------------------------------------------------------------------------
      # "Users"
      # ---------------------------------------------------------------------------
      # Count: The number of user accounts _in addition_ to Admin
      # ---------------------------------------------------------------------------
      Users:
        Count: 1
  
    # ---------------------------------------------------------------------------
    # Org2: See "Org1" for full specification
    # ---------------------------------------------------------------------------
    - Name: Org2
      Domain: org2.example.com
      Template:
        Count: 2
      Users:
        Count: 1</code></pre>
  </div>
  </div>
  
  <strong>fabric.sh:</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>#!/usr/bin/env bash
  #
  # Copyright IBM Corp. All Rights Reserved.
  #
  # SPDX-License-Identifier: Apache-2.0
  #
  # simple batch script making it easier to cleanup and start a relatively fresh fabric env.
  
  if [ ! -e "docker-compose.yaml" ];then
    echo "docker-compose.yaml not found."
    exit 8
  fi
  
  ORG_HYPERLEDGER_FABRIC_SDKTEST_VERSION=${ORG_HYPERLEDGER_FABRIC_SDKTEST_VERSION:-}
  
  function clean(){
  
    rm -rf /var/hyperledger/*
  
    if [ -e "/tmp/HFCSampletest.properties" ];then
      rm -f "/tmp/HFCSampletest.properties"
    fi
  
    lines=`docker ps -a | grep 'dev-peer' | wc -l`
  
    if [ "$lines" -gt 0 ]; then
      docker ps -a | grep 'dev-peer' | awk '{print $1}' | xargs docker rm -f
    fi
  
    lines=`docker images | grep 'dev-peer' | grep 'dev-peer' | wc -l`
    if [ "$lines" -gt 0 ]; then
      docker images | grep 'dev-peer' | awk '{print $1}' | xargs docker rmi -f
    fi
  
  }
  
  function up(){
  
    if [ "$ORG_HYPERLEDGER_FABRIC_SDKTEST_VERSION" == "1.0.0" ]; then
      docker-compose up --force-recreate ca0 ca1 peer1.org1.example.com peer1.org2.example.com ccenv
    else
      docker-compose up --force-recreate
  fi
  
  }
  
  function down(){
    docker-compose down;
  }
  
  function stop (){
    docker-compose stop;
  }
  
  function start (){
    docker-compose start;
  }
  
  
  for opt in "$@"
  do
  
      case "$opt" in
          up)
              up
              ;;
          down)
              down
              ;;
          stop)
              stop
              ;;
          start)
              start
              ;;
          clean)
              clean
              ;;
          restart)
              down
              clean
              up
              ;;
  
          *)
              echo $"Usage: $0 {up|down|start|stop|clean|restart}"
              exit 1
  
  esac
  done</code></pre>
  </div>
  </div>
  
  But when I recreate Certificates and other cryptography artifacts by command : cryptogen generate --config crypto-config.yaml --output=crypto-config , modified docker-compose.yaml , started up the network and created channel again. It failed to create Channel and printed some Error Messages in Command Line:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>[33morderer.example.com       |[0m [31m2018-02-19 13:21:08.393 UTC [cauthdsl] func2 -&gt; ERRO 1b3[0m Principal deserialization failure (The supplied identity is not valid, Verify() returned x509: certificate signed by unknown authority (possibly because of "x509: ECDSA verification failure" while trying to verify candidate authority certificate "ca.org1.example.com")) for identity 0a074....</code></pre>
  </div>
  </div>
  </p>
  
  <p>I don't know how to fix it. I have tried to remove all the containers and restart docker again, it still did not work. And I tried solutions in <a href="https://stackoverflow.com/questions/45726536/peer-channel-creation-fails-in-hyperledger-fabric">peer channel creation fails in Hyperledger Fabric
  </a></p>
  
  <p>And it also didn't work.</p>