Smart grids are developing rapidly, offering significant benefits but also major challenges. Among the main issues are trust between network players, transparency of energy transactions and data confidentiality. To address this, it is crucial to create energy transaction systems that ensure transparency, trust, and minimization of energy losses, while preserving the confidentiality of the information exchanged. An in-depth study led to the design of an innovative architecture in 7 layers, including a specific layer for energy transfer in order to accurately monitor consumption in smart grids. The division of smart grids into geographical areas aims to optimize energy transmission and reduce losses. In this article, a smart contract-based mechanism was developed, deployed on an Ethereum testnet to manage financial and energy transactions, to ensure transparency and build trust. A decentralized application (Dapp) has also been created to facilitate the management of these transactions. This architecture has been validated by comparative simulations between our market model and the one based on the double auction mechanism. The results show that our system, using energy consumption tokens on the Ethereum Virtual Machine (EVM) of the Sepolia testnet, reduces transaction losses, stabilizes prices, and maintains a high level of satisfaction through transparent and reliable transaction management and consumption tracking.