ABSTRACT Efficient energy distribution and utilization play a significant role in the energy grid, especially with renewable sources. The existing grid system has problems in resource utilization, data privacy, wireless communication, and dynamic demand handling. An energy grid is proposed based on IoT, blockchain, and machine learning techniques to solve the problems. The proposed energy grid architecture controls energy flow according to the demand, predicts expected load, analyzes consumer behavior, and enables the users in the grid trade energy in peer to peer manner. Energy flow in storage modules controlled with high voltage relays, and it automates the charging and discharging of respective battery pools in the grid. Energy consumption and battery status in the grid uploaded to the distributed file system. The data clustering model deployed in the server analyses those data and divides the consumers into three groups according to the consumer’s consumption behavior: high, moderate, and low consumption. The Time series analysis model deployed to forecast the load and predict peak hours. The codes deployed as a smart contract in an Ethereum blockchain platform. Machine learning algorithms are deployed for forecasting and clustering. In forecasting, the average error rate is 37% less than other generally used algorithms, and in the clustering algorithm, the accuracy increases as the dataset increases, which is 30% more than other cluster models. The controlled energy storage model in this grid provides up to 500–600 extra charge cycles for batteries than other traditional methods. The distributed IPFS storage provides data security, and smart contracts support grid operational security and data privacy. The data analyzation module of the grid helps effective resource utilization.