Consensus mechanism is the core of blockchain technology, and consensus algorithms are the specific technical means to achieve this mechanism. Consensus mechanism ensures consistency and correctness of blockchain database, and is crucial to system performance of the blockchain such as security, scalability and throughput. Therefore, firstly, from perspective of underlying storage of blockchain technology, consensus algorithms were divided into two categories: chain and graph, and working principles, optimization strategies and typical representative algorithms of different types of different categories of consensus algorithms were classified and reviewed. Then, in view of complex application background of blockchain, the mainstream improved algorithms of chain structure and graph structure consensus algorithms were sorted out respectively and comprehensively, and main line of consensus algorithm development was given, especially in terms of security, the algorithms were compared deeply, and advantages, disadvantages and possible security risks of them were pointed out. Finally, from multiple dimensions such as security, scalability, fairness and incentive strategy, challenges faced by the current blockchain consensus algorithms were discussed in depth, and their development trends were prospected, so as to provide theoretical reference for researchers.