The consensus algorithm, as one of the cores of blockchain technology, plays a very critical role. As one of the mainstream consensus methods, PBFT has the advantages such as low energy consumption and large throughput. However, the traditional PBFT algorithm also has disadvantages, such as high network bandwidth occupation, for PBFT needs broadcasting information for all nodes in stage 3 and 4; limited expandability. With the increase of nodes, the bandwidth overhead of the blockchain network will increase significantly, which leads to a decrease in throughput, so that cause a crash of the blockchain network. We proposed an improved PBFT consensus based on a credit value bidirectionally waning, named BW-PBFT. The algorithm first elects some nodes to form a committee according to the ballot and the credit value, and then the committee nodes use the PBFT algorithm for consensus, and calculate the credit value of the nodes according to the performance in the consensus process. If nodes do not get punishment anymore, their credit value will approach 50 with the increase of the blockchain height. Theoretical analysis and experiments prove that the proposed algorithm can effectively improve the quality of the nodes involved in the consensus.