Blockchain for Supply Chain Management

Blockchain for Supply Chain Management

hello world it's Suraj and today I want to talk about blockchain for supply chain management in this video I'll talk about the market for supply chain how blockchain can affect it I'll demo this app that I've compiled and I've run locally called asset tracker that uses solidity to create an asset on the blockchain this is on the test rink be aetherium network and i'll talk about how that works I'll go over the only legit blockchain supply company that I could find called sinc fab how they work what they're doing with their version of an IRC 20 token and then I'll cut it out I'll code out in solidity an asset tracker that runs on the etherium blockchain ok so that's what we're gonna do in this video we're gonna create a decentralized supply chain app for asset tracking okay so the supply chain industry is huge and it's only going to grow over time so of the Americas Asia Africa right these are all markets that are big and the developing countries in particular particularly on the coast of Africa are going to grow exponentially over time and parts of Asia as well so the supply chain industry is not going anywhere it's been around for a while and it will be it's here right now and it will be here in the future and so this is a very big industry and for those of you who don't know what the supply chain is whenever you are the the path that any product you have in your home your shirt your desk your computer you know whatever it follows a path of intermediaries to get from the factory where it was created to you and that chain includes distributors it includes procurement officers people who are quality inspection officers it goes through different channels right it's not just like direct from manufacturer to the end user the consumer rights there's like four or five six sometimes you know a dozen intermediaries in between there and that process a lot of data can get lost in that process right some Quality Assurance person could say well I thought that it was going to come yesterday but it didn't and someone delayed a shipment from this city this city and so that kind of that kind of error just trickles throughout the entire supply chain and can ruin everything right so there are there big problems with the supply chain but what I found very interesting is you know in a survey that a bunch of professionals c-level professionals were asked what is the aspect of digitization hilarious word that you believe will drive the most value in the future most of them said supply chain visibility right so usually you don't hear that much about the supply chain when you're thinking about applications of blockchain you're thinking about banking you're thinking about you know perhaps real estate or betting or gambling but I believe that the supply chain is as of now the biggest industry for blockchain like this is where the the the most immediate real world use case comes from right and the reason is is because there's so many problems with the supply chain as of now that blockchain could help fix so let's think about all the ways that the supply chain is wrong right the supply chain is sub-optimal so one would be ocean frights for example they account for 90% of goods traded globally that's a huge number ninety percent of goods traded globally enter the ocean fright enter an ocean fright at some point now the problem with ocean frights is shipping information usually travels through numerous companies and contractors this can cause a delay and remember a delay anywhere in the supply chain not just cost time it costs real money right because these intermediaries are all right now trying to predict what day something will come to them the product and when they can then inspect it or whatever their job is and then they can send it on throughout the rest of the chain so there's a lot of problems here when it comes to planning and forecasting Asset Management visibility procurement manufacturing financials right there's there's a lot to keep track of right for app at least for one company but the problem is when it comes to supply chain there's not just one company involved right ideally you know if I wanted a desk I would just go directly the factory or I would ping the factory and say I want a desk and then that desk could just like be drone shipped over to me and that's it but that's unfortunately not the way the world works there's a lot of intermediaries there right how much are you supposed to pay a driver when are they supposed to know when a certain product has been shipped how can all of them trust each other to have done their job right how can the driver trust that the package was delivered at this point how can the consumer the end consumer know trust that the product that they're using is an actual quality product right because if all this data you know is stored in a database on a website any of the intermediaries could easily modify that data right to fit their best interest right because remember there's not one company in the supply chain there are multiple companies so the problem is that they all have competing interests so it you have to trust all of them and this is a problem right because any of them can just modify something and say oh you know what the date for this product was meant for this day and then the other person will say no we had a deal and they'll say oh well look at the database and they changed it and you just have to go with that right because you can't you you just have to trust them has it down and this is a problem right and that's just that's just based on trust alone right so Trust is a big problem when it comes to supply chain all of these intermediaries with competing interests these businesses have to trust each other to create this cohesive chain of operations to get a product from the factory to the consumer so there has to be a better way and that's just one problem right there's there are other problems it's difficult for small businesses to get into the game right like if you're a small business usually manufacturers only want to deal with big companies why again it comes down to trust there has to be some reputation because these big companies have been ripped off so many times they want to trust a larger company with a huge history of clientele because they have to or else they would lose money but as a small business you don't have that reputation number two is that there's an opaque procurement process 31% of buyers site finding the right manufacturing suppliers is a stand issue in the production process okay that's another one outdated technology right we're talking about decades-old system some of these supply chain services are running on ms-dos yes really little to no IP protection that's it that's a whole nother can of worms right IP in an intellectual property who owns what when was something created who's putting a timestamp and a creation stamp on what these are these are stamps that should be immutable and right now they are totally beautiful mutable or modifiable so the solution to this is the blockchain okay and I'm surprised that there aren't more companies that are using the blockchain to make the supply chain process more efficient right this is a huge opportunity to to make a business right this is this is an opportunity to create a sustainable business using blockchain technology supply chain there it is now there's because there's so many different sub applications within the supply chain industry right digital ownership who owns what proof of origin did this crop come at that was this crop organic what it wasn't handled properly who handled it what how many intermediaries did it go through trusted maintenance tracking did this product go through these specific intermediaries that we wanted it to did it go through this Quality Assurance process we wanted it to did they water it did they peel it of anything that it didn't need you know if it's a vegetable there's a lot of things that you know that there's a lot of issues regarding trust that all these intermediaries have to deal with so what a blockchain can do is if we think about a blockchain it is an immutable ledger okay so it's just think of it as like a huge column of transactions right like an Excel spreadsheet the best part about a blockchain is that nobody can modify it right once it's been created no one can modify it it's read-only access as to read-only data structure now this is perfect for the supply chain once one intermediary does their job they can they can send as a transaction that data to the blockchain then the second part the second intermediate intermediary knows that this this person time-stamped it on the blockchain now I know you know whatever this person did and then they'll do the same and then that just keeps going and when it gets to the end consumer the end consumer can say where did where where is my product from and rather than having to trust the label on the product they can literally look at the blockchain and it will show the history of where that product has been but that's just for the consumer right we can think about the retailer we can think about the store we can think about the third-party logistics companies all of these intermediaries can benefit from from the blockchain like using the blockchain in this case right there the the logistics companies are notified of the origin of a product the retailer gets to add updates to its data rector records automatically because it's listening to the blockchain a store has full transparency on every single delivery order there's a lot there you know consumers can just scan a QR code on some you know product and immediately know where where it came from which is a perfect use case but the problem is that like not many companies have done this well by the way like there's so many companies that say we are supply chain for blockchain and they don't actually have any customers or clients but I found sink fab and sink that seems pretty cool if we go to let's see blockchain documents and then in the presentation you'll see some of their clients which i think is very very cool they've got some governments here which is very cool they're there they've been working with some governments a city of san leandro city of san francisco and some other ones but yeah these are real clients that this company has been tracking for years they've been working with these clients for years and yeah I think that's pretty cool so if you want to look at a real world use case it's sink fab manufacturing supply chain blockchain very cool stuff but right so so instead of having multiple versions of truth right remember please come these are all silos with their own databases what if there was one single source of truth that they all had to listen to right this is the source of truth immutable it will never change it records everything that happens across the supply chain and you can read it and you can look at it and it's it will never change and you can trust it why I've gone into that and other other videos why the blockchain is immutable just YouTube's search Siraj blockchain decentralized applications that will get you the first thing so so how so how is a real-world application like sinc fab actually doing this like what are they doing that makes that that gives them the ability to have clients and build an actual business around this right so if we think about the manufacturer and the buyer rights so you have a manufacturer and they create these products and then you have the buyer they're buying these products what incentive does each of these parties have to get to to deal with this service well for the hardware buyer right the person who wants to buy some hardware for the manufacturer it eliminates all the intermediaries and brokers in that process which saves them money and they can go directly to the manufacturer it's kind of like uber for manufacturing on-demand manufacturing now if you've ever tried to contact a manufacturer or a factory if you have a hardware startup for example it's a lot of work and it's not easy and it's a very dated process right sometimes you have to fill out a form and then you have to wait like three weeks and then they'll get back to you but with this you just you get a listing of them on demand I want this and then it comes back to you now on the manufacturer side how are they incentivized well it eliminates their marketing costs right now they have to find buyers so they have to put real money into marketing they're their manufacturing service but this the smart contracts that sync that provides connects them directly to the buyer and guarantees payments so remember how I said how small businesses usually can't come into this game because there's a reputation system well because of smart contracts they can because they can trust that even small players will do their part because there's a trust blockchain in the middle that is a smart contract that escrows the funds so you can't just back out of it because there's a two of three escrow signature which we'll get into and they've got their own token it's called MFG but I really found there are smart contract architecture interesting so a person has an identity they'll make a purchase order now a purchase order can consist of so many different features right from from your ID to your payment terms whatever your inspection reports and then they'll make a payment using that and it goes from in-progress cancelled to complete it they can a buyer can make a purchase order on a smart using a smart contract on an immutable blockchain that's so if you've ever worked with the supply chain that's a that's a new concept it's it's never been that easy for a buyer to just make a purchase order without having to deal with at least two or three intermediaries when it comes to hardware manufacturing but with this they can write so this provides high quality quotes from the source on-demand purchasing for the for the hardware innovators and a direct connection to the manufacturing facility which eliminates marketing costs for the manufacturers which a thing they even have an app which is super cool and it's a pretty app you know etc etc but yeah that's the price it's it's a 13 step process if we look at the the logic for the smart contract but I think a better way to explain this process is to really build a very bare-bones version of an asset tracker okay so let's do that will create a bare-bones asset tracker in remix which is the solidity compiler now sync fab has built their token on aetherium zrc theorems blockchain and it's an IRC 20 token they also are using the etherium blockchain to build their smart contracts so what we're going to try to do is replicate a verge a version of sync fabs code but a very simple version of that code and all this is going to do is it's going to track an asset on a blockchain so where do we start so the first thing we want to do if we're going to structure this smart contract is to say that we're gonna do the this pragma mark solidity and then say what version is so remember the pragmas are known something from compilers like GCC you know they give the compiler additional information on how to process the the given code it even tells the compiler to use the highest version available using this little mark above above that mark okay so once we have that we can say let's assume that we have an assets file now the assets file will contain more metadata about the assets that we have assets that's solidity okay so in our asset tracker so this is this what it does it's a tracker now normally we would have a database on a web app that does this but because this contract will live on a blockchain nobody owns this so it's an unstoppable asset tracker right nobody can modify it now this ass this asset tracker will contain an ID for the asset which will call us which is a string which we'll call ID and we'll create a getter and a setter for this so we can get and set this whenever we create it right so we want to create an ID and then we want to get it later so we can verify it so this ID is going to return a string for the string which is the ID okay so there's that part and there's a bunch of different types we could use whenever we're coding solidity there's bools there's you know there's static I've got a list of all the different solidity types for you in the video description so when it comes to tracking the data structure that we're going to use I'm going to say let's create that data structure that data structure is called an asset right so what is contained in an asset well an asset has a name right an asset has a description it has a source or we can call it a manufacturer in this case and we've have some boolean that says has it been initialized or not which will tell the rest of the smart contract whether or not it's been an issue so so this is just a simple example remember assets can have so many different features as we saw before an asset can have you know virgin conversion numbers it can have a report you know etc but this is just a very simple example but in order to store these assets we're going to create these two mappings that's going to allow us to store asset properties as well as the relation between assets and wallets based on the UU IDs which are their unique identification strings so it's a private asset store so that's the first mapping will create that's going to be used to store assets under their respective UUID and then we'll have another mapping that map's the asset store from the name description this is I mean this is for the wallet store right so true what else do we want to say manufacturer and well this is to store assets using their respective UUID and then we'll have one another mapping and then we'll have another mapping for the address to make an assignment of an asset to a wallet so and we can say message the sender uu ID equals true okay so that was okay so that's the first part now for different there could be a number of real-world events that could happen here writes like asset creation asset transfer and we're going to define counterparts for that in this smart contract right so what are some possible things that could happen to an asset well one could be the creation of an asset right so what would be the parameters for asset creation well we want the address of the account right we want its its ID its unique identifier we want what else we want we want its manufacturer and we want I think that's it yeah those are the three what else do we want so let's just we want to be able to reject to creation so will say event to reject create okay and then we want another one that's going to be asset transfer asset transfer and we want one more which is going to be reject transfer and this is going to be address account of course this is going to be from because it because these last two are from this is going to be a message this is we don't need one for a transfer and then we have a message for a reject you know rejection message and hmm okay cool so there's that now we can create an asset so let me just write out okay so now let me write out just a simple function for asset creation right so if we want to create an asset we can say okay so using what we've just created before let's say to create an asset we need snail we need a description for this for the asset and we need the manufacturer manufacturer now once we have that we can write this out so if the asset stores unique identifier is initialized then we're going to reject the creation step saying the sender and the UUID are going to Beezus parameters and what that means is if it's already initialized offset with this UUID already created it means it's already been created now once we have that that's just kind of our failure case now once we have that then we can say let's store if it's if it hasn't been created before then let's create the asset the name description true and the wallet store all right because we're gonna store the asset we have we're going to store it in our wallet and we're going to create that okay so what okay so what this is saying is that in order to let me just make sure that this is all good yeah so what this is saying is that in order to transfer an asset we're going to create a function that takes the address of the target wallet along with the asset ID okay and we check those two preconditions and the asset is if the accent actually exists then we don't want to recreate it but if it doesn't then we're going to create the asset ourselves now this is this is the type of function that we would call from web three Jas right so this is the okay this is the contract that we would deploy to the blockchain and then we would use web 3GS so then call this contract specifically create asset using an innate the description the manufacturer okay sing fab has their own smart contracts that we could look at on github they have quite a lot of smart contracts here but if you're looking for a good source to learn about a production-ready smart contract code for supply chains definitely check them out yeah so that's it for this video I hope you found it useful and yeah


23 thoughts on “Blockchain for Supply Chain Management”

  • Very thorough. We want to add that different platforms are typically going to solve different problems. Some systems are going to focus on transfer of goods, others on purchase and financial exchange. Our system is about tracking ingredients, suppliers and documentation from seed to shelf with recall and return systems and automation to avoid mistakes. One challenge will be getting these different systems to talk to each other. We are happy to talk more if anyone has questions.

  • Hi Siraj, did you somewhere on the internet share your concept document that you show in the video? I'd really much like to read it.

  • devesh kaushik says:

    I'm getting many errors in the code.
    1) browser/Supplychain.sol:27:18: ParserError: Expected identifier but got '='
    assetStore[uuid] = Asset(name,description,manufacturer,true);
    2)browser/Supplychain.sol:12:29: ParserError: The state mutability modifier "constant" was removed in version 0.5.0. Use "view" or "pure" instead.
    function getId() public constant returns(string){

  • bhemeswararao ankireddy says:

    Hi good video but I want to full excution of code create own supply chain BlockChain on ethereum please give the creating steps from scratch please

  • Jackson Mackson says:

    Jupyter notebook which is used in this video can be accessible from this link :

  • Charles Michael says:

    imho SophiaTX is one of the best project when it comes to blockchain based solutions for supply chain. They have been named one of the best projects for long term investment. They are steadily progressing with their product which is quite revolutionary twitter.c0m/Sophia_TX_/status/1061954296953163777

  • Can say here in this article is like a continue of this vide:

  • Dude, you just don't know what you're talking about when it come to supply chain blockchain. I am a firm believer in decentralization. How you expect that to work in supply chain in not reasonable. the usps has great tracking service, you can track a package from the moment is ships to delivery. The same problem will exist with blockchain, you cannot verify the product you order is the product you will get. anyone can lie during shipment, products can be switched or defective products can be shipped from the manufacturers. If you're buying rice from Thailand, you cannot guarantee the rice farmer did't buy rice from his neighbor, of a lessor quality and sell it for aromatic jasmine rice. Or if you're shipping it into china, there is no way you can guarantee that a chinese shipper doesn't switch the product and replace it with common chinese rice, and just repackage it , which happens quite often. that is why there are buyers reps at the factories, to make sure quality is as described. BLOCKCHAIN is not going to fix any of this. SO, quit hanging out on grindr and actually figure out how blockchain will actually work and be an asset to the supply chain.

  • Concerning the scan of a QR code, doesn't that only confirm the type of product and not the specific instance? There is usually some printed data on packaged goods that identify the lot and possible instance. Right now, that is not scan-able (as far as I know).

  • Shaji Manghat says:

    I am a Manager (supply chain operation) for the last 15 years in one of the global MNCs providing supply chain solutions to customers – this is the reasons I have invested heavily in VeChain – amazing uses cases – total visibility 🙂

  • Problem with most investors in crypto assets is the lack of timing and patience that can make you a fortune.

  • Lonwabo Zaula says:

    i was trying to do this exercise but having an error on line 28 in the video, the error says expected identifier but got '=' so i can't compile, any help is much appreciated, i am trying to a smart contract similar to this one

Leave a Reply

Your email address will not be published. Required fields are marked *