Skip to content

A Hyperledger Fabric Single Org Demo - written in Go Fabric SDK

Notifications You must be signed in to change notification settings

knagware/employeeledger

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Employeeledger

N|Solid

Employeeledger is a web application written in Go language to demonstrate the Hyperledger Fabric Blockchain framework. The project repo has been designed to upload employee records into the blockchain and also has the functionality to update, delete the record stored securely in the Hyperledger framework.

However, this explanation guide does not explain how Hyperledger Fabric works, so for the information, you can follow at Hyperledger.

Installation

Employeeledger requires Docker & Go to run.

Docker

$ sudo apt install docker.io
$ sudo apt install docker-compose

Go

Installation

$ sudo apt-get update
$ sudo apt-get install golang-go

Set your Go path as environmental variable

add these following variable into the profile
$ export GOPATH=$HOME/go
$ export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
then
$ source ~/.profile
$ go version
$ go version go1.11 linux/amd64

Build Your Network

This sample Hyperledger Fabric blockchain network is built on a single organization consisting of two peer nodes. There are few prerequisites to follow to set up and install a blockchain network in the docker container.

Prerequisites
You can choose any of the following link based on you operating system and hardware architecture of your system.
Arch
Linux AMD 64
Linux s390x
Linux PPC64le
Windows AMD 64
Darwin AMD 64
Configuration

There are few configuration files is written, which composed of various configuration details of a network like Certificate Authority (CA), Peer , Orderer , CouchDB.

crypto-config.yaml

This configuration file will generate few certificates and key for the organization and it’s related entities like peers, admin, orderer. The cryptogen binary will take the config file as input and after execution, it will create a crypto-config folder in the config directory, which will contains all the generated certificates and key.

./bin/cryptogen generate --config=./crypto-config.yaml
configtx.yaml

This config file will contains complete details of a channel related to an organization. It will create three artifacts for a network.

  • orderer.genesis.block : This will initialize the Fabric’s orderer
      ./bin/configtxgen -profile EmployeeLedger -outputBlock ./artifacts/orderer.genesis.block
    
  • employeeledger.channel.tx Channel is a private network between peers to communicate in a network
      ./bin/configtxgen -profile EmployeeLedger -outputCreateChannelTx ./artifacts/employeeledger.channel.tx -channelID employeeledger
    
  • org1.employeeledger.anchors.tx : This artifact will allow the peers to interact with each other in a network.
      ./bin/configtxgen -profile EmployeeLedger -outputAnchorPeersUpdate ./artifacts/org1.employeeledger.anchors.tx -channelID employeeledger -asOrg EmployeeLedgerOrganization1
    
You can find a shell script "config.sh" in the fixtures folder, it will generate all the prerequisites configurations of a network. So, you can directly execute script to skip all the manual steps.
Docker-Compose

Now, we need to deploy the configuration details into a docker container, so we need to use Docker Compose. There will docker-compose.yaml configuration file, which will contain all config details for Orderer, Certificate Authority, Peer, Couch DB.

  • The compose file can be deploy into a network, by executing following command

     docker-compose up -d // the docker-compose.yaml has to be located at same command location
    
And also replace the newly generated CA key, which can be found at crypto-config/peerOrganizations/org1.employee.ledger.com/ca/some random generated sk file, at the docker-compose.yaml : line 44, 50 & 55

So, all done , your blockchain network is now deployed into a docker container.

You can check by executing following command

docker ps

Run the application

  • As you have sucssefully deployed your blockchain network. Now you can run the application.
  • There is a master Makefile , you can find in the project root directory.
  • Just type “make” in the command line and it will take few minuetes to start the server.
  • If all goes well, you can see server running at port 6000
  • Now, open your browser and type http://localhost:6000

Few Screenshots

Login

Dashboard

About

A Hyperledger Fabric Single Org Demo - written in Go Fabric SDK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 95.2%
  • Shell 2.9%
  • Makefile 1.9%