Table of Contents
Hyperledger fabric samples git repository comes with many blockchain examples that you can deploy on the blockchain. From fairly simple network like basic network that has only one organazation and only one peer to a complex structure like first network that has two organizations and four peers in total. As with all these networks fabric samples also comes with pre built chaincodes in Go language, Javascript and Java. Along with these chaincodes fabric samples also includes some Nodejs based deployed SDK’s. One most famous nodejs deployed project in called Fabcar. To initiate fabcar you have to start the basic network and then access its blockchain using the fabcar network. To achieve the Hyperledger Fabric TLS disabled state, all you have to do is follow this blog and i will set you up.
Build Your first Network ( byfn):
BYFN by default starts without the certification authority and TLS enabled. To achieve the Hyperledger Fabric TLS disabled state these are the settings that we can modify according to our own needs once you learn the get around with fabric’s files.
First of all lets see how do we run byfn fabric normally and then we will modify it and then run it with the TLS disabled.
I am not going to assume that you already have the samples and everything to let me explain it from the very basics. lets download the fabric samples first.
Create a new folder named Blockchain. and then open terminal in that folder.
Run this command in the terminal.
$ git clone https://github.com/hyperledger/fabric-samples.git
After you run this command you will get all the fabric samples and that brings us one step closer to achieving the Hyperledger Fabric TLS disabled state. Now they are not yet ready to work. You need to download binaries and docker images of the fabric version which you want or by default let it do it for the latest version.
run this command in the fabric samples directory.
$ ./scripts/bootstrap.sh [version] [ca version] [thirdparty_version]
The version, ca version and thirdpart_version are optional. u can simply run it without them as well.
After all everything is done. You are now ready to run the script for byfn. Go to the frist network directory and run the byfn script using this command.
for levedb
$ ./byfn.sh up
or you can start it with couchdb.
$ ./byfn.sh up -s couchdb
You will see a lot of console outputs on your screen that is fabric just building you a new orderer, peers, couchdb etc.
Once they are done. your byfn is all ready to run but know that there arent any chain codes install on your byfn network. If you want to know how to install your custom chaincode on byfn then go to this article.
Hyperledger Fabric TLS Disabled:
Now take everything down and we will start the byfn again but this time we will modify it and achieve the Hyperledger Fabric TLS disabled state . To turn of the TLS in byfn you first need to get your hands dirty with byfn files and modify the settings in it so that when you run the byfn up script it reads the new settings and setup your blockchain according to that.
Now what we have to do is start by going through the byfn files and searching for TLS_ENABLED=true command and changing all of these to false. Disable every TLS_ENABLED orderer, peer or CA you find. Disable there TLS by changing the true value to false.
The files where you have to change the TLS values are .
./base/docker-compose-base.yaml
./base/peer-base.yaml
./docker-compose-cli.yaml
./docker-compose-e2e-template.yaml
./docker-compose-org3.yaml
Once you change the TLS_ENABLE values to false for all of them you are done then. You have successfully disabled TLS for you byfn network.
Now again go to the first network directory in your terminal and start it by running the command
$ ./byfn.sh up
and this will now run the whole network with TLS disabled. You can test by invoking the chaincode from the fabcar network betwork the fabcar nodeJS app uses TLS disabled blockchain.
Read more blogs written by our blockchain development company.