Installing Hyperledger Composer

The Hyperledger Composer can be installed on Ubuntu or MacOS. We will cover Ubuntu in this document.

Pre-Requisites:

To run Hyperledger Composer and Hyperledger Fabric, 4 GB of memory required. If you are running Ubuntu system on virtual-box then system need at least 12–16GB RAM.

The following are prerequisites for installing the required development tools:

• Operating Systems: Ubuntu Linux 14.04 / 16.04 LTS (both 64-bit), or Mac OS 10.12

• Docker Engine: Version 17.03 or higher

• Docker-Compose: Version 1.8 or higher

• Node: 8.9 or higher (note version 9 is not supported)

• npm: v5.x

• git: 2.9.x or higher

• Python: 2.7.x

• A code editor of your choice, we recommend VSCode.

**If installing Hyperledger Composer using Linux, be aware of the following advice:

• Login as a normal user, rather than root.

• Do not su to root.

• When installing prerequisites, use curl, then unzip using sudo.

• Run prereqs-ubuntu.sh as a normal user. It may prompt for root password as some of its actions are required to be run as root.

• Do not use npm with sudo or su to root to use it.

• Avoid installing node globally as root. **

Installing Hyperledger Composer on Ubuntu-14.04/Ubuntu-16.04:

Download the prerequisites using the following commands:

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

curl command download ‘prereqs-ubuntu.sh’ file in current directory.

Permission of ‘prereqs-ubuntu.sh’ file is read and write only. You can see in left side “-rw-rw-r — ” as below

Run above command to give execution permission ‘read, write, execute‘ to ‘prereqs-ubuntu.sh’ file. You can see chenges in left side “-rwx-rw-r — ” and file name display in different color.

Next run the script file’ prereqs-ubuntu.sh’, you will be prompted for your system password. Type your system password and press Enter.

‘./prereqs-ubuntu.sh’ command download and install all pre-requisites.

Congratulations, the installation of the pre-requisites for Hyperledger Composer is complete! You can now proceed with installing the development environment. Logout then login system before continuing.

Installing the development environment:

Before you begin

Make sure you have installed the required pre-requisites. These instructions assume that you’ve not installed the tools and used them before. If this is not the case, you might want to check that your previous setup is completely destroyed before you start following this guide.

Destroy a previous setup :( If you installing first time then skip this part)

If you’ve previously used an older version of Hyperledger Composer and are now setting up a new install, you may want to kill and remove all previous Docker containers, which you can do with these commands:

Installing components

Step 1: Install the CLI tools

There are a few useful CLI tools for Composer developers. The most important one is composer-cli, which contains all the essential operations, so we’ll install that first. Next, we’ll also pick up generator-hyperledger-composer, composer-rest-server and Yeoman plus the generator-hyperledger-composer. Those last 3 are not core parts of the development environment, but they’ll be useful if you’re following the tutorials or developing applications that interact with your Business Network, so we’ll get them installed now.

1. Essential CLI tools:

2. Utility for running a REST Server on your machine to expose your business networks as RESTful APIs:

3. Useful utility for generating application assets:

4. Yeoman is a tool for generating applications, which utilizes generator-hyperledger-composer:

Step 2: Install Playground

If you’ve already tried Composer online, you’ll have seen the browser app “Playground”. You can run this locally on your development machine too, giving you a UI for viewing and demonstrating your business networks.

Browser app for simple editing and testing Business Networks:

Step 3: Set up your IDE

Whilst the browser app can be used to work on your Business Network code, most users will prefer to work in an IDE. Our favorite is VSCode, because a Composer extension is available.

https://go.microsoft.com/fwlink/?LinkID=760868

https://code.visualstudio.com/download

Go to directory where file is downloaded. In my case file is downloaded in ‘Downloads’ directory.

Now run below command to install VSCode.

sudo dpkg -i <downloaded file name>

Above command will install VSCode.

Open VSCode, go to ‘Extensions’, then search for and install the ‘Hyperledger Composer’ extension from the Marketplace.

Step 4: Install Hyperledger Fabric

Controlling your development environment:

Starting and Stopping Hyperledger Fabric:

You control your runtime using a set of scripts which you’ll find in if you followed the suggested defaults.

The first time you start up a new runtime, you’ll need to run the start script, then generate a PeerAdmin card:

You can start and stop your runtime using , and start it again with .

At the end of your development session, you run and then . Note that if you've run the teardown script, the next time you start the runtime, you'll need to create a new PeerAdmin card just like you did on first time startup.

Start the web app(“Playground”)

To start the web app

It will typically open your browser automatically, at the following address: http://localhost:8080/login

You should see the Card you created with the script on your "My Business Networks" screen in the web app: if you don't see this, you may not have correctly started up your runtime!

Congratulations, you’ve got all the components running.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store