Source :
- https://docs.google.com/document/d/1-Yc8shZdpqEk4nMUwW9gfDwBm3KCZIHZzGKPOZvcQQw/edit?tab=t.0
- https://learn.kba.ai/course/hyperledger-fabric-fundamentals-golang/lessons/installing-the-prerequisites-copy/
- This Github repo, is prepared as a part of Blockchain Setup Lab (Blockchain Honor-Minor Degree Course / Semester 7 Lab) offered by Department of Computer Engineering to the Final year students of VES Institute of Technology, Mumbai (An Autonomous Institute, Affiliated with the University of Mumbai)) during the Academic Year 2025-26.
- This content is prepared on the basis of the Course offered by Kerala Blockchain Academy (KBA) : Hyperledger Fabric Fundamentals (Go Lang)
- To understand the hardware pre-requisites for setting up a Hyperledger Fabric Network
- To take a walkthrough the insallation of Packages
- To bootstraping the Hyperledger Fabric Network using IBM Microfab
- To understand the key terminologies in Hyperledger Fabric Network
- To understand the Use-case scenario - Tracing mangoes
- To set up a small Multi-org based Hyperledger Fabric Network in Go Lang
- Operating System: Ubuntu 24.04 or higher Steps to upgrade from Ubuntu 20.04 to 24.04 LTS
- RAM: 8GB or higher ( Course is tested in an 8GB machine)
- Free disk space: 40 GB
- High-speed internet connectivity
Note : If there are any errors detected, please run the commands suggested on the terminal for troubleshooting.
- curl
- NodeJS
- VScode
- build-essentials
- WEFT Library
- Docker Community Edition
- Docker Compose
- Go compiler
- Add user to the Docker group
On the Terminal of Ubuntu 24.04 LTS
- Current working directory :
pwd
- Change the directory :
cd Desktop
- List the files in directory :
ls
- Create a new folder :
mkdir Blockchain_HFN
- Change to the bew folder :
cd Blockchain_HFN
- Update the packages list :
sudo apt-get update
Note : If there is an error while executing the above update command,
-
To list all the lock files :
ps aux | grep -E 'apt|dpkg|apt-get'
-
To teminate all the process which are stuck :
sudo fuser -vik -TERM /var/lib/dpkg/lock /var/lib/dpkg/lock-frontend /var/lib/apt/lists/lock
- Run the command to install Curl :
sudo apt-get install curl
- Verify the installation and check the version of Curl :
curl --version
-
Remove old version :
sudo apt-get remove nodejs | sudo apt-get autoremove
-
Run the command to download and execute the nodejs file :
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
-
Start the installation for NodeJs :
sudo apt-get install -y nodejs
ORsudo apt install nodejs
- Check the version of nodejs :
node --version
ORnode -v
- Check the version of npm :
npm -v
-
Install dependencies :
sudo apt install software-properties-common apt-transport-https wget
-
Import Microsoft GPG key :
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
-
Add the VS Code repository :
sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
- Update package lists again :
sudo apt update
- Install VS Code :
sudo apt install code
- Check the version :
code -v
- Run the command :
sudo apt install build-essential
curl -sSL https://raw.githubusercontent.com/hyperledger-labs/weft/main/install.sh | sh
OR
sudo npm install -g @hyperledgendary/weftility
-
Remove old versions of docker :
sudo apt-get remove docker docker-engine docker.io containerd runc
-
Update the apt package index and install packages to allow apt to use a repository over HTTPS:
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
- Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
-
Set up the stable repository:
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
-
Update the apt package index, and install the latest version of Docker CE:
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
-
Verify that Docker CE is installed correctly:
sudo docker run hello-world
- Check the version of Docker :
docker --version
- Download the current stable release of Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
- Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
- Check the version :
docker-compose --version
-
Download Go :
wget https://golang.org/dl/go1.17.6.linux-amd64.tar.gz
-
Extract the archive :
sudo tar -xvf go1.17.6.linux-amd64.tar.gz
-
Move the Go binary files to /usr/local :
sudo mv go /usr/local
-
Add Go binary path to the system PATH :
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.profile
source ~/.profile
-
Verify Go installation :
go version
Note :
- By default, Docker runs as a root-owned service. To manage Docker as a non-root user, your user needs to be part of the docker group. This allows you to run Docker commands without needing sudo.
- To add user to docker group:
sudo usermod -aG docker $USER
- This command appends your user to the docker group, allowing permission to access the Docker daemon files and directories.
- Log in to a new group:
newgrp docker
- Check if your user has docker group membership :
groups
- Run the docker command :
docker ps
to list all the containers without needing root privileges.
Microfab is a containerized Hyperledger Fabric runtime for use in development environments.
export MICROFAB_CONFIG='{
"port": 8080,
"endorsing_organizations":[
{
"name": "ProducersOrg"
},
{
"name": "SellersOrg"
}
],
"channels":[
{
"name": "mango-channel",
"endorsing_organizations":[
"ProducersOrg",
"SellersOrg"
]
}
]
}'
- port: Port on which Microfab container is mapped to run. This configuration file is in JSON format a key-value format.
- endorsing_organisations: Organisations present in a business network.
- channels: Name of the channel on which the network is operated.
-
To run the runtime docker environment :
docker run -e MICROFAB_CONFIG -p 8080:8080 ibmcom/ibp-microfab
- To stop the container : Press
Control + C
- To remove the container :
docker container prune