Getting Started with Hyperledger Composer on Ubuntu

0
23

A simple guide to set up your environment with Hyperledger Composer and allow you to develop a blockchain business network.

Hyperledger Composer is an extensive, open development toolset and framework to make developing blockchain applications easier. Our primary goal is to accelerate time to value, and make it easier to integrate your blockchain applications with the existing business systems. You can use Composer to rapidly develop use cases and deploy a blockchain solution in weeks rather than months. Composer allows you to model your business network and integrate existing systems and data with your blockchain applications.

You’ll need the Windows Subsystem for Linux to run Ubuntu on Windows 10. To proceed with the WSL installation, follow the simple guide here.

  • Log in your Ubuntu terminal as a normal user to install the prerequisites.
  • Install Node and Docker.

Then install the hyperledger composer prerequisites.

curl -O https://hyperledger.github.io/composer/latest/prereqs-ubuntu.sh

chmod u+x prereqs-ubuntu.sh
installing prerequisites for hyperledger composer

Run this script to install Hyperledger Composer prerequisites.

./prereqs-ubuntu.sh

*If you get the error: (Error: Ubuntu bionic is not supported hyperledger composer), edit the script using;

nano prereqs-ubuntu.sh

change declare -a version=('trusty' 'xenial' 'yakkety'); ‘

to declare -a version=('trusty' 'xenial' 'yakkety' 'bionic');

then continue with the installation.*

Install the Hyperledger Composer extension on VS Code.

composer extension on VS Code

We’ll need some CLI tools installed to support essential operations: Running a REST server, generating application assets and generating applications.

sudo npm install --unsafe-perm --verbose -g [email protected]
sudo npm install --unsafe-perm --verbose -g [email protected]
sudo npm install --unsafe-perm --verbose -g [email protected]
sudo npm install --unsafe-perm --verbose -g yo

To view and demonstrate your business networks, install the Playground UI.

sudo npm install --unsafe-perm --verbose -g [email protected]
installation of the playground UI

Install Hyperledger Fabric. The installation of Fabric v1.2 gives you a local runtime to deploy your business networks.

mkdir ~/fabric-dev-servers && cd ~/fabric-dev-servers

curl -O https://raw.githubusercontent.com/hyperledger/composer-tools/master/packages/fabric-dev-servers/fabric-dev-servers.tar.gz
tar -xvf fabric-dev-servers.tar.gz
cd ~/fabric-dev-servers
export FABRIC_VERSION=hlfv12
./downloadFabric.sh

When performing the first new runtime, run the start script and generate a Peer Admin card.

./startFabric.sh
./createPeerAdminCard.sh

Start the web app

composer-playground
playground will start on port 8080
Let’s Blockchain!

To terminate a development session/Stop your local runtime use;

./stopFabric.sh

Voilà! You’re now set with an installation of Hyperledger Composer + Hyperledger Fabric. Make some magic 🙂