Powered by
/src$ make
  • Home
  • About
  • Directory
  • Contact
  • Home
  • About
  • Directory
  • Contact

Hyperledger Fabric Getting Started Tutorial + Installation Guide

6/22/2018

 
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?

Picture
Hyperledger Fabric is a permissioned distributed ledger technology. Basically, if you want to make your own blockchain (and not hop onto Ethereum or some other existing blockchain), then you can do that with Hyperledger Fabric. 
​Here are some key points about Fabric:
  1. It's modular, which means that you can choose a change aspects of it depending on your particular needs. (For example, the consensus protocol, the database management service, the ordering service can all be configured.)
  2. ​The smart contracts can be written in some popular programming languages, such as Java, Go, and NodeJS/Javascript.
  3. The Fabric blockchain is permissioned, meaning that only invited people can participate and view the blockchain.
  4. You don't need cryptocurrency for the mining of blocks, which can sometimes enable simpler and safer contracts and transactions.
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
References
1. 10 Blockchain Questions in 10 Minutes.
2. The Hyperledger Iroha Tutorial.
3. The Fabric project on Hyperledger's website.
4. Hyperledger Fabric wiki introduction.
​
5. Hyperledger Fabric source code on github.

Comments are closed.

    Author

    Hi, 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.
    Metamask tip button
    License: All code and instructions are provided under the MIT License.

    Discord

    Chat with me.


    Youtube

    Watch my videos.


    Twitter

    Get the latest news.


    Twitch

    See the me code live.


    Github

    My latest projects.

Powered by Create your own unique website with customizable templates.