SlideShare a Scribd company logo
1Page
Introduction to Hyperledger Composer
Simon Stone, Maintainer
@mrsimonstone
2
Blockchain for business
• Blockchain builds on basic business concepts
– Business Networks connect businesses
– Assets flow over business networks
– Transactions describe asset exchange
– Participants submit transactions
– Contracts define the rules for transactions
– The ledger is a log of transactions
• Blockchain provides a shared, replicated ledger
– Consensus, immutability, finality, provenance
3
Blockchain today
• Blockchain platforms, for example Hyperledger Fabric, provide a technical
foundation for transactional applications across business networks:
– Smart contracts (chaincode) are executed on a distributed network
– Inputs go into an immutable ledger; outputs go to a data store (world state)
– Applications are built from the ground up
4
Smart contracts/chaincode today
• Too much boilerplate code, not enough focus on the important business logic.
Business logic
Data validation
Access control
RPC interface
Error handling
5
Hyperledger Composer
• Hyperledger Composer is a framework to accelerate the development of
applications built on top of Blockchain platforms:
– Start from the business level; model network assets, participants, and transactions
– Applications use business centric APIs to invoke transactions that create, delete, and
update assets and transfer them between participants
– Assets, participants, and transactions are recorded in the world state in registries
– Easily integrate Blockchain with existing business processes and systems of record
– Emphasis on quick solution creation and business-centric vocabulary
6
Extensive, familiar, and open development toolset
CLI utilities
Data modelling JavaScript
business logic
Web playground
Editor support Integration
$ composer
Client libraries
composer-client
composer-admin
Code generation
7
Key development concepts
• Model files describe the assets, participants, transactions, and events that exist in
a business network
– Expressive modelling language includes relationships, arrays, and validation rules
– Data serialized as JSON, and is fully validated by the Hyperledger Composer runtime
• Access control lists define rules for sharing and privacy
– Rules are automatically enforced by the Hyperledger Composer runtime
• Transaction processor functions implement additional business requirements
– Standard JavaScript code executed on the Blockchain by the Hyperledger Composer runtime
• A business network definition is the set of the above for a given business network.
8
Model files
Namespaces group related types
Types have a set of properties,
denoted with a leading ”o”
Types can have relationships to other types,
denoted with a leading ”-->”
Specific keywords for defining assets, participants,
transactions, and events in a business network.
Non-abstract types must have an identifying field.
9
Access control lists
Rules are executed in order from top to
bottom. If no rule permits access, then
access is denied.
Rules can contain complex conditions.
Conditions are written in JavaScript,
and can access the participant and
resource.
Each rule permits or denies permission to a
participant to perform an operation on a
resource. Resources are assets,
participants, etc.
10
Transaction processor functions
Transaction processor functions are written in
standard JavaScript (ES5) and they can use
the runtime API to interact with the Blockchain.
Transaction processor functions are atomic; all of
the updates are applied, or no updates are applied.
Annotations in the comments define the transaction
that the function accepts, and that the function is
a transaction processor function.
Interact with the registry APIs to add, update, and
remove assets stored on the Blockchain in the world
state.
Use the event APIs to publish events to external
applications for notifications and triggering
downstream processing.
11
Business network definition
Each business network definition has metadata
associated with it – at least a name and version.
The business network definition contains all of the
model files, access control rules, and transaction
processor functions for a business network.
The metadata is stored in a package.json file.
Each business network definition is a npm module.
Business network definition
Model files
Access control rules
Transaction processor functions
12
Deployment
Business network definitions can be deployed to
a Blockchain platform, for example Hyperledger
Fabric v0.6 or v1.0.
Composer has a runtime which understands,
manages, and executes the business network
definition.
The business network definition is not compiled
or translated into smart contract code, for example
Composer does not convert JavaScript transaction
processor functions into Go code.
Smart Contract
Business network definition
“user” code
Composer runtime
“our” code
The business network definition and Composer
runtime are deployed together as the smart
contract.
13
Execution
Smart Contract
Business network
definition
“user” code
Composer runtime
“our” code
Client Application 1
Client Application 2
Client apps call either the
Composer Node.js client API
or the Composer REST API.
Client apps are submitting
standard Blockchain
transactions and they go
through consensus etc.
Transaction processor functions
are called in the scope of the
Blockchain transaction.
World
State
Blockchain
Platform
Assets, participants, and
other resources are stored
in Blockchain world state
Mike
Arium Logistics
Employee
Debbie
VDA
Regulations
Administrator
Paul
Buyer/Owner
Tommen
Insurer
Vada
Police
Alex
Agency for Vehicle
Standards
B L O C K C H A I N
Tommen
Insurer
Vada
Police
Alex
Agency for Vehicle
Standards
Mike
Arium Logistics
Employee
Debbie
VDA
Regulations
Administrator
Paul
Buyer/Owner
B L O C K C H A I N
Tommen
Insurer
Vada
Police
Alex
Agency for Vehicle
Standards
Mike
Arium Logistics
Employee
Debbie
VDA
Regulations
Administrator
Paul
Buyer/Owner
Mobile
App
B L O C K C H A I N
Tommen
Insurer
Vada
Police
Alex
Agency for Vehicle
Standards
Mike
Arium Logistics
Employee
Debbie
VDA
Regulations
Administrator
Paul
Buyer/Owner
Mobile
App
Enterprise
Integration
Tools
ERP
IoT
B L O C K C H A I N
Tommen
Insurer
Vada
Police
Alex
Agency for Vehicle
Standards
Mike
Arium Logistics
Employee
Debbie
VDA
Regulations
Administrator
Paul
Buyer/Owner
Business
Rules
Analytics
Mobile
App
Enterprise
Integration
Tools
ERP
IoT
B L O C K C H A I N
19
Demo
• {{demo}}
20
Development
• Hyperledger Composer was accepted as an incubator project in March 2017.
• All development plans can be tracked and viewed in GitHub:
– https://github.com/hyperledger/composer/projects
– https://github.com/hyperledger/composer/issues
• We would love for you to come along and participate!
– Review and comment on our future user stories
– Contribute code by submitting pull requests
– Help us build plans for the future
– Weekly calls to review designs, progress, and gather user feedback
• Calls run on an alternating schedule (week A – 4pm UTC, week B – 9am UTC)
21
Future plans
• #543 Complex query: a SQL-like Composer query language for querying
assets and participants on the Blockchain.
– Requires CouchDB support from Hyperledger Fabric v1.0.
• #55 Historian: a new component that records all events that occur in the
business network, including the modifications to assets.
• #898 Links: the ability to share and access data between multiple business
networks, even if they are running on different Blockchain platforms.
22
Links
• We’re all over the internet!
– Hyperledger introduction: https://www.hyperledger.org/projects/composer
– Website, tutorial, and docs: https://hyperledger.github.io/composer/
– Public playground: https://composer-playground.mybluemix.net/
– Source code: https://github.com/hyperledger/composer/
– NPM modules: https://www.npmjs.com/search?q=hyperledger+composer
– JSDoc: https://hyperledger.github.io/composer/jsdoc/index.html
– Docker images: https://hub.docker.com/u/hyperledger/
23
Community
• You can come and speak to us as well!
– Chat to us using Rocket.Chat at https://chat.hyperledger.org
• #composer and #composer-dev channels
– Ask (and answer!) questions on Stack Overflow using the hyperledger-composer tag
– Tweet us using the #Hyperledger #Composer hashtags!
24Page
Thank you!

More Related Content

Introduction to Hyperledger Composer

  • 1. 1Page Introduction to Hyperledger Composer Simon Stone, Maintainer @mrsimonstone
  • 2. 2 Blockchain for business • Blockchain builds on basic business concepts – Business Networks connect businesses – Assets flow over business networks – Transactions describe asset exchange – Participants submit transactions – Contracts define the rules for transactions – The ledger is a log of transactions • Blockchain provides a shared, replicated ledger – Consensus, immutability, finality, provenance
  • 3. 3 Blockchain today • Blockchain platforms, for example Hyperledger Fabric, provide a technical foundation for transactional applications across business networks: – Smart contracts (chaincode) are executed on a distributed network – Inputs go into an immutable ledger; outputs go to a data store (world state) – Applications are built from the ground up
  • 4. 4 Smart contracts/chaincode today • Too much boilerplate code, not enough focus on the important business logic. Business logic Data validation Access control RPC interface Error handling
  • 5. 5 Hyperledger Composer • Hyperledger Composer is a framework to accelerate the development of applications built on top of Blockchain platforms: – Start from the business level; model network assets, participants, and transactions – Applications use business centric APIs to invoke transactions that create, delete, and update assets and transfer them between participants – Assets, participants, and transactions are recorded in the world state in registries – Easily integrate Blockchain with existing business processes and systems of record – Emphasis on quick solution creation and business-centric vocabulary
  • 6. 6 Extensive, familiar, and open development toolset CLI utilities Data modelling JavaScript business logic Web playground Editor support Integration $ composer Client libraries composer-client composer-admin Code generation
  • 7. 7 Key development concepts • Model files describe the assets, participants, transactions, and events that exist in a business network – Expressive modelling language includes relationships, arrays, and validation rules – Data serialized as JSON, and is fully validated by the Hyperledger Composer runtime • Access control lists define rules for sharing and privacy – Rules are automatically enforced by the Hyperledger Composer runtime • Transaction processor functions implement additional business requirements – Standard JavaScript code executed on the Blockchain by the Hyperledger Composer runtime • A business network definition is the set of the above for a given business network.
  • 8. 8 Model files Namespaces group related types Types have a set of properties, denoted with a leading ”o” Types can have relationships to other types, denoted with a leading ”-->” Specific keywords for defining assets, participants, transactions, and events in a business network. Non-abstract types must have an identifying field.
  • 9. 9 Access control lists Rules are executed in order from top to bottom. If no rule permits access, then access is denied. Rules can contain complex conditions. Conditions are written in JavaScript, and can access the participant and resource. Each rule permits or denies permission to a participant to perform an operation on a resource. Resources are assets, participants, etc.
  • 10. 10 Transaction processor functions Transaction processor functions are written in standard JavaScript (ES5) and they can use the runtime API to interact with the Blockchain. Transaction processor functions are atomic; all of the updates are applied, or no updates are applied. Annotations in the comments define the transaction that the function accepts, and that the function is a transaction processor function. Interact with the registry APIs to add, update, and remove assets stored on the Blockchain in the world state. Use the event APIs to publish events to external applications for notifications and triggering downstream processing.
  • 11. 11 Business network definition Each business network definition has metadata associated with it – at least a name and version. The business network definition contains all of the model files, access control rules, and transaction processor functions for a business network. The metadata is stored in a package.json file. Each business network definition is a npm module. Business network definition Model files Access control rules Transaction processor functions
  • 12. 12 Deployment Business network definitions can be deployed to a Blockchain platform, for example Hyperledger Fabric v0.6 or v1.0. Composer has a runtime which understands, manages, and executes the business network definition. The business network definition is not compiled or translated into smart contract code, for example Composer does not convert JavaScript transaction processor functions into Go code. Smart Contract Business network definition “user” code Composer runtime “our” code The business network definition and Composer runtime are deployed together as the smart contract.
  • 13. 13 Execution Smart Contract Business network definition “user” code Composer runtime “our” code Client Application 1 Client Application 2 Client apps call either the Composer Node.js client API or the Composer REST API. Client apps are submitting standard Blockchain transactions and they go through consensus etc. Transaction processor functions are called in the scope of the Blockchain transaction. World State Blockchain Platform Assets, participants, and other resources are stored in Blockchain world state
  • 15. Tommen Insurer Vada Police Alex Agency for Vehicle Standards Mike Arium Logistics Employee Debbie VDA Regulations Administrator Paul Buyer/Owner B L O C K C H A I N
  • 16. Tommen Insurer Vada Police Alex Agency for Vehicle Standards Mike Arium Logistics Employee Debbie VDA Regulations Administrator Paul Buyer/Owner Mobile App B L O C K C H A I N
  • 17. Tommen Insurer Vada Police Alex Agency for Vehicle Standards Mike Arium Logistics Employee Debbie VDA Regulations Administrator Paul Buyer/Owner Mobile App Enterprise Integration Tools ERP IoT B L O C K C H A I N
  • 18. Tommen Insurer Vada Police Alex Agency for Vehicle Standards Mike Arium Logistics Employee Debbie VDA Regulations Administrator Paul Buyer/Owner Business Rules Analytics Mobile App Enterprise Integration Tools ERP IoT B L O C K C H A I N
  • 20. 20 Development • Hyperledger Composer was accepted as an incubator project in March 2017. • All development plans can be tracked and viewed in GitHub: – https://github.com/hyperledger/composer/projects – https://github.com/hyperledger/composer/issues • We would love for you to come along and participate! – Review and comment on our future user stories – Contribute code by submitting pull requests – Help us build plans for the future – Weekly calls to review designs, progress, and gather user feedback • Calls run on an alternating schedule (week A – 4pm UTC, week B – 9am UTC)
  • 21. 21 Future plans • #543 Complex query: a SQL-like Composer query language for querying assets and participants on the Blockchain. – Requires CouchDB support from Hyperledger Fabric v1.0. • #55 Historian: a new component that records all events that occur in the business network, including the modifications to assets. • #898 Links: the ability to share and access data between multiple business networks, even if they are running on different Blockchain platforms.
  • 22. 22 Links • We’re all over the internet! – Hyperledger introduction: https://www.hyperledger.org/projects/composer – Website, tutorial, and docs: https://hyperledger.github.io/composer/ – Public playground: https://composer-playground.mybluemix.net/ – Source code: https://github.com/hyperledger/composer/ – NPM modules: https://www.npmjs.com/search?q=hyperledger+composer – JSDoc: https://hyperledger.github.io/composer/jsdoc/index.html – Docker images: https://hub.docker.com/u/hyperledger/
  • 23. 23 Community • You can come and speak to us as well! – Chat to us using Rocket.Chat at https://chat.hyperledger.org • #composer and #composer-dev channels – Ask (and answer!) questions on Stack Overflow using the hyperledger-composer tag – Tweet us using the #Hyperledger #Composer hashtags!

Editor's Notes

  1. This presentation assumes that the audience has seen Blockchain Explained (https://ibm.box.com/v/BlockchainExplained)
  2. So the business network in this scenario is based on an individual purchasing a car. We’re going to start you off as Paul, who’s an aspiring Arium Motors customer, on his phone. (hand over phone) Today he’s placing an order, which takes place on his phone
  3. So the business network in this scenario is based on an individual purchasing a car. We’re going to start you off as Paul, who’s an aspiring Arium Motors customer, on his phone. (hand over phone) Today he’s placing an order, which takes place on his phone
  4. So the business network in this scenario is based on an individual purchasing a car. We’re going to start you off as Paul, who’s an aspiring Arium Motors customer, on his phone. (hand over phone) Today he’s placing an order, which takes place on his phone
  5. So the business network in this scenario is based on an individual purchasing a car. We’re going to start you off as Paul, who’s an aspiring Arium Motors customer, on his phone. (hand over phone) Today he’s placing an order, which takes place on his phone
  6. So the business network in this scenario is based on an individual purchasing a car. We’re going to start you off as Paul, who’s an aspiring Arium Motors customer, on his phone. (hand over phone) Today he’s placing an order, which takes place on his phone