📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

Getting Started with Hyperledger Fabric and Installation | Blockchain

Telusko12:01

Transcription

Welcome back, aliens! My name is Erwin Ready, and let's continue this series on blockchain.

Not in this point, we have talked about what is blockchain. We have seen what is Ethereum, and then in between, we have talked about Hyperledger. Now, see, when you talk about Bitcoin, it is great. When I talk about Ethereum, it is awesome. And but still, there is some issue which we have to address.

Now, one of the issues about blockchain is it is awesome in the cryptocurrency world, but what about the enterprise market? The only problem is whatever you save in blockchain, they actually get stored on a distributed ledger. So, this is basically a fancy word for database. So, you can imagine we have a distributed database, and you are storing all your data in the distributed database. Which also means that if you have a network of 10 nodes, every node will have the database. That also means that everyone knows the entire data because blockchain is transparent, so they can see your data.

So, next, say that there are three to four companies, your organization, and all not all are actually communicating. Let's say A and B, they are communicating, and they want to share data. If they do any transaction, all other nodes will come to know that, "Hey, these two have done some transaction." So, we need to have some privacy there, right? We need to have some secrecy because companies, they don't want to share their data with everyone else. And that's where we got a new project, which is Hyperledger. In fact, they have talked about it, but inside the Hyperledger as well.

So, if it's a big of blockchain line, we have some small projects. When a small, they are not small, actually. So, there we have some big projects like Hyperledger Fabric, we have Sawtooth, and Fabric is powered by IBM. So, it's a very big project, and it is getting full of fame nowadays in the blockchain industry. And today, we will see how to do a setup for Hyperledger Fabric.

Now, basically, for Hyperledger Fabric, you don't have to do a lot of different stuff. They have to give you an awesome script. You just have to run that script, and everything will be installed on your machine. Save it. That is, if we don't have to make a video, right?

So, now, of course, you can go to the official website of Hyperledger Fabric and you can see the documentation. They have given these steps. You can follow them. It will mostly work. The only thing is you need a Linux-based OS, okay? So, we can also do this setup in Windows because now Windows also supports Linux subsystem. So, you can just enable that feature using Windows. I can just go to "Turn Windows on and off" settings, and you can enable the Windows Subsystem for Linux, and then you can install Ubuntu in that, and it will surely work.

Now, for that, you need to have a Windows Pro version. So, if you have Windows Home version, it will not work. But we'll be using Ubuntu here. And of course, right, if you are learning blockchain, if you are learning to get a job, why not install Ubuntu and use it, right? Okay, so let's, let's get started.

So, basically, we need certain prerequisites for that. So, if you can see on this screen, to install Hyperledger Fabric, you need to have these things in your machine. So, you need `curl` because you will be requesting for some scripts. You will be needing Docker, of course, right? So, Hyperledger Fabric will give you an image, you can which you can run on your Docker, Docker container. So, you need these two things: Docker and Docker Compose. You also need Go. Big, it's because Hyperledger Fabric is built using Go language, and that's why you need a Go setup. You also need Node.js and NPM. Not for this, isn't for this. In fact, you also need JDK. Hyperledger Fabric actually supports three languages: Java, JavaScript, and Go. And of course, we all know about Java and JavaScript, but Go is also a powerful language which which you can use. In fact, the awesome thing is the Fabric is built on Go, as we talked about, right?

So, and if you want, if you want to use JavaScript for Hyperledger Fabric, so if you want to do programming, that you have to install Node.js and NPM. But what if you want to do in Java? Of course, you need to dedicate there. And I am assuming that most of the machines have JDK. So, I should have written that there you need JDK as well. And then you also need Python 2.7. Now, by default, Ubuntu comes with 3.3.x, so you need to have 2.7. So, make sure that you download that as well.

Now, if you want to know this setup, it's very, it's quite straightforward. You can just go to command prompt and you can just run the scripts there. So, first, you can verify does your machine has Go. So, again, just say `go --version`, and it will show you some version and some of the stuff. If you're showing this version and anything about this, it will, a bunch of Fabric will work for you. Otherwise, you have to upgrade your Go. If you want to install `curl`, it's very easy. Just have to `apt install curl`, so have to say `sudo apt install curl`, and then it will install `curl` for you. Now, since I already have it in my machine, so I don't have to do that.

The next thing I need here is Docker. And for Docker installation, Docker is also easy. In fact, you can check, do you have Docker on your machine pre-installed? You can simply say `docker --version`, and if it is giving you anything about this, it will surely work. I guess about 18.something always works for Docker, and this is working for me. So, here, Docker. And you also need Docker Compose. Now, if we don't have Docker installed, again, this, this command is very easy. You can simply say `sudo apt install docker`. And for Docker Compose, it's the same thing. So, I can, so I can do that as well. You have to also confirm, do you have Docker Compose? And yes, I have that. So, anything about 1.2.1.21 is a good number for you. You can go with that.

So, we have `curl` on this machine. If you don't have it, you know the step. So, I do have to pass the command. It will surely work. And we have to install Docker and Docker Compose. The next thing we need here is Python, right? So, we'll verify that as well. So, you can simply say `python --version`, and you can see we got 2.7. Now, if you don't have 2.7 versions, what you can do is again, just go to Google and search for "how to switch from 3.x to 2.7". So, you have to install 2.7 as well. That is the important step.

We also need Go, right? So, we can verify the Go version. So, we can say `go version`. In fact, it, I guess it will not give you a version number. So, if you do that, it will show you a lot of commands of Go. That means Go is installed. Otherwise, if we don't have Go installed, this step is very easy. Just have to say `sudo apt install golang-go`, and if you say, if you enter, of course, it will, it will install Go in your machine. So, that's it. Those are the steps.

And one important thing about Node.js, you can verify that as well. You can say `node -v`. Yeah. So, if you say `node -v`, it will give you the Node version. If you don't have it, again, setup is very simple. `sudo`. In fact, if you have this command, if it is not, if you're not getting the version, it will also give you the command that itself. That's the awesome thing about Ubuntu or Linux, basically. And if we also check for NPM, it's the same, same way. So, these are the prerequisites. If you want to install Hyperledger Fabric.

Now, once you know these steps are done, once you know all these things, all these things are there, introduced, these are very easy to work with. Now, once you know that you have all this thing with you, it's time to execute the Hyperledger Fabric script. Since when you talk about Hyperledger Fabric, there are a lot of things you have to follow. But fortunately, Hyperledger Fabric, they have given you this script. Just run this script, and it will install whatever things it needed to get it up and running.

Now, basically, when you install Hyperledger Fabric, they also give you some examples. Now, they call it as Fabric Samples, and in there, in those samples, they have a lot of different examples given. An example for FabCar, we have BYFN, which is your Build Your First Network. We also have Commercial Paper. So, we'll talk about those things in the subsequent videos. I will see how to build your first network. We also see how to load the application, and maybe we can see some coding part in the in the FabCar as well. And basically, we will try to do in Java first, and then we can see other languages. Okay?

So, one, so let's the install Hyperledger Fabric here. See, one thing is very important here. When you run this script, it will do certain things for you. It will download the samples for you. It will download the Docker images. It will download the Fabric. Now, in all those steps, it will go to the Git server. It will download some repositories for you. And of course, if you want to download the repositories, maybe the length of the, the length of this script will be long, or maybe it will try to actually try to create a new line feed for you, or maybe. So, though there are some issues we have to solve. And for that, you to pass two commands basically to make it enable. The first one is `git config --global`, so we have to make the newline feed false. So, we can say `autocrlf` and we have to say `false`. So, to make sure that is false and done.

The next thing we have to do is we have to say, we have to enable the long paths. So, have to say `true`. Those things, two things are required. And once you are done with this, it's time to do the main thing. So, for that, let me just close this, clear this friend, and let's execute the command for that. Okay, so before doing that, I will just change, I will make a directory here. `mkdir`. I will say this is `telescope-hyperledger-fabric`, and I will move with that particular folder, so that everything will be there in everything will be stored in that folder. And now, let me just run this script.

Okay, so if you want to run this script, it's very simple. You just to say `curl` and then you have to specify this the URL. I will give this URL in the description area. And that's the, and that's how you run the command. So, you say enter. Or there's an issue here. Oh, it's not `o`, it should be capital `O`. Okay. And you can see the first thing it will do is it will download these samples. It will download the sample for you, and it will be available in this folder, which is that is `telescope-hf`. Now, with that, it will also download the Hyperledger Fabric. It is bulky. It will take some time. And by the time it downloads that, let me just take you.

So, this is the folder which I've created, which is `telescope-hf`, and you can see here, we have `fabric-samples`. And if you open this, you can see they have given you some projects which you can use. This is your first network here, and this is the script you have to run for the for the projects. It will do the setup for you. Then it will build a network. It will build the chains. In fact, one of the difficult thing about Hyperledger Fabric is the terms. So, that different terms are available here. You have to buy at them. Unfortunately, in fact, you don't have to buy hard them. Once you start working on it, and it will make sense. And then it will also say about trap card. In the upcoming tutorials, we'll see about commercial paper and let's see what else we can take. Take here. And if you can see this, "chaincode". So, "chaincode" is basically a smart contract in Hyperledger Fabric, or just a fancy term.

Let's see what is happening with our terminal. You're still downloading the Hyperledger Fabric. So, what it will do is, I will just pause the video and then we can continue. And if you can see, it is downloading 1.4.4 version, which is the latest one when I'm making this video. But if you are watching this video after some time, of course, will be having new versions. But what if we don't want download the new version? So, let's say I'm using 1.4.4 because I have not mentioned anything. But if you want to specify the version, you can do that. So, when you, when you were executing this query, just after this, you have to say there was a number, 1.4.3 or 1.4.2. It will download that Fabric version. And you can see it is downloaded the Hyperledger Fabric for you, and it will be available. And now it is also pulling some other Docker images. Let's see you that. So, I told about Docker images here. And that's done.

So, this is how you do a setup for Hyperledger Fabric on your machine. Of course, we will be also running a network here in the next video. So, in the next video, we'll see how do you run your first network. So, what is "first network"? So, if you can see here, this is your first network. And if you just go there, they have a script which is BYFN, which is the ability of first network. Run this script, and it will build it for you. And you'll see we will try to understand when you build a script, when you build a network, how it looks like.

Now, what's also important is when you talk about Hyperledger Fabric, it has its terms, and we also see those terms in the theory videos. So, I hope you are excited from the Hyperledger Fabric tutorials, and I'm excited. We'll see in the next video. So, if you're enjoying this video, let me know in the comment section and hit the like button, and do subscribe for further videos. Bye!