Install Hyperledger Fabric and Convector on Fedora
For some reason, I decided to try out Fedora. I quite like their policy of keeping most of their packages updated and hence, took an active decision to give it a try.
This article hopefully would become a part of a very long series of articles on writing chaincode for Hyperledger Fabric Distributed Ledger system.
I personally like Convector because the Convector code looks far more cleaner , far more readable and far easier to understand than the complicated code that is traditionally written for Hyperledger Fabric. Fabric’s code style looks like it needs 100 comments while Convector code is easier to read and fairly self describing while doing the same thing.
While you can use TypeScript with regular chaincode as well, Convector uses TypeScript features making Convector code look like the TypeScript we all have came to enjoy reading and writing. If your team works with C# or Java and not just TypeScript, I bet your team would have an easier time moving to Convector due to the code cleanliness that using TypeScript can promote.
As a programmer, I value readability very highly. Ease of readability always leads to ease of maintenance and I think everyone likes easy to maintain and easy to read code. As is obvious from this code.
Update your system
No article on Linux would be complete without a simple request for you to update your OS packages. So why should this be any different?
sudo dnf update
Installation of Docker is a bit more interesting. While Convector is using Docker, I noticed Fedora is making a move towards Podman.
The steps are from Docker’s own website but for obvious reasons are subject to change, so do make a check from there in case something doesn’t work.
Adding Docker repository
For me, this was already installed. But this helps us add new repository.
sudo dnf -y install dnf-plugins-core
Let us now add the repository
sudo dnf config-manager \
Installing Docker Engine
sudo dnf install -y docker-ce docker-ce-cli containerd.io
Using Docker without sudo
sudo groupadd docker
sudo usermod -aG docker $(whoami)
sudo setfacl --modify user:$USER:rw /var/run/docker.sock
sudo systemctl start docker
Add Docker Compose
sudo dnf install -y docker-compose
Install useful dependencies
sudo dnf install -y curl git golang python python2 gcc-c++
Install Node.JS 8.11.4
Yes we need an older version of Node.JS. It’s one of the many minor issues with Convector. Now for obvious reasons your other projects probably use newer versions of Node.JS. I know mine do.
So it would be nicer if we could maintain multiple Node.JS versions and we can use Node Version Manager to do this.
This will help us install Node v8.11.4
Node Version Manager
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bashsource ~/.bash_profile
nvm install 8.11.4
Install Hyperledger Fabric 1.4.0
Yes Convector works with Hyperledger 1.x currently only.
Let us install
curl -sSL https://goo.gl/6wtTN5 | sudo bash -s 1.4.0
Hurley helps us create Convector projects.
npm i -g @worldsibu/hurley @worldsibu/convector-cli
Creating a Blockchain Network
Use Hurley to create a new blockchain network with 2 organizations, 2 users per organization, and 1 channel in your computer.
This small article is inspired by Covalent’s own article on Installation on Ubuntu. As you would notice, we have cut down quite a few advanced steps that not a lot of users might have shown interest in.