Hyperledger’s Fabric Composer: Simplifying Business Networks on Blockchain

by Carlo GutierrezApril 3, 2017
Learn what Fabric Composer is, how it defines a business network, manages assets/participants, and performs transactions on a Hyperledger 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.

ibm-interconnect-2017-anthony-o-dowd-hyperledger-fabric-composer-v12

“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.

IBM Blockchain Hyperledger Fabric Composer Playground

In addition, Fabric Composer is designed with underlying technology stack familiar to open-source developers:

  • Business logic is implemented in JavaScript.
  • 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.

IBM Blockchain Hyperledger Fabric Composer Open Source Toolset

 

Hyperledger Fabric Training

How does it work?

Fabric Composer is used to simplify the process of defining a business network, creating and tracking assets, and performing transactions.

IBM Blockchain Hyperledger Fabric Composer Business Network

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.

One can make use of the Composer Playground, which is an interactive web tool for testing and deploying business networks. Alternatively, users can opt to install it on Docker.

IBM Blockchain Hyperledger Fabric Composer Playground Car Auction Model File

 

Defining participants / assets / transactions

The model file includes the definitions for participants, assets, and transactions, which are serialized as JavaScript Object Notations and are validated by Fabric Composer runtime. The key elements are broken down as follows.

  • Assets represent the resources being exchanged in the business network.
  1. These are defined using the asset keyword.
  2. Assets have domain-relevant class names.
  3. o is used to denote properties, while --> is responsible for establishing relationship to other resources. Optional elements are allowed and field validators can be provided.
  4. Stored in an asset registry. Registries are first-class abstraction.

IBM Blockchain Hyperledger Fabric Composer Asset

  • 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.

IBM Blockchain Hyperledger Fabric Composer Participant

  • 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.

    IBM Blockchain Hyperledger Fabric Composer Transaction

 

Transaction processors

The script file includes sets of transaction processors written in JavaScript and executed on the Fabric network by the Fabric Composer runtime.

  • Provides transaction implementation logic.
  • Written in JavaScript but could be in any programming language in principle.
  • 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.

IBM Blockchain Hyperledger Fabric Composer Transaction processor v2

 

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.

IBM Blockchain Hyperledger Fabric Composer ACL

Once participants and assets are available, transactions can start being used.

IBM Blockchain Hyperledger Fabric Composer Playground Car Auction elements v2

Users can create their own business network from scratch or link their GitHub profiles within the tool to import existing samples.

 

Using CLI

Outside of the Composer Playground, users can opt to use the CLI to manage an existing business network.

IBM Blockchain Hyperledger Fabric Composer CLI commands

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 --cli in npm.
  • Generates full list of commands with --help. Individual commands also support --help.
  • Uses public APIs.

IBM Blockchain Hyperledger Fabric Composer API

Fabric Composer currently has JavaScript and REST APIs available.

  • 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:

  1. Install Fabric Composer tools.
  2. Define business network, assets, participants, and transactions.
  3. Implement any transaction processors.
  4. Test business network withing Composer Playground.
  5. Deploy business network to live Hyperledger Fabric.
  6. Generate a sample application.
  7. Test the sample application.

IBM Blockchain Hyperledger Fabric Composer Anthony O Dowd

Following these steps, users should be able to experience how a business network on Hyperledger Fabric operates.

 

What’s next?

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.

ibm-interconnect-2017-anthony-o-down-fabric-composer-v11

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.

More detailed documentation is available for those interested and further development can be tracked in GitHub. You can also check out Anthony’s presentation on Fabric Composer here.

 

Related videos

 

Related reading


About the speaker

Anthony O'Dowd, Solution Architect, Blockchain Technologies, IBM bio
Anthony O’Dowd is a Solution Architect, Blockchain Technologies, at IBM. He is helping clients with solution architecture and application design for decentralized ledger systems. Anthony has hands-on design experience with the Linux Foundation Open Ledger project and other open-source blockchain technologies. He has a strong background in middle and back-office technologies, playing key roles in the development of IBM MQ and Integration Bus software offerings on mainframe and distributed platforms.
Interested in how to use Hyperledger Fabric to build network and deploy chaincodes? Download our Fabric Starter cheat sheet!

To stay tuned with the latest updates, subscribe to our blog or follow @altoros.

  •  
  •  
  •  
5627