peer chaincode deploy -n mycc -c '{"Args": ["init", "a","100", "b", "200"]}' =>Error connecting to 0.0.0.0:7050 due to grpc: timed out when dialing - hyperledger

I'm doing a project on hyperledger fabric and wish to run the chaincode.
but whenever i run this command
"peer chaincode deploy -n mycc -c '{"Args": ["init", "a","100", "b", "200"]}'"
in my GitBash,
It displayed an error i can't resolve.
"Error: Error getting broadcast client: Error connecting to 0.0.0.0:7050 due to grpc: timed out when dialing"
Is it a port issue?
Can anyone help me resolve this issue?

7050 is the port of orderer service try to verify if you have it using docker images fabric-orderer if not use
docker pull ${DOCKER_NS}/fabric-orderer:${ARCH}-${VERSION}
then use orderer start
in my case :
DOCKER_NS=hyperledger
ARCH=x86_64
VERSION=1.0.0-alpha

Related

Hyperledger Fabric v2 new chaincode lifecycle install problem with dind vm endpoint + tls

having trouble with new v2 chaincode lifecycle, I am using docker vm dind endpoint https://127.0.0.1 with tls on, peer has all docker client crypto material set
CORE_VM_DOCKER_TLS_ENABLED=true
CORE_VM_DOCKER_TLS_CERT=/tmp/org1/peer1/docker/cert.pem
CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=host
CORE_VM_DOCKER_TLS_KEY=/tmp/org1/peer1/docker/key.pem
CORE_VM_ENDPOINT=https://127.0.0.1:2376
CORE_VM_DOCKER_TLS_CA=/tmp/org1/peer1/docker/ca.pem
Trying to install chaincode package.
peer lifecycle chaincode install patient_consent-v0.0.1-package.tar.gz \
--peerAddresses fabric-dev-peer1-org1:7051 --connTimeout 10s \
--tlsRootCertFiles /tmp/org1/peer1/tls/msp/cacerts/fabric-dev-tlsca-org1-7052.pem \
-o fabric-dev-orderer1-org1:7050 --tls --cafile /tmp/org1/peer1/tls/msp/cacerts/fabric-dev-tlsca-org1-7052.pem
This gives me
Error: chaincode install failed with
status: 500 - failed to invoke backing implementation of 'InstallChaincode'
could not build chaincode
docker build failed
docker image inspection failed
Get https://127.0.0.1:2376/images/dev-peer1-org1-patient_consent-v0.0.1-9aedb4f5f58cb4bf18cf38f53751928caf9074c4bcb6859d8417fb37c09ab596-0acf342a6da8bfef85ec6b4d9dbe3ca4236ab9e52d903bb9fb014db836696d7b/json
remote error:
tls: bad certificate
In the peer chaincode install command, you have put the wrong tlsRootCertFiles for the orderer. The --cafile is same as the peer. It is the orderer CA file .
--tlsRootCertFiles /tmp/org1/peer1/tls/msp/cacerts/fabric-dev-tlsca-org1-7052.pem \
-o fabric-dev-orderer1-org1:7050 --tls --cafile /tmp/org1/peer1/tls/msp/cacerts/fabric-dev-tlsca-org1-7052.pem
Usually when you spin up the test-network (2.0/1),the orderer tls CA files is found at organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
You can check in your setup and put the right path for orderer --cafile flag.

Hyperledger Composer: command composer network start failing

I am trying to deploy a business network using command:
composer network start -c PeerAdmin#hlfv1 -n test-bna -V 0.0.1 -A admin -S adminpw
And it is failing with error:
Error trying to start business network. Error: Failed to connect to
any peer event hubs. It is required that at least 1 event hub has been
connected to receive the commit event.
On checking the composer logs, it says:
2018-11-08T13:30:59.190Z WARN :HLFConnection
:_connectToEventHubs() event hub localhost:7051 failed to connect:
12 UNIMPLEMENTED: unknown service protos.Deliver {}$
2018-11-08T13:31:46.763Z WARN :HLFConnection
:_connectToEventHubs() event hub localhost:7051 failed to connect:
12 UNIMPLEMENTED: unknown service protos.Deliver {}$
Could someone please help with resolving this?

Hyperledger fabric: Cli Bash isn't able to connect to orderer; chaincodes not instantiating on channel

Error:
error getting broadcast client: orderer client failed to connect to
orderer.example.com:7050: failed to create new connection: context
deadline exceeded
I'm getting this error when trying to start a private collection in Fabric.
Following the docs properly and everything at the basic level seems to work (creating first app, creating first network, and extending first network - have not tried upgrading network parts yet). But as I create the private collections feature, it stops precisely at this step.
This happens when I start the network, go into the peer container using docker exec -it cli bash and instantiate the chaincode on the peer (peer chaincode install -n marblesp -v 1.0 -p github.com/chaincode/marbles02_private/go/) which works.
But when I instantiate it on the channel (peer chaincode instantiate -o orderer.example.com:7050 --tls --cafile $ORDERER_CA -C mychannel -n marblesp -v 1.0 -c '{"Args":["init"]}' -P "OR('Org1MSP.member','Org2MSP.member')" --collections-config $GOPATH/src/github.com/chaincode/marbles02_private/collections_config.json --connTimeout 30s) it produces this error and I dont know how proceed further.
Can someone help me understand what's wrong here or how to get my chaincode instantiated on my channel because I have to get the private collections to work?
Its possible this question is related to some communication between different docker images as my orderer and peer are in different containers. My commands run in the peer container (atleast thats what I think) and its unable to talk to orderer container.
Here are kinematic screenshots:
UPDATE:
This is my command: (peer chaincode instantiate -o orderer.example.com:7050 --tls --cafile $ORDERER_CA -C mychannel -n marblesp -v 1.0 -c '{"Args":["init"]}' -P "OR('Org1MSP.member')" --collections-config $GOPATH/src/github.com/marbles02_private/collections_config.json --connTimeout 30s).
I get this without sudo:
Error: error getting broadcast client: orderer client failed to connect to orderer.example.com:7050: failed to create new connection: context deadline exceeded
and with sudo I get
Error: error getting endorser client for instantiate: endorser client failed to connect to 0.0.0.0:7051: failed to create new connection: context deadline exceeded
and in sudo case, it doesn't even wait 30s, it shows error within ~2 seconds.

Hyperledger Fabric: Orderer Client failed to connect to orderer.example.com

I am new to hyperledger fabric and I am trying to create a sample blockchain network from scratch using hyperledger fabric. In order to do so, I configured "crypto-config.yaml" file, and generated the respective organization's certificates by running it against the "cryptogen" tool. I also generated the respective "channel-artifacts" by configuring the "configtx.yaml" file and running it against the configtxgen tool. I then modified the "docker-compose-cli.yaml" file and "docker-compose-base" file.
Now, in order to bootstrap the network, I ran the following docker command:
docker-compose -f docker-compose-cli.yaml up
I then executed the following commands:
docker exec -it cli bash
export CHANNEL_NAME=testChannel
peer channel create -o orderer.example.com:7050 -c testChannel -f ./channel-artifacts/testChannel.tx
On executing the "peer channel create" command I received the following error:
Error: failed to create deliver client: orderer client failed to connect to orderer.example.com:7050: failed to create new connection: context deadline exceeded
I am not sure as to why this error is occurring. My configuration for the Address section in OrdererDefaults (in configtx.yaml file) is:
Ordertype:
- solo
Addresses:
- orderer.example.com:7050
Hence, please let me know if I am missing something in order to clear the "peer channel create" issue.
do a docker ps and see if the orderer is up and running
if not do a docker logs orderer.example.com and check orderers logs
usually the orderer logs give clear clues on what has happened
read the logs and fix the issue . that's what i did
and instead of creating a peer first going inside it and creating a channel ,i suggest you create the channel first and join the peer to it afterwards
Create the channel
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin#org1.tracexyz.com/msp" peer0.org1.tracexyz.com peer channel create -o orderer.tracexyz.com:7050 -c cheeseproduction -f /etc/hyperledger/configtx/channel.tx
Add peer 0 to the channel
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin#org1.tracexyz.com/msp" peer0.org1.tracexyz.com peer channel join -b cheeseproduction.block
Fetch from peer 1
docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin#org1.tracexyz.com/msp" peer1.org1.tracexyz.com peer channel fetch config -o orderer.tracexyz.com:7050 -c cheeseproduction
Join peer 1 also to the channel
docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin#org1.tracexyz.com/msp" -e "CORE_PEER_ADDRESS=peer1.org1.tracexyz.com:7061" peer0.org1.tracexyz.com peer channel join -b cheeseproduction.block
this is how i connected two peers to a single channel. my org name was tracexyz (tracexyz instead of example ) and my channel name was cheeseproduction
I guesss you can replace those with your own values
after doing these go inside the peer with
docker exec -it cli bash
it will take you inside the default peer which is peer0.org1
then do a peer channel list to see the channels to which peer0 has joined
you will see it will list cheeseproduction

ERRO : Error trying to connect to local peer: grpc: timed out trying to connect

Unable to deploy chaincode example in my local hyperledger fabric.
system config: mac osx, Docker toolbox for mac
One validating peer is up and running using docker-compose.yaml
membersrvc:
image: hyperledger/fabric-membersrvc
command: membersrvc
vp0:
image: hyperledger/fabric-peer
environment:
- CORE_PEER_ADDRESSAUTODETECT=false
- CORE_VM_ENDPOINT=http://172.17.0.1:2375
- CORE_LOGGING_LEVEL=DEBUG
- CORE_PEER_ID=vp0
- CORE_SECURITY_ENROLLID=test_vp0
- CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT
links:
- membersrvc
command: sh -c "sleep 5; peer node start --peer-chaincodedev"
While deploying chaincode by running
CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS=0.0.0.0:30303 ./test
Its showing the error as [shim] ERRO : Error trying to connect to local peer: grpc: timed out trying to connect
I tried replacing CORE_PEER_ADDRESS as suggested by grep timeout solution but no change in error.
First Validating peer output
Chaincode deployment error window
You need to use the correct port number on which peer process is listening to.
instead of using the following command,
CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS=0.0.0.0:30303 ./test
try this instead,
CORE_CHAINCODE_ID_NAME=mycc CORE_PEER_ADDRESS=0.0.0.0:7052 ./test
if it doesn't work then run the following command to check your listening port and use that instead,
netstat -atp tcp | grep -i "listen"

Resources