Create your own custom chaincode in Hyperldeger Fabric 2.X

Fig.1 : The network architecture that we will deploy


In this tutorial we are going to create a Hyperledger Fabric network containing 2 peer organizations and 1 orderer organization, which communicate with each other through a channel. After setting up the network, we will move on to developing and distributing the chaincode. The code will be written in Java and, then, we are going to deploy it in the network adapting the deploy script to do it.

This chaincode it’s just a simple parcel shipping manager, that allows us to check the status of the transport of goods inside parcels. The assets (parcels) are created with the following attributes: ID, SENDER, RECEIVER, CITY and TIMESTAMP. Therefore, through the chaincode, each city that will cross the package will be registered together with its timestamp, in order to keep track of all its movements in the Blockchain. Furthermore, the possibility of querying assets through their ID or some attribute will be added.

Deploy the network

In order to deploy the network just follow my first tutorial.

Create chaincode Maven project

more content available soon



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store