The ever-increasing electrical energy demand, growth of renewable energy sources, cyber-physical security threats, increased penetration of electric vehicles (EV) and unpredictable behavior of prosumers and EV users creates instability in the overall power grid system. To be able to manage the demand-response in a timely manner there is a need to predict the usage pattern for the control loop to adapt accordingly. Thus, proper day-ahead controlling and scheduling of distributed energy resources using prediction algorithms is required to meet the smart grids load demand. Using a centralized DSO create problems of single point failure and trust building for such operations. Secure communication between many customers and entities is also an important part of many smart-grid solutions. Distributed energy management and decentralized energy trading between prosumers can be achieved using blockchain technology and machine learning techniques. Blockchain smart contracts allows P2P distributed energy exchange of electricity generated by prosumers without third party intervention. Machine learning techniques help to create a prediction model based on energy usage data. Security and resilience to several cyber attacks is critical for powergrids which remain as a main challenge to overcome. Applying blockchain will help to increase delity and security by creating a distributed trust platform. Blockchain can also be used as a solution to several optimization and reliability challenges within the grid. Hence in this review, we identify the potential of blockchain technology and machine learning techniques in smart grid and the benefits achieved by combining both together to develop a future smart grid scenario by reviewing several related works. In the end we discuss research challenges and future research directions of applying blockchain and machine learning techniques for smart grid system. The identified areas that require significant research are demand management in power grids, improving security of grids with better consensus mechanisms, scheduling of the entire grid system, guarantee of origin, designing secure microgrids and interconnection of different blockchain networks.