Hyperledger’s Fabric Composer: Simplifying Business Networks on Blockchain
What is Fabric Composer?
The blockchain technology was one of the highlighted trends during IBM InterConnect 2017. There were several sessions about blockchain during the conference and among them was an introduction to Fabric Composer presented by IBM’s Anthony O’Dowd.
Fabric Composer is a new open-source application development framework, which simplifies the creation of Hyperledger Fabric blockchain applications. The tool aims at helping users to create blockchain applications based on Hyperledger Fabric without needing to know the low-level details involved in blockchain networks.
“Fabric Composer really is the middleware that sits between business applications, which require Hyperledger Fabric, and makes it easy to build them.” —Anthony O’Dowd, IBM
Why use Fabric Composer?
It takes time, effort, and other investments to place any business network on a blockchain. Fabric Composer helps users to easily define and model business networks on a blockchain:
- Experiment and get hands-on experience with blockchain.
- Learn syntax, how to model data, build assets, and submit transactions.
- Run applications with pre-built best practices in a public or privately managed environment.
- Integrate existing systems of record using LoopBack and REST.
In addition, Fabric Composer is designed with underlying technology stack familiar to open-source developers:
- There are client libraries for Node.js (npm) and editor plugins for Atom and Visual Studio.
- It has a CLI to deploy and manage business networks and perform other operations from the API.
- It has code generation and there are tools built using Yeoman that enable users to generate an application using a deployed business network definition.
- It has integration support for such standards as LoopBack and Swagger for defining REST APIs.
How does it work?
Fabric Composer is used to simplify the process of defining a business network, creating and tracking assets, and performing transactions.
A business network models participants, assets, registries, and transactions. Transaction processors implement business logic on these elements. Access Control Lists (ACL) define privacy and sharing settings.
Defining participants / assets / transactions
- Assets represent the resources being exchanged in the business network.
- These are defined using the asset keyword.
- Assets have domain-relevant class names.
ois used to denote properties, while
-->is responsible for establishing relationship to other resources. Optional elements are allowed and field validators can be provided.
- Stored in an asset registry. Registries are first-class abstraction.
- Participants represent the counterparties in the business network and are defined in the same fashion as assets. The difference is that at step #1 a user provides the participant keyword and data is stored in a participant registry.
- Transactions represent the steps that govern resource life cycle, typically assets, which are defined using the transaction keyword. Steps #2 and #3 are the same as for participants/assets.
- Provides transaction implementation logic.
- Has @param and @transaction annotators.
- Performs state changes on domain specific resources using model defined syntax.
- Provided in a seperate .js file. Uses model definitions from the CTO file.
- Will result in REST APIs for applications.
Access Control Lists
Access Control Lists (ACL) are the settings for sharing and privacy, which are automatically enforced by the Fabric Composer runtime.
- Separate ACL from application logic.
- Defined in a permissions.acl file in the business network definition.
- Flexible model grants both type and instance access (e.g., “create cars” and “scrap my car”).
- Includes optional condition for more sophisticated ACL checking.
- Executed in order until first rule is hit. DENY has precedence over ALLOW.
Once participants and assets are available, transactions can start being used.
Users can create their own business network from scratch or link their GitHub profiles within the tool to import existing samples.
Outside of the Composer Playground, users can opt to use the CLI to manage an existing business network.
The CLI includes a suite of commands to interact with an operational business network.
- The intended usage is for scripting and interactive operations.
- Packaged as composer
- Generates full list of commands with
--help. Individual commands also support
- Uses public APIs.
- Node.js is initially provided but the programming language is not tied to it.
- Composer-client and composer-admin npm modules for app developers and admins respectively.
- Programming model uses JSDOC.
- Domain specific REST APIs are also available.
How does it all come together?
As mentioned in the beginning, Fabric Composer is intended to speed up the creation of Hyperledger Fabric blockchain applications. Using all the tools, a simple application development life cycle would follow these steps:
- Install Fabric Composer tools.
- Define business network, assets, participants, and transactions.
- Implement any transaction processors.
- Test business network withing Composer Playground.
- Deploy business network to live Hyperledger Fabric.
- Generate a sample application.
- Test the sample application.
Following these steps, users should be able to experience how a business network on Hyperledger Fabric operates.
On March 29, the Hyperledger Project announced an active proposal to incubate Fabric Composer. Currently, Fabric Composer is still undergoing the review process by the technical steering committee.
The Fabric Composer community intends to develop more sample applications to help with demonstrations. Additionally, there are plans to add first class abstractions:
- Extensive query to support reporting and analytics.
- Events for notification and loose coupling of transaction processors.
- Links for business network linkage.
- IBM InterConnect: Blockchain to Transform IoT, Supply Chains, and the World Around Us
- Hyperledger Fabric’s Chaincode, Practical Byzantine Fault Tolerance, and v1.0
- Hyperledger Fabric v1.0 to Bring Improved Transactions and a Pluggable Data Store
- Hyperledger Fabric Approaches v1.0 with Better Scalability and Security
About the speaker