Build a blockchain prototype in minutes with Hyperledger Composer
Building a blockchain proof-of-concept typically involved weeks of programming before you can show your idea to potential users or investors. Over the last months, new tools such as Hyperledger Composer have emerged to speed-up this process, enabling business analysts or consultants to build a blockchain prototype in minutes, without requiring coding skills. In this article, I will show you quickly how to do this, and what you can also do with it afterward.
While Bitcoin and cryptocurrencies continue to make the headlines, the enterprise world is getting increasingly familiar with blockchain technologies — such as Hyperledger Fabric.
Open-source, production-grade and designed for security, Hyperledger Fabric is a popular choice when looking to apply blockchain to an enterprise use case.
- Unlike Bitcoin or Ethereum, it allows the creation of permissioned networks, where participants are known, execute transactions in a private network, and where data is shared only on a need-to-know basis.
- Hyperledger Fabric is also well documented and supported by an active and growing user community — both of them are useful when getting started, to become familiar with a blockchain technology, or to get support to solve your technical challenges.
Note: To learn more about Hyperledger Fabric, I would recommend an excellent free online course “Blockchain for Businesses — An Introduction to Hyperledger Technologies” from the Linux Foundation on edX, which gives an excellent introduction. The online official tutorials are also most helpful when starting your first experiments.
Building a blockchain prototype: between excitement and pain
The next step when developing your big blockchain idea typically involves the creation of a proof-of-concept, not only to ‘wow’ your investors, but also to:
- test your business case assumptions: who the network participants are and which roles they will have, what transactions will they execute, what assets will they exchange, or how end-users will interact with the ledger.
- build knowledge on practical concerns, such as the network topology (consensus, peers, channels, certificates), how will you operate the network every day, how you will develop and deploy your smart contracts, or how applications will interact with it.
Building this prototype can however take weeks of development — regardless of the underlying blockchain technology used: from programming the smartcontract — scratching your head using a new language (Go, Solidity), to setting up your test blockchain network, coding the web application to interact with it, spending time on forums to get technical support, making sure all is tested and fully safe etc.
This means several days or weeks before you finally have something you can proudly show, get your first feedback and … go back to the drawing board, spending again several days to accommodate the prototype and show it back.
Enters Hyperledger Composer
Over the last few months, new tools such as Hyperledger Composer have emerged to help speeding up the development of blockchain applications. Hyperledger Composer is a toolkit that abstracts the underlying technical concepts of the blockchain, and helps you focus instead on the interesting part: the business network.
Using Hyperledger Composer, you manipulate concepts that are more familiar to the business world, such as transactions, transaction participants, assets, roles or permissions — rather than genesis block, consensus, channels, certificates, private keys etc. This approach will typically cover 9 out of 10 enterprise use cases — otherwise, you can still chose to develop in Go…
Hyperledger Composer comes with a web user interface where business analysts or consultants can design the network, and demonstrate step by step how it will work, by:
- defining the business network (with the members, assets, transactions and access rights) without requiring coding skills,
- testing the network, by executing transactions step by step, directly from the web UI and on a real Fabric-based blockchain network.
Define your Blockchain Network using the Playground
To get started with Hyperledger Composer, you can try it online here (hosted on IBM Bluemix). (Note that you can also install it locally on your machine).
Hyperledger Composer comes with a set of sample networks which are useful when you look for inspiration or examples you can start with. These samples are very diverse (from auction, to asset trading, to supply chain management, identity management etc.) so there is a great chance you will find something close to your case.
In the “Define” section of the Playground, you can define your entire business network with little simple coding: the model of your participants, assets and transactions signature; the logic of the transactions and the access policy.
Test your network by execute transactions in the Playground
The “Test” section of the Playground is where you can run your transactions, see the complete history of transactions executed, and see the different assets created.
With each sample comes an “About” page that typically contains transactions samples you can copy and paste into the “Test” section so that you can try it.
After you have added participants and executed your first transaction, you can browse the history of transactions (“All Transactions”) or browse through the list of assets that were created (“Assets”). This is a very powerful feature to demonstrate step-by-step how the network will work.
Once you are happy with your network, you can actually export it as a .BNA file (Business Network Archive) and import it later again into the Playground — or more.
What to do next?
At this stage, you were able to define your network and run some transactions. You were also able to show this to colleagues, potential users or investors and get their feedback. Now, your prototype can actually do much more.
Deploy your Business Network on an existing Hyperledger Fabric network
Using the same BNA file, you can deploy your business network on any existing Hyperledger Fabric network. To do this, Hyperledger Composer comes with a set of commands that creates and starts a simple Fabric network (one peer, ‘solo’ orderer), and allow you to deploy your BNA file like any regular smartcontract.
You can also deploy your BNA file on any existing Fabric network, and even have the Playground (in the case you installed it locally) connect to it.
Developing applications to connect with your ledger
With your business network definition deployed on a Fabric network, you can start developing applications that will interact with it. You can also existing applications — such as web applications, Python scripts or even mainframes — to interact with your network, execute transactions etc.
Hyperledger Composer can generate a REST API that enables applications to access the smartcontract over web services. Here again, no coding required: the REST API functions are automatically derived based on your business network definition.
The REST server is based on NodeJS; it comes with a Web UI to test your API calls; it can also broadcast events, when some of them are defined in your Business Network definition.
Industrialize your Business Network development
Your .BNA file is also the foundation for industrializing your blockchain developments:
- Hyperledger Composer has also released extensions to popular development environments such as VSCode or Atom, to continue extending and testing your business network definition using your favorite environment, and share over a Git repository,
- Continuous integration fans will enjoy API for testing purpose, and will write feature-tests using the popular Gerkin language.
Wait. Not too fast.
Prototyping with Hyperledger Composer playground is fun, and really allows for faster user feedback. The feedback is also faster to integrate, by adapting your business network definition accordingly and show the changes back to the users.
But similar to most blockchain technologies out there, Hyperledger Composer is still at a very early stage (v0.17 at the time of writing) and evolving very fast. This means that:
- You might think twice before putting it in production since the technology is not production-ready yet, (ie. version 1.0 or above). Otherwise you might pioneer issues related to stability, performance, memory leaks or security leaks etc. which you probably don’t need in a productive environment.
- Since the source code is evolving fast, you take the risks that parts of your own code will render obsolete as new versions are released — so in any case you should follow the releases and the roadmap very closely.
Because of this, I’d probably recommend to keep Hyperledger Composer for the prototyping phase only, and then consider other options moving forward based on how fast you plan to be in production, and how this aligns with the roadmap of your favorite blockchain technology(ies).
You are now ready to follow the tutorial.
Happy blockchain prototyping!
What about you? What is the next big idea you will prototype using Hyperledger Composer? I’d be happy to hear your experiments.
Originally published on LinkedIn.com
If you enjoyed reading this piece, please hit the “Clap” icon below to recommend it to your followers.