SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

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.
 

Mais procurados (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
 

Semelhante a 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
 

Semelhante a 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
 

Último

Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 

Último (20)

Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 

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