Site icon DLK

Hyperledger Composer Installation on MacOS [tutorial]

Installing pre-requisites

First, install nvm (the Node version manager). nvm is a tool that allows you to easily install, update and switch between versions of Node.js.

To install nvm, run the cURL code below.

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash

Restart the Terminal.

Then, we need to store user preferences for bash. But first, select those two lines and copy to clipboard.

export NVM_DIR=”/Users/serkanerkan/.nvm”
[ -s “$NVM_DIR/nvm.sh” ] && \. “$NVM_DIR/nvm.sh”

Open a terminal window and write the code below.

sudo vi .bash_profile

Press “E” key and open the edit screen.

Add the copied lines in this section and press “esc” key then enter “:wq”

You can be able to check nvm version now.

nvm --version

Installing the Node

Install the latest version of node.

nvm install --lts

In this point, you may need to stable version of node. You can install it with this command.

nvm install v8.9.4

you can change the default node version with this command.

nvm use v8.9.4

you can check the current version of node.

node --version

Installing the Development Environment

Essential CLI tools:

npm install -g composer-cli

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

npm install -g composer-rest-server

Useful utility for generating application assets:

npm install -g generator-hyperledger-composer

Yeoman is a tool for generating applications, which utilises generator-hyperledger-composer:

npm install -g yo

Installing Playground

Browser app for simple editing and testing Business Networks:

npm install -g composer-playground

Installing Hyperledger Fabric

In a directory of your choice (we will assume ~/fabric-tools), get the .zipfile that contains the tools to install Hyperledger Fabric:

mkdir ~/fabric-tools && cd ~/fabric-tools

curl -O https://raw.githubusercontent.com/hyperledger/composer-tools/master/packages/fabric-dev-servers/fabric-dev-servers.zip
unzip fabric-dev-servers.zip

Use the scripts you just downloaded and extracted to download a local Hyperledger Fabric runtime:

cd ~/fabric-tools
./downloadFabric.sh

Controlling Your Development Environment

Starting and stopping Hyperledger Fabric

You control your runtime using a set of scripts which you’ll find in ~/fabric-tools 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:

cd ~/fabric-tools
./startFabric.sh
./createPeerAdminCard.sh

You can start and stop your runtime using ~/fabric-tools/stopFabric.sh, and start it again with ~/fabric-tools/startFabric.sh.

Start the web app (“Playground”)

To start the web app, run:

composer-playground

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

You should see the PeerAdmin@hlfv1 Card you created with the createPeerAdminCard 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, and you also know how to stop and tear them down when you’re done with your dev session.

quotationhttps://hyperledger.github.io/composer/v0.16/introduction/introduction

Exit mobile version