How to use HyperLedger Composer Node Sdk? - node.js

I am working on hyper ledger composer based project. I am writing chain code using javascript.
But I do not want to use automated generated rest server APIs to submit transactions, assets etc.
Can we develop own API in the node to interact with the network?
How?
Please share any code sample or link or any description about this scenario.

This article should help to get you started, along with the Hyperledger Fabric SDK documentation.
The article referenced above was literally the third result when I Googled "hyperledger api rest server example" (and the first result on duckduckgo). Please put at least a minimal amount of effort into research before asking a question.

Related

Looking for a End-to-End tutorial to develop a NodeJs Blockchain Appliation using Hyperledger Fabric and Composer REST SERVER

Since more than one month, I am working on creating a multi Organization Hyperledger Fabric Application.
I started with Composer, used playground to test my business logic. Then deployed it to the Locally running Fabric Network and used the COMPOSER REST Server to interact with the Blockchain.
The problem started when I wanted to use my Node Application with this network. I can't get my head around participants, network cards, importing these cards, binding these cards, having a wallet for these cards, Activating these cards, enrolling them and doing all this from the NODE Application.
I want One tutorial which will help me connecting a NODE application to a Blockchain network with a Business card and explain everything in layman terms.
Bottom Line: I want to develop a node application, which will use the REST server-generated for the locally running Hyperledger Fabric using Composer. Any suggestion on End-to-End tutorials or step by step method to understand these concepts will be really appreciated.
what you need can be found here:
https://hyperledger-fabric.readthedocs.io/en/latest/write_first_app.html
it covers everything you need to create a fully fledged application using the node SDK. Make sure you follow all the resources including the Setting up your first network tutorial. The link is on that page.
The problem with composer is that it is not developed anymore by IBM:
https://lists.hyperledger.org/g/composer/message/125
as such I would not recommend you spend any more time on it.

Customized Hyperledger Explorer is possible...?

I successfully completed a hyperledger composer and working it well.
I just created explorer for the same network using the git https://github.com/hyperledger/blockchain-explorer. This explorer is slow to load. I just decide to create own explorer using Node.js . My questions is
How to get blocks number, hash, etc using node.js.(I already visited the site node api link . But do not see any example how to use it)??
Have any idea to increase the speed of existing hyperledger explorer.??
Please give any suggestion for my problem. Thanks in advance
Fabric 1.1.0
Composer 0.19.16
Os: Ubuntu 16.04
Hyperledger Explorer has to traverse the blockchain to build its view of the ledger (stored in a PostgreSQL DB). If you have a large number of blocks, this can take some time. However, once this has been built, new blocks should be picked up as fast as your network can supply them.
However, if you want to look at improving it, why not just start with the existing code? This is after all the whole point of open-source software :)
Hyperledger explorer is provide API such as http://localhost:8080/blocks/{channel name}/{block number}
We can easily implement the front end and call the API at back end. Hope you help you. Thanks

Hyperledger Fabric: Where to find a production quality sample?

we are wondering where can we find a production quality sample for HL Fabric? we have studied the samples included with official release and have found that:
the balance-transfer sample shows how to write a HL Fabric app and make transactions and queries on the chaincode but uses the cryptogen tool which is not recommended for use in production
The fabric-ca app on the other hand shows how to spin up a network without using cryptogen but does not show how to write an app that can then be used to do transactions, make queries, enroll new users and so on
So we are looking for a sample that combines the best of above two apps. Does such a sample exist? Writing an app to get the benefits of both turned out to be harder than we thought e.g., fabric-ca sample does not output any network-config which is needed by balance-transfer and we are facing difficulty figuring out what the network-config should look like in this case. Also we see conflicting code between node and typescript in balance-transfer (although both are javascript) etc.
In the latest master of Hyperledger Fabric, there is a new and much more detailed sample--the commercial paper.
The tutorial covers the whole lifecycle of a chaincode.

Hyperledger -- how to set up REST API for invoking Chaincode

I'm playing around with Hyperledger and am trying to figure to figure how to set up the server with REST api for chaincode defined here https://openblockchain.readthedocs.io/en/latest/API/CoreAPI/#rest-api
Unfortunately many of the links are dead, so I'm not sure how to set it up. I understand the query language, I just don't knopw how to begin the web server.
Does anyone have any ideas?
Hyperledger Fabric v1.0 and later does not provide a native REST API for interacting with peer and/or orderer nodes. If you have not done so, I'd advise taking a look at http://hyperledger-fabric.readthedocs.io/en/release-1.1/ to better understand the current Fabric architecture.
There is a project to provide a REST API server in front of Fabric nodes. It was not updated to support Fabric v1.1 (at least not yet) but does support Fabric v1.0 and should provide at least an example of how to add a REST API in front.
I'd also advice taking a look at the samples which are documented here as well. The fabcar sample provides a nice, simple example of how to connect a Node.js application to Fabric.

What does Hyperledger composer do .Does that create chaincode for fabric or something else?

I have been working on hyperledger fabric for some time. But I don’t understand where hyperledger composer comes in place . I do understand that it helps in visualizing the logic and transaction. But what I don’t get is how do you integrate it with fabric network? what does it create? Is it chaincode if not then what?
The Compose runtime is chain code that executes the business network archive artefacts created by the end-user.
Perhaps this will help?
https://blog.selman.org/2017/07/08/getting-started-with-blockchain-development/
The tech answer is that Hyperledger Composer is an abstraction layer over Hyperledger Fabric.
The practical answer is that it is awesome. Think how Angular and hundreds of other frameworks make web programming easier.
It is a framework where you can write your blockchain in Javascript and specify your data objects in an easy to understand text file. Throw in some querying, ACL stuff and pathways to use some nice opensource tools that let you do things like generate a Web API automatically and play around in a web environment without installing anything.
We are using it for the Integra Ledger Legal blockchain. (www.integraledger.com). I just spent the day working in it.

Resources