Abstract:Federated blockchain systems find widely application in fields such as finance and logistics. However, the practical Byzantine fault tolerance (PBFT) algorithm, commonly applied to these systems, encounters challenges of low scalability and high communication cost, limiting its effectiveness in large-scale scenarios. To address these issues, the k-PBFT consensus algorithm, a dynamic multi-organizational practical Byzantine fault-tolerant algorithm, is proposed. The k-PBFT algorithm leverages an enhanced k-means algorithm to partition nodes into multiple autonomous organizations based on node time delays and communication distances. Each organization communicates through designated representative nodes. When a new node joins, it is assigned to the most suitable organization based on its characteristics. Additionally, the k-PBFT algorithm improves system security by introducing a reputation mechanism to distinguish honest nodes from malicious ones. It also implements a node tenure mechanism, giving honest node in the blockchain the opportunity to serve as representative or master node within an organization. Experimental results show significant improvements over the PBFT algorithm: the k-PBFT algorithm reduces communication complexity by 75%, decreases latency by 210 ms, and increases throughput by 100% with 100 nodes. In high-latency environments, the k-PBFT algorithm reduces latency by 20% and boosts throughput by 17% compared to the improved PBFT algorithm based on reputation grouping with 100 nodes.