Frithiof Frithiof -3 years ago 153
Node.js Question

Connecting a composer web rest server to this fabric explorer node.js app

I've been playing around with Hyperledger Composer, following the excellent tutorials at

I've come as far as to generate a REST API to my running business network.


I'm very new to these things and have little to no experience developing web apps. My goal is to setup something to have a very visual way to showcase my business network just as a fun proof of concept.

I found this, which looks like excatly what I'm looking for:

However, the instructions are not as easy to follow as the Hyperledger Composer tutorials. Seems to be aimed at Hyperledger-Fabric, and, from my understanding Composer runs ontop of fabric to simplify app development.

So, am I wrong in assuming that I should be able to connect the Blockchain-explorer app to my running Composer REST Server quite easily?

Would appreciate some pointers on how to configure this. I think it would be a great visual way to make a noob friendly next step.

Thank you in advance.

Answer Source

as you rightly point out - the Hyperledger Composer Developer tutorial takes you through a very simple Commodity Trading business network (highlighting the acceleration aspects of developing blockchain apps and blockchain 'smart contract' logic using Composer, gaining an understanding of its modeling capabilities and its powerful toolset).

In simple terms, think of Hyperledger Fabric as the blockchain infrastructure (where you see blocks (of transactions) - eg such as shown on the Explorer UI you mention) and think of Hyperledger Composer as a layer or level of abstraction above Fabric (but ultimately uses Fabric as the blockchain network). Quick overview here should make it clearer - Youtube

So for your PoC (to showcase your business network), you can do the following:

  • Start up the REST server and generate the REST API endpoints - it discovers your business network (when it connects through the connection profile eg. 'hlfv1' blah blah), and exposes the assets, participants and transactions, for you to show how to create txns, query txns, do asset or inventory listings through the REST Explorer interface.
  • Next, perform (per the tutorial) 'Generate the Skeleton Web App' which again will intuitively discover your business network and build you a nice, skeleton Angular 4 app which allows you to show an app (good enough for your PoC) interacting with not only the configured blockchain environment but your business network too. So you could add an asset through that Web UI, refresh your browser after and show the additional asset. You could then show the REST Explorer 're-querying' the same business network in a separate browser tab or window (and seeing the newly added asset(s) created in the Angular UI - for example). You could add through the REST interface, a number of assets, participants, transactions and then go on to show many other aspects such as simple queries (which the tutorial provides) and have (via REST) the ability to add, query, update assets and complete transactions.

Its really that straightforward. Hyperledger Composer takes care of the consistency (data types, formats, relationships between records eg owners of an asset, how to model then interact with your data on the blockchain) and lets you get on with driving your PoC (and what you want to convey) - or going forward, building your use cases using Composer !

My advice is to complete the end-to-end Developer tutorial, become familiar with everything in that and understand what you can achieve. They try the Queries tutorial to see the power of queries too. From there, you should have some very good insights for your PoC.

Hope this helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download