Skip to main content

Create your own BlockChain using Hyperledger Composer

Hyperledger is designed for the advancement of blockchain technology in a diversified business like banking, IoT and other technology-related services.  This article give you an idea to install Hyberledger ecosystem for you to get started with your first Blockchain project.

Prerequisites for the installation

Install node.js from the below command:

sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
nodejs -v 
sudo apt-get install build-essential

Creating a business network card

The main concept for Hyperledger Composer is the business network definition (BND). It defines the data model, transaction logic and access control rules for your blockchain solution. To create a BND, we need to create a suitable project structure on a system.

To create the business network card :

e:\Blockchain\adventsys-demo>yo hyperledger-composer:businessnetwork
Welcome to the business network generator
? Business network name:adventsys-network
? Description: blockchain demo using hyperledger composer
? Author name:  Kaushik Shetty
? Author email: [email protected]
? License: Apache-2.0
? Namespace: org.adventsys.demo
? Do you want to generate an empty template network? No: generate a populated sample network
   create package.json
   create README.md
   create models\org.adventsys.demo.cto
   create permissions.acl
   create .eslintrc.yml
   create features\sample.feature
   create features\support\index.js
   create test\logic.js
   create lib\logic.js
FILE STRUCTURE OF THE BUSINESS NETWORK CARD
\---adventsys-network
    |   .eslintrc.yml
    |   package.json    (File containing business network metadata)
    |   permissions.acl (This document with basic access control rules)
    |   README.md
    |
    +---features
    |   |   sample.feature
    |   |
    |   \---support
    |           index.js
    |
    +---lib
    |       logic.js (File containing transaction processor functions)
    |
    +---models
    |       org.adventsys.demo.cto (File which will contain the class definitions 
    |                               for all assets,participants,and transactions 
    |                               in the business network)
    |
    \---test
        logic.js

Deploying the business network card

First, we have to create an archive of the business network card in (.bna format)

Note : change the directory to adventsys-network using cd command
 
e:\Blockchain\adventsys-demo\adventsys-network>composer archive create -t dir -n .
Creating Business Network Archive
 
 
Looking for package.json of Business Network Definition
        Input directory: e:\Blockchain\adventsys-demo\adventsys-network
 
Found:
        Description: blockchain demo using hyperledger composer
        Name: adventsys-network
        Identifier: [email protected]
 
Written Business Network Definition Archive file to
        Output file: [email protected]
 
Command succeeded
 
e:\Blockchain\adventsys-demo\adventsys-network>

.bna format file : [email protected]

Share this post

Comments (0)