Leveraging Blockchain Technology for Secure Energy Trading and Least-Cost Evaluation of Decentralized Contributions to Electrification in Sub-Saharan Africa

The International Energy Agency has projected that the total energy demand for electricity in sub-Saharan Africa (SSA) is expected to rise by an average of 4% per year up to 2040. It implies that ~620 million people are living without electricity in SSA. Going with the 2030 vision of the United Nations that electricity should be accessible to all, it is important that new technology and methods are provided. In comparison to other nations worldwide, smart grid (SG) is an emerging technology in SSA. SG is an information technology-enhanced power grid, which provides a two-way communication network between energy producers and customers. Also, it includes renewable energy, smart meters, and smart devices that help to manage energy demands and reduce energy generation costs. However, SG is facing inherent difficulties, such as energy theft, lack of trust, security, and privacy issues. Therefore, this paper proposes a blockchain-based decentralized energy system (BDES) to accelerate rural and urban electrification by improving service delivery while minimizing the cost of generation and addressing historical antipathy and cybersecurity risk within SSA. Additionally, energy insufficiency and fixed pricing schemes may raise concerns in SG, such as the imbalance of order. The paper also introduces a blockchain-based energy trading system, which includes price negotiation and incentive mechanisms to address the imbalance of order. Moreover, existing models for energy planning do not consider the effect of fill rate (FR) and service level (SL). A blockchain levelized cost of energy (BLCOE) is proposed as the least-cost solution that measures the impact of energy reliability on generation cost using FR and SL. Simulation results are presented to show the performance of the proposed model and the least-cost option varies with relative energy generation cost of centralized, decentralized and BDES infrastructure. Case studies of Burkina Faso, Cote d’Ivoire, Gambia, Liberia, Mali, and Senegal illustrate situations that are more suitable for BDES. For other SSA countries, BDES can cost-effectively service a large population and regions. Additionally, BLCOE reduces energy costs by approximately 95% for battery and 75% for the solar modules. The future BLCOE varies across SSA on an average of about 0.049 $/kWh as compared to 0.15 $/kWh of an existing system in the literature.


Introduction
With the world population explosion and industrialization growth in developing countries, consumers' need for energy consumption has reached an unprecedented level. As countries like India and China are speedily industrializing, the present limited set of traditional energy generating plants like natural gas and coal will no longer be sufficient [1]. Therefore, there is a need for the transition into renewable energy resources (RES) like micro-renewable, biomass, combined heat and power, geothermal, solar, and wind energy, which are decentralized [1]. A traditional energy system consists of energy generating plants, distribution and transmission lines, transformers, substations, and consumers. In a traditional energy system, centralized energy system (CES) plays a major role in coordinating, controlling, and managing different energy generating plants. However, the CES becomes inefficient because of high operation and maintenance cost (OM), lack of trust and untimely response (due to high traffic of energy requests). CES generates electricity at large scale and ensures economies of scale by reducing the energy set up cost; however, this benefit is often not felt in rural communities [2]. It is, therefore, necessary to consider the condition under which the energy needs of rural communities can be satisfied more efficiently via decentralized manners [3]. Decentralized energy system (DES) provides independent and flexible sources of energy that satisfy several communities. DES is a network of distributed RES off the grid, where each RES has a controller that communicates and negotiates conveniently with others to achieve their goals without the influence of a central controller. DES provides energy supply to critical facilities during emergency and outage, reduces energy storage cost, ensures fault tolerance and local accountability. However, frequent intermittency of RES's outputs at participants level can make DES complex [4,5].
Access to cheap electricity via the solar home system (SHS) is an evolving paradigm that integrates RES. SHS is a small-scale power system that offers a cost-effective way of satisfying household energy demand in the absence of the main grid [6]. greenSHS can improve the lives of approximately 1.1 billion people with inaccessible electricity worldwide, predominantly affected regions include sub-Sahara Africa (SSA) (i.e., 620 million), the geographical focus of this study; greenAsia (350 million); and the Caribbean and Latin America (20 million) [7]. In SSA, firms and households can withstand several hours of brownouts, which limit their potential usage of electricity. In Liberia, more than half of the households connected to the grid have no supply of electricity. Also, countries like Sierra Leone and Uganda experience energy reliability issues. In addition, more than 50% households in Nigeria, Ghana, Zimbabwe, and Burundi have no access to electricity [8]. The cost of energy in SSA is highest in the world, where regulatory tariff is below the cost-recovery levels. It potentially increases the existing problem of reliability of energy. To address these problems, this paper proposes a blockchain-based DES (BDES) to increase energy efficiency and fix tariff regulatory issues through a proposed price negotiation mechanism [9]. Reliable energy can contribute in increasing the uptake across and within countries, and countries can increase their tax revenues by more than 4% per year to address the problem of reliable energy [8]. Because of the energy market size of each country in SSA, there is a need for a pool of energy resources, which can reduce energy supply risk by taking advantage of economies of scale. In this study, a blockchain-based energy trading system is proposed, which automates and minimizes the cost of maintaining unpredictable growth in the number of participants in the energy market. Energy security has been debated over the past two decades as vital agendas for increasing country's uptake [10]. These energy security policies are mostly enforced in countries, such as the US, China, and the Middle East, rather than in the SSA. Large-scale resource mining, such as uranium, has been the focus of energy security in SSA, which has drawn investment boom; however, RES is given little attention. Nonetheless, Africans have tried to increase their local energy security by using variety of energy resources; however, there are no reliable data records for energy security and energy consumption by customers. Other factors that limit SSA energy security include energy supply risk, which can be mitigated by effective policy-making and regulation using cost-effective technology, and technical challenges like energy theft, which pose serious problems in energy management, especially in Botswana [11]. The regulatory framework also poses serious organizational and record-keeping challenges to energy security in SSA. Non-technical challenges include the problem of data access and ownership of large amounts of data generated from the energy consumption of consumers, which is personal and high value. Customers, however, are interested in the protection of their data, while utilities, on the other hand, depend on the data of customers to efficiently operate their energy plants. However, policy-makers are also interested in the data from consumers for cost-effective energy planning policies. Therefore, protecting the privacy of consumers' data and providing each stakeholder with the level of access it needs, is important. Data privacy is another problem in SSA, which poses a vital question of how secure consumers' data is to an adversary, and therefore an efficient mechanism needs to be provided. Also, due to the infrastructural strength of the energy system in SSA, one key challenge is communication, which comes with cybersecurity concern on the invasion of consumers' private data. This challenge arises when digital electricity infrastructure is implemented. Based on the above-mentioned challenges, high cost of energy generation in SSA, energy policy, and regional electrification investment plans may raise research questions about. • Is there any feasible long-term cost-effective energy planning model for energy generation in SSA? • Are there any solutions to historical antipathy or lack of trust and security that can jeopardize the process of regional decentralized energy cooperation in SSA? • Are there any technologies that provide a secure trade arrangement for cross-border electricity, which can effectively solve the problem of fair energy trading and payment in SSA?
A cost-effective energy planning model is used to compare the energy generation capacity of a CES with the options of DES that often consider solar with battery storage [2]. brown Several energy planning models were proposed in the literature to provide cost-effective solutions to classes of DES for different countries [12][13][14][15][16][17][18]; however, their focus was on isolated geographical locations. Although, the authors of [19] have proposed a model for energy planning for multiple SSA locations. However, its implementation was precluded by the lack of available knowledge of security, privacy, trust and energy trading. The authors of [11] highlighted the challenges of introducing smart grid (SG) in SSA to tackle energy crises, such as cybersecurity, regulatory framework, technical and non-technical issues. However, they do not consider energy crises in terms of declining storage capacity and electricity theft. Also, SSA's critical energy infrastructures are weak and unreliable in terms of energy storage and management in contrast with developed countries. Energy generations in SSA are insufficient to satisfy the increasing demand of the region, especially in peak time demands [11]. Therefore, it is necessary to introduce technology that can pool energy resources together. Although, the authors of [20] argued that introducing SG can provide equity and access to electricity in SSA. However, other SG challenges are not considered, such as lack of trust, privacy, and security. Based on the above limitations, it is clear that blockchain technology is not explored in SSA, which is the motivation of this study. In this paper, the main objective is to propose a secure BDES framework that leverage blockchain technology for decentralized electrification in SSA. First, a cost-effective energy planning solution is designed to estimate the cost of a CES, which is comparable to the cost of a DES, and analysis of the cost-benefit trade-off between energy costs of CES, DES, and the proposed BDES is also considered. Second, the issues of how to increase local energy supply through self-consumption and self-sufficiency or a secure cross-border exchange of energy via blockchain-based trading are discussed in this paper. Third, this study also proposes a blockchain-based energy price negotiation and incentive models that encourage prosumers to contribute their excess energy generations to the market. Fourth, excess rewards or incentives of prosumers are traded within the blockchain network using the proposed cryptocurrency trading framework. Furthermore, simulation results aim to illustrate the potential benefits of blockchain technology in a DES. Besides, it also provides high-reliability service at system protection and cost that outperforms the existing highly undependable grid system. At the end of the paper, all abbreviations used in this work are presented. This paper is the extension of the previous work [21] that provides the proposed BDES under study. The impact of energy reliability on generation costs based on the fill rate (FR) and service level (SL) for decentralized SHS using daily variations of location-specific solar resource data with 1 o latitude and longitude was proposed in the previous work. A Quasi-Newton's method was used to optimize solar modules and battery storage costs, whereas a multi-step optimization method was used to minimize the least-cost system. In the current study, the contributions are listed below.
1. This paper proposes a secure BDES that addresses the issue of historical antipathy (i.e., lack of trust) and security in order to establish decentralized electrification in SSA. 2. A blockchain-based mechanism for the trading and payment of energy in SSA is proposed to ensure fair regional and cross-border energy trade. New methods of self-consumption and self-sufficiency are included in the proposed energy trading mechanism to enhance energy trading for regional energy producers. 3. A cost-effective energy planning model is proposed to quantify the impact of energy reliability on generation costs. The proposed energy planning model is used to compare the economic energy generation costs between CES and DES in SSA. 4. Energy trading price negotiation and incentive mechanisms are also proposed to encourage more participation of energy users in energy trading and payment. Also, a mechanism for cryptocurrency trading is introduced to reduce excess rewards and alleviates the electricity debt of customers.
The organization of this paper is as follows. Section 2 provides the literature review, and Section 3 describes the proposed framework and problem formulations. Section 4 presents the simulation results and their discussions, and Section 5 provides the research implications. Finally, the conclusion and future work direction are given in Section 6.

Literature Review
This section presents the review of related work based on energy management in SG, blockchain for SG and least-cost evaluation of decentralized electrification in SG.

Energy Management in SG
In SG, prosumers are entities that produce and consume energy. Small-scale prosumers are individual prosumer who do not generate energy for commercial purposes, however, generate energy for its needs. Note that solar system is more suitable for small-scale deployment. Therefore, small-scale prosumers' energy can be metered by larger suppliers [22]. In addition, small-scale prosumers are not able to participate in the wholesale energy market because they contribute little to generation, transmission, and settlement procedures. Whereas, large-scale prosumers are regional utilities with small-scale energy deployment [23]. If prosumers are unable to meet their current energy demands, then the required energy demands are fulfilled from the grid. To ensure the stability of the grid and reduce peak requests, the utility employs demand-side management (DSM). It encourages customers to optimize their energy use through direct control or incentive mechanisms like dynamic pricing schemes [24]. DSM plays a vital role in shaping the overall energy demands of consumers along with distributed energy resources (DERs). DERs are small-scale RES generated at the consumers' side. DSM further reduces investment cost and improves the efficiency of the energy system. In addition, a dynamic pricing scheme like time of use is employed to incentivize consumers in terms of reduced cost to shift their high load demands from on-peak to off-peak time slots [25]. However, consumers can create rebound peaks during off-peak time slots as they exploit the low price in these time slots despite efficient scheduling mechanism. Although, DER owned by a single prosumer can be optimally operated and controlled [26]. However, operation and control of DERs from different prosumers may raise problems in storage and generation. In the literature, the game theory approach is used to model and coordinate individual prosumer within peer-to-peer (P2P) environment such that each entity hopes to maximize its payoff [27][28][29][30]. In P2P energy trading, fixed price mechanism becomes inefficient as the participants of energy trading need to set energy price based on negotiation, auction and sometimes through an analytical approach. Also, the accepted price by participants is usually lower than the grid price. Nevertheless, these participants create peaks in demand as they take advantage of the low price. In contrast to the fixed price mechanism, in a competitive market, the energy dual price variables (i.e., selling and buying) can be optimized [22]. However, the optimized price variables cannot be used to provide incentives if one participant has asymmetric information.

Blockchain for SG
Different countries have started sandbox implementation of blockchain projects in the energy sector by relaxing energy regulations at a minimal scale to allow innovations. This approach encourages energy inventors to test their prototype systems without affecting the energy system. Singapore National Electricity Regulations and the United Kingdom have deployed this approach, which attracted prominent blockchain investors to pilot their ideas with jurisdiction [31]. The government of New York State encourages investors to pursuit prototype projects by applying a range of technologies, not necessarily blockchain, with less restrictive regulations. Two years ago, utility services of network companies, such as Tennet Holding BV and Vattenfall AB, have adopted a testing software project for blockchain, with 23 utility companies like Iberdrola SA and Total SA participating in the project [32]. These utility companies participated because they wanted to test how blockchain works and whether it will pay off when used for trading [32]. Similar projects have been developed like Brooklyn that support efficient operations of energy systems, reduce energy cost, improve resilience and reliability [31,33]. Blockchain may assist in solving several problems of optimization [34] and energy reliability by providing visibility and control of real-time power injection and flow from DERs at substation level [35]. Large penetration of DERs without the precise cybersecurity measures, such as monitoring and trustworthy communication, may jeopardize the energy system and cause outages and reliability problem for consumers [35]. Attackers may modify DERs data being sent to energy management system by exploiting the insecure communication channel to compromise DER's control algorithm. Blockchain can be used to mitigate this type of attack by recording the data transaction time. In addition, it authenticates and verifies transaction data to drop any command that contradicts commands written in the smart contract [31]. Blockchain increases reliability and trust among participants, which are important features in data management that are not part of the traditional system. On the other hand, the traditional system is vulnerable to a single point of failure. If data is stored at a single point, then it will be difficult to audit and track due to the time of request. Blockchain helps to ensure that data is stored across all nodes [36].
Blockchain technology provides security, and improves communication and trade by increasing transparency of transactions. Also, blockchain provides traceability of consumers' payment data and trust between participants [37]. Furthermore, blockchain's cryptocurrency provides an avenue for autonomous market entities to participate in the energy market using P2P market model (i.e., a model providing direct energy trading between peers [27]). Blockchain and P2P energy infrastructures are also necessary for developing countries to achieve new and low cost of RES [37]. P2P energy trading system consists of buyers and sellers of RES, where a fabricated price of energy autonomously depends on the number of participants (i.e., producers and consumers) [25]. However, the fabricated price of energy may result in imbalance of orders (i.e., imbalance of order is a situation resulting from excess of buy or sell orders on trade exchange [38]). Blockchain can significantly minimize the fabricated price with the help of a smart contract. Blockchain smart contract is a computer script that provides terms and conditions, binds participants, and also transfers digital currencies or assets between participants [37].
Based on trust, blockchain encourages rural settlers to produce and trade their energy with other participants in the same community. It also encourages the sale of surplus energy to the main grid via transmission lines. Consumers from another community can purchase energy via mobile devices as pay-as-you-go service or nonpayment as community services. Rural households can generate their energy using SHS in the case, where they cannot access electricity from the grid. Households with SHSs get incentives instantly when they generate enough energy to meet consumers' demand through energy trading. Energy trading can be conveniently performed on blockchain network through digital tokens, and tokens can be redeemed for a remote cryptocurrency. The immutable feature of the blockchain makes energy trading more secure as an individual or group cannot alter trade data.
Nowadays, different developments and applications of blockchain have emerged [39]. Blockchain 1.0 is based on digital currency systems, such as Bitcoin. Blockchain 2.0 incorporates the smart contract and other digital assets, which support applications within the blockchain and the currency systems. Blockchain 3.0 combines infrastructures like the Internet and mobile communications [39]. Based on the different developments of blockchain, the future evolution of blockchain with energy trading can achieve interoperability, adaptability, privacy, sustainability, and instantaneous transactions [39]. Consumers can increase their market sizes, as documentations, payments, and energy exchange improve the efficiency of doing business. In addition, by eliminating the need for a third party to approve transactions between consumers, payments are made at a cost lower than the conventional utility rates.

Least-Cost Evaluation for Decentralized Electrification in SG
Energy reliability refers to the performance of a power system [40]. Energy reliability is evaluated based on the assumption of practical applications of probability theory. The assessment of energy reliability's impact on cost is examined based on adequacy and security. Energy security refers to the ability of a power system to overcome dynamic and external disturbances, which include loss of generations, transmission, and voltage instability [40]. On the other hand, energy adequacy refers to the availability of facilities within the system that can fulfill the customers' load demands and operational constraint of the system. However, energy adequacy does not address dynamic disturbances like voltage instability [40]. Note that the investment cost is used to relate reliability with economics. Based on this approach, levelized cost of energy (LCOE) is a method used to compare the economic cost of a RES relative to other RES. The economic costs include the cost of energy generating plant (may include fuel cost), maintenance cost, and other related taxes and subsidies that are based on the operation of energy generating set. Mathematically, LCOE is defined as the net current value in unit-cost of energy over the lifespan of the energy generating plants in cost per kilowatt-hour (kWh) [12].
This paper discusses some of the uses of LCOE in the electricity market for different countries. The LCOE of wave energy conversion is considered for four different potential sites along the US pacific coast during one year [12]. The proposed scheme is used to model the device power performance and estimates the capital expenditure and operation expenditure reduction by 75% to achieve LCOE of 0.30 $/kWh. The wave energy conversion and wave energy conversion array techniques achieve annual production of~200% through control strategies. However, variability and intermittency issues associated to the performance of wave resources are not considered. In China [13], LCOE is used to estimate the on-shore wind power that will decline by 13.91% from 0.40 RMB/kWh in 2016 to 0.34 RMB/kWh in 2025. Although on-shore wind power achieves the grid parity with the carbon pricing of 10, 35, and 60 RMB/kWh for 2019, 2017, and 2016, respectively, by comparing the on-grid price of coal-fired power and LCOE. Furthermore, grid parity is delayed based on sensitivity analysis of high discount rates, curtailment rate, learning rate, and low capacity factor. Besides, they achieve grid parity with high carbon pricing. However, the variation in carbon tariff will increase the storage need. In Mauritius [14], off-shore wind and solar technologies are used with capital factor to determine the impacts of LCOE on bagasse generation, utility-scale PV, and landfill gas-to-energy, which are below average costs and fuel oil's operating costs. The results enable policy-makers to prioritize cost-effective solutions. However, the performance of photovoltaic (PV) technology for short and long term range with reliable information is not provided by the study in Mauritius. In Pakistan [15], LCOE is used to determine the performance of wind farms in terms of the average capacity of 34.50%, real availability of 90% and 97% of technical performance. The costs of 0.113 $/kWh and 0.040 $/kWh for 1-10 and 11-20 years are estimated from LCOE. Based on the report, the low production cost is attained per kWh as it is also compared with other technologies.
In Italy [16], an opportunity LCOE is used to aid stakeholder in selecting corporate power purchase agreement price and contractual length. An opportunity LCOE is estimated such that the contractual length should be within 7 years, whereas corporate power purchase agreement price ranges from 75 £/MWh to 100 £/MWh. In Korea [17], real LCOE is responsible for direct and indirect generation costs and economic theory is used to derive these costs. Indirect cost is used to quantify the importance of the energy generation mix. The real LCOE provides accuracy of power generation costs and quantities of RES. The results show that for extra units of RES, indirect cost savings are achieved. The authors of [18] analyzed the levelized cost of system for six different island geographies by exploiting PV, wind, battery storage, and pumped hydro-storage, based on sizes and contexts. The levelized cost of the system shows the generation of electricity will increase considerably with the rise in RES penetration up to 40% to 80% optimally. Reports show that the PV has significantly contributed in halve of the islands. However, storage is the requirement for saving overproduction as the dependence upon diesel production is limited. The authors of [19] proposed LCOE for decentralized solar power systems in SSA. In their framework, a standalone SHS is considered with solar and battery capacities using fraction-of-demand-serve. Also, fraction-of-demand-serve is used to measure the reliability via a multi-step optimization to derive the least-cost system. However, the authors did not consider energy trading in a trusted and secure environment for the decentralized SHS.

Proposed Framework
The framework consists of main grid that is the major source of energy, whereas prosumers and consumers belong to the blockchain network. Prosumers use SHS to generate energy and engage in trading of energy and cryptocurrency with other prosumers and customers. Consumers receive energy directly from the grid and can also participate in the trading of energy and cryptocurrency with each other and prosumers. Note that blockchain ensures a trustful and secure environment for trading. In addition, it serves as a broker between all participants in the proposed framework. Furthermore, blockchain uses the excess coins or incentives from prosumers and consumers to settle their financial debts. The subsections below describe the components of the proposed framework.
A blockchain structure is chain-shaped [41][42][43]. Every data block contains transactions, which are replicated and accessible by all participants via a distributed network [44]. In Figure 1, blockchain has two parts: first, the shared ledger and second, the smart contract. The shared ledger contains the transaction records and the hash values, while the smart contract provides conditions for energy trading. The present hash value depends on the hash of previous block to form the Merkle structure. The initial block in the blockchain is known as the genesis block, and a newly created block is validated and sequentially chained to the genesis block or previous block to create a chain of blocks. The implementation of blockchain has some basic components [41].

•
The blockchain user creates a new transaction, which is visible to other nodes in the network. • Each node validates each transaction at a certain period. Invalid transactions are discarded. Contrarily, valid transactions are packed into a new block through the mining process. • Before a block is committed to the blockchain, a notification is sent to all mining nodes within the blockchain network. Mining nodes, which receive the committed block, will verify the validity of the block with a hashing mechanism [45]. If the block passes the verification test by the majority of mining nodes, then it will be chained at the end of the current blockchain. Thus, a consensus is established. In this paper, proof of authority consensus mechanism is used [46]. The total usage of energy is measured and recorded with the help of smart meter and it indicates the first proof of their work for all prosumers.

Prosumers
Energy prosumers are consumers that are involved in energy generation. When they generate more energy than their demands, the surplus energy is sold to the other consumers. On the contrary, when prosumers are energy deficient, they purchase the required energy from local energy market by taking part in trading or from the grid. Small-scale prosumers are prosumers who cannot function economically without remuneration and self-consumption [47]. Solar energy is more suitable for small-scale deployment, whereas other RES, like wind turbine, is more useful on a large-scale deployment [47]. In this paper, prosumers have household standalone SHS for their energy generations. SHS consists of one or more PVs, charge controllers (to prevent batteries and appliances from damage), solar cells, and a battery to store the harvested energy.

Energy Consumers
Energy consumers are entities, which consume electricity. Consumers pay their electricity bills through cash, debit cards at the start of each month, or in arrears by quarterly account. Consumers use the same price for energy consumed per kWh. Consumers who have dual meters pay less during night consumption and consumers who have a capped rate, pay more if they exceed a consumption threshold. Blockchain technology will be used to minimize the vetting processing time during electricity bill payment.

Smart Contract
Blockchain's smart contract is a computer script that provides terms and conditions, which binds participants and also transfers digital currencies or assets between participants. Smart contract provides enforcement, and minimizes contract signing and regulatory costs [48].

Financial Mode
Financing distributed and decentralized SHS's startups project is tedious due to inadequate financing and lack of trust between participants. Energy brokers with high credibility are unable to review the process of authenticating the system due to high cost of processing long-time contract rules [48]. The consensus mechanisms of blockchain establish trust and participants' contract rules can be unanimously processed and validated. In addition, stored records of participants in blockchain simplify the business process, thereby improve the financial efficiency of decentralized SHS.

Metering Mode
Smart meters installed in the residential homes of all prosumers and consumers provide the first proof of their work for energy consumed or sold. Without the blockchain, there is an issue of inaccurate metering of prosumers caused by substandard measuring devices, information losses during transmission, and lack of focus by the data entry staffs [48]. Blockchain provides a digital precision of the smart meters' data and management. Access restriction and time of access are recorded and proper digital mapping is enforced to achieve accurate measurement through a well-defined rule.

Trading Platform
Prosumers utilize their energy generation and can buy energy from other prosumers, if required. With blockchain, prosumers can sell their excess generations to neighboring prosumers or consumers via P2P trading mode. By trading, the excessive energy is not wasted. By contrast, in absence of trading, the excessive amount of energy would be wasted. Besides, prosumers can change their operating mode if their local energy generation is insufficient and then buy the needed energy from other prosumers. Thus, blockchain ensures energy is fully utilized and also minimizes energy wastage.

Industrial Standard
Blockchain technology has a high degree of adopting decentralized SHS. Blockchain creates a trustless environment and establishes P2P trading market without the trust endorsement of a third party. Therefore, it reduces the difficulty of unifying industrial standards [48].

Problem Formulations
To avoid verbosity, only relevant formulations from the previous study [21] are presented.

The Isoreliability Curve
The set of solar and battery storage capacity, which satisfy the FR is calculated in an hourly time slot. The isoreliability is used to depict the constraint imposed by system [19]. The paper considers dynamics of the time slot, h; for solar, C s (h); and battery, C b (h), capacities (subscript s and b denote solar and battery), individually. After battery charging or discharging, the excess energy (or deficit) is calculated as where I s (h) is the insolation, which is measured in kWh and L(h) is the load at h, measured in kWh.
To determine amount of available energy, a state of charge SOC is used to define the energy stored in a battery at a given time slot h as [19] At a given time slot h, the unmet load is calculated as [19] FR N is calculated as the fraction of demand, which is to be satisfied through the available energy without loss of energy. N is the total number of simulations. FR N represents the fraction of demand, where recovery is possible, and it is also measured empirically by averaging the number of correctly delivered energy to the number of demands. FR N depends on the service level SL N . Besides, SL N is the expected probability of not hitting the stock-out. In addition, SL N represents the trade-off between the cost of storage and stock-out. SL N is calculated as where E val p (h) denotes the available energy during the time slot h with subscript p to demote prosumer, and it is given as [49] E val where SOC thr (h) denotes the SOC's threshold thr and E rt (h) denotes the rated capacity of the battery storage. E req p (h) represents the required energy and it is calculated as [49] E req where SOC max (h) represents the maximum SOC at a given time slot h. The FR N is calculated as where d N is given as [19]: Isoreliability curve is generated by considering the dynamics of insolation, capacities of solar and battery as a function in their compact form. The storage and solar capacities are optimized using the Quasi-Newton method [50] to get two optimal points (C s h ,C b h ). The isoreliability curve values used in this paper are taken from [19] for each degree of latitude and longitude across the SSA.

BDES
The prices of solar and storage are formulated to derive their respective costs, which depend on the isoreliability curve values. A battery replacement cost is used to derive the total cost of storage. Thus, the capital cost of the battery is defined as [19] where Cost b is the battery cost per kWh, which is computed as [19] where r is the discounted rate, m is the project term, Pr b is the total price of battery including replacement cost, and LT is the lifetime of the battery. To prolong the lifespan of solar, its solar derating is performed. Thus, the capital cost of solar is computed as [19] S where Pr s is the solar module's price per kW, Chrg c is the charge controller, and α is the derating factor taken to be 0.85 [19]. The derating factor is used to account for conversion losses, panel mismatch, dirt, and wiring issues. The total capital cost of the system SYS c is given in Equation (12), and it is calculated based on average daily loadĀvgDL, capital cost per unit peak load C peak L , and system's peak load capacity S peak L .
Based on Equation (13), CRF is the capital recovery factor, r is the annual discounted rate, and β is the blockchain incentive such that 0 < β ≤ 1. The BLCOE is calculated using Equation (14).
The objective is to minimize BLCOE such that {C s , C b } falls within the isoreliability curve. Thus, the total capital cost is formulated as [19] Although, r, mean load, peak load, α, Pr b , and Pr s are all parameters to be regulated separately of isoreliability curve. However, providing optimization of all parameters is like minimizing the total capital cost given in Equation (15), which is constrained by the isoreliability curve [19]. A continuously differentiable isoreliability can be discretized as analytical solution exists for the problem. Therefore, the integral search on the reliability curve is used to find the point of minimizing the cost.

CES
In CES, two important component costs of satisfying energy demands via centralized generation are required: the variable cost V c of energy generation based on centralized technology, which is measured in $/kWh, and the infrastructure cost of transmission line T c , which is measured in $/m/year [3]. The total levelized cost of centralized energy C LCOE is defined as where subscript c denotes centralized and E c (FR)V c is the total yearly energy consumption for households with grid connection. Let L c (FR) be the number iterations defined as a function of FR. Note that the transmission levelized cost is defined as [3] T c = PV generation cost Annualized discounted cost of operation .
T c is used to express the discounted cost of operation over the lifecycle of one year, which covers energy generation within this period.

DES
T c is used to formulate levelized cost for the decentralized generation D LCOE , which is calculated as the function of energy demand for decentralized energy and T c [3].

Modeling the Types of Prosumers
In this section, prosumers are classified into two categories: critical prosumer (CP) and non-critical prosumer (NCP). CP is the prosumer that cannot be disconnected and has no role in the energy price negotiation, whereas NCP is the prosumer that operates when its energy offer is accepted as a demand or generation with a minimum price limit [51]. In Algorithm 1, the CPs must submit their estimated energy usage beforehand to the smart contract, while the smart contract calculates the energy gap. Energy gap is the difference between energy demand and energy generation, and it is denoted by energy losses or gains. If there are more energy demands, then energy generation offers will be accepted in a hierarchical order of the offered prices until there is excess energy generation. The acceptance of the energy offers is used to determine the energy prices for CP, whereas the NCPs are paid based on offered prices. The CPs pay the price for their energy usage and a reward is given to them if their estimated energy usage do not cause system imbalance. Similarly, a reward is given to NCPs if they can provide the estimated energy generation. Conversely, CPs get penalized if the estimated energy usage causes the system imbalance. The blockchain reward R p (h) during a given time slot h, where, subscript p denotes prosumer.
where H p (h) is the historical performance of prosumer during a given time slot h with work capital ratio (WCR) as the constraint, which is defined in Section 3.8. E p (h) is the prosumer's estimated energy usage during a given time slot h, whereas A p (h) is the prosumer's actual energy usage during a given time slot h and M is the cardinality of prosumers. The penalty P p (h) during a given time slot h of a given prosumer is defined as if energy gap > 0 then 8 Calculate reward R p by Equation (19) 9 else 10 Calculate penalty P p by Equation (21) /* Store and sort offers by offer values for demand and supply, separately */

11
if Offer from NCP < Estimated Net demand from CP then 12 if Last NCP is in the list then 13 Send imbalance message to the network 14 Set i = i+1 15 else 16 Update list with last NCP's offer 17 else 18 Accept offer from NCP and update estmated demand 19 Set j= j+1 20 Define the market price P BLK The blockchain price in Equation (22) during a given time slot h is calculated as the ratio of the accepted offered price Pr p2p (h) (where the superscript p2p denotes prosumer to prosumer), to the accepted energy ACTenergy during a given time slot h, and it is given as where Pr p2p (h) is the ratio of E req h and E val h given in Equation (23).

Energy Trading of Prosumers in SSA
In this study, prosumers are considered in a given region as points that create a directed graph. Let V p be the vertices that denote prosumers and E p be the edges that connect prosumer i and j. The total transfer energy from prosumer i to j should not exceed their surplus energy EXC p2p p , which is defined as where TE i,j is transmission energy decision of the prosumers, which is defined as where E T p (h) is the energy that is transported from prosumer i to j during a given time slot h. To reduce energy loss during transportation, it is expected that the prosumers operate within their nearest locations. Finding the optimal path to move from one location to the other is not in the scope of this study.
In this study, a situation is considered where prosumers can instantly satisfy their actual energy needs with their on-site energy generations. As a result, a self-consumption SC p of a prosumer is examined in this study. SC p is the PV energy generation that is directly consumed by a prosumer, and the cost of individual PV energy generation is far less than the retail electricity, which makes SC p more profitable without subsidies [52]. Methods that can increase SC p of prosumers are energy storage and active load shifting as part of DSM [52]. SC p is defined as the ratio of PV energy generation that is directly consumed locally with battery storage over the total PV energy generation. In addition, SC p is formulated by taking the average of two SC p functions defined by [52,53], as A 1 and A 2 , respectively.
Thus, the proposed SC p is formulated as where E dc is the PV energy generation that is directly consumed locally, and E pv is total PV energy generation and E bc is the battery charging [53]. Note that there is no universal nomenclature in the formulation of SC p [52]. The degree of self-consumption in which on-site PV energy generation is sufficient to meet prosumers' energy needs is defined as self-sufficiency SS p . SS p is formulated by taking the average of two SS p functions defined by [52,53], as B 1 and B 2 , respectively: where E l is the total energy demand. SS p can be expressed as the ratio of total consumed PV energy generation over the total energy demand. Note that the SC p is normalized by E pv , whereas SS p is normalized by E l . By increasing PV generation relative to the energy demand, will always decrease SC p , while SS p either will remain unchanged or increased [52]. Therefore, the minimized instantaneous energy consumption I p (h) of the prosumers during a given time slot h, where H is the total time, defined as [52] The energy deficit of each prosumer that is satisfied via the blockchain network during a given time slot h is defined as [ If E p2p p (h) > 0, then prosumer can purchase the required energy from another prosumer via the blockchain. Otherwise, prosumer satisfies his actual energy need using his on-site energy generation. If excess energy EXC p2p p is actualized after meeting the immediate energy demand need of prosumer, then it will be sold to other prosumers via the blockchain. EXC p2c p is defined as [52] EXC p2p p If EXC p2p p > 0, then it implies that there is an excess of energy generation; otherwise, there is no excess of energy generation. On the other hand, another situation is considered, where a group of prosumers can instantly satisfy their energy demand needs from a group of prosumers in another blockchain. The group instantaneous energy consumption needs g p during a given time slot h is minimized as g p (h) = min h∈H {Total loads, Total PV energy generations}, As prosumers can interact with each other through the blockchain, a large group of energy demand and excess energy generations need to be satisfied and aggregated. Equations (36) and (37) define the energy demand and excess energy, respectively.
where the superscript g2g denotes group to group. If E g2g g (h) > 0, then the group of prosumers purchase the required energy from another group of prosumers via blockchain. This process is described as a regional blockchain-based energy trading. In Africa, four joint regional grids have been established to pool energy resources together, such as southern African power pool, which is the largest. In addition, others are western African power pool, eastern African power pool, and central African power pool [54]. The operating cost OC p (h) of each prosumer during a given time slot h is defined as where S p2p p (h) is selling cost and B p2p p (h) is the buying cost, which are calculated using Equations (39) and (40), respectively.
Depending on the regional energy needs, groups of prosumers can act as regional energy sellers or buyers, which are described in Sections 3.5.1 and 3.5.2.

Regional Sellers of Energy
In this subsection, a case is considered where group of prosumers in a particular region tries to sell their excess energy to group of prosumers in other regions that have energy deficits through blockchain. The selling cost S g2g r during a given time slot h for a particular region r is defined as S g2g r = Total cost of energy demand within the region at h + The total cost of excess energy within the region at h Total energy generated within the region at h , (41) where, Total cost of energy demand within the region at h = Energy demand within the region at h × Consensus price within the region at h, The total cost of excess energy within the region at h = Excess generated energy within the region at h × Offer prices by prosumers within the region at h.

Regional Buyers of Energy
When a group of prosumers from blockchain in a particular region is unable to meet the energy needs of its region, it is expected by the group to purchase the needed energy from a group of prosumers from blockchain in other regions that have the excess of energy. The buying cost of regional blockchain B g2g r is defined as

Blockchain Incentive Mechanism
Several factors limit consumers' willingness to pay for electricity and to set up the SHS project in developing countries. These factors include technical reliability like lack of information and the political influence, which is related to political disincentive. Therefore, a special incentive that motivates consumers to pay their electricity bills via blockchain is considered in this study.
In the proposed incentive scheme in Figure 2, a standard time frame is defined for the payment of electricity. The consumers' historical performance is compared against the standard time to determine their efficiencies regarding their payment patterns. The Gantt task approach is used in this paper to incentivize consumers [55]. The Gantt task approach guarantees that the consumers' time-rate (i.e., the amount of time it takes for consumers to make electricity payment) should be below the standard time. Thus, if a consumer takes longer time than the standard time to make the payment, then his efficiency is below 100%, and he is paid only the exact reward. Conversely, if a consumer completes payment at the exact standard time, then his efficiency is 100%, and in addition to his reward, a bonus of 20% will also be given to him. In contrast to the above, if a consumer completes payment before the standard time, then his efficiency is more than 100%; thus, in addition to his reward, he is paid at high-piece rate (i.e., an incentive given to consumers for each period of payment below the standard time).

Cryptocurrency Trading
In this paper, the rewards (coins) of prosumers are tradable between participants. Prosumers with excess coins can sell them to the blockchain and blockchain broadcasts these coins as cryptocurrencies to the network. Consumers who require additional earnings (incentives) can purchase these cryptocurrencies. Similarly, consumers can sell their excess earnings as cryptocurrencies with others who have low earnings. Depending on the policy, if NCP is unable to produce enough energy generation due to the cost of startup, then working capital (WC) offset will be used. This offset is the working capital (WC) cost reduction for each NCP. Furthermore, the same principle applies to the consumers: if a consumer does not have enough earnings to comply with the regulation of electricity bill payment, then electricity bill offset is used. Although, participants who take these benefits from this scheme will have to pay the exact offsets in the later time with their excess coins or incentives. Fraudulent participants will be blacklisted with a notification to all nodes within the blockchain network about their activities. Such participants can no longer get benefit from the scheme and their accounts will be deactivated.
The advantage of cryptocurrency trading is that there are clear WC cost and electricity bill reduction targets, which are to be achieved. Furthermore, the mechanism is also cost-efficient, as the cost of WC and electricity bill varies among the prosumers and consumers, respectively. This mechanism also makes it easy for participants to fulfill their financial obligations. In addition, this mechanism provides a way where excess coins or earnings can be efficiently utilized. With this mechanism, larger number of participants can be integrated to ensure a more stable market for energy trading and to encourage developing country's involvement.
There are several important elements, which need to be considered when designing the proposed cryptocurrency trading.
1. Scope: it includes all the financial levels of prosumers and consumers and the type of RES. 2. Capital allocation: it determines the WC and the electricity bill reduction rate. It also determines the length of time that the cryptocurrency will stay relevant. 3. Offset policy: it determines whether the offset is necessary to be used in the scheme, what type of offset is allowed and the limit or amount of offset required. 4. Trading: it specifies the rules for cryptocurrency trading and the compliance policy. 5. Expansion potentials: it is flexible to accommodate larger number of participants and should be compatible with other monetary exchange.

WC Formulation
Globally, financial debts, technical, political, and managerial issues are the major causes of energy crises in developing countries. The total financial debt is expected to rise between $2.6 and $2.9 billion during the period of 2017 to 2022 [56]. However, new sources of finance are evolving, but they are not sufficient to fund larger needs. Thus, more funding is required to fulfill the WC of several investors. In addition, inadequate WC is forecasted to be the barrier to growth, as shown in a survey conducted in 2017 (see Figure 3). The survey report shows that WC has the highest percentage, which may restrict the growth of any organization. Therefore, the driving force behind the rise of valuations is enhanced by getting equity to finance WC. In addition, WC can be satisfied with external fundraising.
WC management determines how the liquidity of business works and also ensures that proper planning and control of the current assets (CAs) and current liabilities (CLs) will relieve short-term responsibility risks [57]. WC management is used to measure the performance of a firm and should be made the constitutive part of the firm's financial strategy. As shown in Figure 4, in east Africa, sales have greatly dropped across segment due to crosscutting issues, such as WC challenges, drought, and value-added task refund from the government. In Ethiopia, WC for suppliers and the available funds for the consumers are key challenges that restrict business growth [56]. More WCs are needed to offset the negative cash flow gap, especially when cash outflow is more than the cash inflow [58]. As shown in Figure 4, the exact financial records of prosumers for all locations in the SSA were not published; therefore, publicly available financial records in [56] (see Table 1) are used to generate random results for all locations. In Table 1, the first column presents the capital utilization, where receivable funding is the amount of money collected in a short time, inventories funding is an asset-based type of loan that allows you to leverage your inventory and capital expenditure is the amount of money spent on acquiring an asset. Their corresponding values in dollar ($) are given in the second column. The third column presents the capital source, such as operating cast, which measures the amount of cash generated from the normal business operation. Change in payable is the increase in receivables, while external debt is the amount borrow from foreign lender, external equity is where rate paid is equal to market rates and external grant is the non-payable fund given by foreign party. The corresponding values in ($) for capital source are presented in the fourth column.
The negative WC depicts that the CLs are more than the CAs. WCmanagement is measured by the cash conversion cycle [57]. The WC can be calculated as where CA is the sum of receivable funding, inventories funding, and capital expenditure, whereas CL is the sum of operating cash, change in payables, external debt based on equity and grants. Thus, the WCR is given as Cost $/kWh

Simulations and Discussions
This section provides the discussion of simulation results.

Simulation Parameters
In this section, the assumption of economic parameters are presented in Table 2. This paper considers the same parameters and uses the linear regression model used in [19], to ensure a fair comparison. The international renewable energy agency describes the cost breakdown of SHS greater than 1 kW installed across Africa [19]. The solar insolation data used in this paper is obtained from the national aeronautic and space administration [59]. Table 2 gives the breakdown of the estimated economic assumptions considered in the scenario. In this table, the first column presents the names of the parameters, d.c denotes direct current, and soft costs are the interconnection costs; the second and third columns provide values for the current and future estimations. The proposed scheme is implemented using MATLAB, and blockchain is implemented using the Ethereum platform.  Figure 5 shows the density of energy cost calculated within same locations for different values of FR for LCOE and the proposed BLCOE. Figure 5a shows the LCOE without blockchain [19], and Figure 5b shows the future scenario of BLCOE. The dashed line depicts the least-square fit to a single regression model for all locations, where a = −0.0257, b = 0.0616, c = 0.0839, and R 2 = 0.4405 for Figure 5a, and a = −0.0079, b = 0.0189, c = 0.0258, and R 2 = 0.4305 for Figure 5b. The scenario with LCOE shows a reduced reliability premium as well as reduced spatial variability in component costs. The reduced component costs invariably have non-uniform reductions in reliability premium for regions with high costs. On the other hand, the scenario with BLCOE shows that BLCOE rises logarithmically above 99% as FR approaches one. The minimum BLCOE confirms that the fixed cost associated with systems, such as inverters and wiring, have no significant impact as FR values approach one. Thus, it is economical to design the system with the blockchain concept, as blockchain does not alter the reliability even if FR is less than 90%. From the figure, the future scenario with blockchain shows the impact of the reduction in the reliability premium for the component costs with less spatial variability. If the reduction in the variance of BLCOE is less, then the component costs reduction may cause imbalanced impacts on the reliability premium for regions with high costs. Figure 6 shows the LCOE for two scenarios: Figure 6a shows the current scenario with LCOE [19] and Figure 6b shows the future scenario with BLCOE. Future scenario with BLCOE presents 95% decline in the cost of battery storage and 75% fall in the solar module and balance system costs. In addition, the anticipated future BLCOE varies across SSA by about 0.049 $/kWh with less spatial variability better than the present spatial variation of~0.15 $/kWh [19]. The cost reductions in the future scenario minimize its coefficient of variation with uneven implications on the higher cost locations. The future scenario with blockchain confirms that the blockchain can provide further cost reductions via incentives and P2P energy trading.

Comparison between of Isolation and Solar System Using Least-Cost System
In Figure 7, results of the proposed BLCOE with a linear regression model denoted by a black line onto mean insolation are presented for different values of FR, for instance, Figure 7a when FR = 0.9, R 2 = 0.75, it implies that the mean insolation achieves 75% of the variation of BLCOE for FR = 0.9, Figure 7b when FR = 0.99, R 2 = 0.56. It implies that the mean insolation achieves 56% of the variation of BLCOE for FR = 0.99, and Figure 7c when FR = 0.999, R 2 = 0.23, it implies that the mean insolation achieves 23% of the variation of BLCOE for FR = 0.999. The results of Figure 7d shows that, as the values of FR increases, the regression values R 2 deteriorates accordingly [19]. The isoreliability optimization model achieves a better prediction of BLCOE based on mean insolation with a lower FR value. The converse is not true for higher values of FR, as more costs are obtained from the temporal variability of the solar resources than mean insolation. As shown in Figure 7a-c, the mean insolation loses its predictive power as FR values increase, contrarily to the proposed model in Figure 7d. The loss of prediction occurs because the variation of solar energy is reliable at high value of FR, rather than the mean insolation.  Figure 8 shows the reliability premium for all locations across SSA. In the current reliability premium (a), some portions of locations have a higher premium with cost above 0.05 $/kWh [19]. Conversely, the future scenario with blockchain shows uniform premium across the distribution with cost less than 0.05 $/kWh. The premium is associated with additional costs of storage and solar capacity. However, in the future scenario case, superiority in terms of costs of battery storage and solar module among locations is not observed.

Variation of Load Demand with Respect to FR
The effect of blockchain technology is analyzed based on the relationship between FR and different load demands as shown in Figure 9a-d. Figure 9a depicts the constant demand, Figure 9b is the heaviest day demand, Figure 9c is medium household demand, and Figure 9d is the heavy night demand. The figures report low BLCOE for various load demands. It is observed that 0.1 $/kWh cost difference for the heaviest day and heavy night demand is achieved, which depicts the boundary for achieving load shifting from day to night using the demand response. It is also observed that the medium demand roughly achieves the minimum cost as compared to constant demand. It is because the medium demand approximately balances consumption from the battery storage. Due to the decentralized and localized P2P energy trading activities between prosumers, the load shifting from high peak to low peak time slots using the demand response program is fully implemented. Blockchain provides benefits, such as real-time energy trading, fast response, and efficient payment vetting process with minimum or no delay.  Figure 10 shows the effect of cost coefficient of variance on BLCOE. The coefficient of variation gives the ratio of the standard deviation to the mean, which is used for comparing two distributions whose measurements are incomparable. If the value of the coefficient of variation is high, it means that there is a high level of dispersion around the mean. However, a smaller value of the coefficient of variation denotes better estimate. From the figure, as the values of FR approach one, the coefficient of variation in BLCOE increases accordingly and reliability is achieved at the expense of generation cost. In addition, the future cost of blockchain based scenario outperform the current cost in terms of minimum coefficient of variation. The lower values of the coefficient of variation of the proposed scenario shows the accurate estimate for the future energy cost.   Figure 11 shows the cumulative cost of solar generation and battery storage versus FR. From the results, it is observed that as FR increases from 60 to 77%, capital cost reduces with the cost of storage and solar generation using Equations (10), (11), and (15). It implies that with a smaller population, storage and solar generation can satisfy prosumers' load demands within a blockchain-based decentralized infrastructure. However, as FR increases from 77 to 100%, costs of solar generation and battery storage increase rapidly, whereas capital cost slowly rises and then falls.

Least-Cost Evaluation for CES, DES, and BDES Contributions to Electrification in SSA
In Africa, access to affordable energy from the grid requires huge cost and long-term development. As a result, affected regions depend on a solar energy project that remains unfunded; however, blockchain-based project initiative can bridge the gap. Due to the high cost of PV cells, solar panels are built only when a sufficient amount of solar cells are purchase. Considering the households without solar grid, the actual owner of solar cells receives cryptocurrency as payment for the energy sold. In this study, analysis of rural electricity generation option in SSA has assumed a daily energy demand to be 8.2 kWh. Also, the energy generation of 100 kWh per month is shown in Figures 12-14 using Equations (16), (17), and (14), for DES, CES, and BDES, respectively. It is observed from these figures that some regions like Morocco, Algeria, Libya, Nigeria, Gabon, Zambia, and Zimbabwe have high energy generation cost, which is above 2.5 $/kWh for the decentralized infrastructure as compared to CES and BDES. However, BDES outperforms its counterpart with the minimum energy generations cost. The high energy generation cost for DES occurs as a result of retail electricity price, prosumers' incomes, and quantity of energy demand. For a fair comparison, same FR value is used for DES, CES, and BDES. However, there are no retail electricity prices at 100 kWh per month for some countries, as they are not being published.
The retail electricity prices of 100 kWh per month are shown in Table 3 for FR = 60% and Table 4 for FR = 99%, respectively. The first columns from both tables present the lists of selected 43 countries in Africa. The second set of columns present the retail prices at 100 kWh per month; the third set of columns present the fraction of the population in percentage; and the fourth, fifth, and sixth sets of columns present the results for CES, DES, and BDES, respectively. In addition, transmission levelized cost parameters are taken from [3]. From Table 3, it is observed that more than 80% cost of energy generations for centralized infrastructure are low as compared to decentralized infrastructure, and the blockchain-based decentralized infrastructure outperforms its counterpart due to its lowest energy generation cost. It is because the estimated cost of energy consumption varies significantly from country to country. The comparative analysis of these infrastructures is based on mean and standard deviation (Std) of energy generation. Lowest mean values of the energy generation cost indicates that the infrastructure is far better than infrastructures with the highest mean values. From the results in Table 3, when FR = 60%, it is clear that countries like Burkina Faso, Cote d'Ivoire, Gambia, Guinea, Liberia, Mali, and Senegal support DES with low mean values of the generation cost as compared to the CES.
Burkina Faso is a country that has long recognized decentralization by enacting an act in 1998 for rural development. In terms of electricity, Burkina Faso relies much on thermal-fossil generation, which generated~70% of the country's total electricity. With regards to RES, Burkina Faso solar grid is based on SHS and hybrid PV-diesel mini-microgrid, which has installed capacity of~10 kWh in 2014 [60]. This generation formed~0.1% of the country's total energy consumption. In 2017, solar grid capacity of 33 MW was installed, which contributed to~5% of the country's total electricity production. Solar grid with a capacity of 100 MW was installed in 2018, which generated about 10% of the total country's electricity [60]. The simulation results confirm that Burkina Faso can achieve the mean generation cost of 0.9129 $/kWh for CES, 0.8218 $/kWh for DES, and 0.4205 $/kWh with BDES.
Gambia is a country with a total electricity generation of 100 MW and excess demand of about 50 MW. In Gambia,~42% of Gambians have access to electricity, whereas 58% of the population of Gambians have no access to electricity [61]. Fossil fuels produce about 98% of the electricity production of the Gambia, while RES with a series of potential options is underexplored. Solar system is the most considered option, which has a production capacity of about 4 kWh/m 2 of solar radiation [61]. Although, there is hope to increase the solar generation from 2 to 4% by the national development plan [61]. However, the simulation results confirm that the Gambia can achieve the mean generation cost of about 2.4512 $/kWh for CES, 2.2143 $/kWh for DES, while 1.1332 $/kWh per month for BDES.Guinea-Bissau is a country with an energy mix of fossil fuels, biomass, and hydropower. The primary source of electricity is the biomass; however, majority of the population have no access to electricity [62]. From 2012 to 2014,~1% access to electricity was recorded in Guinea-Bissau, which resulted from poor energy performance and social instability [62]. With regards to RES, there is no statistical information as the government of Guinea-Bissau regards RES as a discrete sector [62]. The simulation results confirm that Guinea-Bissau can achieve the mean generation cost of 0.9486 $/kWh for CES, 0.7975 $/kWh for DES as compared to 0.4081 $/kWh per month for the BDES.
Cote d'Ivoire is a country with electricity accessible by 80% of urban area and about 29% of rural community. Approximately 56% of the nation's electricity rate is generated from hydropower, natural gas, and biomass. With regards to RES, a mini-grid based on solar generation with a capacity of about 2077 kWh/m 2 was installed [63]. Note that Cote d'Ivoire has no current operational solar grid; however, a standalone solar system is used for domestic lighting [63]. The simulation results confirm that Cote d'Ivoire can achieve the mean generation cost of 0.6105 $/kWh for CES and 0.3595 $/kWh for DES, whereas 0.1840 $/kWh per month was achieved for the BDES infrastructure. In Liberia, biomass is used as the sole source of energy consumption, which creates a share of 80% of the used energy. Approximately 16.8% of urban dwellers and 2% of rural settlers can access electricity from self-energy generation with diesel and gasoline generators [64]. With regards to RES, monthly solar radiation generates~4 kWh/m 2 /day of electricity during the raining seasons, whereas 6 kWh/m 2 /day is generated during the dry seasons [64]. The energy generations from solar can achieve the average total capacity of 1712 kWh/m 2 of electricity. The simulation results confirm that Liberia can achieve the mean energy generation cost of approximately 4.0300 $/kWh for CES and 2.4216 $/kWh for DES as compared to 1.2393 $/kWh per month for BDES.
In Mali, electricity generation is dominated by 55% of hydraulic and 45% of diesel energy sources. Solar generation capacities are recorded with~2100-2300 kWh/m 2 , which increase the country's total energy generation [65]. In 2010, 6.3 MW of energy was generated from RES, whereas an estimated value of approximately 150.7 MW for 2020 and 201.8 MW for 2030 is expected [65]. The simulation results confirm that Mali can achieve a mean generation cost of 2.2928 $/kWh for CES, 2.1995 $/kWh for DES as compared to 1.1256 $/kWh per month for BDES. Senegal electricity is dominated by 87.4% of fossil fuels and 3.3% of RES [66]. However, from the simulation results, it is confirmed that Senegal can achieve mean generation cost of 2.4818 $/kWh for CES, 2.1963 $/kWh for the DES as compared to 1.1240 $/kWh per month for the BDES.
It is also observed that the proposed blockchain-based infrastructure shows a minimum mean energy generation cost for a retail price of 100 kWh per month as compared to CES and DES, respectively. The performance of the BDES is shown in Figure 14. The proposed incentive mechanism further reduces cost of energy generations. From the simulation results in Table 4, it is also observed that when FR = 99%, decentralized infrastructure no longer provide energy generation cost reduction. With the BDES, countries can achieve relatively minimum mean energy generation cost.  Figure 15 shows the spatial distribution of the proposed blockchain prices across all locations for 2400 prosumers using Equation (22). The result shows that only a small portion of locations has a high price, which is due to variations in the accepted offer and accepted energy.

Evaluation of Blockchain-Based Energy Trading in SSA
Price $/kWh Figure 15. Blockchain price at 250 kWh per month. Figure 16 shows the result of the offered prices versus consensus prices across all locations. The offered prices are given by the NCPs while the consensus prices are obtained using Equation (22). The figure shows that the consensus prices are lower than the offered prices and it is due to the negotiation by all NCPs.

Evaluation of Different Unmet Loads for Blockchain-Based Energy Trading
To examine the performance of the proposed blockchain-based energy trading mechanism. Four different unmet load consumption cases, such as constant, medium hourly, heavy night, and daily home business are considered for the analysis. Figure 17 shows the constant hourly load consumption using Equations (28) and (31). It is observed that during the time slots of 1 am-6 am, the maximum unmet energy load is 0.6 kW. However, between the time slots of 8 am-19 Pm, there is no energy demand, which implies that the load demands are satisfied by self-consumption. During these time slots, the battery will be in charging state. Note that DSM can be applied to satisfy the unmet load through load shifting and self-consumption, while the excess of the energy after self-consumption will be sold to other prosumers via blockchain with an offered price of 6.60 $/kWh. It is also observed that as the prosumers' unmet loads increase relative to the energy generation, self-sufficiency of the prosumers decreases with increase in self-consumption. Therefore, using Equation (32), the instantaneous consumption of the prosumers either decreases or remains constant.  Figure 18 shows the unmet load for medium household load consumption using Equations (28) and (31). It is observed that during the off-peak time slots, maximum unmet load is 0.85 kW. During the peak time slots, prosumers load demands are satisfied by self-sufficiency. It is also observed that by increasing the energy generation relative to unmet loads, will reduce the self-consumption, while self-sufficiency will be increased. The excess of energy after self-consumption will be sold to the blockchain at an offered price of 7.58 $/kWh.  Figure 19 shows the unmet load for heavy night hourly household consumption using Equations (28) and (31). It is observed that at time slot 20:00, the maximum unmet load is 0.75 kW. The excess of energy after self-sufficiency will be sold to the blockchain with an offered of 9.84 $/kWh.  Figure 20 shows the unmet load for daily business household load consumption using Equations (28) and (31). It is observed that the maximum unmet load is 0.65 kW. The large margin between self-sufficiency and self-consumption implies that it requires extra energy generations to satisfy the unmet loads. Note that the offered price for the energy sold to the prosumer via blockchain is 23.63 $/kWh.  Table 5 shows the summary of annual hourly and daily trading results of the whole prosumers network with different unmet load consumption profiles using Equations (39) and (40). The first column in the table gives the variety of unmet loads; the second, third, and fourth columns present the selling cost, buying cost, and the offer price, respectively; and the fifth column presents the proposed blockchain price. From the results, the selling cost of prosumer (i.e., prosumer with excess of energy generation) is found to be far less than the buying cost of the prosumer (i.e., prosumer with energy deficit). It is because each prosumer, determines the offered price based on the cost of on-site energy generation using Equation (23). On the other hand, based on consensus mechanism, a minimum negotiation price is reached by all mining nodes in the blockchain network. It also determines the selling price for the amount of energy required by the prosumers. However, the minimum blockchain price may raise the cost of storage for buying prosumers as they take this advantage to buy more energy. Note that this problem can be solved using a proportional sharing approach. This approach will limit the amount of energy required by each prosumer per day, which depends on the policy stipulated in the smart contract. However, this study is not limited to proportional sharing approach, other fair allocation mechanisms, such as game theory can also be applied.

Research Implications
As blockchain technology is underexplored in SSA, this study provides important research implications in four aspects: (1) The benefit of blockchain technology to address lack of trust, security and privacy in SSA. (2) The use of blockchain-based energy trading mechanism in SSA. (3) The use of blockchain-based cost-effective energy planning model for decentralized electrification in SSA. (4) The benefit of the proposed blockchain-based incentive mechanism for customers in SSA.
First, until recently, most energy transactions in SSA have been conducted in a centralized manner, which has legal and technical implications. In this framework, distributed transactions are achieved effectively in real-time. The proposed framework offers trust consolidation for distributed transactions, as all nodes are in agreement to verify and authenticate transactions before they are encapsulated into the blockchain. With the proposed framework, historical antipathy is eliminated using the blockchain's smart contract. Critical energy infrastructures in SSA are weak and unreliable in terms of energy security and management as compared to developed countries. Therefore, the proposed BDES is reliable and can strengthen energy infrastructures by its underlying security properties of the blockchain technology. Second, energy generations in SSA are insufficient to satisfy the increasing energy demands of the region, especially in peak time demands. The proposed blockchain-based energy trading mechanism allows prosumers with surplus energy to sell their excess energy to other consumers with insufficient energy at a low selling price. Figures 17-20 show how Equations (28) and (31) are used efficiently by prosumers to instantly satisfy their actual energy demands with their on-site energy generations. Excess of energy after self-consumption is traded with other prosumers with insufficient energy. Different unmet load demands are considered in this study that indicate the resilience of the proposed mechanism to handle variety of unmet load demands. Table 5 shows that prosumers can use Equations (39) and (40) to calculate the energy selling and buying costs. Computation of both costs depends on prosumers' energy demand and excess energy. The offer prices by prosumers are obtained from the price negotiation mechanism of Equation (23). Third, lack of cost-effective energy planning model in SSA has resulted in high cost of OM in transmission and distribution. Therefore, the proposed BLCOE is used to measure the impact of energy reliability on generation cost based on FR. Results of Figures 5-8 show that prosumers can achieve low energy costs, if the proposed mechanism is implemented. Additionally, low reliability premium is achieved with minimum BLCOE for prosumers with less variability in the component cost using Equation (15). Furthermore, using Equations (14), (16), and (17), countries can decide which models best suit their energy needs. However, the proposed solution of Equation (14) outperforms Equations (17) and (16) with the least energy generation cost. Tables 3 and 4 confirm that the proposed BDES achieves minimum energy generation cost for 60% and 99% of the population in SSA with retail price of 100 kWh per month. Fourth, energy theft in SSA increases the financial burden of the energy prosumers as customers refuse to pay for the electricity they have consumed. Therefore, the proposed incentive and cryptocurrency trading mechanisms will manage excess rewards of customers and offset their financial debts.
Future research could examines how socio-cultural background of prosumers in SSA may limit the acceptance of the proposed framework as the adoption of blockchain technology is still in its infancy. Additionally, the economic background of prosumers in SSA is another constraint that can prevent the proposed system from being implemented, as prosumers need to be trained and well informed about the emerging technology.

Conclusions
The proposed framework in the paper efficiently resolves the possible security challenges of SG for the decentralized electrification in SSA, such as lack of trust and privacy of prosumers' data. The solutions provided by the proposed framework are threefold. First, as cost-effective energy planning model in SSA is underexplored, this paper proposes a BLCOE mechanism that compares the energy cost of solar module and battery storage for standalone SHS in SSA. In the proposed mechanism, the impact of energy reliability on generation cost is measured based on FR and SL. BLCOE is minimized by approximately 95% for battery and 75% for the solar module. Future energy costs vary across SSA on an average of 0.049 $/kWh FR against existing cost model of 0.11 $/kWh. The impact of reliability premium is as low as 0.05 $/kWh in the anticipated blockchain scenario using the least-cost system. The low impact of reliability premium observed from the simulation results enables prosumers to make upfront curtailment decisions in real-time. The impacts of BLCOE on the variation of consumers' load demands, such as constant demand, heaviest demand, medium demand, and heavy night demands, are also studied. The simulation results confirm that a minimum BLCOE is achieved for different loads, which occur based on demand response. However, the heavy night demand incurs a high BLCOE cost. The coefficient of variation is used to compare the distributions of the proposed cost model with the existing model. Results from the coefficient of variation of the proposed model confirm the accurate estimate for future energy cost.
Second, because of weakness of the existing energy infrastructures in SSA to generate reliable energy that can satisfy the growing energy demands in the region, this paper proposes a method that pools RES together from different prosumers using the proposed self-consumption and self-sufficiency methods. To ensure that the excess energy of prosumers is not wasted, a price negotiation mechanism for prosumers is proposed. In the proposed mechanism, two types of prosumers are considered: NCPs and CPs. NCPs engage in price negotiation by contributing their excess energy to the blockchain-based energy market, whereas CPs have no role in the price negotiations, but can request for energy to satisfy their current demands. A reward is given to NCPs based on their energy contributions, while penalties are issued to CPs if their requests cause the system imbalance. Simulation results show that the minimum consensus prices are achieved with price negotiation. In addition, regional blockchain-based energy trading is achieved.
Third, electricity theft is predominant in SSA, as customers may refuse to pay for electricity they have consumed. These attitudes of customers increase the financial burden on the utility company. Therefore, this paper proposes an incentive mechanism based on Gannt task approach to motivate customers to pay their electricity bills. Additionally, excess rewards from customers can either be traded within the blockchain network or used for settlement of customers' financial debt.
This study will enable agencies and governments to make a strategic decision about, where and when they should rely on the BDES to meet societal goals. The proposed mechanism will also be useful to the independent power producers to address the power shortage problem by offsetting their WC cost through the sale of cryptocurrency. The proposed framework serves as a guide to set up country-to-country energy trading through the blockchain technology. In addition, this study aims to address the following research questions.

•
Is there any feasible long-term cost-effective energy planning model for energy generation in SSA? The framework proposed in this paper provides energy cost planning model that quantifies the impact of reliability on energy cost based on FR. Also, the proposed model estimates the future energy generation cost for 20 years to be 0.049 $/kWh as compared to 0.11 $/kWh for the existing scheme. • Are there any solutions to historical antipathy or lack of trust and security that can jeopardize the process of regional decentralized energy cooperation in SSA? The proposed framework ensures that a trustful and secure environment is established for cooperation among regional decentralized energy providers. Also, with blockchain smart contract, historical antipathy among regions is eliminated. • Are there any technologies that provide a trade arrangement for cross-border electricity and can effectively solve the problem of fair energy distribution and payment of electricity bill in SSA?
The proposed framework ensures that blockchain-based cross-border energy trading is achieved. Also, the use of cryptocurrency as means of payment is encouraged, which minimizes the vetting process and eliminates the third party system.
In future, this study intends to analyze the possible security threats that may confront the proposed framework and offer the required remedies. In addition, this study intends to examine the impacts of the increasing number of prosumers and consumers on the performance of the proposed framework, for example throughput, computational cost and storage.
Author Contributions: All authors agreed on the main idea. O.S. and A.J. implemented the proposed schemes and also wrote the proposed system models and results. A.A., M.Z. and I.U. wrote rest of the paper, organized and refined the refined the paper as well. All authors together responded the reviewers' comments. N.J. supervised the overall work. All authors have read and agreed to the published version of the manuscript.

Conflicts of Interest:
The authors declare no conflict of interest.