Create your own BlockChain using Hyperledger Composer
Hyperledger is a platform that promotes the use of blockchain technology in various industries like banking and IoT. This article provides a guide on how to install the Hyperledger ecosystem, enabling you to start 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
- Install docker from the link, Click here
- Installing the components required, Click here
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: kaushik4130797@gmail.com
? 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: adventsys-network@0.0.1
Written Business Network Definition Archive file to
Output file: adventsys-network@0.0.1.bna
Command succeeded
e:\Blockchain\adventsys-demo\adventsys-network>
adventsys-network@0.0.1.bna