Hyperledger Composer vs Hyperledger Nodejs Api - hyperledger-fabric

I am new to hyperledger and bit confused about hyperledger composer & nodejs api.
I saw using composer we can create assets, transactions, participants and chaincode and in last we have to archive it this all into .bna file and finally we deploy this chaincode into network using admin card
But at other end using NodeJs API we can also write chaincode by overiding init & invoke methods.
How can we relate these all.

The best way to think about this is the following:
1) Hyperledger Fabric v1.1 supports writing chaincode in two languages: Golang and JavaScript via Node.js
If you want to do all of the heavy lifting yourself, you can write straight chaincode.
2) Hyperledger Composer provides a higher-level model-driven language for developing smart contracts. It currently only allows deployment of these artifacts to Hyperledger Fabric. It also happens to support writing functions in JavaScript as well.
So if you want to start from a higher-level model-driven approach, Hyperledger Composer is the way to go. If you want to write all of the plumbing yourself or use very low-level chaincode features, then using chaincode itself is the way to go.
Moving forward, we are looking at a better way to move between the two and not force a decision / direction up front.

There is another option, we develop a framework called Convector to be in the middle of Composer (high abstraction, low control) and raw code (low abstraction, high control, therefore high risk). We open sourced it a few days ago. At WorldSibu we don't like loosing so much control over our code like with Composer but as Gari Singh was saying, doing all the heavy lifting for each project is crazy. It is like a Mongoose for Hyperledger Fabric. It may help to check it out.

It is also worth noting that, according to IBM, Composer is no longer recommended as a production solution, but only for prototyping. In HLF 1.3, chaincode can now be written in Go, Javascript and Java.

Related

Hyperledger Fabric blockchain network from scratch

I've been studying the Hyperledger Fabric framework reading the docs for quite a while now but I'm getting a little lost in the middle of all that info. My question is: Is there any guidelines/"Step by step" on how to design a blockchain network from scratch? If you are starting a new project, where do you start?
Because I think I would understand it way more quicker if I actually started coding a little instead of reading and reading and reading...
Thanks a lot!
Edit 1:
I've chosen #kekomal answer as the correct one but I'd like to thank #Isha Padalia for the awesome VS Code extension and tutorial.
If you are really interested in learning and diving into Hyperledger Fabric, avoid byfn script. It performs a lot of magic for building a very simple Hyperledger Fabric network. After that, you have a network that you don't know how has been created and you have absolutely no idea of how to start deploying your custom network. There are daily questions here from people who started that way and are absolutely lost.
I find interesting this tutorial: https://medium.com/beyondi/setup-the-hyperledger-fabric-network-from-scratch-b82913b47549. Take into account that it is a little bit outdated.
You can complement it with this newer tutorial: https://www.blockchainexpert.uk/blog/how-to-deploy-hyperledger-fabric-network-from-scratch. Don't only run the steps. Analyze the files in https://github.com/blockchain-expert/hyperledger-fabric-network-from-scratch. Try playing with configtx.yaml, crypto-config.yaml and docker-compose files to customize your network and understand what you are doing.
Customize your organizations, your consortiums, your ordering service, your peers... Create your channels, join them, update your anchor peers... And understand what you are doing.
After that, if your network had one orderer, deploy a new one with more than one (with Raft consensus). If your network was using cryptogen, deploy a new one using Fabric-CAs instead. Or you can follow by playing with chaincodes.
NOTE: Apart from Hyperledger Fabric itself, it is essential to have basic notions of docker and PKI.
You are a beginner in Hypelredger fabric development then you have first cleared the concept of the orderer, peer, CA, and organization concept. And then first you have to start IBM Blockchain Platform VS Code extension for fabric. It will provide a local fabric environment to create, test and deploy a fabric smart contract. Also generate 1 peer, 1 orderer, 1 CA service under VS code environment.
Here is a link to start development with VS code extension.
Hope it will help you:)
hi #d3v9 start from here https://hyperledger-fabric.readthedocs.io/en/release-1.4/build_network.html. also you can find some great article on medium

Hyperledger Fabric Chaincode Development Language - NodeJS, Java, or Go?

With consideration of existing functionality, developer productivity (assuming minimal experience in each language), support within the Fabric community, and roadmap for enhancements, is there any chaincode development language that should be preferred as the short-term and, perhaps separately, as the long-term choice?
Prior question Node.js or Go for Hyperledger Fabric's chaincode development? did not address Java as an option, and does not account for recent Fabric 1.4 platform release.
As of Hyperledger Fabric v1.4, there is base functional parity between Go, Node.js, and Java chaincode.
The previous answer in Node.js or Go for Hyperledger Fabric's chaincode development? is still fundamentally true. Base features typically get delivered in Go chaincode first. That being said, a new programming model has been introduced to Node.js chaincode in v1.4 that is explained in the new Developing Applications documentation. If the new programming model is of interest to you, Node.js chaincode would be a good choice.
At the end of the day, each of the languages have similar function, similar performance, as well as good support and community adoption.

How to get chaincode to read from api's outside of the Hyperledger fabric blockchain

I'm wondering how you can get a hyperledger fabric smart contract to read from external API's ?
A service called oraclize (http://www.oraclize.it/) is used to do this operation in Ethereum blockchains - Is there anything similar for hyperledger fabric smart contracts or any workarounds?
In Hyperledger Fabric - smart contracts (the chaincode), could be implemented at the moment with either golang or Java, both of which are Turing complete and provides you with reach set of libraries and frameworks. Among which you can you any network library to get connected with external services, while you need to be extra cautious doing this to make sure your chaincode is deterministic (e.g. two independent executions of the same chaincode calling same external API will get same result back).
Riccardo from Oraclize here.
We are actually working on a Oraclize integration with Hyperledger.

What are the functional differences between Fabric Javascript SDK and Hyperledger Composer?

Other than the fact that Composer makes deployment and testing of prototype business networks easier and the fact that we don't have to know golang to develop chaincode, what is the difference in the functionalities that these interfaces provide that may lead one to choose one over the other?
This article can probably provide you with the answers you need:
https://blog.selman.org/2017/07/08/getting-started-with-blockchain-development/
Hyperledger Composer is both an application development framework and set of powerful tools which simplifies and expedites the creation of blockchain applications and smart contracts that are ultimately executed on the Hyperledger Fabric blockchain. Composer has its own runtime, that is generic chaincode and hosts and interprets the business network deployed - so your smart contract need only use Javascript, not chaincode in Go a (which is Fabric's domain) s you mentioned. It also has a modeling facility to create your business network model and to define such controls as Access Control lists and queries to be executed.
This architecture link should help you with further understanding -> https://www.slideshare.net/SimonStone8/hyperledger-composer-architecture
Furthermore see the Hyperledger Composer docs, see here:
https://hyperledger.github.io/composer/
TO see the Hyperledger Fabric docs - see here:
https://hyperledger-fabric.readthedocs.io/en/latest/

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