Typical Hyperledger Composer Solution Architecture
Hyperledger Composer enables architects and developers to quickly create "full-stack" blockchain solutions. I.e. business logic that runs on the blockchain, REST APIs that expose the blockchain logic to web or mobile applications, as well as integrating the blockchain with existing enterprise systems of record.
Hyperledger Composer is composed of the following high-level components:
- Execution Runtimes
- JavaScript SDK
- Command Line Interface
- REST Server
- LoopBack Connector
- Playground Web User Interface
- Yeoman code generator
- VSCode and Atom editor plugins
Execution Runtimes
Hyperledger Composer has been designed to support different pluggable runtimes, and currently has three runtime implementations:
- Hyperledger Fabric v1.1. State is stored on the distributed ledger.
- Web, which executes within a web page, and is used by Playground. State is stored in browser local storage.
- Embedded, which executes within a Node.js process, and is used primarily for unit testing business logic. State is stored in an in-memory key-value store.
Connection Profiles
Connection Profiles are used across Hyperledger Composer to specify how to connect to an execution runtime. There are different configuration options for each type of execution runtime. For example, the connection profile for a Hyperledger Fabric v1.1 runtime will contain the TCP/IP addresses and ports for the Fabric peers, as well as cryptographic certificates etc.
Connection Profiles are part of Business Network cards.
JavaScript SDK
The Hyperledger Composer JavaScript SDK is a set of Node.js APIs the enables developers to create applications to manage and interact with deployed business networks.
The APIs are split between two npm modules:
composer-client
used to submit transactions to a business network or to perform Create, Read, Update, Delete operations on assets and participantscomposer-admin
used to manage business networks (install, start, upgrade)
Details of all the APIs are available as JSDocs (see reference).
composer-client
This module would usually be installed as a local dependency of an application. It provides the API that is used by business applications to connect to a business network to access assets, participants and submitting transactions. When in production this is only module that needs to be added as a direct dependency of the application.
composer-admin
This module would usually be installed as a local dependency of administrative applications. This API permits the creation of and deployment of business network definitions.
Command Line Interface
The composer
command line tool enables developers and administrators to deploy and managed business network definitions.
REST Server
The Hyperledger Composer REST Server automatically generates a Open API (Swagger) REST API for a business network. The REST Server (based on LoopBack technology) converts the Composer model for a business network into an Open API definition, and at runtime implements Create, Read, Update and Delete support for assets and participants and allows transactions to be submitted for processing or retrieved.
LoopBack Connector
The Hyperledger Composer LoopBack Connector is used by the Composer REST Server, however it may also be used standalone by integration tools that support LoopBack natively. Alternatively it may be used with the LoopBack tools to create more sophisticated customizations of the REST APIs.
Playground Web User Interface
Hyperledger Composer Playground is a web user interface to define and test business networks. It allows a business analyst to quickly import samples and prototype business logic that executes on the Web or Hyperledger Fabric runtime.
Yeoman Code Generators
Hyperledger Composer uses the Open Source Yeoman code generator framework to create skeleton projects:
- Angular web application
- Node.js application
- Skeleton business network
VSCode and Atom Editor Extensions
Hyperledger Composer has community contributed editor extensions for VSCode and Atom. The VSCode extension is very powerful and validates Composer model and ACL files, providing syntax highlighting, error detection and snippets support. The Atom plugin is much more rudimentary and only has basic syntax highlighting.