hyperledger fabric chaincode dev mode connection error - docker

I was following this tutorial of building a simple chaincode in dev mode here.
I'm stuck here
First I cleared everything with docker rm -f $(docker ps -aq).
When I enter docker-compose -f docker-compose-simple.yaml up it ends with this Error: Error getting broadcast client: Error connecting to orderer:7050 due to context deadline exceeded
cli | Usage:
cli | peer channel create [flags]
cli |
orderer | 2017-12-05 20:44:53.681 UTC [orderer/common/deliver] Handle -> WARN 0d1 Error reading from stream: rpc error: code = Canceled desc = context canceled
orderer | 2017-12-05 20:44:53.681 UTC [orderer/main] func1 -> DEBU 0d2 Closing Deliver stream
cli exited with code 1
What is causing problem? Is it dns problem that it can't find orderer?

Alright, I finally figured that out, the problem is in network, so I had in my virtual machine parameters set NAT for network, and nothing worked. I've set it to bridge mode and everything worked fine.

Related

Hyperledger Fabric peer container fails to start after network was shut down

I'm using the test-network from the hyperledger fabric samples at LTS version 2.2.3. I bring up the network with ./network.sh up createChannel -s couchdb followed by the command for adding the third org in the addOrg3 folder: ./addOrg3.sh up -c mychannel -s couchdb. Sometimes I want to have a fresh start when working on a smart contract so I bring down the network with ./network.sh down. Then when I restart the network with the previously mentioned commands sometimes one of the peer nodes will just fail to start. The log just shows this:
2022-02-18 13:10:25.087 UTC [nodeCmd] serve -> INFO 001 Starting peer:
Version: 2.2.3
Commit SHA: 94ace65
Go version: go1.15.7
OS/Arch: linux/amd64
Chaincode:
Base Docker Label: org.hyperledger.fabric
Docker Namespace: hyperledger
2022-02-18 13:10:25.087 UTC [peer] getLocalAddress -> INFO 002 Auto-detected peer address: 172.18.0.9:11051
2022-02-18 13:10:25.088 UTC [peer] getLocalAddress -> INFO 003 Returning peer0.org3.example.com:11051
I tried connecting to the container and attach to the process peer node start which is the process that brings up the container to get some more info on why its hanging. But since it is the init process with pid 1 one neither attach to it nor kill it. Also killing the container is not working as it is just not responding so I need to kill the whole docker engine. I tried the following without success: Purging docker with docker system prune -a --volumes, restarting my computer, re-downloading the fabric folder and binaries. Still the same error occurs. How is this possible, which information is still on my machine that makes it fail? At least I assume there is something on my machine as the same freshly downloaded code works on another machine and after many times repeating the pruring and restarting and redownloading it also works again on my computer.

Hyperledger Fabric error at adding new org to channel

I'm running Fabric test network v2.2. Everything was successfully set up. I'm now trying to add an extra organization to the network.
I've generated crypto materials, and the configuration update tx. I sign the transaction, Essentially, everything executed correctly, where the success message regarding the addition of a peer was obtained.
EDIT:
Although it seems that the peer0 from a new org (org5) was correctly added, the org5 logs show that:
2021-05-31 13:13:50.794 UTC [peer.blocksprovider] DeliverBlocks -> WARN 7b0 Could not connect to ordering service: could not dial endpoint 'orderer.example.com:7050': failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp: lookup orderer.example.com on 127.0.0.11:53: no such host" channel=mychannel
peer0.org1.example.com shows similarly that:
2021-05-31 13:13:06.802 UTC [gossip.gossip] func1 -> WARN 409 Deep probe of org5.example.com:11071 failed: context deadline exceeded
2021-05-31 13:13:06.802 UTC [gossip.discovery] func1 -> WARN 40a Could not connect to Endpoint: org5.example.com:11071, InternalEndpoint: org5.example.com:11071, PKI-ID: <nil>, Metadata: : context deadline exceeded
Any ideas on how to solve this?
Logs:
Orderer logs: https://gist.github.com/RafaelAPB/bada1278a096e252060e3d117b3c5719
peer0.org1.example.com logs: https://gist.github.com/RafaelAPB/d5b6af66a62a18d9572399274a0a6aa5
org5 logs: https://gist.github.com/RafaelAPB/cddba91566e66ca45f5494dff43196a0
peer 5 docker-compose:
https://gist.github.com/RafaelAPB/b82a64d4122e103f06dd7e4b9bc9023c
I guess that your orginal docker network is cactusfabrictestnetwork_test,and your origin fabric components has join this docker network,so your new peer(peer0.org5.example.com) should join this docker network(cactusfabrictestnetwork_test),then all these component can find each other.
then your peer0.org5.example.com docker-compose file should like this https://paste.ubuntu.com/p/G7MyWSCN6g/ and before you start your peer0.org5 container ,set COMPOSE_PROJECT_NAME=cactusfabrictestnetwork,and your peer0.org5 will join network cactusfabrictestnetwork_test,reference this https://docs.docker.com/compose/networking/

Hyperledger - container_linux.go:349 starting container process caused "no such file or directory": unknown

I have installed Hyperledger Fabric (2.0.0-alpha) in Docker (2.2.0.5) running on Windows (Linux containers) and am trying to start the first-network example. When running the command ./byfn.sh -m up I am getting the following error:
OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused
"no such file or directory": unknown ERROR !!!! Test failed
From the Docker Dashboard, cli and peers have started, instead of orderer. When checking the logs of the orderer I see the following error:
2020-05-04 20:29:04.492 UTC [orderer.common.cluster] loadVerifier -> ERRO 003 Channel byfn-sys-channel has no blocks, skipping it
2020-05-04 20:29:04.500 UTC [orderer.common.cluster] loadVerifier -> INFO 004 Loaded verifier for channel testchainid from config block at index 0
2020-05-04 20:29:04.520 UTC [orderer.common.server] initializeServerConfig -> INFO 005 Starting orderer with TLS enabled
2020-05-04 20:29:04.521 UTC [orderer.common.server] initializeMultichannelRegistrar -> INFO 006 Not bootstrapping because of existing chains
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xe06ad9]
goroutine 1 [running]:
github.com/hyperledger/fabric/protoutil.GetMetadataFromBlock(0x0, 0x1, 0x0, 0x194, 0x1dad440)
/go/src/github.com/hyperledger/fabric/protoutil/blockutils.go:110 +0x39
github.com/hyperledger/fabric/protoutil.GetLastConfigIndexFromBlock(0x0, 0xc0002f22a0, 0xffffffffffffffff, 0x0)
/go/src/github.com/hyperledger/fabric/protoutil/blockutils.go:130 +0x37
github.com/hyperledger/fabric/orderer/common/multichannel.ConfigBlock(0x7f12cf76eda8, 0xc0002f22a0, 0x7f12cf76eda8)
/go/src/github.com/hyperledger/fabric/orderer/common/multichannel/registrar.go:111 +0x68
github.com/hyperledger/fabric/orderer/common/multichannel.configTx(0x7f12cf76eda8, 0xc0002f22a0, 0xc0002f22a0)
/go/src/github.com/hyperledger/fabric/orderer/common/multichannel/registrar.go:124 +0x35
I've checked for solutions online but no results till now.
Similar question 1 - he does not explain if he installed a new Docker version or did anything else differently.
Similar question 2 - in docker-compose.yml my working_dir for orderer.example.com is /opt/gopath/src/github.com/hyperledger/fabric/orderer and for cli /opt/gopath/src/github.com/hyperledger/fabric/peer
Also, my GO version is go1.8.7
I solved the issue following a few steps:
My scripts were not working well. so I opened file script.sh and utils.sh with notepad++ and set the EOL Conversion to Linux. After this I got the following error:
Error: failed to create deliver client for orderer: orderer client
failed to connect to orderer.example.com:7050: failed to create new
connection: connection error: desc = "transport: error while dialing:
dial tcp: lookup orderer.example.com on 127.0.0.11:53: no such host"
!!!!!!!!!!!!!!! Channel creation failed !!!!!!!!!!!!!!!!
I also cleared all unused images with the following docker rm -f $(docker ps -aq)
Bringing down the network ./byfn.sh down and then start it again solved the issue.

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.

Push docker image to Google Container Registry failure on Mac

I was trying to upload my image to Google Container Registry, but it return some error and I don't know how to troubleshooting.
$> gcloud docker -- push asia.gcr.io/dtapi-1314/web
The push refers to a repository [asia.gcr.io/dtapi-1314/web]
53ccd4e59f47: Retrying in 1 second
32ca8635750d: Retrying in 1 second
e5363ba7dd4d: Retrying in 1 second
d575d439624a: Retrying in 1 second
5c1cba20b78d: Retrying in 1 second
7198e99c156d: Waiting
6ca37046de16: Waiting
b8f2f07b3eab: Waiting
16681562a534: Waiting
92ea1d98cb79: Waiting
97ca462ad9ee: Waiting
unable to decode token response: read tcp 10.0.2.10:54718->74.125.23.82:443: read: connection reset by peer
I checked permission on my Mac.
$> gsutil acl get gs://asia.artifacts.dtapi-1314.appspot.com
It returned a list of correct permission.
I'd tested push on the cloud console, it works.
Does anyone have clue?
Thanks a lot if anyone could help. :)
Other troubleshooting
gcloud auth login
gcloud docker -- login -p $(gcloud auth print-access-token) -u _token https://asia.gcr.io
gsutil acl get gs://asia.artifacts.{%PROJECT_ID}.appspot.com
Add insecure-registry to dockerd startup command.
--insecure-registry asia.gcr.io
Might be the same cause
gcloud docker -- pull google/python
The error was
Error response from daemon: Get https://registry-1.docker.io/v2/google/python/manifests/latest: read tcp 10.0.2.15:37762->52.45.33.149:443: read: connection reset by peer
docker server log
DEBU[0499] Increasing token expiration to: 60 seconds
ERRO[0500] Error trying v2 registry: Get https://registry-1.docker.io/....../python/manifests/latest: read tcp 10.0.2.15:37762->52.45.33.149:443: read: connection reset by peer
ERRO[0500] Attempting next endpoint for pull after error: Get https://registry-1.docker.io/....../python/manifests/latest: read tcp 10.0.2.15:37762->52.45.33.149:443: read: connection reset by peer
DEBU[0500] Skipping v1 endpoint https://index.docker.io because v2 registry was detected
ERRO[0500] Handler for POST /v1.24/images/create returned error: Get https://registry-1.docker.io/....../python/manifests/latest: read tcp 10.0.2.15:37762->52.45.33.149:443: read: connection reset by peer
Environment
MacOS: 10.11.6
Docker Toolbox (on MAC)
Docker 1.12.3 (Git commit: 6b644ec, Built: Wed Oct 26 23:26:11 2016)
The root cause was stupid, but I'd like to update this for anyone who see this question. I found when I attached my computer to company's WIFI. Then It would work (Still some reset). The cable network of my company is mysterious broken to Google Container Registry. The cable network works for all other services (google/youtube/mobile services) we used but broken to Google Container Registry.
Seems like a permission issue. Try running
gcloud auth login
I remember running into a similar issue and this helped.

Resources