Demonstration of Blockchain Based Peer to Peer Energy Trading System with Real-Life Used PHEV and HEMS Charge Control

: To further implement decentralized renewable energy resources, blockchain based peer-to-peer (P2P) energy trading is gaining attention and its architecture has been proposed with virtual demonstrations. In this paper, to further socially implement this concept, a blockchain based peer to peer energy trading system which could coordinate with energy control hardware was constructed, and a demonstration experiment was conducted. Previous work focused on virtually matching energy supply and demand via blockchain P2P energy markets, and our work pushes this forward by demonstrating the possibility of actual energy ﬂow control. In this demonstration, Plug-in Hybrid Electrical Vehicles(PHEVs) and Home Energy Management Systems(HEMS) actually used in daily life were controlled in coordination with the blockchain system. In construction, the need of a multi-tagged continuous market was found and proposed. In the demonstration experiment, the proposed blockchain market and hardware control interface was proven capable of securing and stably transmitting energy within the P2P energy system. Also, by the implementation of multi-tagged energy markets, the number of transactions required to secure the required amount of electricity was reduced.


Introduction
To further implement decentralized renewable energy resources [1], blockchain based peer to peer (P2P) energy trading is a promising concept [2]. The realization of P2P energy trading has high affinity with implementation of renewable energy, for it is capable of empowering small energy producers, and diversify energy production profiles quickly [3,4]. In the realization of P2P energy trading, blockchain is a promising concept, with its benefits in data security, immutability, and higher efficiency in administrative processes [5,6].
The architecture and concrete viable algorithms of blockchain based P2P energy markets have been designed and proposed in-depth [7,8]. Also, many researchers have proposed and virtually verified blockchain system architectures, which could possibly realize this concept [9][10][11][12][13][14]. This trend is backed up with extensive consideration on social acceptance and policy adjustments as energy distribution being a social infrastructure which involves several stakeholder responses when trying to be updated [15][16][17][18][19].
Building up on this trend of P2P blockchain energy system implementation, in this paper, a unified demonstration experiment of both the virtual layer of blockchain systems, and the physical layer of energy charge/consumption hardware, was conducted. Previous work has focused on virtually matching supply and demand of existing energy flow, by measuring the values via smart meters. Our demonstration pushes this forward by enabling control of energy flow, and thus charge/discharge hardware, according to energy transactions on the blockchain market. This demonstration experiment aims to confirm that blockchain systems could realize energy flow control, and clarify issues regarding stable operation of the system.
In the demonstration experiment conducted, PHEV and HEMS actually used in daily life by users were connected to the blockchain system, and energy matchmaking was done in a blockchain continuous energy market. Based on the secured matches, actual energy transmission was controlled, transmitting the transacted energy through existing power transmission infrastructure. In construction of this market, additional system requirements for future energy procurement user needs and system stability were clarified, and a multitagged continuous market was introduced for the market algorithm.
The main idea of this paper is to control real-life P2P energy trading hardware based on matching results of the blockchain energy system in order to demonstrate the possibility of energy flow control using blockchain based energy markets.
Our contributions are as follows.
• Implement a blockchain based P2P energy trading system, which could coordinate with real-life used energy charge/discharge control hardware (Section 3). • Propose a multi-tagged energy market algorithm, which was required to further match energy market participant requirements, and simultaneously stabilize the system. This algorithm was also implemented (Section 4). • Conduct a demonstration experiment for one year with real-life participants and energy charge hardware to confirm blockchain system stability and also define further blockchain system implementation requirements (Section 5).

Blockchain Based Peer to Peer Energy Markets
Various approaches have been taken to implement the power trading functions on blockchain as a P2P power trading market.
Mengelkamp et al. built a blockchain-based microgrid energy market called The Brooklyn Microgrid, which introduced seven market components. A case study was conducted to show its effectiveness and future work [9]. Green et al. measured the electricity consumption of a family of two adults and two children in Perth, Australia. The house was named 'Josh's House' and was equipped with a 3 kW photovoltaic system. It was concluded that citizen-based distributed power systems and conventional integrated power grids need to coordinate combining the use of storage batteries [10]. Janusz et al. selected the machine to machine (M2M) power market as a model for developing blockchain-based applications for Industry 4.0, and implemented it on MultiChain [11]. Further, addressing the issue of system delay in the usage of blockchain in actual energy trade, blockchain network algorithms have been proposed to create secure and minimum latency communications [14].
Also, as an initiative of the Japanese government, at Urawa Misono Saitama Prefecture, the Ministry of the Environment created a blockchain platform to transact electric power between the photovoltaic (PV) system installed in a shopping mall, the PV/batteries installed in five buildings in the subdivision (three in the central housing area), and five convenience stores [12,13].
The blockchain energy market platform constructed in this study is an updated version of the platform constructed by the Ministry of the Environment, designed to control reallife used HEMS and PHEVS (Section 3) and further realize efficient matchmaking via the multi-tagged continuous market (Section 4).

Peer to Peer Energy Transmission Control
As structured in [20,21] and modeled in [22] , peer to peer energy trading requires fine management and execution of bilateral energy transmission.
In terms of virtual energy management of peers, Erol-Kantarci et al. proposed a home energy system (HEMS) method that was based on appliances, a smart meter, and storage units; a convenient time to execute participant demand was obtained [23]. To create a sensor based network of participants, Han et al. used IEEE 802.15.4 and zigbee [24], to further realize smart home energy management [25]. In the electric vehicle (EV) sector, to ensure accurate information synchronization, Hussain et al. proposed a communication network architecture based on IEC 61850-7-420 logical nodes [26,27]. Furthermore, to ensure charge completion of EVs within uncertainties and grid load restrictions, EV behaviour modelling and management methods have been proposed [28,29].
For physical energy transmission, Abe et al. proposed the digital grid [30], where the power system is separated into asynchronously connected grids by hardware named the digital grid router, a multi-legged ac/dc/ac converter. There is no need for additional placement of transmission lines, for energy is sent through the existing transmission lines in a cost efficient way [31]. The router is capable of bi-directional power flow, with the direction of current flow controlled through the leg and the value of current by hysteresis control [32,33].

Social Acceptance of Peer to Peer Energy Trading
As energy being a social infrastructure with regulations and a vast number of stakeholders participating, legal foundations and participant incentives are being studied further. In a review by Ahl et al. [15], future possibilities of regulations and standards were pointed out. Cali et al. analyzed in-depth incentive mechanisms of the market in order to support policy makers in preparing relevant energy policies [19]. Issues in the business domain were discussed by Hanna et al. [16]. There is currently a gap between technological advances in blockchain P2P energy trading and its social standards, but efforts are underway to address this.
In terms of participant understanding, simulational studies have been conducted, with each participant's utilities numerically analyzed, with the overall convergence of the system also taken into account [17,18]. Other approaches could be taken to analyze each participant's behavioural data. In the context of energy disaggregation, prediction models of energy consumption behaviour is being proposed [34,35]. Also, studies to gain characteristics of EVs through behaviour data clustering have been conducted [36].

Overall Architecture
The overall architecture of the constructed blockchain-based peer-to-peer trading system is shown in Figure 1.
The blockchain system was constructed using Ethereum with private blockchain, andpProof of authority as the consensus algorithm. There are two types of nodes, named the fullNode and the authority node. The duties of the nodes are further described in Section 3.2.
Through an cloud-deployed API, each market participant makes bids to the energy market, confirms the contracted bids to control energy flow, and reports actual executed energy transactions. These actions account for "Bid Flow", "Energy Control Flow", and "Execution Done Report Flow" in Figure 1, respectively. Bids creation is assumed to be done by bidding agents representing each participant's energy procurement requirements. Contract confirmation /energy hardware control / energy transaction reporting is assumed to be done by a client system, and energy transaction measurement is assumed to be done by smart meters. This enables an end to end machine to machine (M2M) control of energy transaction, without any human intervention. This could lower market participation barriers from the viewo of each participant, and also increase the security of the overall system. Further information and energy flow will be described in Section 3.3.

Blockchain Energy Market System Composition
Ethereum [37] was selected in order to build the blockchain energy market. This is mainly because Ethereum is capable of using proof of authority (PoA) [38] as the consensus algorithm, which enables high-speed transaction processing.There exists a tradeoff between transaction broadcast speed and security, and proof of authority via Ethereum was selected as the balance point [39].
The structure and transaction flow of the market is shown in Figure 2. Two types of nodes, the fullNode and authority, were designed as the building blocks of blockchain. The fullNode is responsible for accepting transactions and referencing data, while the authority is responsible for transaction processing and block generation. The user cannot directly access the authority, thus minimizing external influence.
The user sends power buy and sell bid transactions to the fullNode via the agent program, which forwards the received transactions to the authority. Also, when the fullNode receives a reference process such as data acquisition, it refers to its own ledger and returns the result to the agent. When the authority recieves a transaction, it conducts a calculation and logging process to log the transaction results to its ledger. Since the fullNode synchronizes its data with authority, the fullNode's ledger can be kept up-to-date.
In this composition, scalability of the system could be designed according to user requirements. By increasing the number of authority nodes, the reliability of transaction processing could be improved. Also, by increasing the number of fullNodes, the amount of possible concurrent transactions and data reference processing could be increased.

System Interface
The types of requests designed are shown in Table 1. Using this interface, the participants could make bids to the market, obtain current market contractions, and report energy transaction. From the participant point of view, using these request structures automatically creates unforgeable energy transaction certificates, which is fundamental in a reliable market.
The bid structure to the blockchain system is shown in Table 2. Following this structure, each market participant generates bids expressing its energy trading requirements. In doing so, the market window tags and energy feature tags were introduced to further enable trading requirement expression. For example, energy procurement requirements, such as those listed below, could be expressed with low cost. We want to buy renewable energy, even if it costs a little higher than fossil-based energy.
This concept and its merits will be discussed further in Section 4. After bids are contracted, the contracts are notified to the market participant systems, and actual energy charge/discharge is executed. The execution reports are sent to the blockchain system in the structure shown in Table 3.  As briefly stated in Section 3.3, in construction of the P2P blockchain energy market, a market that adds a tagging element to normal electricity trading was constructed. The overall bid structure resulting from this was shown in Table 2.
Tags are additional attributes of energy that are added to the market, such as renewable energy and fossil fuelled power. Market participants could express their willingness to pay for these additional attributes by setting separate prices for each tags. Market time windows could be also expressed. In former non-tagged market structures, in order to express these features, additional energy markets needed to be newly constructed. This promotes market fragmentation, which leads to an increase in user stress and system load. This will be further mentioned in Section 4.2.

System Design Intention and Assumed Market Participants
General system requirements of a continuous market are listed below, and implementing these functions using blockchain are the fundamentals for continuous markets.

•
User bid account management • First come first serve matching • Bid price and amount order book management Additional to this, through user feedback and literature reviews of ways to further engage P2P market participation [40], the requirements listed below require addressing .

1.
Enable the feature expression of energy, which is currently transacted as a commodity.
Examples of features could be energy generation method, energy generation location, etc. The installation of tags in the bid market and energy type is capable of overcoming these issues without raising the blockchain system load. Separate prices could be set for each tag combination. Examples of the usage of tags to tackle the issues is further described in Section 4.3.

Example Usage of Tags
In the proposed bid structure, by setting the bid amount of energy in a single value, while setting the corresponding market time/energy feature tag/each bid price in numerous options, a wide range of bids can be made and weighted according to taste.
For example, in the case of bidding for 50 Wh of electricity, a parallel bid as shown in Table 4 could be generated, expressing the will to purchase renewable energy ("green" tag) at a slightly higher price than fossil based energy ("brown" tag). Another example is shown in Table 5. In this case, a time-based parallel bidding is used. This type of strategy could be used when the market participant is only connected to energy charge/discharge devices at a range of time windows, and thus wants to set a range of bids to acquire the necessary and sufficient amount of energy within the range. This bid structure fixes quantity over a range of markets and makes it is possible to prevent the excessive procurement or sales of electricity, while bidding to multiple market time windows at the same time. For example, in the bid in Table 4, if 30 Wh of energy is obtained from 2:00 p.m.-2:30 p.m. in tag combination 1, the total bidded amount of energy would automatically be reduced to 20 Wh by the market system, preventing excessive procurement. This is not the case if there exist multiple energy markets for each time window or tag, where the market participant needs to actively detect energy contraction, and quickly adjust its market bidding position over multiple markets. This raises participant stress and system load, for the number of requests needed to be sent to the blockchain system rises.

Demonstration Experiment Settings
In order to verify the effectiveness of the platform created, a demonstration experiment was conducted from 17 June 2019 to 31 August 2020, in Higashifuji, Shizuoka-Prefecture of Japan.
Demonstration experiment participants are shown in Table 6. An example image of batteries and EV chargers installed at demonstration experiment participant houses are shown in Figure 3. Also, an image of the bird's eye view of the company office and installed PHEV charger is shown in Figures 4 and 5.
Demonstration experiment market settings are shown in Table 7. The market time window was set according to Japan Electric Power Exchange(JPEX) settings. Energy type tags were designed according to business energy transmission needs.
One fullNode and one authority was set up for the blockchain system. As stated above, in future systems, by increasing the number of authority nodes, the reliability of transaction processing could be improved. Also by increasing the number of full nodes, the amount of concurrent transactions can be increased, and the amount of data reference processing can be increased.

System Performance
The system performance was verified by first checking that daily transactions were executed without any issues, and second analyzing issues in blockchain system operation. Previous work [9,11] demonstrated that blockchain systems are capable of stable energy matchmaking in the virtual layer. The performance mentioned here additionally has the scope of physical energy charge/discharge control and its following execution reports. Overall, the system was capable of handling and executing the bid transactions from the participants without any faults. The data of the number of transactions handled are shown in Table 8. One block accounts for 5 s. In the blockchain system management operation, the matters shown below had to be dealt with in the following manner.

1.
Forced reboot of fullnode Issue: occurs when the participating agent systems connected to the blockchain system tries to fetch hundreds of thousands of blocks worth of information at once. The fullnode runs out of memory and is forced to restart. Handled: fix the system connecting to blockchain 2.
Insufficient disk space Issues: occurs due to increase in data storage. Handled: both the authority and fullnode storage was increased from 50 GB to 100 GB to 150 GB accordingly.
The former issue is due to extending the scope of the blockchain system from the virtual layer to the physical layer, and future work should address this issue in system design. Future system implications from these matters will be discussed in Section 6.

Effect of Multi-Tagged Continuous Market
The market performance was compared to the performance of the Urawa Misono project of the Ministry of the Environment [12,13]. The proposed market in this paper was implemented based on the market in the Urawa Misono project, which makes this a reasonable comparison. The evaluation results are summarized in Table 9.
First, in comparison of one energy market type ( i.e., brown energy market only), a reduction in the number of transactions per user, compared to the existing method, was confirmed. Installing tags allows bidding to multiple markets simultaneously while executing only the required amount, which lead to this reduction. This effect was further confirmed for two energy market types (i.e., green and brown energy market).
This reduction effect is due to the feature whereby the proposed multi-tagged bid structure could express more information in a single transaction. The previous structure required the creation of a transaction per energy market type and per market time window, resulting in fragmentation of bids, and also many bid cancellations. The proposed structure could express this information in a single transaction, and thus improve system efficiency.
In addition, through participant transaction and requirement analysis, it was confirmed that the over-execution of transactions was suppressed. 6. Discussion

Further Usage of Tags
Introducing the concept of tags enabled the expression of additional characteristics and values of energy. This paper mainly mentioned the RE value of energy, but the possibilities tag usage is more extensive.
For example, different voltage levels could be expressed using tags as well. Energy is transacted at different voltage levels according to consumer requirements. Using previous non-tagged markets to express this difference results in the number of required transactions increasing, as shown in Table 9.
Another usage is to express additional emerging energy values, such as local energy consumption [41,42]. From the power transmission system point of view, promoting local energy production and consumption is environmentally friendly, reducing system load. Also, local energy consumption could be used as marketing tools for companies, for this consumption implies that the company is restoring earned cash to the local economy, and thus further activating it.
The concept of tags allows for the flexible updating of the P2P energy market according to the distributed needs of each participant, which is a distinct aspect for distributed energy markets to have an attraction compared to conventional centralized energy distribution.

Blockchain System Operations
As stated above, in a blockchain system operation from 17 June 2019 to 31 August 2020, there were matters in access load control from external systems, and node server storage.
The former matter should be avoided in the future by creating access load limits to APIs, offered to the external systems. Further management should be done by setting access limits according to the participant agent type in order to balance agent system execution and blockchain system stability. The latter matter should be avoided by setting server storage alerts and actively raising the number of nodes connected to the blockchain system. This scalability is an advantage of using blockchain, and further leverage of this is expected.

Conclusions
In this paper, to further socially implement blockchain based P2P energy trading, a blockchain based P2P energy trading system which could coordinate with energy control hardware was constructed, and a demonstration experiment was conducted. Previous work focused on virtually matching energy supply and demand via blockchain P2P energy markets, and our work advances this forward by demonstrating the possibility of actual energy flow control. In the demonstration, PHEVs and HEMS actually used in daily life were controlled in coordination with the blockchain system. In doing so, the need of a multi-tagged continuous market was found and proposed.
The blockchain system was constructed using Ethereum with private blockchain,with Proof of Authority as the consensus algorithm. Through a cloud-deployed API, each market participant makes bids to the energy market, confirms the contracted bids to control energy flow, and reports actual executed energy transactions. The processes are automated, enabling an end-to-end, machine-to-machine (M2M) control of the energy transaction without human intervention.
The multi-tagged continuous market adds a tagging element to normal electricity trading. The inclusion of tags in the bid information allows users to express individual features of energy, which is currently transacted as commodities. It is also capable of reducing over contraction when bidding over numerous market time windows.
In the demonstration experiment, the proposed blockchain market and hardware control interface was proven capable of securing and stably transmitting energy within the P2P energy system. Also, by the implementation of multi-tagged energy markets, the number of transactions required to secure the required amount of electricity was reduced. In terms of blockchain system operation, matters in the external system requested handling, and the system storage was activated. Based on these issues, implications to future blockchain system implementation were given.
Blockchain based P2P energy transaction is a promising concept in energy decentralization, and its feasibility is being proven. The next step is to make distinct its difference compared to conventional centralized energy distribution from the user's point of view. The usage of tags could express a vast variety of energy value, and the low cost and the ability to design the types of tags, as well as to measuring the effect on market participant utility, is future work that would build on this base. 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 due to privacy.