[Ethereum] Can “ERC721 protocol” be used for supply chain traceability and integrity

blockchaincontract-designcontract-developmenttokens

As I understand it, ERC721's, also known as NFTs (Non-fungible token) are tokens where each one is unique. The individual tokens often come with metadata.

They're usually indivisible (ERC20s you can usually have as little as 1*10-18 of it, but ERC721 you can have multiples of 1).
An example: a game where you have an inventory. All the different items in the inventory could be considered NFTs, where you have 5 arrows, a sword, a fish, etc.

Another example is of course CryptoKitties. A kitty is an NFT with metadata that isn't divisible (you can't sell someone half your cat…) ELI5: Tradeable assets that are unique from each other. Houses, cars, rare/unique collectibles.
Baseballs could be traded as NFTs where a baseball has metadata related to all the players who pitched it, who it's signed by, etc.

The fact that each token can have metadata attached to it, means we can store specific data relative to the factory, supply chain, production chain, producer etc etc in the metadata as a proof of integrity, right?

Suppose we are talking about a production line of pils or vaccine or meat or anything produced in mass, we can insure the integrity of the product by storing specific data (producer, date time of production, unique identifier) in the metadata that we can send in the transaction in our blockchain and then verify at any moment the metadata via our blockchain explorer.

is all that scenario possible with the ERC721 or am I just imagining thing?

Best Answer

Short answer: yes, it's possible to use non-fungible tokens (NFTs) which support ERC721 standard for supply chain.

Long answer: Yes! But first things first. ERC721 is just a standardized interface which ensures some interoperability between apps that work with NFTs. It would be hard to support hundreds of different non-fungible token contracts if each of them would have its own set of rules and methods. Now, even if you pick ERC721 standard there are many ways how to implement a NFT token contract which could be applied to supply chain.

One simple example: each NFT represents a product and can hold a list of meta-data records (on-chain):

  1. First meta-data record is factory and product information (location, timestamp, materials, etc.).
  2. When this product is sent to a warehouse, we imprint (on-chain) new meta-data with transportation company and warehouse information including pickup and delivery times.
  3. Previous step could probably repeat a couple of times before our product gets to a store. And here the same thing happens - we add another record of meta-data about the store, date, etc.

This all looks good, except in reality all the meta-data that we pushed on-chain add up really fast! So, the first step is to reduce the size - instead of raw meta-data, we store only hash digests of raw data. Let's call them proofs:

  1. Factory:

    • meta-data: hash({"companyName": "Foo", "address": "...", ...}) -> "proof1"
    • NFT meta-data is a list of proofs: ["proof1"]
  2. Delivery 1:

    • meta-data: hash({"companyName": "Bar", "timestamp": "...", "containerNo": "...", ...}) -> "proof2"
    • NFT meta-data: ["proof1", "proof2"]
  3. Warehouse 1:

    • meta-data: hash({"companyName": "Bar", "address": "...", ...}) -> "proof3"
    • NFT meta-data: ["proof1", "proof2", "proof3"]

...

  1. Warehouse 10:
    • NFT meta-data: ["proof1", "proof2", "proof3", ..., "proof10"] <- A chain of "proofs"

This is much better than storing the original meta-data on-chain. However, now we have to store raw data somewhere off-chain where interested parties can query it and validate (by using the proof which is on-chain). You could go even further and look into side-chains in order to further reduce the costs of transferring and storing data on-chain.

Disclaimer: I'm a part of the team who works on open source 0xcert protocol for non-fungible tokens. One of the supported use cases is supply chain (using ERC721 NFTs: https://github.com/0xcert/ethereum/blob/master/contracts/tokens/ChainableXcert.sol) and the example above briefly describes it. It's currently under heavy development (alpha release probably a month away) but it might still be helpful/interesting. You are welcome to take a peek/open a PR/Issue: https://github.com/0xcert/ethereum

Related Topic