Blog: Using smart contracts to balance grids and integrate renewable energies via EV fleet charging, part 2/2

Collab: Francesco Bellesini, Emotion SRL & Giuseppe Raveduto, Engineering Ingegneria Informatica
Part 1/2 of this blog can be read: here.

The marketplace & smart contracts

When we think about a marketplace, one of the images that comes in mind is that of a crowded location in which countless interactions among different people are taking place at the same time.

If you go further, you can start to identify different kinds of marketplaces and relations: In some cases you have just one seller and different buyers, sometimes it’s the other way around with one buyer looking for the best price among different sellers, and often it’s what computer scientists call a “many-to-many” relation in which different sellers are offering their goods or services to different buyers. Also, all the interactions can happen in real time or inside time-boxed sessions (during an auction, for example), at a fixed price or with a price determined dynamically based on the equilibrium between request and demand (the “clearing price” used in any exchange, for example).

In SOFIE, we started to conceptualize all of these characteristics and model them as a software to determine if and how the emerging “smart contracts” could help us to build a new decentralized, fair, transparent, and secure marketplace powered by the blockchain.

Smart contracts exploit the blockchain mechanisms to provide a tamper-proof decentralized “world computer” allowing developers to deploy and execute their programs. The power of smart contracts relies on the ability to store its own state into a blockchain, making it possible the storage of arbitrary data and on the ability to implement arbitrary logic for any type of custom applications.

The characteristics of the smart contracts made it possible to develop and test in a real-world scenario the marketplace software model that we defined, making it possible for DSOs, Fleet Managers and Energy Retailers to operate together on the same marketplace contributing, with their transactions, to stabilize the local electrical grid.


But what makes this solution special, in comparison with any other software-based marketplace?

The fact that smart contracts are deployed on a blockchain means that they are running on a decentralized and cryptographically secured platform, so that it’s not possible to alter the way it operates arbitrarily.

This is particularly interesting if we analyse how it applies to the matchmaking algorithm used in our smart contract: the fact that the rules are written inside the smart contract and not on a software running on a machine owned by a specific entity, ensures that all the participants to the marketplace will be treated fairly and that the winning offers are selected transparently. In this way even a small new operator on the market can be sure that its offer will be selected if it’s the best one, without any kind of bias.


Another great innovation brought by the blockchain is the self-enforcing capability of the smart contracts.

In a traditional energy market there would be a long time for the payment settlement. The agreements on the marketplace have to be registered, the measures from the energy meters collected, and then there should be enough time to ensure that none of the parties involved raise any dispute about the transaction. 

The aggregators working on this field can wait up to 30 days to be paid after a successful transaction!

Using a smart contract capable to interface directly with the smart meters on the grid can reduce this to a near real time process. The smart contract waits for the time agreed on the market session, verifies directly that the energy transaction is happening and, once that the agreed quantity has been transferred, unlocks the payment without the need for longer settlement times.

Photos: Pixabay