I am trying to develop a chaincode in hyperledger. I know that the chaincode cab be developed in either java,go or node js. My question is does it matter which language I am developing the chaincode in?
When considering which language to write chaincode in I've typically seen orgs ask themselves the following questions:
Which language has the most mature SDK/support?
Which language has the most developer interest/ease of hiring?
Which language provides the most safety?
The last one is often overlooked but is, in my opinion, one of the most crucial when considering that bugs in chaincode are often much more important than bugs in typical code! Remember that the output of the chaincode is inscribed for all time within the ledger, and that fixing the outputs of bad chaincode can be a costly process.
Considering those questions, you can evaluate the three languages (go, nodejs, java) chaincode supports as follows:
Golang has by far the most mature SDK/support. Fabric is written in Go and considers Go a first-class citizen in all tangential projects; it is therefore often the first considered and most updated language when it comes to Fabric support.
NodeJS is probably easiest to find talent for and is already a widely popular language, meaning chaincode will typically be most accessible when written in NodeJS. The first developed and most popular Fabric SDK (non-chaincode) is the nodejs one so these go together very well. Of course, Java probably has just as many if not more available developers, but I'm counting it second here as it is much less supported.
Golang and Java are both strongly typed languages and provide the guarantees such languages bring. Java also brings with it many years of production experience and safety. Those both win out when it comes to language safety over a dynamically-typed, JIT-compiled language like nodejs.
TL;DR: Golang has strong safety guarantees and is most widely supported, NodeJS is easier to write and easier to find developers for, Java is a tough sell
I'd suggest using GoLang as it is a highly efficient and powerful language in terms of performance and scalability.
Related
Kotlin vs Node JS for REST Api's
I couldn't find any proper explanation regarding the differences b/w Kotlin and Node JS for REST APIs
Which is better in performance wise?
Let me set the context. Its Kotlin/JVM vs JS/Node.js. We cannot blindly say that this language is better. In general Kotlin is supposed to be faster since it compiled language compared to JS which is interpreted language.
Irrespective of the language used, we will discuss on the API architecture. Serving the APIs can be implemented in either blocking or non-blocking way (I am not going to explain about what it is). Traditionally before a few of years Java/Kotlin with Spring have been using the blocking architecture which delivered performance X. On a contrary, Node.js is based on non-blocking architecture which gave us better performance than the blocking architecture and architecture style is the only reason why Node.js performed better. Later Spring released a newer version of the framework to support non-blocking architecture. The non-blocking style is called as Reactive programming/Spring Webflux.
So now both of the languages support non-blocking architecture. In terms of raw language performance, Kotlin will be better since its compiled language. Also in theory interpreted languages are supposed to be slower. But we cannot say which is better without any testing.
Personally I am fan of Java/Spring because of OOPS and later at one point I started using TS/Node.js. TS eliminates most of the runtime issues with its type checking. But still we cannot compare it with the type system available in Java/Kotlin. As a language I feel Java/Kotlin is superior and one thing I like most in JavaScript is handling objects/JSON. Checkout "Kotlin for JavaScript" as well which lets you write in Kotlin and transpile to JS. Ignore this "Kotlin for JavaScript" feature, I am planning to try Kotlin/Spring in non-blocking architecture for my future projects. If you have usecases with WebSockets, I think Node.js will perform better and I am not sure If there are any libraries in Java/Kotlin since I havn't explored it.
One disadvantage in non-blocking style is that I need to pass the login context object to almost all the methods in the project. In blocking architecture we will add the login context information in thread local so that we can access it anywhere until the request is completed.
I am sure that I did not answer your question completely. But I hope that the information what I have give is useful.
Correct me If I am wrong in any of the aspects.
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.
Is there a cross language framework like axon framework?
I need a cross language DDD framework supporting Java, .Net, nodejs, golang
There are multiple development languages in my company,I expect to implement DDD without changing the programming language used by developers
I expect a cross language development framework
The greater part of the value of DDD comes from the strategic patterns, which are non-technical. Take a look at this video for an overview: Strategic Domain-Driven Design by Nick Tune
Then on the technical side, your domain code can remain pretty framework free and using hexagonal/ports and adapters/clean architecture whatever framework is most mature/productive can be used for the implementation of repositories/services/APIs/busses etc.
That being said, DAPR is the 1st cross-language framework I have seen (that is less intrusive than Service Fabric) that ticks a lot of the boxes. I will say it is still early in development and I have not used it in any meaningful way myself.
One approach to satisfying this requirement is to use a service oriented/microservices architecture.
Essentially, you would be exposing all of your domain behavior via a set of interfaces that are implemented via REST-ish apis. What that means is that the implementer of a service can create their service in any language independent of what the clients of the service are using.
Something like Akka Serverless from Lightbend would fit the bill: business logic can be implemented in any language which supports gRPC.
I am experimenting with Hyperledger Fabric and am not sure what the best smart contract language to start.
That being said, I did start with JS using the Commercial Paper example.
Can you change smart contract language along the way?
For example, you write the first few version of your contract in JS and then you switch to GO?
Yes you can change chaincode language as you go. Just make sure the same chaincode is installed on all the peers.
A good approach is to write in a supported programming language that is fast for you. This allows rapid prototyping and demonstration. If it works out, rewrite in a compiled language, such as Go, which also has the benefit of stronger typing.
Our new project will get a lot of concurrent requests. I don't have a lot of experience with this. Any suggestions? I've looked at NodeJS, Twisted, EventMachine & Tornado but I don't have any way to measure how suitable they will be.
Any suggestions?
Ask yourself the following questions (at least) and then decide:
What language do I (or/and my colleagues) know? If you know Python you could choose Twisted, if you know Ruby you can choose EventMachine or if you are really good with JavaScript you could choose Node.js. (only Erlang wouldn't have an advantage here)
Do I want to use a language construct (Erlang, Node.js) or a library (Twisted, EventMachine)?
Do I need a lot of resources, community support, books etc? Check out for yourself how big are their channels on IRC, you'll make an idea. (I may be biased, but I see tons of people on the Node.js channels and they are really helpful)
How mature do you want the framework to be? (Node for example has 2 years, Erlang has been officially released in `98, etc)
What companies/products are using what async frameworks? (for example CouchDB has been built with Erlang, Node.js is used by Github, Linkedin and others, EventMachine is used by PostRank, 37 signals etc)
The suitability of specific non-blocking framework may be dependent on certain aspects, such as:
Preferred language/platform - someone can be versed in specific language which might speed up the development. Also finding a skilled people might be a problem.
Availability of non-blocking libraries for your framework - for example most of the node.js modules are by default non-blocking compared to other frameworks where you might run into a problem of finding a non-blocing version of library which offers desired functionality.
Documentation and community support is essential.
As others say - you should go with the one that has the non-blocking libraries (e.g. DB drivers) you need and, if possible, uses the language your team knows. Popularity may also be an advantage.
If you're programming in Python, gevent might also be a good option. There is even a Socket.IO implementation.
Develop a metric to measure suitability, then use that metric. How can anyone here tell you which one is the most suitable if you don't provide any basis for evaluation?
Wait, scratch that. Twisted is the most suitable for everything, always, no matter what.