Published on

Hyperledger Fabric: SDK language vs Chaincode language


When architecting a Hyperledger Fabric application you have have a number of layers to consider:

  1. The application layer: this is the component that speaks to your chain using one of the available Fabric SDKs
  2. The chain code layer: this is generally the equivalent of a DAO on a standard tiered application which is used to Create, Read and Update data on the chain. You can also use this layer to enforce validation as well as any other rules you may need.

These 2 layers can easily be coded in different language similar to how a tiered app also can (and often is). We ended up using the Nodejs sdk as it is the most mature and GoLang for the chain code as we have adopted it as a language for our team.

Using different languages also has the surprising benefit of not mistakenly confusing which parts of the application layer you are in if you keep both the chain code and sdk code together in the same repository.

Another advantage of using GoLang on the chain code side is that you can and do bundle all your go requirements into one executable binary with no other dependencies needed to run it (as you compile the code into a binary for the target system). This is not the case when using one of the other options like JavaScript or Java.