A blockchain is a decentralized peer to peer platform which provides security services based on some key concepts, namely authentication, confidentiality, integrity and authorization. It is the process of recording and keeping track of the resources without the intervention of a centralized authority. This paper provides an overview of blockchains, the structure of blockchains, consensus algorithms, etc., It compares the algorithms based on their utility and limitations. Though blockchains provide secure communication, there are some minimal data leaks which are discussed. Various security issues in blockchains are discussed such as denial of service attacks, etc., In addition to security, some other blockchain challenges are presented like scalability, reliability, interoperability, privacy and consensus mechanisms for integration with AI, IoT and edge computing. This paper also explains about the importance of blockchains in the fields of smart healthcare, smart grid, and smart financial systems. Overall, this paper gives the glimpse of various protocols, algorithms, applications, challenges and opportunities that are found in the blockchain domain.