Hyperledger Composer is an extensive, open development toolset and framework to make developing blockchain applications easier. Our primary goal is to accelerate time to value, and make it easier to integrate your blockchain applications with the existing business systems. You can use Composer to rapidly develop use cases and deploy a blockchain solution in weeks rather than months. Composer allows you to model your business network and integrate existing systems and data with your blockchain applications.
Hyperledger Composer supports the existing Hyperledger Fabric blockchain infrastructure and runtime, which supports pluggable blockchain consensus protocols to ensure that transactions are validated according to policy by the designated business network participants.
Everyday applications can consume the data from business networks, providing end users with simple and controlled access points.
You can use Hyperledger Composer to quickly model your current business network, containing your existing assets and the transactions related to them; assets are tangible or intangible goods, services, or property. As part of your business network model, you define the transactions which can interact with assets. Business networks also include the participants who interact with them, each of which can be associated with a unique identity, across multiple business networks.
How does Hyperledger Composer work in practice?
For an example of a business network in action; a realtor can quickly model their business network as such:
- Assets: houses and listings
- Participants: buyers and homeowners
- Transactions: buying or selling houses, and creating and closing listings
Participants can have their access to transactions restricted based on their role as either a buyer, seller, or realtor. The realtor can then create an application to present buyers and sellers with a simple user interface for viewing open listings and making offers. This business network could also be integrated with existing inventory system, adding new houses as assets and removing sold properties. Relevant other parties can be registered as participants, for example a land registry might interact with a buyer to transfer ownership of the land.
Key Concepts in Hyperledger Composer
Hyperledger Composer is a programming model containing a modeling language, and a set of APIs to quickly define and deploy business networks and applications that allow participants to send transactions that exchange assets.
Hyperledger Composer Components
You can experience Hyperledger Composer with our browser-based UI called Hyperledger Composer Playground. Playground is available as a hosted version (no install necessary) or a local install (good for editing and testing sample business networks offline).
Developers who want to use Hyperledger Composer’s full application development capabilities should install the Developer Tools.
Key Concepts in Hyperledger Composer
Blockchain State Storage
All transactions submitted through a business network are stored on the blockchain ledger, and the current state of assets and participants are stored in the blockchain state database. The blockchain distributes the ledger and the state database across a set of peers and ensures that updates to the ledger and state database are consistent across all peers using a consensus algorithm.
Hyperledger Composer uses Connection Profiles to define the system to connect to. A connection profile is a JSON document the is part of a business network card. These profiles are usually provided by the creator of the system they refer to and should be used to create business network cards in order to be able to connect to that system.
Assets are tangible or intangible goods, services, or property, and are stored in registries. Assets can represent almost anything in a business network, for example, a house for sale, the sale listing, the land registry certificate for that house, and the insurance documents for that house may all be assets in one or more business networks.
Assets must have a unique identifier, but other than that, they can contain whatever properties you define. Assets may be related to other assets or participants.
Participants are members of a business network. They may own assets and submit transactions. Participant types are modeled, and like assets, must have an identifier and can have any other properties as required. A participant can be mapped to one or multiple identities.
An identity is a digital certificate and private key. Identities are used to transact on a business network and must be mapped to a participant in the business network. A single identity is stored in a business network card and if that identity has been mapped to a participant, it allows the user of that business network card to transact on a business network as that participant.
Business Network cards
Business network cards are a combination of an identity, a connection profile, and metadata, the metadata optionally containing the name of the business network to connect to. Business network cards simplify the process of connecting to a business network, and extend the concept of an identity outside the business network to a ‘wallet’ of identities, each associated with a specific business network and connection profile.
Transactions are the mechanism by which participants interact with assets. This could be as simple as a participant placing a bid on a asset in an auction, or an auctioneer marking an auction closed, automatically transferring ownership of the asset to the highest bidder.
Queries are used to return data about the blockchain world-state. Queries are defined within a business network, and can include variable parameters for simple customization. By using queries, data can be easily extracted from your blockchain network. Queries are sent by using the Hyperledger Composer API.
Events are defined in the business network definition in the same way as assets or participants. Once events have been defined, they can be emitted by transaction processor functions to indicate to external systems that something of importance has happened to the ledger. Applications can subscribe to emitted events through the
Business networks may contain a set of access control rules. Access control rules allow fine-grained control over what participants have access to what assets in the business network and under what conditions. The access control language is rich enough to capture sophisticated conditions declaratively, such as “only the owner of a vehicle can transfer ownership of the vehicle”. Externalizing access control from transaction processor function logic makes it easier to inspect, debug, develop and maintain.
The historian is a specialised registry which records successful transactions, including the participants and identities that submitted them. The historian stores transactions as
HistorianRecord assets, which are defined in the Hyperledger Composer system namespace.
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.
- Execution Runtimes
- Command Line Interface
- REST Server
- LoopBack Connector
- Playground Web User Interface
- Yeoman code generator
- VSCode and Atom editor plugins
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 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.
The APIs are split between two npm modules:
composer-clientused to submit transactions to a business network or to perform Create, Read, Update, Delete operations on assets and participants
composer-adminused to manage business networks (install, start, upgrade)
Details of all the APIs are available as JSDocs (see reference).
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.
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
composer command line tool enables developers and administrators to deploy and managed business network definitions.
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.
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.
This article has been published from the source link without modifications to the text. Only the headline has been changed.