0

Problem:

I am very new to blockchain with Hyperledger. I am customizing the startNetwork.sh script. So I have created something like this.

# don't rewrite paths for Windows Git Bash users
export MSYS_NO_PATHCONV=1

#removing all the containers
echo "#### Removing all the containers"
echo ""
echo ""
docker rm -f $(docker ps -aq)
echo ""
echo ""

#prune the volumes
echo "#### Prune the network "
echo ""
echo ""
docker volume prune
echo ""
echo ""

#down the previously build networks
echo "##### Removing networks and containers #####"
echo ""
echo ""
docker-compose -f docker-compose-cli.yaml down --volumes 
echo ""
echo ""

#Up the network
echo ""
echo "##### Network is under the build #####"
echo ""
echo ""
docker-compose -f docker-compose-cli.yaml up -d
echo ""
echo ""

#starting the cli
echo ""
echo ""
echo "##### Starting the cli incase if it is sleep #####"
docker start cli
echo ""
echo ""

docker exec -e "CORE_PEER_LOCALMSPID=PSPMSP" -e "CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/psp.example.com/users/Admin@psp.example.com/msp" -e "CORE_PEER_ADDRESS=peer0.psp.example.com:7051" -e "CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/psp.example.com/peers/peer0.psp.example.com/tls/ca.crt" peer0.psp.example.com peer channel create -o orderer.example.com:7050 -c mychannel -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

But when I hit ./startNetwork.sh on the bash terminal it leaves me an error of

2019-03-18 06:42:52.162 UTC [main] InitCmd -> ERRO 001 Cannot run peer because cannot init crypto, folder "/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/psp.example.com/users/Admin@psp.example.com/msp" does not exist

But when I issuing this command inside the cli container It was worked successfully. Can someone help me to modify this file in order to get rid of this error? Thank you!

dwp
  • 908
  • 4
  • 24
  • 42
  • hi there, I suspect the answers here -> https://stackoverflow.com/questions/50229686/hyperledger-first-network-sample-error and here -> will help you resolve your custom script path issues: https://stackoverflow.com/questions/49551179/hyperledger-fabric-peer-error – Paul O'Mahony Mar 18 '19 at 12:14

1 Answers1

0

cli expects a few crypto artifacts to interact with Fabric components. In the sample, they are generated, and mounted into docker contains at specific path, and exported as env var, so it can be invoked within the container. You'll need to do the same setup in bash in order to get it work. Check out how the cli container is defined in docker compose file (which might be overwhelming, and probably it's a better idea to do it in cli container)

guoger
  • 197
  • 1
  • 2
  • 9