Hyperledger Fabric: CreateChannel Issue version-2 - hyperledger-fabric

fabric fabric-samples/test-network createChannel failed
[1]: https://i.stack.imgur.com/tJLk3.png

At the point of failure, it can't connect to 7050, which is the port for the orderer node. If you do a docker ps it should at least tell you if that peer is currently running and that it really is available on that port. Are the YAML files exactly as you found them or did you make any amendments? Configuration is sometimes the biggest culprit if you are not careful about managing the changes.

Related

Error deploying Fabric test-network fabcar chaincode

I am following the documentation (https://hyperledger-fabric.readthedocs.io/en/latest/test_network.html) to deploy a test network for Fabric on Ubuntu 16.04 on Amazon Lightsail. All commands have been executed successfully with results as expected until
./network.sh deployCC -l javascript
The following error message is received:
Error: endorsement failure during invoke. response: status:500 message:"error in simulation: failed to execute transaction 2554869d3683a7e77202f448aa201fd2f97243faa4ff5dd4839eb8d3175cf53b: could not launch chaincode fabcar_1:bec08b518fdb2bda0a0fb41a4a6f996a87ba08887583febedbc791cba7e91537: chaincode registration failed: container exited with 0" !!!!!!!!!!!!!!! Invoke execution on peer0.org1 peer0.org2 failed !!!!!!!!!!!!!!!!
Any assistance will be tremendously appreciated.
K
For fabcar sample, you can use startFabric.sh script inside fabcar to deploy chaincode with the language that you want. Specifically run ./startFabric.sh javascript in your case.
This script generally runs ./network.sh with some additional network cleanups.
everything is working as expected now. The issue had been with system sizing - increasing the memory to 4GB RAM fixed it
Thank you everyone for your suggestions.
K
I am assuming that you are doing a fresh installation.First stop all the containers if it's not stop.
docker stop $(docker ps -a -q)
After that remove the unused volume using the command.
docker volume prune
or docker system prune to remove any unused data.
You have to remove the certificates manually(if it's not deleted).First of all execute the ./network.sh down command.Then go into the test-network/organizations and remove the content of peerOrganizations and ordererOrganizations
Then move to the fabric-ca directory and remove the content of org1 ,org2 and ordererOrg, keep in mind that in here you don't have to remove any .yaml file.
And remove the fabcar.tar.gz package in test network.
Now start the network using the commands below:
./network.sh up createChannel -ca -c mychannel -s couchdb -i 2.0.0
./network.sh deployCC -l javascript
I have the same problem with javascript chaincode (it works 2 days ago, having the same error now), but deployCC with golang (weirdly) doesn't have this problem. So if using javascript is not a requirement you can also just run ./network.sh deployCC
Shut down your network. Then start it again. Then create a channel and deploy your chaincode. It will work.
I was getting same error because I created a named channel first and tried to deployed code there with -c. But when I shutdown and performed all steps again with default "mychannel" and it worked fine for me.

Hyperledger fabric2.0 peer lifecycle chaincode approveformyorg Error: timed out waiting for txid on all peers

The config looks good, and I can successfully run package and install. However, approveformyorg return this error: timed out waiting for txid on all peers.
I don't know how to debug this error. I have tried to change some environment variables (like CORE_PEER_TLS_ROOTCERT_FILE, CORE_PEER_MSPCONFIGPATH).
Is it a network error? Or is the order set wrong?
Thanks for your help!
Running picture
I have encountered the same problem。The reason for my problem is that the DNS Server in Docker cannot resolve the domain name of the orderer node。It does not use the DNS settings in /etc/hosts。So the peer node can not connect to the ordering service to receive the blockWhen you check the log of the peer node, you will find that there is no such host.
Therefore, I added extra_hosts to the docker-compose.yaml files of all nodes(include orderer nodes).The document is https://docs.docker.com/compose/compose-file/compose-file-v2/ .Next I deleted and rebuilt all services。Now it has worked.
This happend to me when my order and my peer wasn't able to interract with each other.
Take a look at your peer and orderer logs to check if their is no network error.

Error: failed to create deliver client: orderer client failed to connect to orderer: failed to create new connection: context deadline exceeded

I have been following the tutorial of Hyperledger Fabric Multi-Org setup and I was able to do it successfully. Now I want to customise it according to the name of the organization that I want to and I encountered below error when I was try to up the network. Hope someone could help me identify the problem. Thanks in advance.
it might be possible due to: TLS-connection problem, Connection problem (peer does not see orderer).
Check the peer's logs in debug mode.
docker logs <peer_container_id>
I hit the similar error "context deadline exceeded".
My env is
host: ubuntu 16,
native docker: peer containers and an order container running on the host
no virtual machine.
Running commands on the host.
Change
export CORE_PEER_ADDRESS=peer0.org1.example.com:7051
peer channel join -o $ORDERER_ADDRESS -b $CHANNEL_BLOCK
to
export CORE_PEER_ADDRESS=localhost:7051
peer channel join -o $ORDERER_ADDRESS -b $CHANNEL_BLOCK
Fixed the error.
The way to locate the cause is checking if you can reach the addresses(orderer / peer) on the same terminal running the commands. Hope it helps.
In my case, there was some issue with the firewall (uft ubuntu).
I dissabled it an it worked.
However, I recommend you to check which ports you should open.

Fabric Error: failed to create deliver client: orderer client failed to connect to orderer.example.com:7050: failed to create new connection

There was an Hyperledger Fabric error updating the anchor peer in the Building Your First Network document. This error is as follows.
Error: failed to create deliver client: orderer client failed to connect to orderer.example.com:7050: failed to create new connection: x509: certificate signed by unknown authority
I need your help.
I fixed by bringing the network down (byfn.sh down)
and then up again (byfn.sh up).
Please see this link for more information:
How to fix "FAILED to execute End-2-End Scenario" in Hyperledger Fabric?
x509: certificate signed by unknown authority
This error is due to the certificate format mismatch, It happed to me when I used v1.0 cryptogen tool for certificate generation and ran the network with v1.1 Fabric containers.
So, try to update the cryptogen tool from here -> http://hyperledger-fabric.readthedocs.io/en/release-1.1/samples.html#binaries.
I don't know what version you were using so, I assumed it would be v1.1. So, please specify the Hyperledger Fabric version you were using.
One of the problems could be that you have an old version of the Hyperledger Example and you are pointing to an old version of the Cryptogen tool. So if you download a newer example, when you generate the crypto-config it will generate it with the old version of the cryptogen tool, this could make your orderer container to stop, cause can validate the certificate generated.
This is because the differents versions of the cryptogen tool generate different metadata.
My suggest is to check if the cryptogen version that you are using is the one contained in your downloaded image of your example. If you had run lot of tests, clean all the docker images and containers, that always help.
If nothing of that works, I wrote a tutorial based on the basic-network example and how to run it in multiple hosts, maybe you can take some information from there.
https://medium.com/1950labs/setup-hyperledger-fabric-in-multiple-physical-machines-d8f3710ed9b4
Please, feel free to ask, if you have doubts!
This error is due to channel capabilities are set as true for v.1.4.0 so you should change it to false so that it can run for every version of the fabric.
Try:
docker ps -a
to find container ID of hyperledger orderer and peer images. Then try:
docker rm *container_ID*
to remove them. After you can run ./network.sh up createChannel.
so for this error i tried doing byfn.sh down and byfn.sh up but after that it threw another error, which i solved by first killing all the containers, removing them, cleaning all images and volumes that already exist and restarted the tutorial. to kill and remove processes and images and cleaning my system.
https://medium.com/coinmonks
docker kill $(docker ps -q)
docker rm $(docker ps -qa)
docker system prune -a
docker volumes prune -a
delete fabric-samples directory and start from the beginning and you're ready to go.

Hyperledger Fabric CLI docker container

I have couple a questions regarding HF CLI docker container and some of CLI commands.
First of all, can someone explain the purpose of this container in context of docker container which is started alongside other docker containers required for HF ecosystem. How can I for example query my business network organisations, different peers, and chain-code status on those peers?
Second of all, when I install a chain code issuing peer chaincode install CLI command, to which peer is that code installed (if i have 5 peers attached to org1.example.com organisation, on which peer aforementioned command will install the targeted chain code)?
And third of all, if I have just one organization in my business network specification which handles multiple peers and channels, when I try to instantiate the installed code issuing peer chaincode instantiate command, how to specify the endorsement policy (http://hyperledger-fabric.readthedocs.io/en/latest/endorsement-policies.html) which has just one organisation in endorsement expression after the -P parameter?
Thank you for your help!
EDIT 1:
Just one update regarding 3rd answer. In you have one organisation maintaining peers and channels when instantiating chaincode, you can omit the endorsing policy parameter (-p). In that case transaction will be endorsed if any peer endorses it
Lots of great questions.
the "cli" container's purpose is to run a peer process as a CLI . It is a bit confusing that the same process is both a client and a server, we may change that. Basically, when you run the peer chaincode commands, you are running the CLI. The peer node commands are the server commands. The cli container in our samples runs a script (scripts/script.sh) which in turn executes a series of CLI commands against the peer nodes.
If you examine scripts/script.sh, you will find a setGlobals function that sets a few environment variables, including CORE_PEER_ADDRESS. This is the peer (server) to which the peer (CLI) will communicate when installing the chaincode.
Actually, after further research, this is not possible, unfortunately. The gate syntax isn't yet implemented. You would need to simulate multiple orgs for this.
Re the second part of this question.
Entering the CLI
docker exec -it cli bash
The bootstrapped peer for CLI is peer0.org1.example.com
Check which PEER you are on:
echo $CORE_PEER_ADDRESS
returns
peer0.org1.example.com:7051
Change to peer1.org1:
export CORE_PEER_ADDRESS=peer1.org1.example.com:8051
Also applies to LOCALMSPID, MSPCONFIGPATH, etc

Resources