Design of Multi-Chain Traceability Model for Pepper Products Based on Traceability Code
Abstract
:1. Introduction
2. Current Status of Blockchain Traceability Storage Research
3. Model Design Ideas—One Master Chain and Multiple Side Chain Structures
4. Construction of Multi-Chain Traceability Model for Pepper Products
4.1. Pepper Multi-Chain Traceability Model
4.2. Storage Schema Design for Multi-Chain Traceability Model
- 1.
- Traceability information is stored on the planting sidechain block:
- 2.
- Sidechain update status data:
- 3.
- Coded exchange smart contract:
- 4.
- Main chain query to see if a record already exists:
- 5.
- New/updated records:
- 6.
- Creating mapping relationships;
4.3. Fast Query Process for Multi-Chain Traceability Model
4.4. Smart Contract Design under Multi-Chain Traceability Modeling
4.4.1. Uplinked Smart Contract
Algorithm 1. Up chain Smart contract pseudo code. |
Input: Pepper for total arsenic X, lead Y, cadmium Z, total mercury G |
Output: successful transaction hash address TxID, failure to return error reason 1: message = Stub. GetState(TraceabilityCode) //Checking for TraceabilityCode records in the sidechain 2: when (ID = 1)//At this time the product is fresh or frozen peppercorns 3: if (X > 0.07 or Y > 0.42 or Z > 0.11 or G > 0.01) 4: return “Excessive heavy metals”//fail to upload 5: when (ID = 2)//At this time the product is dried peppercorns or powdered peppercorns 6: if (X > 0.30 or Y > 1.86 or Z > 0.50 or G > 0.01) 7: return “Excessive heavy metals”//fail to upload 8: message.encryption();//Calling the encryption module to encrypt 9: Stub.PutState (message) //uplink ciphertext data 10: return TxID//Upload successfully, return transaction hash address |
4.4.2. Mapping Smart Contract
Algorithm 2. Mapping Smart contract pseudo code. |
Input: TraceabilityCode, TxID, Update Various Segments Breed Procees Pransport Storge Sales |
Output: return Mapping 1: message = Stub.GetState(TraceabilityCode) //Checking for TraceabilityCode records in the sidechain 2: Index := &Index{} //If you don’t have one, create a new mapping relationship 3: func UpdateIndex (args []string)//If yes, update the mapping relationship 4: if updateItem == “Plant” {//Update transaction hash addresses for each link 5: Mapping.PlantTxId = TXID 6: }else if updateItem == “Process”{ 7: Mapping.ProcessTxId = TXID 8: }else if updateItem == “Transport”{ 9: Mapping.TransportTxId = TXID 10: }else if updateItem == “Storage”{ 11: Mapping.StorageTxId = TXID 12: } else if updateItem == “ Sales “{ 13: Mapping. SalesTxId = TXID 14: } 15: stub.PutState(traceabilityCode, Mapping)//Write the mapping relationship to the main chain 16: return Mapping |
4.4.3. Query Smart Contract
Algorithm 3. Query Smart contract pseudo code. |
Input: TraceabilityCode Output: Return Ciphertext 1: Stub.GetState(TraceabilityCode)//Query TraceabilityCode records 2: (PlantTxId,ProcessTxId,StorageTxId,TransportTxId, SalesTxId) = GetMapping (TraceabilityCode)//Get the address of the transaction hash in the mapping relationship 3: Ciphertext.Plant = PlantChain.GetState(PlantTxId)//Request planting sidechain traceability data based on transaction hash address 4: Ciphertext. Storage = StorageChain.GetState(StorageTxId)//Request Warehouse Sidechain Traceability Data 5: Ciphertext. Process = ProcessChain.GetState(ProcessTxId)//Request for processing side-chain traceability data 6: Ciphertext. Transport = TransportChain.GetState(TransportTxId)//Request logistics side-chain traceability data 7: Ciphertext.Sales = SalesChain.Getstate(TransportTxId)//Request sales sidechain traceability data 8: return Ciphertext//Return to Traceability Information |
4.5. Multi-Chain Model Performance Tests
4.5.1. Enquiry Efficiency Performance Test
4.5.2. Throughput Performance Test
5. Conclusions
5.1. Summaries
- (1)
- The proposed multi-chain traceability model compared to the previous blockchain single-chain traceability model will have higher query efficiency than the traditional single-chain model when the total quantity of data is greater than 1000 items. When the number of batch traceability data entries is high and the total quantity of data is large, the query efficiency of the multi-chain model is higher than that of the single-chain model. The batch traceability data volume of pepper products is about 150 items, and the query efficiency of the multi-chain model is higher than that of the single-chain model when the total data volume is greater than 7000 items. The multi-chain model is more suitable for real traceability scenarios of pepper products.
- (2)
- The model enables full on-chain data storage, making traceability data secure. The nodes in each link of the pepper supply chain can be easily uplinked with data to ensure that consumers can query the complete, accurate, and comprehensive pepper traceability information.
5.2. Prospects
- (1)
- Most of the traceability data in this paper need to be entered manually through the traceability management system, which may generate errors in the entry process. Later, you can use the technology of the internet of things to automatically collected all kinds of information regarding pepper products. The use of IoT equipment makes the traceability process of pepper products precise and automated, reduces the errors and misoperations caused by human input, and improves the operational efficiency of the traceability system and the accuracy of the data.
- (2)
- It may also be possible to enhance the integration of “traceability systems + big data”. The traceability system is capable of collecting complete data from all links in the industry chain, but it is not capable of easily processing the data. Enhancing the level of integration with big data can efficiently and flexibly analyse and process data in the supply chain, analysing more valuable information for industry workers.
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Zheng, Y.G.; Jing, Y.S. (Eds.) Atlas of Medicinal Plants of Taihang Mountain Series; Shanghai Scientific & Technical Publishers: Shanghai, China, 2021; in press. [Google Scholar]
- Zhang, Z.G.; Dong, Y.S. Chongqing Xiaomian Dictionary; Chongqing Publishing Group: Chongqing, China, 2021; in press. [Google Scholar]
- Hui, R.H. Financial Empowerment of Pepper Industry to Do Better and Stronger to Promote Modern Agricultural Development—Research and Thinking Based on the Development of Pepper Industry in a Region; Modern Enterprise: Seattle, WA, USA, 2022; pp. 152–153. [Google Scholar]
- Zheng, Y.N.; Fan, M.T. Determination of toxic and essential metal elements in pepper in Shaanxi. China Condiment 2012, 37, 88–91. [Google Scholar]
- Li, J.F. Analysis determination of elementary in Clovershrub pepper. China Condiment 2012, 37, 87–88. [Google Scholar]
- Peng, Y.; Yao, J.; Yu, Y.H. Investigation and Evaluation on Heavy Metal Content and Pesticide Residues of Three Edible Forest Products in Sichuan Province. J. West China For. Sci. 2018, 47, 26–30. [Google Scholar]
- Chen, X.F.; Tang, S.C.; Gou, J.J. Determination of iron, copper and manganese trace elements in peppercorns of different origins. China Condiment 2014, 39, 121–123. [Google Scholar]
- Foong, S.Y.; Ma, N.L.; Lam, S.S.; Peng, W.; Low, F.; Lee, B.H.; Alstrup, A.K.; Sonne, C. A recent global review of hazardous chlorpyrifos pesticide in fruit and vegetables: Prevalence, remediation and actions needed. J. Hazard. Mater. 2020, 400, 123006. [Google Scholar] [CrossRef] [PubMed]
- Bosona, T.; Gebresenbet, G. Food traceability as an integral part of logistics management in food and agricultural supply chain. Food Control 2013, 33, 32–48. [Google Scholar]
- Sun, C.H.; Yu, H.J.; Luo, N. Fruit and Vegetable Blockchain Traceability Data Storage Method of Fruit and Vegetable Foods Supply Chain Based on Smart Contract. Trans. Chin. Soc. Agric. Mach. 2022, 53, 361–370. [Google Scholar]
- Creydt, M.; Fischer, M. Blockchain and more-Algorithm driven food traceability. Food Control 2019, 105, 45–51. [Google Scholar] [CrossRef]
- Zhou, E.; Hong, Z.; Zhao, D.; Pei, Q.; Guo, S.; Akerkar, R. MSTDB: A Hybrid Storage-Empowered Scalable Semantic Blockchain Database. IEEE Trans. Knowl. Data Eng. 2022, 35, 8228–8244. [Google Scholar] [CrossRef]
- Dong, S.H.; Xin, J.C.; Hao, K. Optimization Algorithm for Connected Queries in a Multi-Blockchain Environment. J. Zhejiang Univ. 2022, 56, 313–321. [Google Scholar]
- Jia, D.Y.; Xin, J.C.; Wang, Z.Q.; Guo, W.; Wang, G.R. An efficient query model for storage capacity scalable blockchain systems. J. Softw. 2019, 30, 2655–2670. [Google Scholar]
- Min, H. Blockchain technology for enhancing supply chain resilience. Bus. Horiz. 2019, 62, 35–45. [Google Scholar] [CrossRef]
- Agarwal, V.; Pal, S. Blockchain meets IoT: A scalable architecture for security and maintenance. In Proceedings of the 2020 IEEE 17th International Conference on Mobile Ad Hoc and Sensor Systems (MASS), Delhi, India, 10 December 2020. [Google Scholar]
- Chen, J.; Lv, Z.; Song, H. Design of personnel big data management system based on blockchain. Future Gener. Comput. Syst. 2019, 2019, 1122–1129. [Google Scholar] [CrossRef]
- Xing, X.; Chen, Y.; Li, T.; Xin, Y.; Sun, H. A blockchain index structure based on subchain query. J. Cloud Comput. 2021, 10, 52. [Google Scholar] [CrossRef]
- Guo, C.; Liu, Y.; Na, M.; Song, J. Dual-Layer Index for Efficient Traceability Query of Food Supply Chain Based on Blockchain. Foods 2023, 12, 2267. [Google Scholar] [CrossRef] [PubMed]
- Zhang, H.; Wei, Z.Q. Query model of blockchain system based on secondary indexing mechanism. J. Comput. Appl. 2022, 42, 129–134. [Google Scholar]
- Ruan, P.; Dinh, T.T.; Lin, Q.; Zhang, M.; Chen, G.; Ooi, B.C. LineageChain: A fine-grained, secure and efficient data provenance system for blockchains. VLDB J. 2021, 1, 3–24. [Google Scholar] [CrossRef]
- Liang, H.; Liu, S.C.; Zhang, Y.N. Multi-chain Blockchain Application Technology for Agricultural Products Transaction. Smart Agric. 2019, 1, 72–82. [Google Scholar]
- Zhu, Y.C. Research on Query Processing for Blockchain Systems; East China Normal University: Shanghai, China, 2020. [Google Scholar]
- GB/T 30391-2013; Prickly Ash. National Standards of People’s Republic of China: Beijing, China, 2013.
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Jin, W.; Zheng, M.; Liu, P. Design of Multi-Chain Traceability Model for Pepper Products Based on Traceability Code. Appl. Sci. 2024, 14, 3809. https://doi.org/10.3390/app14093809
Jin W, Zheng M, Liu P. Design of Multi-Chain Traceability Model for Pepper Products Based on Traceability Code. Applied Sciences. 2024; 14(9):3809. https://doi.org/10.3390/app14093809
Chicago/Turabian StyleJin, Wenxuan, Mingjun Zheng, and Pingzeng Liu. 2024. "Design of Multi-Chain Traceability Model for Pepper Products Based on Traceability Code" Applied Sciences 14, no. 9: 3809. https://doi.org/10.3390/app14093809
APA StyleJin, W., Zheng, M., & Liu, P. (2024). Design of Multi-Chain Traceability Model for Pepper Products Based on Traceability Code. Applied Sciences, 14(9), 3809. https://doi.org/10.3390/app14093809