Isuru Tharanga
6 min readJun 5, 2018

Image courtesy: https://goo.gl/images/LLX659

Yet another Blockchain story about Supply Chain Traceability

The word “Blockchain” has recently become a hype word around the tech community to the point where it is applied for virtually everything, including the places where it shouldn’t actually be used. May be it is because of the massive hype built around the success of crypto currencies including Bitcoin. But, this story does not include crypto currencies, yet you’ll indulge yourself in all the goodness Blockchain has to provide.

Blockchain, How?

First things first, what is blockchain? And why it is that important? Well, blockchain is an offspring of long existed hashing mechanisms, cryptographic algorithms and distributed systems. Simply put, it is a data structure which can be used to store immutable sets of records, or transactions consistently in a distributed network of computers. Since a picture is worth of thousand words and I’m too lazy to type in thousand more words here, let’s look at a typical diagram and try to understand.

Image courtesy: https://goo.gl/images/LVzf91

First, let’s understand the concept of hashing. Say there’s a function, and if you input a specific data item into that function, it will always return a string value, which is a representative of the data item (which is of course called the hash of the data item) you entered to the function. So, this way you can represent a set of data items using a unique hash. Well, it is statistically proven some hashing algorithms always return a unique hash value for a given input.

As now we know what is hashing, let’s look at the diagram. Let’s say the box(block) labeled '1' is the record we generate at first in our data structure. So, when we hash the data in the 1st block, it will return the unique hash, ‘1Z8F’. Since this block is the first in our data structure, we call this by the fancy term ‘genesis block’. Now, it’s time to put some useful data into our data structure. We can bundle some data such as cash transactions, or asset ownership details together and call the whole thing block ‘2’. But, we are going to do a nifty trick here, because we get the hash of the block ‘1' and add to block '2' before we generate the hash of block '2’. Because of this, the hash of block '2' will have some data about block '1’. In this approach, we can generate the hash of block '3' including the hash of block '2’. As you can notice here, each of the blocks will have a ‘dependency’ to the previous block. In simple terms, all the blocks of data in our data structure are ‘chained’ with the previous block using hashes. So, if somebody changes something in block '2’, it will change the hash of block '2’, but, since we used the previous hash of block '2' for generating the hash of block '3’, this change would result in generating an invalid hash for block '3' after changing the block '2’. In most simple terms, updating previous data will result in generating invalid hashes in the blocks which come later, making the whole data structure immutable.

So, this is the power of the blockchain data structure. But, how are we gonna make this useful? Distributed Systems enter! What we do now is, use a distributed system to share the same version of this data structure in every node of the distributed system. Well, this is how the fancy term ‘distributed ledger’ comes into play.

Supply Chains? Why should we track them?

As we know what is a blockchain now, let’s talk about Supply Chains. Well, a supply chain is the network of entities, work flows and processes involved during the life cycle of a consumer product. For an example, say we have a cheese production supply chain. For producing cheese, we need to buy milk, preservatives, yeast and salt from various suppliers. These raw materials should be transported to the production factory. At the end of the production, cheese should be packaged and distributed to finally be consumed by the end customers.

Cheese production supply chain

As we can clearly see, the entities even in this overly simplified supply chain are in geographically different areas. The milk could be produced in Ambewela, the salt could be produced in Hambanthota. The production factory could be in Colombo and the actual packaging could happen in Switzerland. The packaged cheese could be sold in America and it finally could be consumed on Mars. (Yes Elon Musk, we believe in you). So, as you can see, the entire ecosystem is embarrassingly distributed throughout the world, (or solar system). The issue now is, the data related to these supply chains are fragmented and distributed throughout the supply chain without any connection between them. This phenomenon is called ‘data silos’ and the end customers will not be able to realize the connections between these data and trace back to the origin of the product. As an example, if one of our Martian friends gets food poisoning from consuming the cheese he took with him, it will be impossible to determine if the issue was with milk, yeast or poor packaging. So, in current supply chains, traceability is becoming a major requirement.

Blockchain for Supply Chains?

Until now, we only looked into Blockchain and Supply Chains. But, where does these two intersect? Well, we saw supply chains are embarrassingly distributed from our overly simplified cheese production supply chain. And we discussed blockchain is useful as a distributed system than a single data structure. So it is somewhat intuitive to combine the two. But, is this the only reason? Actually No. In our previous discussion, we discussed about blockchain as an immutable data structure and how it is impossible to manipulate the data in it. Well, this can be very useful in our supply chain tracking solution. Revisiting the previous cheese example where our Martian friend gets food poisoning, let’s assume the tracking system was distributed but not immutable. So, when our beloved Musk finds a party to blame for the low quality cheese, a rogue sysadmin in the packaging company could change the data in the system so it would show they have used a A grade packaging material although what was used in actual packaging was C grade packaging. As you can see, it is important to maintain an immutable data structure for the supply chain tracking solution while it is being in a distributed system. Thus, Blockchain!

Well, a Conclusion?

When humans write documents, it is a tradition to write a short conclusion and a summary at the end. So, keeping up with the traditions, here it goes.

The trending new technology, Blockchain is a distributed immutable data structure and it is proven successful in practice. Supply chains are distributed, yet fragmented into data silos. So, blockchain is a fitting alternative to build a distributed supply chain tracking solution.

If you have survived throughout this post so far, I should mention that this post was intended for an audience which is not familiar with blockchain or supply chain traceability. Thus, some of the things are overly simplified for understanding concepts while keeping it educational. This will be the first of the series of posts I’m planning to write since this is the research topic of our undergraduate final year research project. So, thank you for bearing with me, and your comments on this will be greatly appreciated.