Search code examples
hyperledger-fabricblockchainhyperledger-composer

Error trying to connect to business network


I have created a peer admin card. Installed the business network successfully. Trying to start a business network using :

composer network start --networkName  procurement-phase --networkVersion 0.0.87 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin@hlfv1 --file networkadmin.card

The result of execution:

Starting business network procurement-phase at version 0.0.87

Processing these Network Admins: userName: admin

✖ Starting a business network definition. This may take a minute... Error: Error trying to start a business network. Error: Failed to receive commit notification from 192.168.1.164:9051 for transaction '02339b7d2f056310c6659430e51e6dd2c99f6ecfbc094b7696ab14fc726716b5' within the timeout period Command failed

If i execute the same command again and I got another error like :

Starting business network definition. This may take a minute... Error: Error trying to start business network. Error: Peer localhost:7051 has rejected transaction '9704b94187a74aaa6d190441326edff60d675ef377607f91f69d333d6c70749a' with code ENDORSEMENT_POLICY_FAILURE Command failed.

I have checked docker logs of containers running. Got an error in an orderer docker container .


Solution

  • I have solved the above problem by making the following changes : Add the tls(server.key-private key file ,ca.crt file,server.crt file) of orderer in enviroment variables of orderer section in docker-compose.yaml file .

      - ORDERER_GENERAL_TLSENABLED=true
      - ORDERER_GENERAL_TLS_PRIVATEKEY=./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.key
      - ORDERER_GENERAL_TLS_CERTIFICATE=./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
      - ORDERER_GENERAL_TLS_ROOTCAS=./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/ca.crt
    

    Add the below section in volumes of peers section of docker-compose.yaml file.Specify the path of tls folder

     ./crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/peer/tls