Nowadays, fingerprints as biometrics are among the most popular means of identity verification for various applications. However, they are susceptible to theft, tampering, or alteration by attackers after storage. Hence, it is critical to guarantee the privacy of these fingerprint templates because standard privacy techniques are not secure enough. Additionally, fingerprint templates are verified using a deep learning model to distinguish between authentic and fake fingerprints, making them more protected and secure by storing them inside a blockchain, which has become the most common secure technique in recent years. This paper implements the proposed efficient and secure biometric system for verification based on blockchain technology and hyperparameter optimization. First, for the storing phase, each user's authentic fingerprint template, private, and public keys are saved in the block and linked to the previous block in the chain by a hash function. If a hacker attempts to assault a fingerprint, all prior blocks must be changed. Second, for the authentication phase, the user logs in with his fingerprint and looks up the required template in the chain. If the required fingerprint exists, it creates a new block with the login details, and the number 1 is returned, which means that the authentication is valid; if it does not exist, it is verified to see if it is authentic or fake using the proposed biometric convolutional neural network (CNN). The proposed CNN uses the Grid Search (GS) algorithm to tune hyperparameters to distinguish between authentic and fake fingerprints. The SOCOFing dataset is used for evaluating our experiment. According to the experimental results, the proposed CNN model achieved the highest accuracy of 99.52%. As a result of the blockchain, our system can return authentication information after looking up the chain in 300 ms.