{'fraction_non_alphanumeric': 0.024524351388256715, 'fraction_numerical': 0.004151115157032317, 'mean_word_length': 5.196525270758123, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Blockchain-Enabled Energy Demand Side Management Cap and Trade Model

Global economic growth, demographic explosion, digitization, increased mobility, and greater demand for heating and cooling due to climate change in different world areas are the main drivers for the surge in energy demand. The increase in energy demand is the basis of economic challenges for power companies alongside several socio-economic problems in communities, such as energy poverty, defined as the insufficient coverage of energy needs, especially in the residential sector. Two main strategies are considered to meet this increased demand. The first strategy focuses on new sustainable and eco-friendly modes of power generation, such as renewable energy resources and distributed energy resources. The second strategy is demand-side oriented rather than the supply side. Demand-side management, demand response (DR), and energy efficiency (EE) programs fall under this category. On the other hand, the decentralization and digitization of the energy sector convoyed by the emersion of new technologies such as blockchain, Internet of Things (IoT), and Artificial Intelligence (AI), opened the door to new solutions for the energy demand dilemma. Among these technologies, blockchain has proved itself as a decentralized trading platform between untrusted peers without the involvement of a trusted third party. This newly introduced Peer-to-Peer (P2P) trading model can be used to create a new demand load control model. In this article, the concept of an energy cap and trade demand-side management (DSM) model is introduced and simulated. The introduced DSM model is based on the concept of capping consumers’ monthly energy consumption and rewarding consumers who do not exceed this cap with energy tradeable credits that can be traded using blockchain-based Peer-to-Peer (P2P) energy trading. A model based on 200 households is used to simulate the proposed DSM model and prove that this model can be beneficial to both energy companies and consumers.


Introduction
Electric utility companies worldwide deal with severe and recurring power crises caused by a combination of supply-side problems, including fuel supply challenges, maintenance requirements and unplanned outages, and a continuous increase in energy demand, driven by global demographic growth, electrification of the transportation sector, and greater need for heating and cooling. The dilemma of equilibrating the energy supply with energy demand can be targeted using two principal methodologies. The first way is to meet the demand by increasing the power supply, using fast-acting, low energy cost power generators. The second method to equilibrate the supply with the demand is to act on the demand side by managing the load to minimize the overall energy demand and clear the gap between the supply power and demand power [1]. This second methodology relies heavily on the participation of electricity consumers to reduce their electrical energy consumptions during peak times in exchange for an incentive compensation [2].
Nevertheless, when energy demand-side management (DSM) strategies are considered, the economic problem of free-riding emerges [3]. Free-riding usually refers to users who benefit from conservation subsidies without really contributing to decreasing energy consumption or paying for it. In demand-side management programs, free-riding occurs when consumers get incentives without really reducing their loads [4]. On the other hand, the rebound effect is another challenge when assessing the long-term goals and impacts of energy efficiency projects. In energy efficiency projects, the rebound effect, also known as the take-back effect, is the reduction in anticipated energy savings from the applied energy conservation measures or technology caused by a change in consumer's energy consumption behavior due to the applied measure itself [5]. This is a significant outcome of energy efficiency, which is commonly underestimated. Moreover, it characterizes the negative relationship between technology and consumption [6]. Thus, it is essential to develop a demand-side management program that can achieve the ultimate targets of reducing the overall energy demand and shaving the peak load while avoiding the free-riding and rebound effects. The model proposed in this article is a demand-side management model based on the cap-and-trade system, empowered by a peer-to-peer (P2P) blockchain-based credit trading platform that aims to limit the increase in energy demand.
On the other hand, new emerging technologies such as blockchain, Internet of Things (IoT), artificial intelligence (AI), machine learning, Big Data, etc. have the potential to disrupt the energy sector heavily and change it from a centralized, hierarchical supply chain to a decentralized, decarbonized and decentralized smart platform. Energy suppliers are in a continuous quest to reap greater productivity, improve safety and reduce energy costs. The digital transformation of the energy sector offers the means to achieve those goals. Furthermore, the digitalization of the energy sector is the cornerstone of the broad integration of distributed energy resources (DERs) in any electric grid, which aims to increase load flexibility and diversity in the power generation systems. This digital transformation also unlocks new potentials for users to manage their energy consumption and supply while offering them the possibility to become active stakeholders in electricity grid management. For electric utilities, digitalization permits better monitoring of the grid, faster detection of failures supplemented by an autonomous diagnosis and response to those faults, thus reducing power failures, grid downtime, and higher quality of service [7]. Additionally, the accelerated expansion of DERs, as a fundamental part of smart grids, can no longer be efficiently addressed using conventional centralized methods but instead requires a decentralized real-time control and supervision of all grid assets. Hence, new innovative management systems relying on decentralized networks are becoming a necessity. Blockchain technology could facilitate a fully decentralized energy system [8].
A blockchain is a decentralized network that relies on a distributed chronological ledger, hosted, updated, and validated by several peer nodes rather than a single centralized authority, acting as an immutable record of all transactions. The fact that blockchain substitutes the trusted third parties makes this technology a simple, fast, safe, and transparent means of transaction between peers. An example of the implementation of blockchain technology is the famous cryptocurrency Bitcoin. While conventional wire transfers require validation from a bank and take several days to be completed, Bitcoin transactions can be achieved in near real-time directly from peer to peer [9]. Since the appearance of Bitcoin in 2008 as a peer-to-peer (P2P) electronic cash system, blockchain, its underpinning technology, has gained broad interest from different businesses and industries. Blockchain technology promises a secure, near real-time, and low-cost method for conducting digital assets transactions [10]. It increases process automation while managing more significant volumes of data with limited human intervention at lower cost and risk. Meanwhile, energy companies are grappling with increased reporting, transparency, and security regulations, which incurs additional costs to the energy trading process and greater demand for personnel and resources. Blockchain technology can help target those challenges and have a significant positive impact on the energy sector [11]. Traditional transactional models rely on centralized, server-client-based architectures. Transactions between network nodes occur only through an intermediary third party required to establish trust, especially when unknown parties are involved. Nevertheless, the involvement of intermediaries induces additional commission fees in exchange for their services and increases the processing time required for transactions. Furthermore, since all transactions are managed and recorded using a central server, centralized networks suffer from a single point of failure. Alternatively, decentralized architectures, such as blockchain's P2P platform, offer a network of interconnected nodes that can interact directly, preserving the integrity of the grid even if several nodes are jeopardized or disconnected. Thus, P2P decentralized networks allow bridge or mitigate most of the problems associated with centralized networks [12].
Blockchain can transform the energy sector in harmony with the natural laws of growth. It provides an incremental, sequential, highly integrated approach to developing the energy sector's effectiveness and efficiency. This new technology can move the energy market progressively from a dependent market to an independent market to an interdependent market. The existing market is an entirely dependent market where consumers rely on utility companies and service providers. With the development of DER technologies, the market can evolve into an independent market where off-grid isolated micro-grids can survive. But with the integration of blockchain, the energy sector has the potential to metamorphose into an interdependent market ruled by the paradigm of we-we can do it, where people can cooperate and combine efforts, abilities, and resources to create something greater together.
In this article, a new demand-side management (DSM) program, based on the "Capand-Trade" concept merged with blockchain-enabled peer-to-peer (P2P) energy trading mechanism, is proposed. The second section of the article provides a review of the most recent researches on peer-to-peer energy trading, smart energy management, and innovative mechanisms used to mitigate challenges and limitations faced with traditional demandside management models. In Section 3, blockchain technology and its components will be introduced. In Section 4, the proposed blockchain-enabled energy demand-side management Cap and Trade model is defined along with a proposed trading model that highlights its functionality. The proposed DSM model combines the features of blockchain P2P energy trading and the well-known Cap and Trade mechanism used for carbon emissions trading. Thus, to clearly explain the proposed DSM mechanism, at first the Cap-and-Trade mechanism is introduced, and secondly, the importance of adopting a P2P blockchainbased energy trading platform is highlighted. Finally, in Section 5, a simulation model using historical data from 200 households is implemented to test the effectiveness of the DSM mechanism.

Related Works
The language of innovation is expected in sustainable development policy contexts and load reduction, resulting from demand-side management mechanisms, including energy efficiency programs and demand response models. This can be perceived as an innovative equivalent of sustainable power generation development. Thus, in this framework, several works have already been developed to respond to challenges faced by existing demandside management projects. The work conducted in [3] offers a two-step model to address the free-rider issue resulting from demand response programs. The first step focuses on predicting the customer's baseline load using a regression-based estimation model. The second step proposes an incentive paid to the consumer based on load reduction for a specific baseline rate. The proposed two-step method outperformed other approaches in terms of payment rule improvement.
Additionally, demand-side management is considered the central pillar of smart grids and distributed energy resources. Conversely, as presented in [13], the emergence of new technologies in smart grid settings has led to the advancement of the communication and control infrastructure, enabling a better exchange of information and data necessary to implement any demand-side management program properly. Similarly, article [14] proposes, in the frame of smart grids, a methodology to implement an active demand-side management model for households equipped with solar photovoltaic (PV) systems and battery energy storage systems. Nevertheless, the development of innovative demand-side management models is not just limited to the smart grid outline. Advanced technologies such as Artificial Intelligence (AI), machine learning (ML), blockchain, etc., have disrupted conventional demand-side management practices. As presented in [15], AI and ML have emerged as new enablers of demand response programs by tackling various challenges, limitations, and barriers. Among these barriers are the consumers' behavioral characteristics and preferences, a pricing model that responds to the consumers' expectations, the management of the demand load, and connected devices. They also contribute to setting an incentive reward program in a fair and economically efficient manner. In the same vein and as highlighted in [16], data analytics and ML can be employed to forecast energy demand, understand customer behavior, and tailor power generation solutions required in the future to respond to increasing demands.
However, recently blockchain has emerged as a new technology that can play an important role in smart grids and more specifically in advanced demand-side management mechanisms. As presented in [17], blockchain technology, especially when merged with advanced metering infrastructure (AMI), can deliver a transparent, secure, reliable, and timely energy flexibility to adapt consumers' energy load profiles to existing energy value chain stakeholders' capabilities. The work conducted in [18] suggests a blockchain-based DSM model using the Ethereum platform that matches energy demand and energy production at a smart grid level to validate this concept. The model improves feedback from DR enrolled consumers and aggregates and forecasts available DR loads while reducing the amount of energy flexibility needed for convergence. Similarly, article [19] uses a micro-grid with various residential load profiles to test a blockchain enhanced demand-side management mechanism that reduces peak-to-average ratio and smoothens the dips in the load profile caused by supply constraints.
Additionally, the proposed model optimizes the pay-off of both the energy provider and the consumer. Equally, Ref. [20] introduces a distributed demand-side management interconnecting, using a network of IoT smart meters, multiple households equipped with renewable energy sources in a single micro-grid. The proposed system minimizes the individual electricity cost for each household and the total cost of energy consumption for the entire micro-grid. The consumers aim to optimize their daily energy consumption in addition to their source of energy: self-generated energy from renewable energy sources, shared energy on the community microgrid, and energy provided by the utility. Each participant applies the best strategy that minimizes his energy consumption cost while maintaining his privacy of energy consumption.
On the other side, the application of blockchain technology in demand-side management is not restricted to the relationship between the energy service provider and the consumer but can cover machine-to-machine (M2M) interaction in the context of demand response. The work presented in [21] provides an example of M2M interaction where a power management system and a generator will cooperate to adjust the power generation trading over the blockchain. But then again, demand-side management is not only limited to demand response programs, and it also includes energy efficiency mechanisms. Even at this level, blockchain can play a major role in advancing energy conservation measures, as shown in [22]. Based on those above and even though only a little work has been conducted on applying advanced technologies, such as AI, ML, and blockchain in the field of DSM, the potential of these technologies in disrupting conventional DSM models is obvious and worthy of further investigation. Hence, the work presented here offers a new perspective for implementing the renowned emissions trading scheme known as Cap-and-Trade, as a demand-side management mechanism in the energy sector. It uses blockchain technology as a trading platform to limit the continuous increase in electricity demand faced by most utilities worldwide, as shown in Figure 1.

Blockchain Technology
Satoshi Nakamoto first proposed the concept of blockchain in 2008 [23]. Blockchain technology is an additional layer on top of the internet. It is defined as the "internet of assets" as opposed to the world wide web that is recognized as the "internet of information" [24]. Blockchain offers the great potential of digitizing assets such as records, deeds, bonds, copyrights, currencies, art, real estate, carbon credits and energy while enabling a P2P trading system that doesn't rely on third parties. This process is known as tokenization. By converting physical assets to digital tokens, blockchain unlocks new values for real-world assets and enables trading them in real-time.
The value of the global market for blockchain technology is growing. Governments, utilities to academia, and civil organizations are accommodating a digital era in which blockchain is best known by cryptocurrencies like Bitcoin [25]. The blockchain has indeed based its reputation on the Bitcoin revolution, but the blockchain is not only about transferring token ownership. Blockchain technology can have significant social and economic impacts on established business practices. It offers an alternative means of transacting, sharing value, storing data, and doing business by eliminating the need for centralized entities. It is a decentralized trusted network, enabling anyone to digitize and save or transact data, assets, contracts, or value in a secure manner. Global revenues of blockchain technology are forecasted to grow in the coming years to more than $23 billion (U.S.) by 2023. The largest shares will come from the financial and energy sectors [26].
Traditional transactional models are based on a centralized structure. Transactions between network nodes occur through an intermediary third party. Intermediaries are most often required to establish trust between unknown involved parties. On the other side, one of the most notable features of blockchain is its decentralized structure ( Figure 2). With blockchain, the trust between peers is empowered by mathematical algorithms and cryptography, and transactions are conducted from peer-to-peer, which makes blockchain most suitable for applications that meet the following criteria: − Decentralized problems − Peer-to-peer transactions − Beyond boundaries of trust among unknown peers − Require validation, verification, and recording of a time-stamped immutable ledger − Autonomous operations guided by a rule structure and policies

What Is a Smart Contract?
The concept of smart contracts refers to autonomous, self-enforcing programming codes that run on a blockchain network to simplify, govern and enforce agreements and transactions between untrusted peers without the need for a trusted intermediary [27].
The main problem with traditional client-server coded contracts is that when any of the parties involved has root access to the server, they can change the rules and conditions of the contracts. This is why in traditional contract models, a trusted third party or government is required. Intermediaries usually charge fees and can be considered a source of risk that potentially jeopardizes the confidentiality of any contract. This is a problem that blockchain and smart contracts can solve by offering a platform that enables parties to reach a consensus on the required set of rules or business policies and to jointly control the information. Hence, what blockchain and smart contracts offer is an evolution of the internet with immutable shared rules.
Bitcoin was the first blockchain to support basic smart contracts, providing a network capable of transferring value between participants. Its programming language enabled limited transaction features to be created (e.g., payment channels, escrows, multi-sign accounts, and time locks). Ethereum introduced the new feature of smart contracts. Its programming language enabled developers to build their decentralized applications (Dapps). At present, it is the most widely used smart contracts platform.
Smart contracts aim to make legal agreements self-executable by using computer code. Unlike conventional contracts drafted by lawyers, signed by stakeholders, and enforced by law, a smart contract establishes a relationship with cryptographic coding. Unlike a clientserver-coded contract, smart contracts are immutable and unstoppable once deployed on the blockchain. Smart contracts offer the following benefits: − Smart contracts are cryptographically secured, immutable, and enforced. − Smart contracts are fast and inexpensive. − They offer a multi-sig feature, which means that transactions are executed only when all approvals or signatures are provided. − They are capable of managing agreements between users without human interruption. − They may serve as part of other contracts (similar to how a software library works).
Smart contracts can run independently and can automatically interact with other smart contracts. − They store information, such as records, prices, energy consumption, etc., generated by the smart contract itself, fed by another smart contract or an outside oracle.
A smart contract is made up of two main parts: smart contract code and smart legal contracts. The smart contract code is the code that is stored, verified, and executed on the blockchain. A smart legal contract is a digital representation of a legally binding agreement using a smart contract code. A smart contract is created and signed by parties using their digital signatures. The terms of the agreement and the obligations of each participant are established and limited by program code instructions and functions. Once the agreement terms are satisfied, transactions are automatically executed as defined in the smart contract code.
Smart contracts are capable of redefining business relationships. Smart contracts offer viable solutions with lower transaction costs and risks [28]. Smart contracts' autonomous and self-enforcing nature makes business operations faster, safer, and less prone to human errors. Additionally, the fact that smart contract-managed processes require less human intervention allows reducing the overhead. Finally, since all transactions are recorded on a distributed ledger, it would be very difficult to tamper with the relevant data.

Concept
The concept of sustainable consumption was first used on a global scale in Agenda 21, the action plan for sustainable development adopted by 179 heads of state at the Rio Earth Summit in 1992. For the first time, overconsumption in industrialized countries was identified as a direct driver of unsustainable development, and the idea of sustainable degrowth was introduced. Basically, the wished-for solution involved short-term and long-term market means to shift consumption patterns in an eco-efficient manner [29]. One way to achieve sustainable consumption is to use economic tools, such as subsidies, taxes, and charges, to impact the price of goods or services and directly alter consumers' choices [30]. Such market-based mechanisms minimize the impact of adverse market externalities and play an essential role in influencing purchasing patterns [31].
Nevertheless, economic tools can only impact consumers' preferences if the offered financial incentive is strong enough to overcome the threshold of the decision-making process. In other words, taxes should be adequately scaled to sway consumer-purchasing decisions. As a result, economic tools can be seen as mechanisms to render eco-friendly products financially appealing for consumers while making ecologically detrimental ones more expensive with the aim of discouraging their consumption. However, subsidies and taxes are not the only forms of economic tools. Trading or purchase schemes can also be used as financial strategies. The energy cap and trade scheme presented in this article falls under this category.
Often, prices of certain goods or services are increased to reflect their environmental cost. Primarily, these additional costs are determined by the price elasticity of the products in question. In other words, it depends on the percentage of consumers willing to decrease their consumption when prices increase at a certain rate. The price elasticity depends on the product or service itself and the household's income group. The cost of environmental policy initiatives is thus determined by users' willingness to alter their consumption and sacrifice some of their well-being in exchange for their environmental contribution. As a result, these increasing costs, which may not necessarily be evenly dispersed, have significant consequences for households [32,33]. Therefore, any economic tool needs to achieve a balanced distribution of the repercussions of the increased cost. One example of such behavior, is the Fuel Poverty Strategy, a UK effort that targets environmental policy distributional challenges [34]. This plan aims at all households whose energy use surpasses 10% of their income to meet their heating demands, with a special focus on disadvantaged groups.
People's habits in consuming energy should be altered to fight against energy demand increase. Habits are defined as the intersection of knowledge (what to do), skill (how to do), and desire (want to do) [35]. Any plan that aims to change people's habits or their energy consumption patterns should combine all three. Thus, considering these criteria, the proposed energy cap and trade scheme penalizes heavy electricity consumers and compensates low energy consumers. The work conducted in [36,37] reveals that as one's income rises, so does one's energy use. This growth, however, is not uniform. Energy consumption growth remains flat as income grows at the lowest end of the income spectrum. Energy consumption begins to rise only after a particular low-income threshold is reached. Therefore, indirectly the suggested energy cap and trade targets consumers with high income without impacting households majorly with relatively low income, which respects the equitability concept in the distribution of the increased costs.
The Cap-and-Trade mechanism is well known in the greenhouse gases emissions reduction and carbon credit markets. A cap-and-trade scheme allows governments to issue a limited number of carbon dioxide emission permits each year, essentially putting a "cap" on overall pollution. Companies that are part of the program can acquire and sell permits amongst themselves [38]. Because the overall supply of permits is limited, some businesses may determine that reducing their emissions is more cost-effective than purchasing permits. For example, investing in more efficient technology, reducing energy waste, or switching to renewable energy are all options that are less expensive than buying permits. The cap is then reduced each year, resulting in fewer and fewer permits available each year. As permits become more expensive, many businesses opt to minimize their emissions rather than purchase allowances. Cap-and-Trade is considered more flexible than flat regulations since they simultaneously combine sustainability goals, covered by the cap, and economic efficiency, covered by the trading feature, and offer the potential to achieve both [39].
In a Cap-and-Trade scheme, allocation is the process of distributing allowances to participating or involved entities. The allocation process should be governed by rules to ensure the fair distribution of allowances. There are three basic ways of allocation; allocating based on historical data (grandfathering), allocating based on benchmarking, and auction [40]. Grandfathering offers participating entities allowances based on their historical data from a pre-defined base year or period. Grandfathering increases the scheme's feasibility by avoiding significant upfront costs. However, grandfathering as a mechanism of allocation tends to reward historically high consumers and necessitates additional allowances for future entrants. Comparatively, using a benchmarking allocation method, allowances are distributed based on performance metrics. Benchmarking rewards efficient and innovative solutions and makes it easier for newcomers to fit in [40]. The third allocation method is selling allowances, usually by auction. The auction method is advantageous in reflecting the real requirement of installations for allowances and offers participating entities an equal chance to procure allowances. Furthermore, it generates revenue for the regulator, which may then be used to fund additional initiatives. Therefore, the choice of the allocation method has a significant impact on the cost-efficiency of any Cap-and-Trade mechanism.
Therefore, analogously to the mechanism applied to fight against the increase in greenhouse gas (GHG) emissions, we propose a cap-and-trade model to limit the increase in energy demand while combining both the goals of sustainability and cost-effectiveness. The proposed model is based on a benchmarking allowance system. Each category of users or each sector, residential, commercial, healthcare, industrial, etc., is allocated a cap for the monthly energy consumption based on a benchmark study of the relevant market. Suppose the monthly energy consumption of the involved entity is below the monthly cap value. In that case, the entity will pay the usual energy rate, but the entity will have to pay an incremented rate for each energy unit consumed above the cap value. Nevertheless, efficient energy consumers might have a total monthly energy consumption way below the energy cap. Thus, the difference between their anticipated monthly energy consumption and the cap value can be tokenized and sold to heavy energy consumers at any rate between the usual rate and the incremented rate ( Figure 3). Thus, the proposed model generates two incentives for consumers. The first incentive is for consumers to lower their energy consumption not to exceed the set cap value. The second incentive is to improve their energy efficiency to maximize the number of energy tokens traded and thus lower their monthly energy bill. The suggested selling algorithm is defined in Algorithm 1. However, the application of such a model can be very complex for utility companies and energy providers. Applying a cap-and-trade model for GHG emissions at the national level or large-scale companies might be feasible. Still, its implementation on a small retail scale with thousands and millions of consumers will undoubtedly prove to be a timeconsuming, labor-intensive, challenging, and sophisticated process. For this reason, we propose using blockchain as a distributed ledger to govern the tokenization of traded energy. It handles payments, keeps an immutable record of all transactions, and manages the relationship between stakeholders: selsumers (consumers who are selling excess energy tokens), pursumers (consumers buying energy tokens), and the utility company.
The adoption of a blockchain P2P architecture for our energy cap-and-trade model offers several advantages. The anonymity of peers and security guaranteed by blockchain are among the most important features. Additionally, blockchain's greatest feature derives from the transparency of its distributed ledger shared by all participating nodes. It provides an unprecedented layer of accountability to any financial or business model, forcing all involved stakeholders to be accountable towards other involved parties. Moreover, the fact that each exchange of tokens is recorded on a blockchain creates an auditable trail of all transactions, which can improve security, prevent fraud, and verify the legitimacy of the traded asset. Finally, blockchain will help make the process more efficient and less costly by eliminating intermediaries or third parties.
Hence, the proposed blockchain-enabled energy Cap-and-Trade DSM mechanism is based on creating a monthly cap for consumers' energy consumption, allowing them to tokenize any unused energy, not exceeding the cap limit, and trading them with other interested buyers using a blockchain P2P energy trading platform.

System Architecture and Functionality
To better understand how the proposed blockchain-enabled energy Cap-and-Trade DSM mechanism works, the architecture of the system, including all soft and hard components functionalities are detailed in this section.
The main target is to enable electric end-users to exchange electric energy tokens securely, in near real-time, and transparently. To achieve this, a Dapp will allow energy consumers and prosumers to participate easily and create their own decentralized and deregulated open P2P energy market.
A public decentralized virtual machine will operate as an autonomous agent that connects and matches selsumers (consumers willing to sell energy tokens) to pursumers (consumers willing to buy energy tokens) and conducts the financial settlement between them without the need for an aggregator, broker, or any type of intermediary. The decentralized virtual machine is nothing more than several smart contracts that take over the two major functions of today's energy retailers: billing and trading while keeping a transparent record of all executed transactions. These smart contracts are then paired with a user-friendly front-end application programming interface (API) that allows selsumers and pursumers to interact directly with the virtual machine. Thus, the virtual machine collects data, processes it, charges the pursumer for the bought electricity based on an agreed-upon rate, and pays the selsumers for the sold energy tokens. It manages the financial settlement between the two parties' digital wallets in an autonomous, secure, and completely transparent manner that doesn't require the intervention of any trusted third party. The proposed architecture is shown in Figure 4. The functionality of the model and the different steps of the process can be summarized as follows: − Data collection is provided by IoT devices connected to Smart Meters − Smart contracts manage the processing and storage of data on the blockchain network in an autonomous way − Transactions between selsumers and pursumers are conducted in near real-time using smart contracts and via the Dapp itself. − Data is recorded and encrypted using cryptography, guaranteeing its immutability and authenticity. − Smart Contracts automate and ensure that all system functionalities, i.e., billing, trading, and reporting, are carried out correctly without the risk of human error.
The Solidity code, included in the Appendix A, represents the smart contract trading.sol that allows to create buy/sell orders and log them. In addition, this smart contract calls for another smart contract called Registeredusers.sol that governs the registration of smart meters for consumers who are willing to participate in the program and allocate an address for each smart meter.

Case Study
To test the functionality and effectiveness of the proposed DSM mechanism, we propose using a simulation model based on historical data from two hundred households and applying the proposed DSM's logic, outlined in Algorithm 1, to the adopted use case. However, to achieve that, the proposed selected use case model is defined in the first part of this section. In the second part, the simulation model and algorithm are transformed into a mathematical model that allows one to test the DSM mechanism under several scenarios.
The ECT DSM mechanism is tested under different scenarios to evaluate its dynamicity and how the outcome will change when the system variables are modified. Finally, the simulation results, under different scenarios, are presented and analyzed.

Selected Model
Two hundred (200) households, randomly taken from a sample of housing units in the Residential Energy Consumption Survey in the United States' Midwest region, are considered to test the proposed energy demand-side management model. The chosen sample is part of the work conducted in [41]. The curves shown in Figure 5 represent the total monthly energy consumption of the 200 households registered over four months of the year (January, May, July, and October). The proposed Cap-and-Trade demand-side management model is verified for the above-defined energy consumption capping applications under different scenarios. In addition, the blockchain-enabled Cap-and-Trade DSM model is tested over four months of the year (January, May, July, and October), each representing a season to account for the energy seasonal variations. Table 1 shows the distribution of the households' monthly energy consumption for the selected months of the year.  The outcomes of the simulation models are evaluated based on three criteria: − The variation of the consumer's monthly electricity bill between the baseline period and under the cap-and-trade DSM program − The variation of the total consumed monthly electric energy of the 200 households between the baseline period and under the cap-and-trade DSM program − The variation of the total collected monthly electric bills by the utility between the baseline period and under the cap-and-trade DSM program An average price for the traded energy tokens was considered to simplify the simulation. Optimization of the transactions between the selsumers and the pursumers is applied, which means that they sold energy tokens are equally distributed among all pursumers. Additionally, it is assumed that all available excess energy tokens are sold. Such an assumption is justified because, in the case of a large grid, there will always be a pursumer willing to buy the offered energy token at a lower price than the electricity tariff per kWh. In other words, if the supply in energy tokens is higher than the demand, all pursumers are served, and in case the demand is higher than the supply, all selsumers are served. This hypothesis defines the optimal case of the considered model. Furthermore, it is considered that a certain percentage of the population will reduce their energy consumption in response to the applied cap and the surcharge for energy consumed above the monthly cap value. This assumption is defined by two the factors α and β, respectively the percentage of households reducing their energy consumption and the percentage by which the monthly energy consumption of these households is reduced. For simulation purposes, α is set at 20% and β at 25%.

Energy Cap and Trade Formulation
A mathematical model serves to test the above-defined algorithm. Accordingly, as previously described, after the application of the Energy Cap and Trade (ECT) demand-side management (DSM) program, it is expected that a certain percentage ∝ of the households will automatically respond to the program and reduce their energy consumption by a certain ratio defined as β i . Moreover, it is assumed that the households that will respond to the applied ECT DSM program are part of the households whose monthly electrical energy consumption E i exceeds the set cap value K. Households with E i < K will not have any interest in decreasing their monthly electricity consumption. For simulation purposes and to keep track of the number of households reducing their monthly electrical energy consumption, a counter n was created. The counter n will be increased by 1 at each iteration if the subject household i have a benchmarked monthly electrical energy consumption above the set cap and if the maximum number of expected households to reduce their energy consumption, defined by the percentage ∝, is not reached. The counter n will continue to increase until it is equal to the round down of ∝ ×N which represents the total number of households to reduce their monthly electrical energy consumption in response to the ECT DSM program.
Hence, to identify the households that have decreased their monthly electrical energy consumption E i , in response to the ECT DSM program, the index p i is defined. This index equals 1 if the subject household i has reduced its monthly energy consumption and 0 if not. The index p i is calculated using Equation (2): i ∈ N set of all households t ∈ T set of time intervals q i = 1 i f E i ≤ K q i = 0 Else p i = 1 i f Household i reduced his electrical energy consumption p i = 0 Else N: Population (in our case, the 200 households) E i : Household monthly electrical energy consumption in kWh K: Defined electrical energy cap value in kWh ∝: Percentage of households to respond to the new rate structure and reduce their monthly electrical energy consumption The simulation aims to analyze the energy demand and economic impacts of the proposed ECT DSM program on the consumer and the utility company or energy provider. Two factors assess the effects on the electricity distribution company. The first one is the total energy consumed by the 200 studied households, and the second factor is the sum of the collected electricity bills from the 200 households. As for the consumers, the main criteria used for the evaluation of the model is the new monthly electric bill U i .
The new total energy demand E T at the utility-scale is given by Equation (3): The reduction in energy demand at the utility-scale is given by Equation (4): E T : Baseline total monthly electrical energy consumption of the population in kWh E T : Total monthly electrical energy consumption of the population in kWh after implementation of the Cap-and-Trade scheme β i : Percentage of monthly electrical energy reduction for each household R E : Total monthly electrical energy consumption reduction The baseline monthly electric bill for household i, is given by Equation (5): The new monthly electric bill for household i, is given by Equation (6): U i : Baseline total monthly electricity utility bill for household i U i : Total monthly electricity bill after implementation of the Cap-and-Trade scheme for household i γ U : Utility electricity rate ($/kWh) γ S : Rate for sold electrical energy tokens ($/kWh) γ B : Rate for bought electrical energy tokens ($/kWh) E C i : Total monthly electrical energy consumed by household i in kWh E S i : Total monthly electrical energy sold by household i in kWh E B i : Total monthly electrical energy bought by household i in kWh The reduction in the monthly electric bill for household i, is given by Equation (7): R B i : Total monthly reduction or increase on electricity bill of household i.

Simulation Results
As previously detailed, the simulation is conducted over four different months of the year to account for the seasonal effect on the energy demand. The obtained results are analyzed considering two different perspectives. The first is the utility company's perspective, and the second one is the consumer's perspective. From a utility perspective, the main target is to reduce the monthly electric energy consumption without heavily impacting the monthly turnover. The obtained results show that even when incorporating the selsumers as energy sellers and competitors to the utility company in terms of selling electricity at a lower rate to penalized pursumers, the monthly turnover of the utility is either comparable to the baseline (period without implementation of any DSM program), for the soft and moderate scenario, or exceeding the baseline for the aggressive scenario (refer to Figure 6). From the consumer's perspective, the simulation results show that the seasonal effect lightly affects the cap value (refer to Figure 7). Still, the same cannot be said for the traded energy tokens. Figure 8 shows a remarkable increase in the number of traded kWh during January and July. The main reason for this development in the number of traded kWh during January and July is the increase in heating and cooling loads during those two months. The high demand for heating and cooling energy is directly reflected in the monthly electric bills, which means that under a Cap-and-Trade scheme, heavy consumers will exceed the monthly cap value and consequently be penalized for the excess energy consumed. Thus, in the proposed ECT DSM program, those heavy consumers will try to buy energy tokens to minimize the additional charge applied to their monthly bills, which verifies the increase in the number of traded energy tokens.  Besides that, it is entirely reasonable to see that the number of selsumers is high in a soft scenario, where the cap value is relatively high, allowing consumers to earn a considerable number of tradeable energy credits. On the other hand, identically, the number of pursumers is low, whereas these numbers are reversed under the conditions of an aggressive scenario, as shown in Figures 9 and 10. Additionally, the proposed ECT DSM model minimizes the impact of free riders while rewarding efficient consumers and penalizing heavy consumers. Figures 11 and 12 show respectively the average monthly reductions on the selsumers' electricity bills and the average monthly increase on the pursumers' electricity bills. Under the conditions of the soft scenario, selsumers can achieve a reduction of approximately 9% on their monthly bills whereas the increase on pursumers' monthly bills is between 3% and 7%. With an intermediate scenario, the selsumers' reduction is between 16% and 18.6%, whereas the pursumers' increase is between 23% and 32.7%. Subsequently, the aggressive scenario allows selsumers to achieve higher reductions on their monthly electric bills and imposes higher penalties on heavy consumers where the increase on the monthly electric bill can reach 140% during January. On the other side, the applied ECT DSM, based on the previously detailed assumptions, can achieve a 6.04% to 8.79% reduction in the total monthly electrical energy consumption (refer to Figure 13).     Lastly, Figure 14 compares the average monthly bills of prosumers under the different scenarios that the utility can adopt to minimize the yearly increase in electricity demand. The baseline scenario is the business-as-usual scenario where no demand-side management program is applied. The second scenario is the "Baseline + Cap" scenario. This scenario simulates the application of a cap value for the monthly energy consumption and penalizes consumers that exceed this cap without offering them any trading option. In that case, even though it is assumed that 20% of households will automatically reduce their monthly electricity consumption by 25% in response to the application of the cap value, the average monthly electricity bills have nearly doubled. This proves that such a model can have a severe negative impact on consumers and can be considered an unembellished DSM model. The other three scenarios represent the implementation of the ECT DSM program with respectively aggressive, intermediate, and soft conditions. As shown in Figure 14, the aggressive scenario can have similar adverse outcomes as the "Baseline + Cap" scenario. In contrast, the intermediate and soft scenarios can maintain an average monthly bill comparable to the baseline model to decrease the overall monthly energy demand, which can be considered a win-win situation for both the utility company and the consumers.

Sensitivity Analysis
As defined in Section 5.1, several parameters are considered in the proposed blockchainenabled C&T energy trading model design. Thus, it is essential to determine and analyze the set of independent variables or inputs that affect the outcomes of our model. The parameters or variables identified as having an impact on the outcome of our model are defined as follows: − Cap value − Energy rates − Percentage of people reducing their energy consumption − The energy consumption reduction rate Indeed, the set cap value is the most critical variable that can significantly impact the performance of the presented model. Hence in this context, Figure 15 represents the sensitivity analysis or the "What if" analysis that illustrates the impact of the set cap value on the model's outcomes.

Other Application: Peak Load Shaving Use Case
The presented and simulated model, in Section 5, is not the only application for the proposed blockchain decentralized application. The developed blockchain-enabled C&T energy trading model can also be used for peak load shaving. The suggested peak load shaving model can operate as follows: − Based on historical data of at least two complete cycles for each household, a cap value will be defined for the peak power during the peak time for every billing cycle − When the power during the peak period for each household is lower than the set cap, the consumer earns energy tokens equivalent to the amount of energy reduction below the set cap value (as shown in Figure 16) − The earned tokens can be exchanged with the utility company or the independent system operator (ISO) to pay the monthly energy bill or can be sold to other consumers − Pursumers can benefit from the bought tokens to pay for the extra charge applied to their energy consumption during on-peak periods − The complete energy trading process will be similar to the one detailed in Section 4.2 Such a model can be used as a demand response program to incentivize consumers to lower their power peak demand during peak-time periods in exchange for tradable energy tokens and thus to contribute to the reduction of the daily peak load and minimizing the need for alternative means of power generation or a large spinning reserve.

Conclusions
This article presents a new DSM model that can help minimize the yearly increase in electricity demand, inspired from the concept of Cap and Trade previously applied to fight against the rise in carbon emissions, and benefiting from the emergence of blockchain technology and the tokenization of energy assets. The suggested ECT DSM concept minimizes the free-rider and rebound effects usually faced with conventional DSM programs. It is fundamentally based on integrating consumers as the main stakeholders in the energy supply and procurement process. It rewards efficient consumers and penalizes heavy consumers. Furthermore, it creates an open market for energy trading based on P2P energy trading. The prices are not controlled by a central entity, i.e., the utility company, but instead governed by the general rules of a deregulated supply and demand. The central concept is that the average energy consumer no longer acts as a passive user, located at the end of the energy supply chain, but rather as an integral part of a future smart digital grid, where more and more distributed energy resources (DERs) are being integrated. Such a consumer-driven energy system can benefit all stakeholders, as proven by the presented ECT DSM model.
The proposed DSM program was tested using 200 households as a test bank, and the model was simulated over four months to account for any seasonal effect. Moreover, three different scenarios, soft, intermediate, and aggressive, were taken into consideration to validate the most appropriate criteria to be applied to get the best-equilibrated outcomes for both the utility and the consumer. The obtained results proved the effectiveness of the model, especially for the soft and intermediate scenarios where the utility company can achieve a reduction between 6.04% and 7.8% on the total monthly energy consumption, without any considerable change in its total monthly turnover and without highly affecting the average monthly bills of the consumers. Furthermore, the sensitivity analysis showed the importance of properly selecting the cap value to achieve an optimal result for both the utility company and the consumers. This value has to be modified every few years to account for new market needs and control the energy demand.
Nevertheless, cash incentives alone are not sufficient to create a good DSM program. Still, they should be complemented by real-time feedback from energy meters and an updated billing system that considers an aggregate bill per consumer rather than individual bills based on single points of delivery (PoD). Such a model can help to protect the system against free riders. For example, a person or a family owning and occupying more than one household will not benefit from a double quota of energy credits and can be billed fairly for their aggregated monthly energy consumption as any other family who owns just one household.
The presented blockchain-enabled energy Cap-and-Trade model can be applied to several applications such as peak load shaving. Moreover, it can offer a new perspective for the utility's relationship with its customers, specifically for DSM projects. However, this model might be confronted by several challenges, such as the need for new legislation and regulations. Additionally, it is crucial to create awareness amongst people to embrace this change and appropriately interact with the system and the new technological innovation to extract the maximum benefits from the program. Otherwise, such a model might backfire and lead to negative results.
The work conducted in this article can serve as a test-bed to evaluate the proposed DSM mechanism for new applications, commercial or industrial, and various microgrids, to optimize the model's outcome especially by combining the impact of other distributed energy resources. Additionally, it will be beneficial to test the ECT DSM model under different rate structures such as Real-Time Pricing (RTP) and Time of Use (ToU), as well as applying the rules of open market demand and supply on the actual price of the traded energy tokens.  Data Availability Statement: Data available on request due to restrictions. The data presented in this study are available on request from the corresponding author. The data are not publicly available since they are part of an ongoing project, and full data will be publicly published once the project is finalized.

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

Appendix A
The following code is written using Solidity a programming language used for coding smart contracts on the Ethereum platform. The smart contract trading.sol allows to create buy/sell orders and log them on the blockchain's shared ledger. In addition, this smart contract calls for another smart contract called Registeredusers.sol that governs the registration of smart meters for consumers who are willing to participate in the program and allocate an address for each smart meter.