To watch the youtube video on this topic, click here.
Introduction - Hyperledger
Hyperledger projects are blockchain related tools built by the open source community and the Hyperledger organization. We've already done a blog post on Hyperledger Iroha, and now we're going to look at Hyperledger Fabric. If you're completely new to blockchain, then take a look at this blogpost on Blockchain Explained With 10 Simple Questions.
This blog post is going to introduce us to Hyperledger Fabric, and then we're going to install the Fabric prerequisite and template networks on our own computer. This will set us up to do more complex things with Fabric in the future, and even learn about Hyperledger Composer. What Is Hyperledger Fabric?
Here are some key points about Fabric:
This all sounds pretty good, so how do we actually use Fabric? In the next section, we'll go through the Getting Started tutorial for building our own Fabric network.
Hyperledger Fabric - Building Our First Network
We're going to build our first Fabric Network by following the official tutorial. However, we'll go over only the most important commands and we'll do the bare minimum to get Fabric working. You can read the official tutorial to see how everything works later.
I've tested these commands on Ubuntu 16.04. If you're using Windows or Mac, then you'll need to install Curl, Docker, Docker-compose, Go, Node and NPM, Python, and maybe a few environment variables on your own.
In your Ubuntu terminal, enter the following commands:
sudo apt-get install curl sudo apt-get install golang-go export GOPATH=$HOME/go export PATH=$PATH:$GOPATH/bin sudo apt-get install nodejs sudo apt-get install npm sudo apt-get install python sudo apt-get install docker curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" sudo apt-get update apt-cache policy docker-ce sudo apt-get install -y docker-ce sudo apt-get install docker-compose sudo apt-get upgrade
With that, our environment is set up.
Next, we're going to download the samples of Fabric that have already been prepared to test it out. Enter the following two commands in your terminal. sudo curl -sSL https://goo.gl/6wtTN5 | sudo bash -s 1.1.0 sudo chmod 777 -R fabric-samples
So now we have the samples.
We're going to make sure that everything runs by running our first network. Change into the first-network directory and run the generate script that will create the certificates and keys for the entities that are going to exist on our blockchain. This will also create the genesis block (the first block on the blockchain), among other things. cd fabric-samples/first-network sudo ./byfn.sh generate Now bring the blockchain network up with the following command.
sudo ./byfn.sh up
If everything worked, then you successfully created your first Fabric network! Congratulations. Let's bring it down for now.
sudo ./byfn.sh down
Okay, so we know our computer can successfully use and deploy Hyperledger Fabric blockchain networks, but what now? Conclusion - Going Deeper
In this blog post, we talked about what Hyperledger Fabric is, we set up our computer to be able to deploy Fabric networks by installing the requirements and deploying the test fabric network. Now what? Now....there's a lot of reading that you have to do. First of all, read through the official tutorial to see what was actually going on in those scripts. Then, you can try to go through some of the other official tutorials.
But with this foundation set, we can learn more about Fabric by creating more blockchain networks that suit our needs, we can test deploying smart contracts to our Fabric blockchain, and we can even start learning about Hyperledger Composer now.
Like this content and want more? Feel free to look around and find another blog post that interests you. You can also contact me through one of the various social media channels.
Twitter: @srcmake Discord: srcmake#3644 Youtube: srcmake Twitch: www.twitch.tv/srcmake Github: srcmake Comments are closed.
|
AuthorHi, I'm srcmake. I play video games and develop software. Pro-tip: Click the "DIRECTORY" button in the menu to find a list of blog posts.
License: All code and instructions are provided under the MIT License.
|