Monday 1 October 2018

Workshop 1: Creating a Hyperledger Fabric network

Hyperledger Fabric Network

Creating a first hyperledger fabric network through Amazon AWS
  1. create an AWS account
  2. I created an AWS student account through www.awseducate.com
    Through your workbench, go to AWS console and create an EC2 instance
    Go to Services-> ec2-> launchinstance-> Ubuntu Server 16.04 LTS (HVM), SSD Volume Type-> m4large
    Add tag->basicnetwork, Create a new key-pair, Download key pair and click launch instance
  3. Connecting to the instance
  4. Once the instance has started, you can connect it through Putty
    Before connecting, convert the .pem file (key pair) into .ppk file using PuttyGen. This step is required because Putty requires a .ppk file and cannot connect using .pem file
    Now add .ppk file to Putty, and connect to the IP of the running AWS instance
  5. Creating first network - installing prerequisites
    1. Install cURL
    2. Type on the terminal cURL command to check if its installed or run cURL --version. If it is not installed you can install it through below command
      sudo apt-get install curl
    3. Install Docker and Docker Compose
    4. and
    5. Install GO Programming Language
    6. Don't forget to set the path. Run command export PATH=$PATH:$GOPATH/bin
    7. Install Node.js Runtime and NPM
    8. Install Python
    9. Retrieve the Python version 2.7, which is goof for running Fabric Node.js SDK, by using command sudo apt-get install python
      You can also check python version by command "python --version"
      You are essentially done for installing the prerequisites. You can refer to detailed installation article herehttps://hyperledger-fabric.readthedocs.io/en/latest/prereqs.html
  6. Installing Sample Binaries and Docker Images
  7. Once you are ready, and in the directory into which you will install the Fabric Samples and binaries, go ahead and execute the following command: curl -sSL http://bit.ly/2ysbOFE | bash -s 1.2.0
    then, curl -sSL http://bit.ly/2ysbOFE | bash -s curl -sSL http://bit.ly/2ysbOFE | bash -s 1.2.0 1.2.0 0.4.10
    I faced an issue of Docker permission denied while trying to connect to the Docker daemon socket
    I solved the issue with command sudo usermod -a -G docker $USER . Don't forget to completely log out of your account and log back in (if in doubt, reboot!):
  8. Running first network
  9. cd fabric-samples/first-network
    Ready to give it a go. Run the command: ./byfn.sh generate
    This command generates all the certificates. And after this, bring up the network
    ./byfn.sh up
    If you’d like to run through this tutorial with node chaincode, pass the following command instead:
    we use the -l flag to specify the chaincode language forgoing the -l flag will default to Golang
    ./byfn.sh up -l node
    Bring down the network with the command ./byfn.sh down

Hyperledger

What is Hyperledger?

https://blockgeeks.com/guides/what-is-hyperledger/
A lot of explanation on the above link.

Important to know -

  1. Hyperledger was created by Linux Corporation in late 2015. 
  2. It is not Bitcoin or some other crypto-currency. It is not Ethereum or some other code execution engine
  3. It aims to create an blockchain based environment where companies and developers can collaborate to create frameworks/ projects.
  4. More than 100 companies are part of it.
  5. What projects have been already created using it:




  • Hyperledger Sawtooth: This is a modular blockchain suite developed by Intel, which uses a new consensus algorithm called Proof of Elapsed Time (PoeT).




  • Hyperledger Iroha: Iroha is a project of a couple of Japanese companies to create an easy to incorporate the framework for a blockchain.




  • Hyperledger Fabric: This project is lead by IBM. Fabric is a plug and plays implementation of blockchain technology designed as a foundation to develop high-scaling blockchain applications with a flexible degree of permissions.

  • Simple video to understand Hyperledger fabric


    Hyperledger glossary
    https://hyperledger-fabric.readthedocs.io/en/release-1.2/glossary.html