Tracing of high-value, priced items is turning out to be one of the most sought after use cases of blockchain technology. There is always a doubt around precious objects like gems, diamonds, and rare metals about their authenticity and quality. Concerns surround counterfeit jewelry and false claims on quality. As a consumer, you would want proof of authenticity and quality. And as a business owner selling jewelry, you want to earn the trust of your customers. Let’s look at a hypothetical scenario to make diamond tracing a possibility using the Hyperledger platform.
Enabling Diamond Tracing From The Jewelry Store All The Way Back to Its Origin
Consider the journey of a diamond from the mine to the display shelf of a jewelry store. Initially it is excavated as a rock. However, in its final form it adorns the display counter. In this entire passage, the diamond changes many hands belonging to different businesses. Blockchain enables transparency and traceability in a multi-party business transaction. So, the businesses collaborating in the diamond processing have something to gain.
A consortium of such companies can collaborate and commit themselves to quality via Blockchain. Thus, addressing the two fundamental concerns, i.e., proof and trust.
Let’s look at one such hypothetical business network for diamond tracing, comprising of the following business entities.
- Miner: A business organization which is engaged in mining of the diamonds in the crude rock form.
- Separator: A business organization which is engaged in extracting, cutting and refining the diamonds.
- Exporter: A trading company exporting the diamonds to other countries.
- Retailer: A jewelry store which buys the diamonds from the exporter and showcases them for selling to customers
In this blog post, we will build a demo Blockchain network scenario using the Hyperledger playground tool. Further, we perform an end to end operation from miner to retailer to establish traceability.
Want to read this post later at your convenient time?
Setting The Stage For Diamond Tracing with Hyperledger Composer
Hyperledger Composer is an extensive, open development toolset and framework for Blockchain. Its primary goal is rapid application development. It can model the business network associated with the various transactions within Blockchain. Thereby executing the smart contract between participants to achieve the business goals.
We will build the diamond tracing model network using the Composer playground tool on the browser. To begin with, here are the files that make up the application.
- org.xyz.diamondchain.model.cto : This is the model definition file containing the business network, participants and the assets and their transactions
Check out the code package containing composer application files for diamond tracing
Launch Hyperledger Composer
You can launch a fresh instance of the Hyperledger composer on the browser by pointing to this link
Launch a new project by clicking on “Deploy a new business network” and select “empty-business-network”.
Now, you can see the default business network listed in the workspace.
Click on the business network and you can see the default application files.
Note: The above visuals are only for providing guidance. Refer to the actual composer documentation to launch your own business network and load the application specific files to play around with the scenario.
Tracking the Diamonds Through the Participants in a Business Network
Every participant in the business network adds a specific value towards achieving the end goal. Consequently, each diamond attains that shape and sparkle which adorns the jewelry.
Let’s look at the passage of diamond from miner to the retailer. There are a series of transactions that take place between the participants as per the sequence diagram below.
The black solid arrows indicate the transactions between the participants and the black dotted, vertical arrows indicates internal transactions within a participant. The red dotted arrow indicates the actual change of ownership of diamonds from one participant to the next.
Here is the list of all the transactions taking place in the system
1.mined: Indicates that a load of rock has been mined
2.sent_for_separation: Indicates that the crude rocks are sent to the separator for separation, cutting and refining process.
3. separation_complete: Indicates that the diamonds have been separated and refined and are batched together for exporting
4. request_by_exporter: Triggers an order by the exporter for shipping the diamonds
5. request_approval_exporter: Indicates that the separator has accepted the order and will fulfill it
6. in_delivery_exporter: Indicates that the separator has sent the diamonds to the exporter.
7. received_by_exporter: Indicates an acknowledgment by the exporter for the received diamonds.
8. request_by_retailer: Triggers an order by the retailer for purchasing diamonds
9. request_approval_retailer: Indicates that the exporter has approved the order and committed to fulfilling it.
10. in_delivery_retailer: Indicates that the exporter has sent the diamonds to the retailer.
11. received_by_retailer: Indicates an acknowledgment by the retailer for the received diamonds.
12. available_for_sale: Indicates that the diamonds are ready for sale.
You must understand that in reality, this process is far more complex. There is a need to confirm the provenance of diamond at a more granular level. Likewise, for the accountability of personnel handling the operations. Also, the logistical coordination between the companies and the intermediate transporters is essential. All this requires a more detailed set of transactions to ensure the authenticity of diamonds.
You can refer to the individual transactions in the diamond.js file to understand how the Hyperledger chaincode is written to handle the states, properties, and ownership of diamonds. For mode details, refer the official composer API documentation.
Time To Ship the Diamonds
Now that you understand the entire process of producing diamonds let's build the model business network on Hyperledger Composer Playground.
To set things up, revisit the default business network that we created in Hyperledger composer. Remove the default model file (Model.cto) and add the CTO file representing diamond tracing scenario. Also, add the chaincode (.js) file. Once deployed, you will be able to see the participants and the assets under the Test tab.
Now we are ready to run through the transactions to ship a batch of diamonds. Take a look at this screencast to walk through the transactions from miner to the retailer. You can jump through the video by following the timelines for each transaction listed below.
00:05 - initialize_demo_resource: This is the first transaction to set up the initial scenario and state for the business network. The miner, separator, exporter and retailer are configured with the following IDs respectively: M001, S001, E001 and R001. The diamond’s id is RD1 , where RD signifies Raw Diamond in the form of rock.
01:05 - mined: This is the mined transaction where the miner mines the raw diamond.
01:45 - sent_for_separation: This transaction signifies the transfer the raw diamond to the separator for refining.
02:32 - separation_complete: This is the transaction that indicates that the separation process is complete. While executing this transaction, the separator also mentions the number of bunches of uncut diamonds extracted from the raw diamond. Based on that you can see that there are three bunches of diamonds at the end of this transaction, with IDs RD1-SBTEN-B1, RD1-SBTEN-B2, and RD1-SBTEN-B3. It is assumed that each bunch consists of an uncut diamond that can be split into 10 diamonds.
03:30 - request_by_exporter: This is the transaction through which the exporter orders for one bunch of diamond. Notice that we have chosen the bunch ID RD1-SBTEN-B1 whose request property gets updated at the transaction.
05:03 - request_approval_exporter : This transaction marks that the separated has accepted the exporter's order.
05:32 - in_delivery_exporter: This transaction marks the shipping of order from the separator to the exporter.
06:00 - received_by_exporter: At the end of this transaction, the shipment is handed over to the exporter.
06:32 - request_by_retailer: This transaction is the request from retailer to purchase the diamonds from the exporter.
07:06 - request_approval_retailer : This is the equivalent of request_approval_exporter transaction and is an indication from the exporter that it has accepted the retailer’s order.
07:35 - in_delivery_retailer: This is the equivalent of in_delivery_exporter and indicates that the exporter has shipped the order to the retailer.
08:02 - received_by_retailer: This transaction marks the handover of shipment from exporter to retailer.
08:35 - available_for_sale: This is the transaction that the retailer performs internally to cut the diamond into 10 pieces for the purpose of selling. At the end of this transaction, each of the 10 pieces is assigned a unique ID from RD1-SBTEN-B1-P1 to RD1-SBTEN-B1-P10.
This was a very simple example of how we can track a thing using Blockchain. As long as the thing is attached to a value which is big enough for people to consider it precious, blockchain can be a justifiable approach to protect everybody’s interests in business transactions.
Blockchain Based Diamond Tracing In Real World
Already, a few companies have sprung up to offer solutions around this use case. Tracr is one such company, exclusively focussed on diamond traceability. Everledger is also working on a similar idea. However, they also track other kinds of things such as minerals, wines, gemstones, etc., apart from diamonds. There is also a consortium of companies, called TrustChain, led by IBM and a few of the major jewelry companies to address the authenticity of diamonds.
You can also leverage the general purpose blockchain platforms to build your own diamond tracing solution, just like we demonstrated in this blog post using Hyperledger. Hyperledger is supported by IBM and has a family of frameworks and tools well suited for various types of Blockchain application development. Therefore, making it suitable for commercial Blockchain deployment.