SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

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.
 

Tendances (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
 

Similaire à 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
 

Similaire à 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
 

Dernier

Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...Nguyen Thanh Tu Collection
 
Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17Celine George
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17Celine George
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxMadhavi Dharankar
 
An Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPAn Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPCeline George
 
4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptxmary850239
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...Nguyen Thanh Tu Collection
 

Dernier (20)

Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
Introduction to Research ,Need for research, Need for design of Experiments, ...
Introduction to Research ,Need for research, Need for design of Experiments, ...Introduction to Research ,Need for research, Need for design of Experiments, ...
Introduction to Research ,Need for research, Need for design of Experiments, ...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
 
Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17How to Manage Buy 3 Get 1 Free in Odoo 17
How to Manage Buy 3 Get 1 Free in Odoo 17
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptx
 
An Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPAn Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERP
 
4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx4.9.24 Social Capital and Social Exclusion.pptx
4.9.24 Social Capital and Social Exclusion.pptx
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
CARNAVAL COM MAGIA E EUFORIA _
CARNAVAL COM MAGIA E EUFORIA            _CARNAVAL COM MAGIA E EUFORIA            _
CARNAVAL COM MAGIA E EUFORIA _
 
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
 
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
 

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