The current tremendous expansion of distributed energy sources and the democratization of electricity generation through conventional and renewable sources such as wind turbines, solar energy, and advances in energy storage capacity [
1,
2], combined with the advancement of digital communication and control technologies, have enabled the transition from traditional grid systems to what is known as a smart grid, in which traditional consumers have evolved into proactive prosumers that can join a grid branch of the larger distribution network and contribute to energy demand management within the grid they have joined, either with traditional fuel-based energy generators or renewable sources [
3,
4]. In addition, the integration of blockchain into the smart grid and the functionalities of smart contracts enabled the emergence of peer-to-peer energy trading [
5,
6], where prosumers can trade their energy generated and injected into the grid in a decentralized manner. It should be noted that the reduction of influence and control by a central authority is paramount in all blockchain-based applications [
7]. Similarly, the decentralization of Blockchain-based P2P energy trading platforms and the safe reduction of the authority of the DSO is an aimed target [
8,
9]. Since prosumers mainly use renewable energy sources, energy and climate policies promote and support such energy platforms to meet both increasing energy demand and sustainable climate goals [
10,
11]. On the other hand, end users can reduce their electricity costs and gain lucrative benefits, making such platforms a win-win scenario. In P2P energy trading platforms, prosumers are rewarded accordingly for their delivered energy through crypto-tokens, which are either fungible or non-fungible [
12] and delivered through appropriately designed smart contracts. In an integrated system, the utility has complete control over the location and connection of distributed energy resources (DER) and will seek to optimally manage demand, while in unbundled systems, each prosumer seeks its own benefit and its goal is to maximize its lucrative profit, according to market rules. Thus, from this perspective, a prosumer that joins a grid and the grid operator can potentially have conflicting goals. The DSO analyzes grid operations and grid investments in terms of peak power flows, while the prosumer sees its revenue in terms of aggregated energy exchange. Moreover, the flexibility of the smart grid, where new prosumers can constantly join or leave the grid, poses a challenge to the effective implementation of demand response control and management systems, which require less flexible deployment of hardware [
13]. Moreover, a demand response control and management system deployed by DSOs would not be considered a decentralized solution and would run counter to the consortium-based decision-making principle of blockchain applications. One of the most widely used demand response solutions is the OPF-based control system. The OPF solution aims to achieve a steady-state operating point in the grid that reduces power generation costs while satisfying demand and operating constraints [
14]. The approach to optimize the power injection within grids considering thresholds is generally challenging because it is a nonlinear and non-convex optimization problem. With renewable energy sources in the grid, the OPF problem becomes even more complicated in both formulation and solution because the generation capacities of the renewable energy sources, which are part of the constraints of the problem, are unpredictable [
15]. Therefore, many researchers have addressed the formulation and solution of the OPF problem for hybrid grids and presented a number of ingenious models [
16,
17]. Most of the works have focused on presenting realistic mathematical models or algorithms to solve the OPF problem for hybrid power sources. However, beyond that, little work has been conducted on how the computed OPF solution can be used for decentralized power generation control in smart grids. So far, the established scheme is to use control units (hardware and software), which does not go in the direction that aims to minimize DSO authority. In this paper, a novel decentralized, transparent, and secure OPF model is used to locally coordinate power generation in distributed networks while taking into account network constraints, without the need for a centralized control unit. The paper describes a detailed approach for implementing the decentralized OPF on a private blockchain smart contracts platform that enables an immutable and access-controlled transaction system for tokenized power assets. The model solves the OPF problem of a given grid where all constraints and fixed parameters are set within an immutable and autonomous smart contract. The only variable parameter is the load demand, which can be updated in the smart contract by a load monitoring unit, either periodically [
18] or in real time [
19] or even using short-term load forecasting [
5,
20], which would allow the smart contract to operate without any required outside interaction. The smart contract solves the OPF problem for a local network. The OPF solution would be computed by a decentralized, unbiased smart entity and would thus be unchallengeable. The solution would be stored in the blockchain public ledger, making it safe from tampering. Prosumers would only receive the energy tokens they are entitled to if they comply with the OPF solution of the smart contract.
The structure of the article can be outlined as follows:
Section 2 highlights the motivation of the presented work,
Section 3 investigates the feasibility of an on-chain solution to the OPF problem through a case evaluation of the execution cost of an on-chain solution for an OPF model for a three-bus network using the linear approximation DC-OPF. This is to show why such an approach is not realistic.
Section 4 describes the proposed new improved smart contract-based model that can be generalized for any defined OPF problem with effective execution cost. In
Section 5, we compare, discuss, and comment on the measured execution costs of the models from
Section 3 and
Section 4. Finally, we draw conclusions in
Section 6.