| Traceability is not only an important means to solve commodity safety,but also one of the important methods in current commodity supply chain management.Traditional commodity traceability systems use centralized data management,which poses a series of issues such as information being easily tampered with,inability to trace transactions,and difficulty in providing evidence,which can infringe on the legitimate rights and interests of consumers.As a distributed database,blockchain has the characteristics of being away from the central node,data tamper resistant,traceable and anonymity,which can bring new solutions for data traceability.The Practical Byzantine Fault Tolerance(PBFT)algorithm is developed for distributed system execution environments with state machine replica replication as the main focus.Although it is one of the core algorithms in blockchain technology,it has problems such as high consensus process latency,low efficiency in selecting master nodes,and inability to dynamically add or delete nodes,which limits the scalability of product traceability.This paper mainly conducts research on the following aspects to address the above issues:(1)This paper proposes a two-stage PBFT algorithm to address the issue of high consensus process latency in the PBFT algorithm.It is planned to delete the client role in this stage,so that it no longer participates in the communication transmission of the consensus process.Correspondingly,the system no longer needs to respond to the client,and the Reply stage can also be deleted.If a node receives r-f messages from different nodes,it represents a consensus among all nodes.(2)In response to the low efficiency of the main node selection process in the PBFT algorithm,this paper proposes to design a strength evaluation rule that divides nodes in the network into general nodes,strong nodes,and weak nodes based on their vulnerability to attack.When selecting the main node,the system only selects strong nodes as the main node based on the strength value,effectively reducing the possibility of malicious nodes wasting resources as the main node.(3)In response to the problem of PBFT algorithm network nodes being unable to be dynamically added or deleted,this article proposes to add a link to handle node addition or deletion requests before each round of consensus,in order to improve the algorithm.After simulating and running the algorithm and conducting a series of comparative experiments,the data results show that the optimized algorithm reduces communication overhead,improves throughput,and increases dynamism while ensuring fault tolerance.It has certain performance advantages.(4)Using the improved and optimized PBFT algorithm as the consensus mechanism,this paper designs and implements a product traceability system based on blockchain technology.Through the demand analysis,feasibility analysis,overall architecture design,database design,etc.of the system prototype,the system can upload the entire supply chain information of goods and store it in the blockchain.Consumers can query the complete circulation of goods through the system to achieve the purpose of anti-counterfeiting traceability. |