Convector 1.3.0 Release

A new shiny version of one of the hottest smart contracts framework out there and one of the top for Hyperledger Fabric.

Covalent Media
4 min readMar 18, 2019

--

It has been a nice journey to build this new release, and even if it's called a minor version, it's nothing but small. This release comes with months of community feedback and decoupling pieces for multi-blockchain projects.

You can find the update in our changelog, but here's a summary of the most important updates:

Fabric 1.4.0 Support

We updated to the most up-to-date version of fabric-client and fabric-ca-client to develop the framework internally, so you can make sure that the framework is being tested and developed using the latest version of Fabric.

Convector has always supported 1.4 since it came out, fabric-client library is a peerDependency, but now the team is using it to develop new features as well.

If you have a convector-cli generated project, you have nothing to do, since it was already generated with that version.

Model Inheritance

Models can now be extended to generate complex, reusable, models. This is helpful for large applications and to achieve a modular approach.

Browser Support

Convector is a full-stack framework, that was the vision since the beginnings of the project, that you could be able to take the same controller and model and use it in chaincode, server, and front-end applications.

There were some limitations on the browser features since the controller was depending on backend libraries like fabric-client. With this latest release, Convector Core can now be loaded in the browser without any problems, since all the blockchain dependencies were refactored out of the core packages.

You can find a running demo of convector in the browser at the end of this post.

In order to make controllers callable, we're deprecating the generate-interface command and it will get removed in the upcoming releases.

Instead of an auto-generated client class, we're now replacing it with a runtime factory, this is way more convenient since generating the client was confusing sometimes.

Fabric Private Data Support

One of the most-wanted features on Fabric is the ability to process transactions with special data that not all the nodes in the blockchain have access to.

You can find more information about that in the Fabric docs site. In this release, we include official support for this awaited feature in a really simple way. You can find a full example of private data working in this repo.

When you use private data, you need transient data as well, here's an example (Hurley 1.0.0 already support this as well):

When you need to read the transient data from your smart contract you can use the new ChaincodeTx helper inside of the controller and it will parse it with the ConvectorModel or yup schema provided:

const transient = await this.tx
.getTransientValue('marble', MarbleTransientInput);

Saving and retrieving private data is as easy as:

const marble = new Marble({
id: req.name,
color: req.color,
name: req.name,
owner: req.owner,
size: req.size
});
await marble.save({
privateCollection: 'collectionMarbles'
});
...const marble2 = await Marble.getOne(id, Marble, {
privateCollection: 'collectionMarbles'
});

New Packages

Instead of having to write each of the package names of the framework, we offer now as well barrel packages.

Deprecations

@worldsibu/convector-tool-dev-env started as a util project to be able to quickly get your hands on a Fabric network. It worked very well, but it was pretty much fixed to one scenario. Hurley is a much more robust tool that we created to fix those problems, and now that we have tested it out heavily making it the default on convector-cli, it's time to deprecate the dev-env and use the appropriate tool for this. You can still use it, but we're planning on removing it in the upcoming releases.

generate-controller-interface was used to generate a client version of controllers, but with the recent addition of ClientFactory in the browser support feature, this is not needed anymore. You can still use and depend on this one, but it will get removed in the upcoming releases.

@worldsibu/convector-core-* packages, since we now have a single package for all the core packages. They won't go away anytime soon, but we discourage its usage in favor of @worldsibu/convector-core.

Demo time

Just like promised, we got Convector running on the browser and the beauty of this is that you can now get your hands on the framework and play with it without having to install anything on your computer. Our recommendation is still to use the CLI to get started, but these stackblitz links are very helpful for doing quick tests or reporting bugs on the core packages.

As usual, feel free to report any problem on github.com/hyperledger-labs/convector or reach out to us in our Discord channel. Enjoy!

--

--

Covalent Media

The Enterprise Blockchain Development Platform​. A unified development platform to create and deploy enterprise smart contract systems. https://covalentx.com