# Energy Blockchain for Public Energy Communities
## 2 Materials and Methods
### LEC Sustainability KPIs  
The schematic of the proposed platform is given in Figure 2. One of the main advantages of the proposed platform is using the publicly disclosed data for performing evaluations of the respective institution sustainability. In particular, KPI calculations algorithms can be made available and saved on the blockchain as open-source code. These algorithms can be used by the community and directly applied to the production and con  
Figure 1: Architecture of the local energy community (LEC) management. sumption data already existing on the platform. In this way, it is possible to automatically calculate and share these results participating in a public institution in nearly real-time. In addition, the resulting KPIs can be shared back to the blockchain. Since the algorithms are open, these calculations can be verified again by the community and shareholders, creating entrusting feedback that leads to community proposed and validated analysis of the public institution behavior in terms of energetic and environmental sustainability. Some basic KPIs, commonly adopted in the specific application context, have been applied to the data obtained from the test site readings available in the blockchain to introduce this possibility [28; 29]. The proposed KPIs are the total cost for the system and the total carbon emissions. \(C(t)\), the total system cost at time interval \(t\) is calculated with Equation (1). Here, \(B_{i}(t)\) is the cost of energy bought from the grid by building \(i\). \(S_{i}(t)\) is the gain obtained by building \(i\) from the selling energy to the grid. \(PV_{i}^{a}(t)\) and \(ES_{i}^{a}(t)\) are the amortization costs of the PV sources and of the energy storage systems installed on each building \(i\). The amortization costs of each device \(i\) have been included in a simple formulation, since they were not the core of the research. For this particular case, these costs have been calculated on a linear base assuming a fixed device lifetime, and the (constant, daily) amortization costs have been added on daily basis on top of the computed costs. These amortization costs, for each device \(i\) and for a time interval \(\Delta t\), namely \(A_{i}(\Delta t)\) have been calculated as shown in Equation (2), where \(I_{i}\) is the initial investment, and \(LT_{i}\) is its expected lifetime. All the quantities are calculated for the selected time interval \(t\). \[C(t)=\sum_{i}(B_{i}(t)-S_{i}(t)+PV_{i}^{a}(t)+ES_{i}^{a}(t)), \tag{1}\]  
\[A_{i}(\Delta t)=\frac{I_{i}}{LT_{i}}\cdot\Delta t. \tag{2}\]  
\(E(t)\), the total emissions of CO\({}_{2}\) of the system, are calculated with Equation (3). The emission factor \(EF\) has been chosen to be equal to 444.4 g CO\({}_{2}\)/kWh, as calculated by the Italian Institute for environmental Protection and Research in Reference [30]. \[E(t)=\sum_{j\in l}(E_{b,j}(t)*EF), \tag{3}\]  
where \(E_{b,j}(t)\) represents the energy bought from the grid ([kWh]) at time \(t\) from the building \(j\), while set I represents the building set, in which are considered the library, the sports  
Figure 2: A schematic view of the proposed platform and actors. chub, the City hall, a primary school and a police building. These KPIs have been initially calculated for the current situation. From an energetic point of view, each building is managed independently from the others, despite their geographical and electrical proximity. In this setup, each building buys energy at retail price and sells it at wholesale price. If a building has the ability to sell energy in the hours of higher production from renewable and low value in the market, and needs to buy it back in hours when the price is higher, significant diseconomies occur, as shown in Figure 3.  
As a second scenario, the public buildings federate into an LEC, where over and under generation are settled among the LEC participants.