Node.js or Go for Hyperledger Fabric's chaincode development? - hyperledger-fabric

Which language among Node.js and Go is better suited for 'chaincode' development when it comes to maintainibility, scalability and better support?

It's a matter of personal preference, but I'd say Golang, because:
Node.js chaincode uses npm install at the time of container building, which is slow and might fail due to network problems, while Golang just compiles the source code without fetching anything.
Chaincode features are introduced to Golang chaincode first and then later on to other chaincode implementations.

Related

What is the difference between fabric-chaincode-go and fabric-contract-api-go?

I am currently trying to learn Hyperledger Fabric , I managed to understand how to setup the network (Orderers, Peers, etc.) but now comes the part of the chaincode.
But, I found two different git repos for (what I understand) can be used to create chaincodes.
The first One being the fabric-contract-api-go, I followed their tutorials a while ago.
And the second one being the fabric-chaincode-go.
So my question is, what is the difference between these two packages, and which one should I use for writing chaincodes? Do you have resources or good examples? (other than the ones in the fabric-samples git)
I followed the fabric-contract-api tutorial and wrote a chaincode a while ago, but now I see people using the fabric-chaincode-go package, and I am a bit lost.
I am sorry, this question might sound stupid, but I don't have a Developer background. I have a SysAdmin background, and not used to GOLANG (but I am a fast learner, given to good resources).
You can think of fabric-contract-api-go as a high-level api that builds on/requires the low-level api fabric-chaincode-go.
It's possible to write golang chaincode using only the low-level api - in fact, this was the only option before Fabric 2.0, when the contract api was also added for golang. Previously, it only existed for node and java chaincode.
If you have the option to use the contract api, doing so will e.g. save you some boiler plate code.
To see the difference, you can e.g. compare the fabcar example: in the 1.4 branch, it used the low-level api (shim). In the master branch however it uses the new contract-api.

Hyperledger fabric gRPC interaction

I've been messing around with gRPC and I was looking into building my own simple and comprehensive hyperledger fabric SDK in rust.
I've looked everywhere for any gRPC spec of hyperledger fabric to see how we can reproduce the functionality of interacting with the peers, stuff like managing channels and performing invokes and queries.
(reproduce this behavior: https://hyperledger-fabric.readthedocs.io/en/release-1.4/commands/peerchannel.html).
Online, everyone says that the functionality is exposed over gRPC, but that they recommend using an existing SDK.
I've inspected the nodeJS SDK and looked for their .proto files, but there are barely any services (https://github.com/hyperledger/fabric-sdk-node/tree/release-1.4/fabric-client/lib/protos)
Is there any way to get their gRPC spec? is there a generic way to do this for gRPC servers? Why is it so hidden?
Thanks!
I believe the protos are recently relocated to https://github.com/hyperledger/fabric-protos for the master branch, which is not yet released.
For an as current 1.4 based project, look at the protos/ directory in the main fabric repository. https://github.com/hyperledger/fabric/tree/release-1.4/protos

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.

Hyperledger Composer vs Hyperledger Nodejs Api

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.

hyperledger fabric working use case in java

I am a beginner in Hyperledger, so need your help here;
as I want to create a blockchain with Hyperledger Fabric using java. And is their any working use case related to it.
Can't use Java to write chaincode yet. You can deploy chaincode written in go and write client using Java sdk. You can check out hyperledger composer.
https://github.com/hyperledger/fabric-sdk-java
You can check it here, there're some chaincode example write in java.
https://github.com/hyperledger/fabric/tree/release/examples/chaincode/java
chaincode_example02 is a money transfer example that is used most often.
FWIW this (now outdated) guide from IBM provides instructions how to run chaincode written in Java on hyperledger-fabric. However, following it as-is didn't not work for me, possibly can make it work with some effort
https://www.ibm.com/developerworks/library/j-chaincode-for-java-developers/index.html

Resources