4
votes

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.

3

3 Answers

10
votes

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.

2
votes

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.

0
votes

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.