Are you new to blockchain? You may have probably already heard about the amazing work that the has done with . It’s a modular framework for building permissioned blockchain networks. Linux Foundation Hyperledger Fabric Here I want to showcase how to create your own smart contract system in an easier way that you would expect. And with the only JavaScript! I will use as a baseline the design from the , I won’t change its design, only migrate the code to . Fabric-Sample repo FabCar Convector Framework As the title mentions, I’ll be using the new with as the underlying blockchain technology. Convector CLI Hyperledger Fabric npm i -g @worldsibu/convector-cliconv new fabcar -c carcd fabcarnpm i What you get by running that command is a whole JavaScript structure for a Fabric smart contract (chaincode). We will need to migrate the current structure from the to a TypeScript class. The first difference is that Convector helps you to structure your mind around pattern. So instead of having everything in a single file, Convector-CLI generates two files for you. fabcar.go car.model.ts Model/Controller One is a simple model with a few Decorators to make it easier for validations, as well a controller class in which you define your smart contract rules. The rest are supporting files. For example are for installation in the blockchain purposes. It already comes in with all the details the network will need. *.config.json Convector recommends using Lerna for a multipackage project as well TypeScript (required for now). Let’s take a look at the original : Go structure type Car struct {Make string `json:"make"`Model string `json:"model"`Colour string `json:"colour"`Owner string `json:"owner"`} As you can see it’s a fairly simple structure. Open your Convector-CLI generated project’s folder and go to . ./packages/car-cc/src/car.model.ts After migrating the car structure from , my file looks like this: Golang car.model.ts As you can see it is still fairly simple yet it has a few Decorators. This will help you avoid validation mistakes since it takes away simple verifications out of your code, for example instead of doing , you only write on top of the property. @ if(!item.owner) throw new Error('owner cannot be null'); @Required() Now, we need to migrate the chaincode’s logic. I won’t copy the whole original code here, it may be better for you to look for it right in . As a overview, they include the following functions for the smart contract: Fabric’s repo if function == " " { return s.queryCar(APIstub, args) } else if function == " " { return s.initLedger(APIstub) } else if function == " " { return s.createCar(APIstub, args) } else if function == " " { return s.queryAllCars(APIstub) } else if function == " " { return s.changeCarOwner(APIstub, args) } queryCar initLedger createCar queryAllCars changeCarOwner They would look like this on Convector: Cleaner TypeScript/Convector way of doing a controller with the typical functions. See how simple the code becomes? That’s the main goal of Convector. In less than 20 minutes you can have your smart contract developed. Obviously the code may look great, but let’s test it out! Convector-CLI creates a basic set of scripts to consume Convector Tools (in this case manager — that installs you a blockchain network, and which helps you installing and upgrading chaincodes). Development Environment Chaincode Manager Back to the console run: # Wake yourself up a dev blockchain $ npm run env:restart ...Register admin for org1Register admin for org2Register user1 for org1Register user1 for org2Register user2 for org1Register user2 for org2Register user3 for org1Register user3 for org2 # Now install the chaincode! $ npm run cc:start -- car 1 ... Org1MSP Org2MSPInstantiated successfullyInitializing controllers now...Initialization successfully That’s all! Now you have a running network (see details of what gets provisioned for you here ) and your own chaincode installed. Development Environment The next step is to call it from your backend! Another great thing about Convector is that you can use the native Fabric tools, so from your programming language your chaincode with the corresponding Fabric SDK. If you are using NodeJS the framework will provide you helpers to connect your backend server with your blockchain. . invoke More info about it here