| With the progress of society and the improvement of quality of life in recent years,people’s concern about food information and food safety issues has been gradually increasing.The existing food and beverage supply chain traceability system cannot cope with the problem of data being maliciously tampered with,which poses a major challenge to the source tracking of food safety issues.The easy traceability and unmodifiable nature of data in blockchain technology can precisely address this problem.The current blockchain technology uses the PBFT consensus algorithm,which has low stability and low consensus efficiency when the cluster size is large and complex.These two problems make it difficult to apply PBFT consensus algorithm in the traceability system of restaurant supply chain.In this paper,we combine blockchain technology with restaurant supply chain,and design,implement and test the traceability system.The main contributions of this paper are as follows:(1)The PBFT consensus algorithm is analyzed in detail,and an optimization scheme based on node credit and dynamic management mechanism,named LBFT consensus algorithm,is proposed for its inability to identify malicious nodes and the possible problem that malicious nodes are selected as master nodes several times.The algorithm evaluates the behavior of each node during operation and maintains a credit value for each node.The LBFT consensus algorithm also optimizes the selection strategy of master nodes,and nodes with excellent behavior will become master nodes first,which greatly reduces the probability of malicious nodes becoming master nodes,avoids view switching caused by malicious nodes becoming master nodes,and improves the stability of the consensus algorithm is improved.In this paper,we build a simulation system for the LBFT consensus algorithm and demonstrate that the LBFT consensus algorithm can identify malicious nodes and kick them out of the cluster through multiple rounds of comparison experiments,and the LBFT consensus algorithm has higher stability than the PBFT consensus algorithm when there are malicious nodes in the cluster.(2)The paper analyzed the problem of inefficient communication when the PBFT consensus algorithm is large,and propose an optimized consensus algorithm based on dynamic grouping mechanism,named LGBFT consensus algorithm.Based on the LBFT consensus algorithm,different groups are set up according to the credit level of nodes.During the consensus process,the clusters are dynamically grouped,and the clusters are gradually split into multiple small clusters,and each node only needs to interact with other nodes in its group,which better reduces the consensus complexity.A simulation system is built for the LGBFT consensus algorithm,and the experimental results demonstrate that the LGBFT consensus algorithm has a higher performance than the PBFT consensus algorithm when the cluster size is larger,and the amount of improvement shows an increasing trend with the increase of the cluster size.(3)The requirements of the catering supply chain traceability system are analyzed in detail,the LGBFT consensus algorithm is combined with the catering supply chain management system,and the catering supply chain traceability system based on the LGBFT consensus algorithm is built,and the system is implemented,deployed,and tested in a more detailed automation and performance test,and it is proved after the test that the system meets the requirements of the catering supply chain traceability system,and at the same time The stability and performance of the system can also reach the expected level. |