Introducing Hyperledger Composer: Unit 02
Introducing Hyperledger Composer: Unit 02
Introducing Hyperledger Composer: Unit 02
Unit 02
What is Hyperledger
Composer?
Application development
Effective administration
Summary
What you should be able to do
• Understand Hyperledger Composer, its capabilities, and its role in modeling and implementing blockchain applications.
• Explore the fundamental concepts to design, model, and implement business networks.
• Discover advanced topics such as connection profiles, ID cards, and integration into current systems.
3
Learning objectives
What is Hyperledger
Composer?
Application development
Effective administration
Summary
Blockchain refresher
5
Hyperledger Composer: Accelerating time to value
Business application
https://hyperledger.github.io/composer/
• Features:
o Model your business networks, and test and expose through APIs.
o Applications invoke APIs transactions to interact with the business
network.
o Integrate existing systems of record by using LoopBack/REST.
7
An extensive, familiar, and open development toolset
composer-client
composer-admin
$ composer
Swagger
8
User roles in a blockchain project
• Network service provider:
NSP
• Governs the network: Channels, membership, and so on.
• A consortium of network members or designated authority.
Business service consumer: Hosts application and User: Runs presentation logic, for
integration logic, which invokes blockchain example, on a mobile device or
transactions. dashboard.
Business service consumer: Hosts application and User: Runs presentation logic, for
integration logic, which invokes blockchain example, on a mobile device or
transactions. dashboard.
What is Hyperledger
Composer?
Application development
Effective administration
Summary
Key concepts for the business service provider
Business service
provider Smart contract logic
Presentation
Uses logic
Develops Develops
Defined in Updates
Participant
registry
12
Key concepts for a vehicle manufacture developer
Vehicle Manufacture
Developer
Updates
Person Manufacturer Regulator
registry registry registry
13
Hyperledger Composer Architecture
14
The business service provider develops three components
• Implements the logic that is • Services that interact with the o Provides the front end for
deployed to the blockchain: registries: the user. May be several of
o Models describe assets, o Create, delete, update, these applications.
participants, and query, and invoke smart o Interacts with business
transactions. contracts. logic through standard
o Transaction processors o Implemented inside interfaces (for example,
provide the JavaScript business applications, REST).
implementation of integration logic, and o Hyperledger Composer
transactions. REST services. can generate the REST
o ACLs define privacy rules. o Hosted by the business interface from a model and
o May also define events and application consumer. a sample application.
registry queries.
15
Assets, participants, and transactions
Transaction
processors
16
Access control
• It is possible to restrict which resources can be read
and modified by which participants:
o Rules are defined in an .acl file and deployed
with the rest of the model.
o Transaction processors can also look up the
current user and implement rules
programmatically.
18
Smart contract development: Hyperledger Composer Playground
20
Creating the business and user applications
quality code.
21
Debugging
22
Learning objectives
What is Hyperledger
Composer?
Application development
Effective administration
Summary
There are two user roles with “administration” responsibility
• Network service provider:
NSP
• Governs the network: Channels, membership, and so on.
• A consortium of network members or designated authority.
Business service consumer: Hosts application and User: Runs presentation logic, for
integration logic, which invokes blockchain example, on a mobile device or
transactions. dashboard.
Packages
User Connection Creates Business
profile network
Issues
archive
Issues
Customizes
Business Refers to and deploys
User service
identity consumer
identity
REST
interface
Connects Asset Participant Transaction Identity
Business app registry registry registry registry
Integration
Hosts …
logic
Business Chaincode container Ledger
Business network
Business logic
service card Hyperledger Fabric
consumer (Connection profile +
Peer
business service
consumer identity)
25
The network service consumer packages resources into a BNA file
26
Connection profiles to Hyperledger Fabric
27
Participant identity Key component; make sure
• The network service consumer issues network it is understood..
participants with an identity to connect to
Hyperledger Fabric:
o Issued as a Hyperledger Fabric user
ID/secret.
o Automatically swapped for a certificate on first
use.
o Packaged in a business network card and
supplied when the client application connects.
• Hyperledger Composer Participant to Hyperledger Fabric Identity
mapping is stored on the blockchain in an identity registry.
• Usually, only business service consumers have a Hyperledger Fabric
identity. Users log in to the business application by using a
separately managed identity; blockchain transactions are invoked by
proxy.
• Manage identity from Playground, JavaScript, REST, or the CLI. For
example, you can test a connection, issue an identity, bind an
identity to a participant, revoke an identity, and list identities.
28
Business network cards
• Business network cards are a convenient packaging of identity and connection profile:
o Contains everything that you need to connect to a blockchain business network.
o Each card refers to a single participant and single business network.
o Analogous to an ATM card.
29
Systems of record integration
• Domain-specific APIs are attractive to mobile and web
developers. Resources and operations are business-
meaningful.
• Hyperledger Composer uses the LoopBack framework to
create REST APIs: https://loopback.io/.
• There are extensive test facilities for REST methods that
use LoopBack.
• Secured by using JS Passport, with 400+ options for
authentication. Support for API keys to secure REST
APIs.
• Hyperledger Composer provides back-end integration
with any LoopBack compatible product:
o Examples include IBM App Connect Enterprise and
API Connect, StrongLoop.
o Outbound and Inbound (where supported by
middleware).
30
Using LoopBack: Examples
32
Learning objectives
What is Hyperledger
Composer?
Application development
Effective administration
Summary
Unit summary
This unit covered an introduction into Hyperledger Composer with the following key takeaways:
• Hyperledger Composer is a suite of open source tools and application abstractions that build and model
blockchain-based business networks.
• Hyperledger Composer is the fastest way to start prototyping blockchain applications.
• An event subscription model enhances the interaction possibilities with applications.
• A combination of connection profiles and identities, which are bundled into business network cards, are the
authentication mechanism to connect to a business network.
• For systems of record integration, Hyperledger Composer uses LoopBack, which itself supports various
interfaces, such as REST, IBM App Connect Enterprise, and IBM MQ.
34
Checkpoint questions
35
Checkpoint questions
2) What are the three models that describe a Hyperledger Composer application?
36
Checkpoint questions
d) Queries are only supported if the Hyperledger Fabric blockchain is backed by CouchDB.
37
Checkpoint questions
4) Connection profiles encapsulate connection parameters for Hyperledger Fabric and are required on a
channel basis.
38
Checkpoint questions
a) Domain-specific APIs are preferred for the integration of mobile and web applications.
b) Fine granular, low-level APIs are preferred for the integration of mobile and web applications.
39
Checkpoint answers
1. a, c, d, e
2. c
3. a, d
4. a
5. a, c, d
40
Exercise introduction
We continue with the introduced example of a vehicle manufacturing process and will implement such a
network on Hyperledger Composer.
We start with Hyperledger Composer Playground and become familiar with the tools. We continue by creating
models for participants, assets and transactions, and use the CLI tools to deploy business network archives to
a Hyperledger Fabric environment.
To get experience for the integration of applications like websites and mobile apps, we look at the powerful
capabilities of LoopBack and Swagger.
41
References
For more information about the topics that are covered in this unit, see the following resources:
• https://hyperledger.github.io/composer
• https://composer-playground.mybluemix.net
• https://hyperledger.github.io/composer/latest/tutorials/tutorials.html
• https://hyperledger.github.io/composer/latest/introduction/introduction.html
42
Thank you.
IBM Skills Academy
www.ibm.com/blockchain
developer.ibm.com/blockchain
www.hyperledger.org
© Copyright IBM Corporation 2017. All rights reserved. The information contained in these
materials is provided for informational purposes only, and is provided AS IS without warranty
of any kind, express or implied. Any statement of direction represents IBM's current intent, is
subject to change or withdrawal, and represents only goals and objectives. IBM, the IBM
logo, and other IBM products and services are trademarks of the International Business
Machines Corporation, in the United States, other countries or both. Other company, product,
or service names may be trademarks or service marks of others.