Optimization and Implementation of Hashgraph Consensus Algorithm Based on Path Storage Table
Hashgraph is a blockchain consensus algorithm that uses a Directed Acyclic Graph(DAG)structure in the database.Hashgraph introduces the concept of virtual voting,which allows nodes to send out blocks concurrently without additional communication overheads and achieves Byzantine fault tolerance in asynchronous scenarios.However,the virtual voting algorithm proposed by the Hashgraph has a high algorithmic time complexity,and the consensus operational logic is too complex.Accordingly,this study proposes a Hashgraph optimization scheme based on path storage tables.First,a witness determination method based on a vertex reachability table is proposed.The method records the reachability relationship between the generated and historical events in real time through storage paths.In the round partitioning stage,the backtracking algorithm is replaced by a function that queries the reachability information of the vertex events to reduce the time complexity of the witness determination algorithm.Second,a well-known witness determination method based on a historical reachability table is proposed to address the issue where the vertex reachability table cannot determine event relationships across rounds.The historical reachability table stores the reachability relationship between witnesses and historical events.It solves the problem of repeatedly backtracking views during the well-known witness determination stage by querying the historical reachability table.Finally,based on the vertex and historical reachability tables,the complex consensus calculation in the Hashgraph is improved to enhance the algorithm's efficiency and accelerate event confirmation speed.Experimental results show that,compared with the original Hashgraph consensus algorithm,the proposed optimization scheme improves algorithm efficiency by 65.76%and throughput by an average of 41.27%.