Walter Montes

CEO @ WorldSibu

Hyperledger Composer is deprecated

Hyperledger Composer is officially deprecated, you can check the message on Composer's Github repo and in the official Rocket Chat channel:
Composer's deprecation news have been around for a while. I posted about it on Sept 3rd 2018 but as of the 29th August 2019 it's officially deprecated.
Hyperledger Fabric is still a hard-to-grasp framework. A lot of developers resorted to Composer for an easy to use, developer-level toolset. When creating a blockchain solution you still have to worry about a lot of new concepts and paradigms to also have to worry about the protocol, the cryptography behind the scenes, and all the rest of complexities when just looking to create a business definition for a DLT/blockchain project.
Thinking in Blockchain: a tutorial for smart contract developers
Convector, from the Hyperledger Labs, is a group of tools that have helped hundreds of developers migrate from Composer without loosing all their work in the process.
Convector adds a lot of tools to your disposal like:
  1. Model controller pattern. Easy to understand and focus on business concepts.
  2. Real-time debugging.
  3. Unit test by default. Friendly with CI/CD.
  4. Runs and scales natively with Fabric (compiles to pure JavaScript without a runtime).
  5. Let you access the Fabric API easily.
  6. Development blockchain network bootstrapper with just one command.
  7. API server generator.
  8. Tens of code samples here.
  9. A lot of content, tutorials and DOCs.
There's a Discord community where hundreds of devs discuss and develop together.
Let's talk about the similarities of Composer and Convector:
From Assets to Models
Assets are a great way of thinking for real-life concepts. From tokens to products.
You may be familiar already with the Model-Controller pattern. In Convector, Models fill that need.
A model has the properties of a thing. In the previous example, taken from the Fabric Samples repo, shows how to structure a car.
You can notice the
@
attributes on top of the properties of the class. These are decorators and they will allow you to add a behavior to the model. For example
@Required()
will make the smart contract reject a transaction if that field is not set to a value, whilst the
@Validate()
decorator will make sure that that field matches the type you set it to. These are just some of the available decorators.
Models have their own files, are simple TypeScript classes extending the
ConvectorModel
type and add a lot of other features.
From Transactions to Controllers
Transactions are the logic units that define how to handle assets. For example, transfer an asset or create a new one.
In Convector, Controllers fill that need. Controllers, just like the controllers in MVC will contain the logic and routing of external functions.
A class that inherits the type
ConvectorController
will become a Controller. Controller functions will become then the Transactions (using Composer's concepts).
Unlike the native Fabric programming model, Convector takes care of common tasks you would need like serialization, type casting, and validations. So take the previous function as an example. It will expose an endpoint to create a car, it will receive a Fabcar type model and will make sure that the input data follows the behavior programmed in the model in the previous class
Fabcar
. This means that if the input model won't comply with it, the function will not compute (throw an error).
Then, to save the model you simply call a
.save()
function that takes care of the rest for you.
Let's see another function:
As you can see, not only Models can be defined as input for the functions, but atomic types too. Getting one model is achieved by using the
getOne()
function from the Model.
Identities
Composer used to create multiple new concepts for identities, however, in Fabric identities are represented by certificates from the blockchain. Instead of creating new models that won't play well with Fabric in the future, Convector aligns to these tools available on Fabric and implement them natively. One example is the identities pattern in our Github repo.

Recap

Convector feels familiar, however it doesn't create new concepts that are not from Fabric neither does create extra runtimes. The code you create can be taken to production and since it compiles to native Fabric code can scale with your network.
Composer was a great tool for newcomers, so instead of going through months of learning the native model from Fabric, Convector can play a role in your project without creating extra dependencies.

Next steps

Looking for a great open-source community to ask, grow, and share? Join the Discord channel, there are hundreds of devs interacting everyday.
  • Chat community
  • Documentation
  • Official Tutorial
Covalent is the creator of Convector and it's provided under an Apache 2.0 license. Here's the source code if you'd like to check it out within the Hyperledger Labs.

Tags

Comments

More by Walter Montes

Topics of interest