Skip to content
IJBAS International Journal of Basic and Applied Sciences E-ISSN 2227-5053

Blockchain-Driven Decentralized Green Energy Trading using Python and Ganache

Authors and Affiliations

  • Mr. R. Kavin Research Scholar, Department of Electrical and Electronics Engineering ‎, Karunya Institute of Technology and Sciences, Coimbatore, India
  • Dr. J. Jayakumar Professor, Department of Electrical and Electronics Engineering, Karunya Institute of Technology and Sciences, Coimbatore, India

About this article

Download PDF

Abstract

Efficient energy sharing among solar-based microgrids was crucial for enhancing grid reliability, scalability, and sustainability in modern energy systems. This research presents a novel blockchain-powered decentralized energy trading framework that integrates Raspberry Pi 4, IoT-driven real-time monitoring, and Ethereum-based smart contracts to facilitate seamless and secure peer-to-peer (P2P) energy exchange. The proposed system enables real-time data acquisition and transmission of critical energy parameters, including current, voltage, and power generation, from five interconnected solar microgrids. Raspberry Pi 4 serves as the centralized edge computing node, aggregating and transmitting real-time energy data to the ThingSpeak IoT platform, where advanced AI-driven analytics optimize grid efficiency. Blockchain technology, specifically Ethereum with Ganache, was employed to create a tamper-proof, transparent, and trustless energy marketplace, eliminating reliance on centralized energy intermediaries. The incorporation of Solidity-based smart contracts automates transactions, ensuring secure, immutable, and fair energy trading while enabling dynamic pricing models based on real-time demand-supply conditions. Python, integrated with Web3.py, facilitates seamless interaction between Raspberry Pi 4 and the blockchain network, ensuring low-latency transaction execution and verifiable trade settlements. Through the integration of IoT-enabled smart grids, blockchain-based energy transactions, and AI-driven predictive analytics, the proposed system offers a scalable, autonomous, and energy-efficient solution for decentralized energy management. Experimental validation confirms the system's effectiveness, demonstrating its ability to achieve real-time energy balancing, seamless P2P trading, and enhanced security through blockchain immutability. This cutting-edge approach significantly advances the adoption of renewable energy sources, optimizes microgrid autonomy, and reinforces the resilience of next-generation smart power networks, paving the way for a sustainable and decentralized energy economy.

Keywords

  • Peer-to-Peer
  • Energy Trading
  • Ethereum
  • Blockchain
  • Python

References

[1] R. Kavin, Dr.J.Jayakumar, “Energy Management System for Distributed Energy Resources using Blockchain Technology” ‎Recent Patents on Engi-neering, Vol 19, No.1, P.no-93-102 2025.‎ https://doi.org/10.14419/xx1m2155.

[2] R.Kavin, Dr.J.Jayakumar, “Decentralized Renewable Power Generation Using IOT And Blockchain Technology,” International ‎Journal of Basic and Applied Sciences, 14 (2) (2025) 319-327.‎ https://doi.org/10.14419/xx1m2155.

[3] ‎F. Alam Khan, M. Asif, A. Ahmad, M. Alharbi, and H. Aljuaid, "Blockchain technology, improvement suggestions, security ‎challenges on smart grid and its application in healthcare for sustainable development", Sustainable Society, vol.55, p. 102018, 2020. ‎ https://doi.org/10.1016/j.scs.2020.102018.

[4] Adetomike Adeyemia, Mingyu Yana, Mohammad Shahidehpoura, Cristina Boterob, Alba Valbuena Guerrab, Niroj ‎Gurungb, Liuxi (Calvin) Zhangb, Aleksi Paasob “Blockchain technology applications in power distribution systems” The Electricity ‎Journal Volume 33, Issue 8, October 2020, 106817.‎ https://doi.org/10.1016/j.tej.2020.106817.

[5] Xiaomin Du, Ying Qi, Beibei Chen, Biaoan Shan, and Xinyu Liu “The Integration of Blockchain Technology and Smart Grid: ‎Framework and Ap-plication” Hindawi Mathematical Problems in Engineering Volume 2021.‎ https://doi.org/10.1155/2021/9956385.

View more references (21)

[6] Ayman Esmat, Martijn de Vos, Yashar Ghiassi-Farrokhfal, Peter Palensky, Dick Epema “A novel decentralized platform for ‎peer-to-peer energy trad-ing market with blockchain technology” Applied Energy 116123, 2021‎. https://doi.org/10.1016/j.apenergy.2020.116123.

[7] Shuguo Chen, Weibin Ding, Zhongzheng Xiang and Yuanyuan Liu “Distributed Power Trading System Based on Blockchain ‎Technology” Hindawi Complexity Volume 2021.‎ https://doi.org/10.1155/2021/5538195.

[8] A.M. Asfar, "Blockchain implementation using smart grid-based smart city", In: Handbook of Research on Blockchain ‎Technology, vol. 44. 2021, pp. 4666-4670.‎ https://doi.org/10.1016/j.matpr.2020.11.013.

[9] K.T. Manish, "Emergence of blockchain-technology application in peer-to-peer electrical-energy trading: A review", Clean ‎Energy, vol. 5, no. 1, pp. 104-123, 2021.‎ https://doi.org/10.1093/ce/zkaa033.

[10] D. Oliver, M. Bessie, and S. Lindokhuhle, "Proposed framework for blockchain technology in a decentralised energy ‎network", Protection and Con-trol of Modern Power Systems., vol. 6, p. 3, 2021.‎ https://doi.org/10.1186/s41601-021-00209-8.

[11] H.A. Arezoo, M.H. Seyed, M. Bisheh-Niasar, M. Shafie-khah, and A. Hasan, "Blockchain technology in the future smart ‎grids: A comprehensive review and frameworks", International Journal of Electrical Power and Energy Systems, vol. 129, p. 106811, 2021.‎ https://doi.org/10.1016/j.ijepes.2021.106811.

[12] A. Kavousi-Fard, A. Abdulaziz, A. Al-Sumaiti, A. Farughian, and S. Alyami, "An effective secured peer-to-peer energy ‎market based on blockchain architecture for the interconnected microgrid and smart grid", International Journal of Electrical Power and ‎Energy Systems, vol. 132, p. 107171, 2021.‎ https://doi.org/10.1016/j.ijepes.2021.107171.

[13] Charithri Yapa “Survey on blockchain for future smart grids: Technical aspects, applications, integration challenges and future ‎research", Energy Re-ports., vol. 7, pp. 6530-6564, 2021. ‎ https://doi.org/10.1016/j.egyr.2021.09.112.

[14] B. Francesco, L. Gianluca, M. Lorenzo, and R. Antonia, "An Ethereum-based solution for energy trading in smart grids", ‎Digital ‎

[15] Communication Networks., vol. 9, no. 1, pp. 194-202, 2021.‎

[16] H. Li, F. Xiao, L. Yin, and F. Wu, "Application of blockchain technology in energy trading: A review", Frontiers in Energy ‎Research., vol. 9, p. 671133, 2021.‎ https://doi.org/10.3389/fenrg.2021.671133.

[17] P. Harshal, S. Shilpa, and R. Linesh, "Study of blockchain based smart grid for energy optimization", Materials Today: ‎Proceedings., vol. 44, no. 4666-4670 2021.‎ https://doi.org/10.1016/j.matpr.2020.11.013.

[18] A.G.A. Anak, and H. Rini, "Blockchain for smart grid", Journal of King Saud University-Computer and Informatic Sciences., ‎vol. 34, no. 3, pp. 666-6675, 2022.‎ https://doi.org/10.1016/j.jksuci.2020.01.002.

[19] X. Wang, F. Yao, and F. Wen, "Applications of blockchain technology in modern power systems: A brief survey", Energies., ‎vol. 15, p. 4516, 2022.‎ https://doi.org/10.3390/en15134516.

[20] S. Cantillo-Luna, R. Moreno-Chuquen, and R.C. Harold, "Blockchain for distributed energy resources management and ‎integration", IEEE Access, vol. 10, pp. 68598-68617, 2022.‎ https://doi.org/10.1109/ACCESS.2022.3184704.

[21] M.K. Hasan, A. Alkhalifah, S. Islam, and N.B.M. Babiker, "Blockchain technology on smart grid, energy trading, and big data: ‎Security issues, chal-lenges, and recommendations", Wireless. Communication. Mobile. Computing., vol. 2022.‎ https://doi.org/10.1155/2022/9065768.

[22] Oskar Juszczyk, and Khuram Shahzad “Blockchain Technology for Renewable Energy: Principles, Applications and Prospects” ‎‎2022, 15, 4603.‎ https://doi.org/10.3390/en15134603.

[23] Md Mahraj Murshalin AI Moti “Blockchain Based Smart-Grid Stackelberg Model for Electricity Trading and Price Forecasting ‎‎ Using Reinforcement Learning” Applied Sciences 2022‎

[24] Mirza Jabbar Aziz Baig “Blockchain based Peer to Peer Energy Trading System Using Open-Source Angular Framework and ‎Hypertext Transfer Protocol” Electronics, 2023‎

[25] Manmmet Singh “BSEMS-A Blockchain-Based Smart Energy Measurement System” Sensors 2023.‎ https://doi.org/10.3390/s23198086.

[26] Ziqiang Xu “Blockchain-Based Malicious Behaviour Management Scheme for Smart Grids” Smart Cities 2023.‎ https://doi.org/10.1155/2023/5794002.


How to Cite

Kavin, M. R., & Jayakumar, D. J. (2025). Blockchain-Driven Decentralized Green Energy Trading using Python and Ganache. International Journal of Basic and Applied Sciences, 14(8), 42-51. https://doi.org/10.14419/nky6ev75