The advancement of mircogrids and the adoption of blockchain technology in the energy-trading sector can build a robust and sustainable energy infrastructure. The decentralization and transparency of blockchain technology have several advantages for data management, security, and trust. In particular, the uses of smart contracts can provide automated transaction in energy trading. Individual entities (household, industries, institutes, etc.) have shown increasing interest in producing power from potential renewable energy sources for their own usage and also in distributing this power to the energy market if possible. The key success in energy trading significantly depends on understanding one’s own energy demand and production capability. For example, the production from a solar panel is highly correlated with the weather condition, and an efficient machine learning model can characterize the relationship to estimate the production at any time. In this article, we propose an architecture for energy trading that uses smart contracts in conjunction with an efficient machine learning algorithm to determine participants’ appropriate energy productions and streamline the auction process. We conducted an analysis on various machine learning models to identify the best suited model to be used with the smart contract in energy trading.