# A Blockchain-Based Real-Time Power Balancing Service for Trustless Renewable Energy Grids
## 4 Prototype Decentralized Application
### DApp Front-End  
The developed DApp has a front-end module providing the user with a web-based graphical interface to manage the balance service operation from the aggregator's point of view. That is, it allows the user to issue aggregated modulation (balance) commands to the associated DERs and configure and install in the blockchain a set of smart contracts that govern the interactions with the DERs. Finally, the front-end allows users to instantiate within the blockchain a set of identities, for an amount that is user-configured. This set of blockchain identities, i.e., accounts, corresponds to the blockchain endpoints of the pool of managed DERs. Thus, any transaction involving one of the said accounts corresponds to an interaction between the smart IoT device of a specific DER plant and the aggregator, and will, in turn, be the execution of a specific smart contract transaction implementing one of their business logic operations. Since Ethereum is a public blockchain, open to anybody to start transactions, to protect our system from tampering, our application's smart contract firstly checks that the originating account is either the aggregator or a known prosumer, i.e., the prosumer has to have an account already registered with the aggregator service. A large part of the front-end graphical interface is reserved for the monitoring dashboard, which, based on the data continuously read from the blockchain, draws a graph showing to the user the current cumulative power output of the managed DERs' pool, in real time. Figure 2 shows a screenshot of the front-end during the system's initialization phase. While DERs interact with the aggregator exclusively through the blockchain, a set of corresponding modules, named \"IoTs\", is instantiated for each DER in the DApp front-end, to represent the data flow out of smart metering IoT devices in the DERs. The aggregator then acquires those readings via secure and private Internet links (that is, outside the blockchain) to have a real-time monitoring of the DERs' plant energy production. For the real-time monitoring of produced/consumed power, the aggregator relies on its own smart meters, installed on the premises of the prosumers' or consumers' sites. These data flows are assumed to travel on a separate network, i.e., encoded over the powerline or a suitable digital link, and flow unidirectionally towards the aggregator. This is a choice motivated by several considerations: (1) blockchains do allow trustless \"agreements\", but do not provide a way to trust \"unilateral\" statements: the meter readings can only be trusted by the aggregator if coming from its own meters; (2) the meter readings are relatively frequent and continuous, and blockchains are not ideal tools to handle fast-paced, sustained, real-time data flows; (3) the meter readings have a very short lifespan, and logging them to the blockchain would be pointless unless the application requires a public and undisputable log to be created for future reference. Other than that, they are only temporarily interesting for the aggregator in order to perform a reality check, to verify the correctness of the power data claimed by the prosumers in their recent transaction requests. Please note that relying on an external communication network for this one-way monitoring data-path complements the blockchain interactions and does not compromise the trustless relation that the blockchain implements between the large community of users and the aggregator for the realization of the balancing service, which is the core of the proposed design. Figure 2: Front-end page of the virtual balance operator DApp, shown in the DERs’ pool set-up phase (last accessed on 28 September 2023). To simulate the DERs' physical smart meters, required to test our DApp, a corresponding number of IoT software objects was instantiated to generate simulated data with an algorithm corresponding to one of (currently) two types of renewable energy sources, solar and wind, with a reading frequency that can be tuned from the DApp front-end.