Food safety issues have a significant impact on consumers,businesses,and the entire country.With the development of the market economy,people’s demand for food safety and other aspects continues to increase.However,the circulation of agricultural products lacks effective traceability and supervision,leading to various food safety incidents and product fraud issues.Therefore,it is urgent to establish an effective and reliable traceability system to ensure food safety,and to solve the problems of incomplete supply chain information and unreliable traceability information in traditional traceability systems.Blockchain has technical features such as decentralization and non tampering,which are used to solve trust problems.Its chain storage structure can achieve non tampering of data.Therefore,this article proposes a research on a trustworthy agricultural product traceability system based on blockchain.The main research content is as follows:(1)A product anti-counterfeiting measure based on blockchain and real-time query anti-counterfeiting technology has been designed to address the issue of source code being copied and forged.This anti-counterfeiting technology scans QR codes for real-time queries,and the query system interacts with the backend database in real time.The searcher’s phone number is uploaded to the backend database(blockchain),so the query record is left on the database during the first scan.If the traceability code has been scanned by someone else,there will be a prompt when someone else scans it for the second time,causing the maliciously copied traceability code to lose its validity.By combining real-time query anti-counterfeiting technology with blockchain technology,we ensure that the anti-counterfeiting database data is not tampered with,further improving the credibility and security of real-time query anti-counterfeiting technology.(2)A traceability data storage model on and off the chain has been designed to address the bottleneck issue of blockchain storage.This storage model adopts a combined storage method of IPFS and blockchain,which directly stores the records generated in each link of the supply chain for online verification.For large files such as images or videos in traceability data,IPFS is used for storage,and their hash values are used for online verification.If there is a privacy requirement,files can be encrypted and stored in IPFS to further improve the security of offline data storage.The use of IPFS can effectively solve the bottleneck problem of blockchain storage,and blockchain technology can also amplify the role of IPFS.Through this storage method,secure and efficient storage of traceability data can be achieved.(3)In response to the main node security and communication redundancy issues of the PBFT consensus algorithm,a C-PBFT consensus algorithm incorporating credit evaluation is proposed.A credit evaluation model is designed to calculate the node credit value,divide the nodes according to the calculated credit value,and select the main node.The PBFT algorithm optimizes the main node redundancy selection strategy,reducing the probability of frequent view switching due to the main node being a Byzantine node,Selecting some nodes with higher credit values to participate in consensus,and selecting the node with the highest credit except for the main node as an alternative main node,improves the reliability of the main node;In addition,under the dual insurance of optimizing the main node selection and optimizing the view switching protocol,the consensus process is optimized,reducing network communication costs and improving consensus efficiency.(4)Finally,this article implements a trustworthy agricultural product traceability system based on blockchain according to the above scheme,and tests the anti-counterfeiting traceability system.Through testing and analysis,the system’s anti-counterfeiting and traceability functions are confirmed.These works have certain significance in solving the problems of existing blockchain traceability systems and improving the credibility and data security of agricultural product traceability systems. |