SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Setting up the Hyperledger
Composer in ubuntu
 Hyperledger Composer is an extensive, open development toolset and
framework to make developing blockchain applications easier.
 These are the components we are going to setup.
Composer Solution Architecture with 8
steps
 Step 1: Installing Hyperledger Composer development tools.
 Step 2: Starting Hyperledger Fabric.
 Step 3: Create a Business Network Definition.
 Step 4: Building .bna (banana file) or Generate the Business Network
Archive.
 Step 5: Deploy banana file to the running Hyperledger Fabric.
 Step 6: Generate REST API.
 Step 7: Test REST API.
 Step 8: Generate angular application and test.
Follow the instructions below to get the required Hyperledger Composer
development tools and stand up a Hyperledger Fabric.
 There are two version of Hyperledger Fabric: v0.6 and v1.0. The default is for
v1.0 and we suggest this is the one you use.
 Before you begin, following are prerequisites for installing the required
development tools:
 NOTE 1: Please do not install Composer as a superuser - or use 'sudo' or the
'root' user, if on Linux (doing will cause issues with the install). Composer should
be installed as non-privileged ($) user.
 NOTE 2: Make sure you have open internet access in order to execute the
below commands. If no open internet access you will end up with SSL Cert
issues while executing some of the https curl URLs within the scripts.
 NOTE 3: Assuming CURL is already installed in your Linux machine.
 If you're running on Ubuntu, you can download the prerequisites using the
following commands:
 Next run the script - as this briefly uses sudo during its execution, you will be
prompted for your password.
Step 1: Installing Hyperledger Composer
development tools
 The development tools you'll need can all be installed (as a non-privileged
user e.g. non-root) as mention in NOTE 1
 composer-cli – contains all the command line operations for developing
business networks.
 It interprets the composer commands in building and deploying the
networks.
 To install composer-cli run the following command (check above
architecture for components overview).
 npm install –g composer-cli
 generator-hyperledger-composer- It is a Yeoman plugin that creates
skeleton applications for your business network.
  npm install -g generator-hyperledger-composer 
 composer-rest-server - uses the Hyperledger Composer loopback
connector to connect to a business network, extract the models and then
present a page containing the REST APIs that have been generated for the
model.
  npm install -g composer-rest-server
  yo - Yeoman is a tool for generating applications. When combined with
the generator-hyperledger-composer component, it can interpret business
networks and generate applications based on them.
 npm install -g yo
Step 2: Starting Hyperledger Fabric.
 Note: You have to run these as sudo user and have open internet access. If not you
will end up with certificates issue.
 In a directory of your choice (will assume ~/fabric-tools) get the zip file that contains
the tools.
 This will set up fabric dev servers in your box.
 Choose which version of Fabric to use. Hyperledger Fabric v1.0 is highly
recommended and the default. If for some reason v0.6 needs to be installed, you can
set it explicitly as follows: export FABRIC_VERSION=hlfv0.6. Don’t change anything for
1.0 (Just ignore this step b)
 Start fabric - All the scripts will be in the directory ~/fabric-tools A typical
sequence for Hyperledger Composer use would be
Step 3: Create a Business Network Definition
 Download sample network using below git command.
 Rename this folder to “my-network” using the below command.
 cp -r ./composer-sample-networks/packages/basic-sample-network/ ./my-
network
 You should now have a folder called my-network (as the basis for our project)
that we can start to modify. 
 Update your package.json file - The metadata (name, version, description) for
the business network definition is stored in the package.json file. Edit the file to
xchange the name to my-network and modify the prepublish script to change
the name of the business network archive.
 NOTE : Update only the bold tags below. Keep rest of the things same.
 
 Update your README.md file to - # My very first Hyperledger Composer
Network Save your changes.
 Define your Domain Model - overwrite below code and save your changes
to models/sample.cto
 Write Transaction Processor Functions – overwrite below code and save your
changes to lib/sample.js ()
 Update your Access Control Rules - The file permissions.acl defines the access
control rules for the business network definition. Replace the entire contents
of permissions.acl with the rule below and save your changes to permissions.acl
Step 4: Building .bna or Generate the
Business Network Archive.
 To check that the structure of the files is valid, you can now generate a
Business Network Archive (BNA) file for your business network definition. The
BNA file is the deployable unit -- a file that can be deployed to the
Composer runtime for execution.
 Switch back to the terminal and type:
 You should see the following output:
Step 5: Deploy to the running Hyperledger
Fabric.
 We are going to deploy the BNA (suffix .bna) file to Hyperledger Fabric v1.0; this
blockchain environment was set up earlier in this guide in Step 2.
 Switch to the terminal, change directory to the dist folder containing the my-
network.bna file and type:
 NOTE : PeerAdmin is purely an identity label referencing cryptographic (eg.
signer certificate) material you have imported into the keyValStore identified in
your connection profile which has meaning to a single Peer (in our dev setup) or
set of Peers (if configured in another way) within the same organization.
 After approximately 30 seconds or so, the business network should have been
deployed to your local Hyperledger Fabric. You should see output as follows:
 You can verify that the network has been deployed by typing.
Step 6: Generate REST API
 To integrate with the deployed business network (creating assets/participants and
submitting transactions) we can either use the Composer Node SDK or we can
generate a REST API.
 To create the REST API we need to launch the composer-rest-server and tell it how
to connect to our deployed business network. The composer-rest-server was
installed when you installed the development environment.
 Now launch the server by changing directory to the my-network folder and type
 These allow the composer-rest-server to connect to Hyperledger Fabric and
configure how the REST API is generated.
Step 7: Test REST API
 Open a web browser and navigate to http://localhost:3000/explorer
 You should see the LoopBack API Explorer, allowing you to inspect and test
the generated REST API.
 Let’s POST a Trader and GET him by his id.
 Select Trader.
 Select POST operation to post a trader in blockchain.
 Click on “Try it out” button
 Verify the response code – 200.
 Response of GET
Step 8: From Yo template.
 Your application is running. You should see the composer-rest-server start, and then
Angular web packs the web application - it serves the content at URL: 
http://localhost:4200
 If you navigate to this URL and press the "Assets" drop down (at the top-right of
the page) you can see any existing instances of Commodity stored on the
Hyperledger Fabric in the table (we have not stored them on blockchain yet!).
You can create new instances using the "Add Asset" button. Note that the
Angular skeleton does not yet allow you to create Participants, so you would
need to create a test Trader instance to act as the owner of the Commodity
(being added here), using the Loopback Swagger UI ( (ie using Playground)
before you can create a Commodity.
 Chain code issue -
https://stackoverflow.com/questions/43666890/fabric-composer-test-code-not-working
 Document source -
https://hyperledger.github.io/composer/tutorials/developer-guide.html

Weitere ähnliche Inhalte

Was ist angesagt?

Security Tips to run Docker in Production
Security Tips to run Docker in ProductionSecurity Tips to run Docker in Production
Security Tips to run Docker in ProductionGianluca Arbezzano
 
Spring Boot on Kubernetes/OpenShift
Spring Boot on Kubernetes/OpenShiftSpring Boot on Kubernetes/OpenShift
Spring Boot on Kubernetes/OpenShiftKamesh Sampath
 
Drone Continuous Integration
Drone Continuous IntegrationDrone Continuous Integration
Drone Continuous IntegrationDaniel Cerecedo
 
Automated Image Builds in OpenShift and Kubernetes
Automated Image Builds in OpenShift and KubernetesAutomated Image Builds in OpenShift and Kubernetes
Automated Image Builds in OpenShift and KubernetesGraham Dumpleton
 
Import golang; struct microservice
Import golang; struct microserviceImport golang; struct microservice
Import golang; struct microserviceGiulio De Donato
 
Continuous Delivery of Containers with Drone & Kontena
Continuous Delivery of Containers with Drone & KontenaContinuous Delivery of Containers with Drone & Kontena
Continuous Delivery of Containers with Drone & KontenaJussi Nummelin
 
Docker pipelines
Docker pipelinesDocker pipelines
Docker pipelinesChris Mague
 
KubeCon NA 2017: Ambassador and Envoy (Envoy Salon)
KubeCon NA 2017: Ambassador and Envoy (Envoy Salon)KubeCon NA 2017: Ambassador and Envoy (Envoy Salon)
KubeCon NA 2017: Ambassador and Envoy (Envoy Salon)Ambassador Labs
 
10thMeetup-20190420-REST API Design Principles 되새기기
10thMeetup-20190420-REST API Design Principles 되새기기10thMeetup-20190420-REST API Design Principles 되새기기
10thMeetup-20190420-REST API Design Principles 되새기기DongHee Lee
 
Ready player 2 Multiplayer Red Teaming Against macOS
Ready player 2  Multiplayer Red Teaming Against macOSReady player 2  Multiplayer Red Teaming Against macOS
Ready player 2 Multiplayer Red Teaming Against macOSCody Thomas
 
Social Connections 14 - Kubernetes Basics for Connections Admins
Social Connections 14 - Kubernetes Basics for Connections AdminsSocial Connections 14 - Kubernetes Basics for Connections Admins
Social Connections 14 - Kubernetes Basics for Connections Adminspanagenda
 
Nginx conference 2015
Nginx conference 2015Nginx conference 2015
Nginx conference 2015ING-IT
 
Innovating Out In The Open - OSCON 2016
Innovating Out In The Open - OSCON 2016Innovating Out In The Open - OSCON 2016
Innovating Out In The Open - OSCON 2016Phil Estes
 
Running and Scaling Docker Containers with Kontena
Running and Scaling Docker Containers with KontenaRunning and Scaling Docker Containers with Kontena
Running and Scaling Docker Containers with KontenaJussi Nummelin
 
Overlay/Underlay - Betting on Container Networking
Overlay/Underlay - Betting on Container NetworkingOverlay/Underlay - Betting on Container Networking
Overlay/Underlay - Betting on Container NetworkingLee Calcote
 
Say Bye to VMware PowerCLI ! Time to "GOVC"
Say Bye to VMware PowerCLI ! Time to "GOVC"Say Bye to VMware PowerCLI ! Time to "GOVC"
Say Bye to VMware PowerCLI ! Time to "GOVC"Ajeet Singh Raina
 
Labels, Labels, Labels
Labels, Labels, Labels Labels, Labels, Labels
Labels, Labels, Labels Docker, Inc.
 

Was ist angesagt? (20)

Security Tips to run Docker in Production
Security Tips to run Docker in ProductionSecurity Tips to run Docker in Production
Security Tips to run Docker in Production
 
Spring Boot on Kubernetes/OpenShift
Spring Boot on Kubernetes/OpenShiftSpring Boot on Kubernetes/OpenShift
Spring Boot on Kubernetes/OpenShift
 
Drone Continuous Integration
Drone Continuous IntegrationDrone Continuous Integration
Drone Continuous Integration
 
Automated Image Builds in OpenShift and Kubernetes
Automated Image Builds in OpenShift and KubernetesAutomated Image Builds in OpenShift and Kubernetes
Automated Image Builds in OpenShift and Kubernetes
 
Import golang; struct microservice
Import golang; struct microserviceImport golang; struct microservice
Import golang; struct microservice
 
Continuous Delivery of Containers with Drone & Kontena
Continuous Delivery of Containers with Drone & KontenaContinuous Delivery of Containers with Drone & Kontena
Continuous Delivery of Containers with Drone & Kontena
 
Dockers zero to hero
Dockers zero to heroDockers zero to hero
Dockers zero to hero
 
Docker pipelines
Docker pipelinesDocker pipelines
Docker pipelines
 
KubeCon NA 2017: Ambassador and Envoy (Envoy Salon)
KubeCon NA 2017: Ambassador and Envoy (Envoy Salon)KubeCon NA 2017: Ambassador and Envoy (Envoy Salon)
KubeCon NA 2017: Ambassador and Envoy (Envoy Salon)
 
Jenkins & IaC
Jenkins & IaCJenkins & IaC
Jenkins & IaC
 
Docker Kubernetes Istio
Docker Kubernetes IstioDocker Kubernetes Istio
Docker Kubernetes Istio
 
10thMeetup-20190420-REST API Design Principles 되새기기
10thMeetup-20190420-REST API Design Principles 되새기기10thMeetup-20190420-REST API Design Principles 되새기기
10thMeetup-20190420-REST API Design Principles 되새기기
 
Ready player 2 Multiplayer Red Teaming Against macOS
Ready player 2  Multiplayer Red Teaming Against macOSReady player 2  Multiplayer Red Teaming Against macOS
Ready player 2 Multiplayer Red Teaming Against macOS
 
Social Connections 14 - Kubernetes Basics for Connections Admins
Social Connections 14 - Kubernetes Basics for Connections AdminsSocial Connections 14 - Kubernetes Basics for Connections Admins
Social Connections 14 - Kubernetes Basics for Connections Admins
 
Nginx conference 2015
Nginx conference 2015Nginx conference 2015
Nginx conference 2015
 
Innovating Out In The Open - OSCON 2016
Innovating Out In The Open - OSCON 2016Innovating Out In The Open - OSCON 2016
Innovating Out In The Open - OSCON 2016
 
Running and Scaling Docker Containers with Kontena
Running and Scaling Docker Containers with KontenaRunning and Scaling Docker Containers with Kontena
Running and Scaling Docker Containers with Kontena
 
Overlay/Underlay - Betting on Container Networking
Overlay/Underlay - Betting on Container NetworkingOverlay/Underlay - Betting on Container Networking
Overlay/Underlay - Betting on Container Networking
 
Say Bye to VMware PowerCLI ! Time to "GOVC"
Say Bye to VMware PowerCLI ! Time to "GOVC"Say Bye to VMware PowerCLI ! Time to "GOVC"
Say Bye to VMware PowerCLI ! Time to "GOVC"
 
Labels, Labels, Labels
Labels, Labels, Labels Labels, Labels, Labels
Labels, Labels, Labels
 

Ähnlich wie Setting up the hyperledger composer in ubuntu

Drupal Continuous Integration with Jenkins - Deploy
Drupal Continuous Integration with Jenkins - DeployDrupal Continuous Integration with Jenkins - Deploy
Drupal Continuous Integration with Jenkins - DeployJohn Smith
 
Blockchain Hyperledger Lab
Blockchain Hyperledger LabBlockchain Hyperledger Lab
Blockchain Hyperledger LabDev_Events
 
Prizm Installation Guide
Prizm Installation GuidePrizm Installation Guide
Prizm Installation Guidevjvarenya
 
3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdf3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdfBOSC Tech Labs
 
Hyperledger Composer
Hyperledger ComposerHyperledger Composer
Hyperledger ComposerRihusoft
 
Installing WordPress on AWS
Installing WordPress on AWSInstalling WordPress on AWS
Installing WordPress on AWSManish Jain
 
Hyperledger Fabric and Tools
Hyperledger Fabric and ToolsHyperledger Fabric and Tools
Hyperledger Fabric and ToolsRihusoft
 
ASP.NET Core and Docker
ASP.NET Core and DockerASP.NET Core and Docker
ASP.NET Core and DockerChuck Megivern
 
1 app 2 developers 3 servers
1 app 2 developers 3 servers1 app 2 developers 3 servers
1 app 2 developers 3 serversMark Myers
 
How create react app help in creating a new react applications
How create react app help in creating a new react applications How create react app help in creating a new react applications
How create react app help in creating a new react applications Concetto Labs
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakayaMbakaya Kwatukha
 
APACHE
APACHEAPACHE
APACHEARJUN
 
Usage Note of SWIG for PHP
Usage Note of SWIG for PHPUsage Note of SWIG for PHP
Usage Note of SWIG for PHPWilliam Lee
 
Diva23
Diva23Diva23
Diva23diva23
 
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agentsPVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agentsAndrey Karpov
 

Ähnlich wie Setting up the hyperledger composer in ubuntu (20)

Drupal Continuous Integration with Jenkins - Deploy
Drupal Continuous Integration with Jenkins - DeployDrupal Continuous Integration with Jenkins - Deploy
Drupal Continuous Integration with Jenkins - Deploy
 
Blockchain Hyperledger Lab
Blockchain Hyperledger LabBlockchain Hyperledger Lab
Blockchain Hyperledger Lab
 
Prizm Installation Guide
Prizm Installation GuidePrizm Installation Guide
Prizm Installation Guide
 
CodeShip
CodeShipCodeShip
CodeShip
 
3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdf3 Ways to Get Started with a React App in 2024.pdf
3 Ways to Get Started with a React App in 2024.pdf
 
Behat sauce
Behat sauceBehat sauce
Behat sauce
 
Hyperledger Composer
Hyperledger ComposerHyperledger Composer
Hyperledger Composer
 
Installing WordPress on AWS
Installing WordPress on AWSInstalling WordPress on AWS
Installing WordPress on AWS
 
Hyperledger Fabric and Tools
Hyperledger Fabric and ToolsHyperledger Fabric and Tools
Hyperledger Fabric and Tools
 
ASP.NET Core and Docker
ASP.NET Core and DockerASP.NET Core and Docker
ASP.NET Core and Docker
 
1 app 2 developers 3 servers
1 app 2 developers 3 servers1 app 2 developers 3 servers
1 app 2 developers 3 servers
 
How create react app help in creating a new react applications
How create react app help in creating a new react applications How create react app help in creating a new react applications
How create react app help in creating a new react applications
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakaya
 
Its3 Drupal
Its3 DrupalIts3 Drupal
Its3 Drupal
 
Howto Pxeboot
Howto PxebootHowto Pxeboot
Howto Pxeboot
 
APACHE
APACHEAPACHE
APACHE
 
Usage Note of SWIG for PHP
Usage Note of SWIG for PHPUsage Note of SWIG for PHP
Usage Note of SWIG for PHP
 
Diva23
Diva23Diva23
Diva23
 
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agentsPVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
 
Overview of Docker
Overview of DockerOverview of Docker
Overview of Docker
 

Kürzlich hochgeladen

ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxRosabel UA
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 

Kürzlich hochgeladen (20)

ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 

Setting up the hyperledger composer in ubuntu

  • 1. Setting up the Hyperledger Composer in ubuntu
  • 2.  Hyperledger Composer is an extensive, open development toolset and framework to make developing blockchain applications easier.  These are the components we are going to setup.
  • 3. Composer Solution Architecture with 8 steps  Step 1: Installing Hyperledger Composer development tools.  Step 2: Starting Hyperledger Fabric.  Step 3: Create a Business Network Definition.  Step 4: Building .bna (banana file) or Generate the Business Network Archive.  Step 5: Deploy banana file to the running Hyperledger Fabric.  Step 6: Generate REST API.  Step 7: Test REST API.  Step 8: Generate angular application and test. Follow the instructions below to get the required Hyperledger Composer development tools and stand up a Hyperledger Fabric.
  • 4.  There are two version of Hyperledger Fabric: v0.6 and v1.0. The default is for v1.0 and we suggest this is the one you use.  Before you begin, following are prerequisites for installing the required development tools:
  • 5.  NOTE 1: Please do not install Composer as a superuser - or use 'sudo' or the 'root' user, if on Linux (doing will cause issues with the install). Composer should be installed as non-privileged ($) user.  NOTE 2: Make sure you have open internet access in order to execute the below commands. If no open internet access you will end up with SSL Cert issues while executing some of the https curl URLs within the scripts.  NOTE 3: Assuming CURL is already installed in your Linux machine.  If you're running on Ubuntu, you can download the prerequisites using the following commands:  Next run the script - as this briefly uses sudo during its execution, you will be prompted for your password.
  • 6.
  • 7. Step 1: Installing Hyperledger Composer development tools  The development tools you'll need can all be installed (as a non-privileged user e.g. non-root) as mention in NOTE 1  composer-cli – contains all the command line operations for developing business networks.  It interprets the composer commands in building and deploying the networks.  To install composer-cli run the following command (check above architecture for components overview).  npm install –g composer-cli
  • 8.
  • 9.  generator-hyperledger-composer- It is a Yeoman plugin that creates skeleton applications for your business network.   npm install -g generator-hyperledger-composer 
  • 10.  composer-rest-server - uses the Hyperledger Composer loopback connector to connect to a business network, extract the models and then present a page containing the REST APIs that have been generated for the model.   npm install -g composer-rest-server
  • 11.   yo - Yeoman is a tool for generating applications. When combined with the generator-hyperledger-composer component, it can interpret business networks and generate applications based on them.  npm install -g yo
  • 12. Step 2: Starting Hyperledger Fabric.  Note: You have to run these as sudo user and have open internet access. If not you will end up with certificates issue.  In a directory of your choice (will assume ~/fabric-tools) get the zip file that contains the tools.  This will set up fabric dev servers in your box.  Choose which version of Fabric to use. Hyperledger Fabric v1.0 is highly recommended and the default. If for some reason v0.6 needs to be installed, you can set it explicitly as follows: export FABRIC_VERSION=hlfv0.6. Don’t change anything for 1.0 (Just ignore this step b)
  • 13.  Start fabric - All the scripts will be in the directory ~/fabric-tools A typical sequence for Hyperledger Composer use would be
  • 14. Step 3: Create a Business Network Definition  Download sample network using below git command.  Rename this folder to “my-network” using the below command.  cp -r ./composer-sample-networks/packages/basic-sample-network/ ./my- network  You should now have a folder called my-network (as the basis for our project) that we can start to modify.   Update your package.json file - The metadata (name, version, description) for the business network definition is stored in the package.json file. Edit the file to xchange the name to my-network and modify the prepublish script to change the name of the business network archive.  NOTE : Update only the bold tags below. Keep rest of the things same.  
  • 15.  Update your README.md file to - # My very first Hyperledger Composer Network Save your changes.
  • 16.  Define your Domain Model - overwrite below code and save your changes to models/sample.cto
  • 17.  Write Transaction Processor Functions – overwrite below code and save your changes to lib/sample.js ()  Update your Access Control Rules - The file permissions.acl defines the access control rules for the business network definition. Replace the entire contents of permissions.acl with the rule below and save your changes to permissions.acl
  • 18. Step 4: Building .bna or Generate the Business Network Archive.  To check that the structure of the files is valid, you can now generate a Business Network Archive (BNA) file for your business network definition. The BNA file is the deployable unit -- a file that can be deployed to the Composer runtime for execution.  Switch back to the terminal and type:
  • 19.  You should see the following output:
  • 20. Step 5: Deploy to the running Hyperledger Fabric.  We are going to deploy the BNA (suffix .bna) file to Hyperledger Fabric v1.0; this blockchain environment was set up earlier in this guide in Step 2.  Switch to the terminal, change directory to the dist folder containing the my- network.bna file and type:  NOTE : PeerAdmin is purely an identity label referencing cryptographic (eg. signer certificate) material you have imported into the keyValStore identified in your connection profile which has meaning to a single Peer (in our dev setup) or set of Peers (if configured in another way) within the same organization.  After approximately 30 seconds or so, the business network should have been deployed to your local Hyperledger Fabric. You should see output as follows:
  • 21.  You can verify that the network has been deployed by typing.
  • 22. Step 6: Generate REST API  To integrate with the deployed business network (creating assets/participants and submitting transactions) we can either use the Composer Node SDK or we can generate a REST API.  To create the REST API we need to launch the composer-rest-server and tell it how to connect to our deployed business network. The composer-rest-server was installed when you installed the development environment.  Now launch the server by changing directory to the my-network folder and type  These allow the composer-rest-server to connect to Hyperledger Fabric and configure how the REST API is generated.
  • 23.
  • 24. Step 7: Test REST API  Open a web browser and navigate to http://localhost:3000/explorer  You should see the LoopBack API Explorer, allowing you to inspect and test the generated REST API.  Let’s POST a Trader and GET him by his id.
  • 26.  Select POST operation to post a trader in blockchain.  Click on “Try it out” button
  • 27.  Verify the response code – 200.  Response of GET
  • 28. Step 8: From Yo template.  Your application is running. You should see the composer-rest-server start, and then Angular web packs the web application - it serves the content at URL:  http://localhost:4200
  • 29.  If you navigate to this URL and press the "Assets" drop down (at the top-right of the page) you can see any existing instances of Commodity stored on the Hyperledger Fabric in the table (we have not stored them on blockchain yet!). You can create new instances using the "Add Asset" button. Note that the Angular skeleton does not yet allow you to create Participants, so you would need to create a test Trader instance to act as the owner of the Commodity (being added here), using the Loopback Swagger UI ( (ie using Playground) before you can create a Commodity.
  • 30.  Chain code issue - https://stackoverflow.com/questions/43666890/fabric-composer-test-code-not-working  Document source - https://hyperledger.github.io/composer/tutorials/developer-guide.html