With the integration of Wireless Sensor Networks and the Internet of Things, the smart grid is being projected as a solution for the challenges regarding electricity supply in the future. However, security and privacy issues in the consumption and trading of electricity data pose serious challenges in the adoption of the smart grid. To address these challenges, blockchain technology is being researched for applicability in the smart grid. In this paper, important application areas of blockchain in the smart grid are discussed. One use case of each area is discussed in detail, suggesting a suitable blockchain architecture, a sample block structure and the potential blockchain technicalities employed in it. The blockchain can be used for peer-to-peer energy trading, where a credit-based payment scheme can enhance the energy trading process. Efficient data aggregation schemes based on the blockchain technology can be used to overcome the challenges related to privacy and security in the grid. Energy distribution systems can also use blockchain to remotely control energy flow to a particular area by monitoring the usage statistics of that area. Further, blockchain-based frameworks can also help in the diagnosis and maintenance of smart grid equipment. We also discuss several commercial implementations of blockchain in the smart grid. Finally, various challenges to be addressed for integrating these two technologies are discussed.