## 3 Proposed PBFT Architecture and Model
### Consensus Process of Proposed PBFT
#### 3.3.2 Consensus Stage  
The proposed PBFT method divides all nodes participating in the network into several clusters. Nodes within each cluster are further divided into groups for the consensus process. Consensus times tend to increase as the number of nodes in a cluster increases. To solve this problem, we improved and applied dynamic grouping and hierarchy management methods. Figure 4 shows the consensus process of the proposed PBFT method. As shown in Figure 4, the consensus process of the proposed PBFT method is subdivided into seven phases. The consensus algorithm for each cluster comprises the following steps:  
* Pre-Request Phase: This involves sending a consensus request message to each cluster. * Request Phase: The Cluster Primary Node (CPN) verifies the received message and broadcasts it to the lower-level Group Primary Nodes (GPNs). Also, the GPN that receives the message propagates the message to GPNs in its lower layers. * Pre-Prepare phase: The GPN of each group forwards the request message to the NNs of its own group and performs verification. * Prepare Phase: Each group prepares for consensus by verifying the message and its intent. * Commit Phase: Consensus is confirmed within each group, and the decision to commit the transaction is made. * Pre-Reply Phase: This phase aggregates the consensus results from each group within the cluster. * Reply Phase: The final consensus results are returned to the client. Furthermore, we propose a model to estimate the expected consensus time of these detailed phases. We also use the expected consensus time estimation model to find the optimal hierarchy structure. In other words, the proposed PBFT dynamically adjusts the number of layers and the number of nodes per group, which can minimize consensus time using the expected consensus time estimation model. The following is a detailed description of the actions taken in each phase and a comprehensive explanation of the execution time estimation model for each phase. Figure 3: An example of blockchain network structure with location-based clustering. (1) Pre-Request Phase: This is the phase where the client or transaction pool manager logically converts the transaction to be agreed upon into block format and creates a consensus message. The consensus message generated in this way is sent to the CPN of each cluster. In this step, the consensus message is assigned a unique number. The previous unique number is reassigned if consensus on the previous consensus message fails and is not reflected in the blockchain. This mechanism allows information to be passed on to nodes participating in the blockchain without a separate synchronization step or reflection confirmation. After receiving the consensus message, the CPN verifies its contents and ensures there are no problems. During this verification, the CPN checks the unique identifier of the consensus message. If it contains information indicating that changes to the ledger are required based on the cluster's previous consensus, the CPN initiates the transition to the next block. The estimated time required for this Pre-Request phase can be calculated using the Equation (1). \[T_{\textit{Pre-Request}}=(\frac{S_{\textit{block}}}{BW}+L_{\textit{inter}}) \times N_{\textit{cluster}} \tag{1}\]  
(2) Request Phase: This phase marks the initiation of consensus for each cluster. The CPN evaluates the integrity of the consensus messages received from the client or administrator. In the absence of anomalies, the CPN broadcasts the consensus message to the GPNs located in the first layer of the hierarchy of the cluster it manages. At this point, the CPN checks for any changes in the number of nodes within the blockchain network of the cluster it manages. If changes are detected, it proceeds with the reconfiguration of groups and the hierarchical structure. The process of group reconfiguration and the transmission of the reconfigured group information is explained in detail in Section 3.3.4.