In recent years, pandemics like COVID-19 have focused our attention on the importance of food safety. It emphasizes the need for traceability in supply chains, efficient data collection and high-frequency transactions. To address these challenges, a blockchain-edge scheme has been introduced that employs dynamic programming to find the best optimal solutions for selecting global transaction paths.

Read: September Issue of Food Infotech Magazine.

Food safety management and supply chains were critical when pandemics like COVID-19 entered the world. It acknowledges the complex network of stakeholders involved in Food Supply Management from food producers to consumers. As mentioned, Blockchain technology can address all these different issues and its decentralized nature can facilitate data sharing and ensure reliability in Food Supply Management systems. Today’s problems, which require high efficiency and real-time data handling can’t be solved by traditional blockchain networks like Bitcoin, which have limited transaction throughput. Even consortium blockchains, which do not rely on mining still require optimization for capacity. Lightning Network was introduced to address these challenges, enabling real-time off-chain transactions without uploading data to the blockchain. This system includes edge-sensing network nodes for authorization and data collection using Radio Frequency Identification (RFID) chips to label food items and collect real-time information about food states. These nodes function as Lightning Network and blockchain nodes, enabling real-time transactions before uploading integrated transaction data to the blockchain.

A dynamic programming algorithm was proposed using the weighted directed graph to represent transaction paths and channels to optimize the best path selection in the Lightning Network [1]. This algorithm optimizes Lightning Network routing fees while keeping all constraints like transmission cost, computing resource consumption and Lightning Network balance.

1. An Approach to the Proposed Model

The proposed model aims to efficiently record the food supply chain’s food transfer process. The model’s workflow, illustrated in Fig. 1 involves multiple phases, including transaction path planning, food state sensing, transaction verification, transaction merging and uploading to the blockchain.

Basic Workflow of Proposed Model

a) Transaction Paths Planning

The technology introduced in this phase is the Lightning Network, a payment protocol built on blockchain technology. Its purpose is to enable fast, low-cost, high-frequency transactions without overburdening the main blockchain. Planning transaction paths involves determining how transactions will traverse the Lightning Network channels. A planned process is necessary as the direct channels don’t exist between all nodes. The dynamic programming algorithm proposed in the model is designed to solve this optimization problem. It aims to find a cost-effective transaction path while considering routing fees and network balance.

b) Food State Sensing

In this step, the main focus is ensuring the integrity and real-time tracking of food items within the supply chain. Also, it introduces edge sensing nodes equipped with sensors and RFID technology. So, when a transaction is initiated, the RFID tags on food items are read, resulting in the collection of unique identification codes and real-time data about the food’s state (e.g., temperature, humidity & freshness). Data collected from sensors and RFID tags are then encrypted to enhance security and transmitted to the Lightning Network for further processing. This automation reduces the risk of manual data input errors and tampering, ensuring the reliability of food state data.

c) Transaction Verification

This phase confirms whether the traded food complies with safety standards and regulatory requirements. Transaction data, including food state information and unique identification codes is sent to the blockchain for validation. Smart contracts within the blockchain execute verification processes by accessing ledger records and compare them with the provided data. This verification process is transparent, efficient and fine-grained, allowing for the rejection of transactions that do not meet safety standards before execution. It ensures the integrity of the food supply chain and reduces the risk of distributing unsafe products.

d) Transactions Merging

In this phase, the Lightning Network is leveraged to merge multiple transactions into consolidated transactions before submitting them to the blockchain. Data security is maintained through cryptographic signatures, ensuring the authenticity of the transactions.

e) Uploading to Blockchain

This final phase involves uploading the consolidated transaction to the blockchain ledger, ensuring a permanent and tamper-resistant record. The mechanism of blockchain consists of endorsement, order and confirmation steps. Endorsement simulates transaction execution and a consensus is reached among nodes on the simulated results. Ordering determines the sequence of transactions for Practical Byzantine Fault Tolerance (PBFT) is applied to ensure agreement. Confirmation verifies that the submitted block complies with the results after the committer nodes update their ledgers.

In conclusion, the proposed FSM model integrates cutting-edge technologies like the Lightning Network and blockchain to address the challenges of food safety and supply chain management. It offers an end-to-end solution for tracking and verifying food items in real-time, ensuring compliance with safety standards, reducing manual data input errors and enhancing the efficiency of transactions within the supply chain. The model uses cryptographic signatures and mechanisms that guarantee data security and trustworthiness, ultimately contributing to safer and more transparent food supply chains.

2. Algorithms

The Path Weight Configuration (PWC) algorithm and the Optimal Transaction Paths Scheme (OTPS) algorithm are essential components in the proposed model for managing transaction paths in the Lightning Network. Its main aim is to efficiently preprocess and select transaction paths, considering constraints such as transmission cost, computing resources and network balance.

a) PWC Algorithm

PWC prepares the Lightning Network for transaction path selection [1]. It processes information about the network’s channel structure and attributes with desired transaction paths by exploring potential ways it constructs a matrix of characteristics for each possible course. This accredit includes routing fees, channel capacity and transmission costs essential for path evaluation.

PWC also uses a Depth-First Search (DFS) approach to build these path attributes, ensuring they meet the criteria for a simple path.

b) OTPS Algorithm

The OTPS algorithm selects the best transaction paths while adhering to specified constraints. It considers conditions like transmission cost (TC), computing resource consumption (CC) and network balance (BC) to determine the optimal transaction paths [1]. OTPS assesses each potential way, evaluating attributes such as routing fees and channel capacities. It undergoes multiple rounds of evaluations, progressively refining the path selection based on the defined constraints. This algorithm ensures that the paths do not exceed the limitations and considers the initial appointment and possible replacements. By evaluating all the tracks, OTPS identifies the optimal solution that minimizes routing fees while satisfying the constraints.

Lastly, PWC prepares Lightning Network by collecting essential attributes for transaction paths and OTPS selects the best course considering various constraints. Combining these algorithms to enable the model, it efficiently manages transaction paths in the Lightning Network, ensuring cost-effective and constraint-compliant transactions.

3. Conclusion

As we look into the future, integrating blockchain technology and the Lightning Network into food safety management and supply chains is poised to revolutionize how we ensure the safety and transparency of our food supply. This innovative approach, as outlined in the proposed model represents just the beginning of a transformative journey towards a safer, efficient and more trustworthy food ecosystem.

In the coming years, we can anticipate several exciting developments and advancements in this field. First and foremost, the continued refinement of the Path Weight Configuration (PWC) and Optimal Transaction Paths Scheme (OTPS) algorithms will lead to a highly efficient and cost-effective transaction path planning within the Lightning Network. These algorithms will evolve to consider a broader range of constraints, accommodating the ever-changing landscape of the food supply chain.

Furthermore, the adoption of this model by various stakeholders in the food industry, including producers, distributors and regulators is expected to grow substantially. This widespread implementation will create a network effect, enhancing the system’s overall effectiveness and strengthening its ability to ensure food safety.

As the technology matures, we can also anticipate developing specialized hardware and software solutions tailored specifically to meet the needs of the food supply chain. These innovations will enhance the accuracy and efficiency of food state sensing, transaction verification and transaction merging processes. Additionally, ongoing research and development efforts will likely lead to enhanced security measures, making the system even more resilient against potential threats.

In parallel, regulatory bodies worldwide may recognize this model’s potential to improve food safety standards significantly. This recognition will lead to the establishment of guidelines and standards that ensure the model’s adoption becomes a requirement rather than an option. Such regulations will further boost consumer confidence in the safety of their food.

Overall, the future of food safety through blockchain and Lightning Network technology is bright. As we refine and expand upon this model, we are moving closer to a world where every food item’s journey from producer to consumer is tracked in real-time, verified for safety and seamlessly integrated into a tamper-resistant blockchain ledger. This future promises safer as well as more transparent and resilient food supply chains, benefitting industry stakeholders and consumers.


1. K. Gai, Z. Fang, R. Wang, L. Zhu, P. Jiang and K. -K. R. Choo, “Edge Computing and Lightning Network Empowered Secure Food Supply Management,” in IEEE Internet of Things Journal, vol. 9, no. 16, pp. 14247-14259, 15 Aug.15, 2022, doi: 10.1109/JIOT.2020.3024694.

About the Authors:

Kushagra Agrawal & Nisharg Nargund


The views/opinions expressed by authors on this website solely reflect the author(s) and do not necessarily reflect the views/opinions of the Editors/Publisher. Neither the Editors nor the Publisher can be held responsible and liable for consequences that may arise on account of errors/omissions appearing in the Articles/Opinions.


An editor by day & dreamer at night; passionately involved with both print and digital media; Pet lover; Solo traveller.

Write A Comment

11 − eight =