## 3 Scalable Dynamic Multi-Agent Byzantine Consensus
### Process
#### 3.2.1 Process in Pre-Prepare Stage
According to the hierarchical and clustering features of SDMA-PBFT, we set the area values to 1, 4, 7 and 10. When \(k=1\), the system is not hierarchical, which is equivalent to all the nodes being on the same layer, and the PBFT algorithm is run directly. When \(k=4\), 7, or 10, hierarchical clustering is performed. The results of traffic messages are shown in Figure 7.

According to Figure 7, after the agent nodes were selected to form hierarchical areas, the traffic decreased substantially. At the same time, the value of \(k\) also has an impact on the traffic. In practice, selecting the optimal value of \(k\) is the main issue that requires further discussion. ### Latency

Our SDMA-PBFT algorithms rely on timeouts to guarantee liveness. However, in some cases, inappropriate values of timeouts and network congestion will make a correct replica suspect or remove a correct primary. Especially for the agent nodes, we set various timeouts to simulate the algorithm. First, we define latency. The delay for the client node to send the request message to receive the determination result is called the latency. Due the impact of various factors in the real environment, it deviates from the theoretical latency. In our experiments, we first fixed the system \(n\) value and area and considered a numerical test system to obtain the latency. The experimental results are shown in Figure 8.

Figure 8: Latency for various values of k.

Figure 7: Traffic for various values of \(k\). According to Figure 8, as \(n\) increases, the total system latency increases. This is consistent with the theory. The more nodes there are, the longer the consensus time and the longer the total system latency. When the total number of nodes is 500, the time that is taken to reach a consensus is approximately 300 us, which increases to 700 us when \(n\) is 2500. This is far greater than the time it takes PBFT to reach a consensus on the same node. In addition, we tested the latency under various values of \(k\). The value of \(k\) has little effect on the system delay, but the overall trend is that with an increase in \(k\), the delay decreases initially and then increases. When the total number of nodes changes, the value if \(k\) of the area is dynamic when the system delay is minimal. In a distributed environment, system congestion or infinite wait is caused by information being affected by network conditions, which results in an increase in system latency. Therefore, we set the timeout for each agent node. If no information of other nodes is received within this time period, the node is regarded as a faulty node. With the timeout, the system will reduce the delay, physical loss, congestion and so on, so the timeout does not wait for the system results but continues the upper data transmission. Figure 8 shows the change in the system delay under various timeout conditions when \(n\) is 2500. According to Figure 9, the latency of the system decreases and then increases with an increase in \(k\). This is because the value of \(k\) affects the total system traffic. The same layer area is executed at the same time; the impact on the system is smaller. Voting results at different levels have a greater impact on the system. We fix \(n\) to 2500, and the system reaches the minimum delay when \(k\) is 8. At the same time, as the timeout increases from 10 us to 18 us, there is also a slight increase in system latency. When \(n\) is 2500 and the timeout value is 0.14 us, the system's output performance attains its minimum value. ### Throughput

In a blockchain distributed system, each client node can send a request to a consensus node to determine whether the transaction or block should be executed. We define the throughput of the blockchain system as the number of transactions that are handled per second (tx/s for short). A test was conducted on BHchain to evaluate the system throughput under various values of \(n\). We now evaluate the throughput that is achieved by various blockchain instantiations.