Abstract In order to solve the problems of the cumbersome user authentication process, insecure identity information, and vulnerable authentication system in traditional identity authentication, a distributed identity authentication method based on blockchain technology is proposed, which utilizes decentralization and is not easy to tamper with characteristics of blockchain and asymmetric encryption to improve the security and stability of user identity authentication system. On this basis, a digital identity authentication optimization scheme is designed, including the use of a hash chain to improve the data structure and the consistency of node data by optimizing the consensus mechanism to enhance authentication security and efficiency. Finally, the automation of authentication is also achieved by introducing smart contracts. The experimental results show that the computational spend of blockchain technology is 55.47% and 97.36% less than the two traditional algorithms, and the overall security score is 22, while the conventional scheme is only 12.5. The blockchain-based authentication mechanism improves the reliability and efficiency of the authentication system.