Blockchain Implementation with Hyperledger Fabric
The agriculture and the industries surrounding it play a critical role in ensuring global food security and economic growth. A fruit harvested in a small village in India could be exported and consumed in another country across the globe, or vice versa. Due to the complexities in the process of harvesting, processing, transportation, storage, etc leads to trust and traceability issues. There have been several attempts in the past to address these issues in different ways.
Innovative technologies like blockchain have emerged as potential game-changers. There are several blockchain frameworks available. Major among them is the Hyperledger Fabric, a robust and powerful blockchain framework, holds great promise for transforming the Global farm supply chain.
This case study aims to explore the implementation of blockchain technology using Hyperledger Fabric in a food supply chain. People mostly call it Farm supply chain, but we can call it Food Supply Chain too, as the same blockchain can be used for any scenario where a food item needs to be processed, transported, stored, sold and consumed. By adopting blockchain, stakeholders including farmers, suppliers, distributors, retailers, and consumers can collectively address issues mentioned before.
Advantages of using blockchain
Some of the key benefits of using blockchain in supply chain are:
Better Traceability
Blockchain enables the creation of a transparent and auditable record of each stage in the supply chain, from harvesting at the farm to processing, packaging, storage and distribution.
Improved Efficiency
In general digitizing any supply chain transaction helps in minimizing the errors and improve efficiency in addressing critical issues such as tracing source of contamination and product recall process.
Trust and Accountability
Where the Blockchain adds more value is in improving trust and accountability in the digitized supply chain. Hyperledger Fabric's consensus mechanism ensures that all participants agree on the validity of transactions. This provides a tamper-proof, single source of truth, reducing the risk of fraud.
Consumer Satisfaction
With the inherent nature of transparency in blockchain, consumers can know the exact origin, processing and distribution process of the food that they are consuming. This transparency encourages more responsibility and ethical practices from all the stakeholders of the supply chain as well as the consumers.
A Use Case Study
Let's consider the example of a Fruit Supply Chain. To start with, we can set up a simple Hyperledger Fabric permissioned blockchain network with a single channel that is accessible to all the stakeholders. Each stakeholder acts as a peer on the network. Each stakeholder would be given a unique identity on the blockchain.
Following are some of the main stakeholders we can identify in a Farm supply chain.
Producer
An individual farmer of a farming company responsible for growing and harvesting fruits. Each farmer would be given a unique identity on the blockchain. Farmer will be able to record details like the harvesting date, quantity, weather conditions, etc.
Local Aggregator
An entity that collects fruits from multiple farmers or producers. It could be a local co-operative, merchant or an APMC body. When the fruit is brought to the local aggregator, it will be assigned a uniqueue lot number, along with collection date.
Packaging Team
An entity responsible for cleaning, sorting and packaging fruits. A QR code could be added on to each package with a unique id that can be used for querying blockchain at any given time.
Quality Assessment and Certification body
A certification body responsible for testing, grading and certifying the fruits based on quality parameters such as the size, color, presence or absence of residue chemicals, etc. All the data will be recorded on the blockchain and linked to the batch number.
Distributor
Distributor is responsible for transporting packages from one location to the other. Typically from a wholesale aggregator to a retailer. Distributor will be recording transport data on to the blockchain. This can include data like: source aggregator identity, date, retailer to whom it is delivered, etc.
Retailer
An individual or an entity that sells fruits directly to consumers. Retailers would be able to collect the fruits from distributors, validate source and quality of the fruit packages on the blockchain.
Consumers
End user who purchases and consumes fruits. Consumers can use the QR code on the package to see origin, and the full path it took from producer to the consumer. Same data could be validated through records stored on the blockchain at any given point of time.
Implementation
State on the blockchain
ID: A unique identification generated for each lot of product that is collected from the farmer.
Variety: A code assigned to different varieties or breeds of the fruit
FarmerID: Unique ID given to the farmer who harvested the fruits
Location: Farm location identifier
HarvestDate: Date of harvesting of current lot of fruits
AggregatorID: Unique ID given to the Local aggregator
Quality: Quality Rating given to the batch of fruits
BatchID: Auto Generated id assigned to current batch of fruits after sorting
DistributorID: Unique identification of the distributor who transfers the fruits from aggregator to retailers
RetailerID: Retailer to whom the batch of fruit is delivered for sale
Source Code Sample
Hyper Ledger Fabric Sample Contract
Blockchain Interface Usage behind the scene
A device at the Farm makes a record on the blockchain, with details of harvested product.
After harvesting, the local aggregator collects the batch of product and makes a record on the blockchain that the product is collected.
A record is created after Product Quality Testing and Packaging.
A batch of fruits is then transferred to the distributor and a record is done on the blockchain.
One more tracking record is done on the blockchain when the boxes are delivered to the retailer.
Consumers can trace the source of each box of fruits using blockchain interface.
The history of the record can be seen on the blockchain at any given point of time. A sample transaction history would look like this: (latest transactions on the top)
ID | Variety | FarmerID | Location | HarvestDate | Quality | AggregatorID | BatchID | DistributorID | RetailerID |
---|---|---|---|---|---|---|---|---|---|
1 | Alphonso | FARMER1 | Bengaluru Farm | 2023-06-27 | 4 | AGGREGATOR1 | BATCH1 | DISTRIBUTOR1 | RETAILER1 |
1 | Alphonso | FARMER1 | Bengaluru Farm | 2023-06-27 | 4 | AGGREGATOR1 | BATCH1 | DISTRIBUTOR1 | |
1 | Alphonso | FARMER1 | Bengaluru Farm | 2023-06-27 | 4 | AGGREGATOR1 | BATCH1 | ||
1 | Alphonso | FARMER1 | Bengaluru Farm | 2023-06-27 | 4 | AGGREGATOR1 | |||
1 | Alphonso | FARMER1 | Bengaluru Farm | 2023-06-27 | 4 | AGGREGATOR1 | |||
1 | Alphonso | FARMER1 | Bengaluru Farm | 2023-06-27 | 4 |
Impact
Consumer Confidence
Consumers can now get to know the precise location of the products they purchase. They can verify the details printed on the box, with the help of blockchain. For example, if a product is marked as organic, consumers can now know the exact farm from which the product is harvested and the certifications provided, etc.
Quick Response to Issues
In the event that a consumer detects a defect in a box of fruit, such as residue pesticide on the fruits. Now we can easily and quickly identify the exact origin of those fruits, batch number, producer and date of harvest. This helps the stakeholders to take immediate targeted actions such as recalling the particular batch of fruits and making sure to minimize the damage. This also improves the trust and reliability of the process.