## 3 Scalable Dynamic Multi-Agent Byzantine Consensus
### Process
#### 3.2.1 Process in Pre-Prepare Stage
For example, when \(k\) is 7 and the total number of nodes is 336, the system only needs to be divided into two layers. The number of nodes in each area is 7, and the complete message is approximately of size 343. According to the analysis in Section 2.3, in the absence of hierarchy and agents, the total system traffic is \(2n^{2}\); that is, the communication complexity is O(\(n^{2}\)). Assume that the system has \(n\) nodes and the size of an area is \(k\). Then, the system satisfies:

\[\text{Number (layer)}=\log_{k}n \tag{13}\]

\[\text{Number (area)}=n/k \tag{14}\]

The traffic in the multi-agent system is approximately

Figure 3:0

\[ \begin{array}{l}=\frac{n}{k}\times 2k^{2}\log_{k}n\\ =2 nk\times\log_{k}n\end{array}  \tag{15}\]

That is, the communication complexity of the multi-agent blockchain system is approximately O(\(nk\times\log_{k}n\)). According to the above, the total number of messages that are sent by the system is related to the value of \(k\). At the same time, the delay of the system will be greatly reduced due to the synchronized execution among the autonomous areas. The experimental results are presented in Section 4. ### Correctness Conditions and Proof

In a blockchain system, the consensus nodes can suffer an arbitrary failure; for example, the nodes may stay silent, delay messages or change messages. Therefore, according to the principle of strong consistency, the proposed method is correct only when the system has the following three characteristics:

**Termination:** Every non-faulty node eventually decides on a value. **Proof:** Assuming that the system has a tolerance limit, suppose the tolerance time is \(T\). If the client receives no more than half of the votes that are collected by the agent within time \(T\), the system will forcibly terminate the execution of the request; otherwise, the block is written to the chain. In the agent multicast process, the agent multicasts the request information to each node according to the global spanning tree algorithm. The system should ensure that all consensus nodes are involved in the system. The agent is responsible for collecting the voting results of the current area and passing them to the upper level. If the agent is a faulty node or a Byzantine node, it is discarded. The system will eventually meet the conditions for entering the termination state. **Agreement:** All non-faulty nodes decide on the same value in a distributed system. **Proof:** Before the client node sends a request message to the consensus system, all consensus nodes start in the same state. A round in a consensus algorithm consists of the three steps: sending, receiving, and local computation. All nodes send the same messages, receive the same messages, perform the same local computation, and therefore end up in the same state. If a node is a faulty node, it will generate the mistake message, which is not counted by the agent. Therefore, all non-faulty nodes decide on the same value in our blockchain system. **Validity:** The consensus value must be the input of at least one node, and the non-faulty nodes must decide on the same consensus value. **Proof:** The validity condition implies that if all nodes have the same input \(x\), then the nodes must decide on \(x\). In our SDMA-PBFT algorithm, the input message is sent by the client and transferred by agents. Agents have only added the counting function and did not modify the view, message digest or other attributes; hence, the input is the same. Consensus depends on many parameters of the distributed blockchain system. Although faulty nodes exist, the operation of the system results in either agreement or disagreement in both cases. Therefore, our algorithm is valid. ### Nodes Join and Quit Dynamically and Freely

In practical applications, scalability is an important factor and lack of scalability hinders the application of such systems. According to the characteristics and performance indices of the blockchain system, we define blockchain scalability:

**Definition 7**. : _Scalability.