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
, 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:
- Model controller pattern. Easy to understand and focus on business concepts.
- Real-time debugging.
- Unit test by default. Friendly with CI/CD.
- Let you access the Fabric API easily.
- Development blockchain network bootstrapper with just one command.
- API server generator.
- Tens of code samples here.
- A lot of content, tutorials and DOCs.
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
will make the smart contract reject a transaction if that field is not set to a value, whilst the
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
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
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
. 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
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
function from the Model.
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
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.
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
- Official Tutorial
Subscribe to get your daily round-up of top tech stories!