Más contenido relacionado
La actualidad más candente (20)
Similar a Introduction to Fabric Composer (20)
Más de Hyperleger Tokyo Meetup (20)
Introduction to Fabric Composer
- 1. © 2017 IBM Corporation 1Page© 2017 IBM Corporation
Introduction to Fabric Composer
Akimitsu Shiseki
Cloud, IBM Japan
JL17850@jp.ibm.com
@akishiseki
Hyperledger Tokyo Meetup 2017-1
- 2. © 2017 IBM Corporation 2Page
Contents
Concepts & Modelling
Applications & Tools
Integrating Existing Systems
2Page© 2017 IBM Corporation
- 3. © 2017 IBM Corporation 3Page
Blockchain Recap
– Blockchain builds on basic business concepts
– Business Networks connect businesses
– Participants with Identity
– Assets flow over business networks
– Transactions describe asset exchange
– Contracts underpin transactions
– The ledger is a log of transactions
– Blockchain is a shared, replicated ledger
– Consensus, immutability, finality, provenance
- 4. © 2017 IBM Corporation 4Page
What is Fabric Composer?
– Blockchains typically provide a low-level interface for business applications
– Smart contract code run on a distributed processing system
– Inputs go into an immutable ledger; outputs to a data store
– Applications are built on top of a low level of abstraction
– Fabric Composer
– A suite of high level application abstractions for business networks
– Emphasis on business-centric vocabulary for quick solution creation
– Features
– Model YOUR business networks, test and expose via APIs
– Applications invoke APIs transactions to interact with business network
– Integrate existing systems of record using loopback/REST
– Tools, APIs and libraries to support these activities
– Open community initiative in support of the Linux Foundation Hyperledger project
Business Application
Fabric Composer
Hyperledger Fabric
http://fabric-composer.org/
- 5. © 2017 IBM Corporation 5Page
Buyer
Owner Buyer
Insurer
Listings registryVehicle registry
"$class": "org.acme.vehicle.auction.VehicleListing",
"listingId": "LIST_1234",
"reservePrice": 500,
"description": "Car sale for playback 2",
"state": "FOR_SALE",
"vehicle": "VIN_123456"
"$class": "org.acme.vehicle.auction.Vehicle",
"vin": "VIN_123456",
"owner": "daniel.selman@uk.ibm.com"
net.biz.vehicle.auction
sell
car
offer bid
for car
offer bid
for car
Transactions
• (Sell)
• Offer
• Close Bidding
close
bidding
( Counterparties outside
the business network )
An Example Business NetworkAn Example Business NetworkAn Example Business NetworkAn Example Business Network
1 23
Business Network
Participants
Identity
Assets
Registries
Transactions
(Events)
(Links)
With FABRIC COMPOSER…
1. Model, test and expose the business network
2. Create apps that consuming the business network
3. Integrating existing systems with the business network
2
DMV
Existing
system
Auctioneer
OwnerApp
App
App
builds on …
- 6. © 2017 IBM Corporation 6Page
Benefits of Fabric Composer
Increases
understanding
Saves
time
Reduces
risk
Increases
flexibility
Bridges simply from
business concepts
to blockchain
Develop blockchain
applications more
quickly and cheaply
Well tested, efficient
design conforms to
best practice
Higher level
abstraction makes it
easier to iterate
- 7. © 2017 IBM Corporation 7
Extensive, Familiar, Open Development Toolset
CLI utilities
Data modelling JavaScript
business logic
Web playground
Editor support Integration
$ composer
Client libraries
composer-client
composer-admin
Code generation
- 8. © 2017 IBM Corporation 8Page
Key Concept: Business Network
– Business network models participants, assets, registries, transactions…
– Includes expressive syntax such as arrays, enumerations and references
– Transaction processors implement business logic on these model elements
– Uses standard Javascript for ease of development and portability
– Access Control Lists define rules for sharing and privacy
– In Fabric Composer, a business network is defined as
– A model definition file
– A set of Javascript processors
– An Access Control List
– Packaged into Business Network Archive for ease of deployment
- 9. © 2017 IBM Corporation 9Page
Modelling Business Networks: Composer-UI
– A modelling environment for modelling, testing, and exposing business networks
– Aimed at technical analysts
– Model assets, participants,
transactions… and more interactively
– Content assist, syntax checking AND
standalone execution
– Connect and deploy to multiple
different environments, e.g. test,
production
http://fabric-composer.mybluemix.net/editor
- 10. © 2017 IBM Corporation 10Page
Key Concept: Assets 1
– Represents the resources being
exchanged in the business network
1. Define using the asset keyword
2. Assets have structure – domain relevant
class name, e.g. vehicle, house, bond
3. Set of properties, denoted by ‘o’.
Relationships to other resources,
denoted by ‘ ’. Optional elements are
allowed. Field validators can be provided
4. Stored in an asset registry. Registries are
first class abstraction.
2
3
4
5
- 11. © 2017 IBM Corporation 11Page
Key Concept: Participants
1
– Represents the counterparties in the
business network
1. Define using the participant keyword
2. Participants have a class name, relevant
to the domain, e.g. buyer, seller
3. Set of properties, denoted by ‘o’.
Relationships to other resources,
denoted by ‘ ’. Optional elements are
allowed. Field validators can be provided
4. Stored in a participant registry
2
3
4
- 12. © 2017 IBM Corporation 12Page
Key Concept: Transactions
1 2
– Represents the steps that govern resource
lifecycle, typically assets
1. Define using the transaction keyword
2. Transactions have a class name, relevant
to the domain, e.g. sellVehicle, buyHouse
3. Set of properties, denoted by ‘o’.
Relationships to other resources,
denoted by ‘ ’. Field validators can be
provided
4. Stored in a transaction registry
3
4
- 13. © 2017 IBM Corporation 13Page
Key Concept: Transaction Processors
– Provide the implementations for
transactions
– Perform state changes on domain
specific resources using model defined
syntax
– Provided in separate .js file. Uses
model definitions from CTO file
– Will result in invocation point from
applications, via REST
- 14. © 2017 IBM Corporation 14Page
Contents
Concepts & Modelling
Applications & Tools
Integrating Existing Systems
14Page© 2017 IBM Corporation
- 15. © 2017 IBM Corporation 15Page
Applications and APIs
– Initially provide node.js programming
language due to ecosystem and skills
– Programming language not tied to
node.js, others as need arises
– composer-client & composer-admin
npm modules for app devs and admins
respectively
– Programming model JSDOC at
– Domain specific REST APIs also available
(see later)
https://fabric-composer.github.io//jsdoc/index.html
- 16. © 2017 IBM Corporation 16Page
Generating Application Assets
– Modelling approach facilitates
skeleton application generation
– Yeoman questionnaire-based.
yo fabric-composer[:angular]
– Generates sample application from
models and network which exploits
REST APIs for domain resources
– Can exercise domain REST APIs
from web UI with :angular option
– Also generate test cases using mocha
and chai node.js test packages
- 17. © 2017 IBM Corporation 17Page
Access Control Lists
– Separate ACL from application logic
– Defined in a permissions.acl
file in business network definition
– Flexible model allowing both type
and instance access e.g. ‘create
cars’ and ‘scrap my car’
– resource can be any type or
instance in the model, including
transactions
– condition allows sophisticated
description of access rights
description | participant | operation | resource |
condition | action
description: “Car asset rule”
participant: ANY
operation: READ
resource: org.acme.Car
condition = (true)
action = allow
description: “Sally’s care rule”
participant(s): org.acme.Driver#SALLY
operation: WRITE
resource(r): org.acme.Car#ABC123
condition: (r.owner = s)
action: allow
‘Anyone can read
car assets’
‘Only Sally can
update her car
when she
owns it’
https://fabric-composer.github.io/reference/acl_language.html
- 18. © 2017 IBM Corporation 18Page
Command Line Interfaces
– Suite of commands to interact
with an operational business
network
– Target use is scripting and
interactive operations
– Packaged as composer-cli in
npm
– Generate full list with composer
–help. Individual (sub)
commands support -help
– Uses public APIs
$> composer –help
Commands:
archive <subcommand> Composer archive command
generator <subcommand> Composer generator command
identity <subcommand> Composer identity command
network <subcommand> Composer network command
participant <subcommand> Composer participant command
transaction <subcommand> Composer transaction command
Options:
--help Show help [boolean]
-v, --version Show version number [boolean]
Examples:
composer identity issue
For more information: http://fabric-composer.org/reference
$> composer transaction submit –help
composer transaction submit [options]
Options:
--help Show help [boolean]
-v, --version Show version number [boolean]
--connectionProfileName, -p The connection profile name [string]
--businessNetworkName, -n The business network name [string] [required]
--enrollId, -i The enrollment ID of the user [string] [required]
--enrollSecret, -s The enrollment secret of the user [string]
--data, -d Transactions JSON object [string] [required]
- 19. © 2017 IBM Corporation 19Page
Simple Application Development Lifecycle
1. Install Fabric Composer Tools
2. Define Business Network, Assets and Transactions
3. Implement any transaction processors
4. Test business network within Composer-UI
5. Deploy business network to live Hyperledger fabric
6. Generate sample application for this network
7. Test sample application
• Strong basis to start your application experience
http://fabric-composer.mybluemix.net/editor
- 20. © 2017 IBM Corporation 20Page
Contents
Concepts & Modelling
Applications & Tools
Integrating Existing Systems
20Page© 2017 IBM Corporation
- 21. © 2017 IBM Corporation 21Page
Loopback and REST Support
– Exploit Loopback framework to create
REST APIs. https://loopback.io/
– Domain specific APIs very attractive to
mobile and web developers. Resources
and operations are business-meaningful
– Extensive test facilities for REST methods
– Provides back-end integration with any
loopback compatible product
– e.g. IBM Integration Bus,
API Connect, StrongLoop
– Outbound notification, an objective
- 22. © 2017 IBM Corporation 22Page
Other Items of Note
– Extensive use of GitHub and npm for sharing and distribution
– Fabric Composer, User Models, User network definitions
– Semantic versioning of networks and models using npm versions
– Intention to add query, events and links as first class abstractions
– Extensive query to support reporting and analytics
– Events for notification and loose coupling of transaction processors
– Links for business network linkage
– More sample applications to demonstrate Fabric composer
– Includes sample-models and sample-networks
– Community Building and Community Process: Transparency
- 23. © 2017 IBM Corporation 23Page
Blockchain on Cloud
Hyperledger
Fabric
Peer
Hyperledger
Fabric
Peer
Hyperledger
Fabric
Peer
KVS
Chain-
code
Hyperledger
Fabric
Peer
KVS
Chain-
code
KVS
Chain-
code
KVS
Chain-
code
A’s Web
application
Cognitive IoT On-premise
SoR
API
B’s Web
application
gRPC
A’s user
B’s user
A’s infrastructure (on-premise)
B’s infrastructure (Cloud)
C’s infrastructure (Cloud)
Company D’s infra (on-premise)
Bluemix
API Economy
gRPC
• Company A and B process transactions based
on agreed upon business rules, chaincode.
• Transaction records are immutable and
auditable by third party.
Cloud Foundry runtime
- 24. © 2017 IBM Corporation 24Page
Blockchain on Cloud
Hyperledger
Fabric
Peer
Hyperledger
Fabric
Peer
Hyperledger
Fabric
Peer
KVS
Chain-
code
Hyperledger
Fabric
Peer
KVS
Chain-
code
KVS
Chain-
code
KVS
Chain-
code
A’s Web
application
Cognitive IoT On-premise
SoR
API
B’s Web
application
• Bluemix High Security Business Network (HSBN)
provides secure managed blockchain service.
• Cloud Foundry allows lean startup and
composable applications. (API economy, DevOps)
Managed Blockchain service
Bluemix
API Economy
gRPC
gRPC
A’s user
B’s user
Cloud Foundry runtime
https://console.ng.bluemix.net/catalog/services/blockchain?env_id=ibm:yp:us-south
- 25. © 2017 IBM Corporation 25Page
Fabric Composer
• REST APIs to GET/PUT/POST/DELETE business entities
- 26. © 2017 IBM Corporation 26Page
Blockchain on Cloud
Hyperledger
Fabric
Peer
Hyperledger
Fabric
Peer
Hyperledger
Fabric
Peer
KVS
Chain-
code
Hyperledger
Fabric
Peer
KVS
Chain-
code
KVS
Chain-
code
KVS
Chain-
code
A’s Web
application
Cognitive IoT On-premise
SoR
API
B’s Web
application
• Web applications can access business entities,
ex. cars or jewels, on blockchain by REST API.
• More blockchain applications, faster with lower
cost.
Managed Blockchain service
Bluemix
API Economy
REST API
LoopBack
REST API
LoopBack
A’s user
B’s user
Cloud Foundry runtime
- 27. © 2017 IBM Corporation 27Page
Summary
Building blockchain apps …
– Fabrics designed for technologists
– Dozens of decisions relating to web
interface, application server, blockchain
resource management etc.
– Everything built from scratch which is
time-intensive and error prone.
Get started with Fabric Composer
– Play with blockchain on Composer Playground -
makes adoption simple
– Learn syntax basics, how to model data, build
assets, submit transactions
– Run applications with pre-built best practices in a
public or privately managed environment. Integrate
with existing systems.
- 28. © 2017 IBM Corporation 28Page© 2017 IBM Corporation
Thank you!
Hyperledger Tokyo Meetup 2017-1