Aiming at the problems of PBFT algorithm of consortium blockchain, such as high communication overhead, low consensus efficiency, and random selection of leader nodes, an optimized algorithm of PBFT is proposed. Firstly, the algorithm improves C4.5 and introduces weighted average information gain to overcome the mutual influence between conditional attributes and improve the classification accuracy. Then classify the nodes with improved C4.5, and select the ones with a high trust level to form the main consensus group. Finally, the integral voting mechanism is introduced to determine the leader node. Experimental results show that compared with traditional PBFT algorithm, the communication times of the improved PBFT algorithm are reduced greatly, which effectively alleviates the problem that the number of nodes in traditional PBFT algorithm increases and the traffic volume is too large, and significantly reduces the probability of the leader node doing evil and improves the consensus efficiency.