## 4 Improvement of PBFT Algorithm  
Since the advent of Bitcoin, blockchain has gradually become a research hotspot in the academic world. As a key technology of blockchain, the consensus algorithm has attracted more and more researchers' attention. Due to the complex and changeable operating environment of blockchain, it is easy to introduce Byzantine nodes into the system, so the Byzantine fault-tolerant consensus algorithm of blockchain must be overcome. The common consensus mechanisms in blockchain include proof-of-work (PoW), proof-of-stake (PoS), and delegated proof-of-stake (DPoS). The practical Byzantine fault-tolerant (PBFT), and most of the other consensus mechanisms are derived from these four mechanisms. Table 1 lists the communication overheads, computing overheads, fault tolerances, throughput, response times, and application platforms of the four algorithms. Compared with PoW and other proof algorithms, the PBFT algorithm has a throughput of thousands of TPS and a response time of seconds, and is considered to be a consensus algorithm suitable for the IoT. However, in a network with N nodes, the PBFT algorithm needs N nodes to broadcast messages twice to the whole network to complete a round of consensus. When the number of nodes in the system increases, the traffic between nodes increases sharply, which brings great pressure on network bandwidth and leads to rapid degradation of system performance. Therefore, the PBFT algorithm is not suitable for a large-scale network environment. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \multirow{2}{*}{**Consensus**} & **Communication** & **Computing** & \multirow{2}{*}{**Fault Tolerance**} & **Throughput** & **Response Time** & **Application** \\  & **Overhead** & **Overhead** & & & **Platform** \\ \hline PoW & Low & High & 1/2 & \(\approx\)7 TPS & 10 min & Bitcoin \\ PoS & Low & Medium & 1/2 & \(\geq\)25 TPS & 1 min & Peercoin \\ DPoS & Low & Low & 1/2 & \(\geq\)300 TPS & \(\approx\)3 s & EOS \\ PBFT & High & Low & 1/3 & \(\geq\)1000 TPS & Second level & Hyperledger \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Consensus algorithm complexity analysis. Figure 3: Flow chart of data consistency between edge nodes. The consensus mechanism is the core technology of blockchain. It determines whether a new block is verified and who keeps records, affecting the security and reliability of the whole system [22]. The practical Byzantine fault tolerance (PBFT) algorithm is adopted as the consensus algorithm in this paper, but the PBFT algorithm has the following problems:  
1. Main node selection problem. Each node of the PBFT algorithm has the same probability of becoming the main node, and they take turns to become the main node and undertake the block task. Selecting the main node in the above way will make some nodes with low performance or poor performance in the consensus process become the main node, which will affect the efficiency of block generation in the system and reduce the system performance. 2. Traffic problems. During the PBFT algorithm's conformance protocol preparation and submission phases, each slave node broadcasts information to all nodes, resulting in O (n\({}^{2}\)) traffic in the consensus process, as shown in Figure 4. As a result, the number of node communications increases power with the increase of node number, which leads to the decrease of consensus efficiency and seriously affects system scalability. In view of the above problems, ref. [23] improved the PBFT algorithm in terms of consensus strategy, and ensured the coordination and security of the algorithm by dividing nodes and clusters. In terms of node selection, ref. [24] improved the PBFT algorithm by dividing multiple node sets according to node responsibilities, making it suitable for dynamic blockchain with a constantly changing number of nodes. In terms of method innovation, ref.