A credible and adjustable load resource trading system based on blockchain networks

In recent years, the residents’ demands for power supply is increasing. The load resource trading system responds to the demands through intelligent scheduling, which can effectively relieve the severe power load pressure. The load resource trading system is a type of nonlinear system because the trading price is adjustable with user’s credit, instead of being linear to the power trading volume. The adjustable load resource trading is faced with the challenges of large demands, strong user autonomy, and secure and tamper-proof transaction data. The blockchain technology has been widely concerned by industrial and academic domains due to its decentralization, strong encryption of account information, and traceability of transaction behaviour. In this paper, we propose a credible and adjustable load resource trading framework based on blockchain, which uses blockchain to achieve credible grid load resource trading. Firstly, we propose a two-layer blockchain architecture based on the alliance chain. The main chain maintains all the data of the system, and the station-area nodes constitute the alliance chain. We design a distributed trading processing mechanism based on hybrid consensus and sharding technologies, which promotes the speed of cross-station transaction consensus. Next, we propose a two-level bidding model, which determines the trading price of load resources based on the maximum benefit of users and the lowest cost of grid companies. The results of extensive experiments shows that our proposed framework can achieve the promising result.


Introduction
The current social power resource distribution is unbalanced, and the urban power burden is increasing day by day. Especially, residents' demands for stable and flexible power supply are increasing with the improvement of quality of life. For example, during the summer power peak, the peak load of the grid continues to climb, but the duration is very short. High peak-valley difference brings great challenges to the stability of the power network and economic operation. Credible and adjustable load resource trading can start, stop, and adjust the operation status of the power supply equipment and the energy storage equipment, according to electricity price and transaction information. It alleviates the contradiction between supply and demand, and ensures the stable and efficient operation of the large smart grid.
Targets for credible and adjustable load resource trading include decentralized autonomy and reliable transactions. Decentralized autonomy refers to that grid companies only need to publish relevant power consumption control indicators, and do not need to participate in residents' power load management in depth. Users are allowed to trade electricity, manage their peak power consumption range, and monitor the specific electricity consumption of each household appliance. To achieve decentralized autonomy, grid participants from all regions need to spontaneously coordinate, respond, and jointly maintain the operation of the low-voltage interactive response management platform. This can not only reduces the business burden of grid companies but also makes power load resource scheduling more flexible and improves the utilization of sustainable power resources. Reliable transactions refer to the integrity, consistency and accuracy of electricity and transaction data. All data cannot be tampered with. Specifically, data records shall truly reflect the actual operation or process. Original data shall be directly and synchronously recorded into the formal record according to the corresponding procedures or regulations at the time when it is generated or observed. Transaction can be traced to the creator of the data through the signature and other information in the record.
Traditional load resource trading relies on third-party central institutions or trusted intermediaries, which manage and endorse user data in the form of central nodes or service platforms. However, the third-party central institutions will not only increase the data processing and trading costs, but also may cause a reduction in service quality and even a crisis of trust. Blockchain technology provides decentralized services, with the characteristics of strong encryption of account information and traceability of transaction behaviour [1,2]. Blockchain stores, verifies, transmits transaction data through distributed nodes of the network, and ensures the tamper-proof and consistency of transaction data through consensus technology and Merkle hash tree, thereby having attracted extensive attention from industry and academia. Although some researchers have applied blockchain technology to the smart grid, such as data trading [3][4][5], electric vehicle charging and discharging management [6,7], and micro-grid energy auction [8], it is still in its infancy and needs to be improved. Therefore, we propose a framework on credible and adjustable load resource trading based on blockchain, which employs blockchain technology to achieve reliable grid load resource trading, and encourages users to actively respond and participate in reasonable power resource scheduling. The blockchain adopts the bookkeeping method of distributed ledger, and blockchain data are transparent and open and cannot be tampered with, which can prevent the power demand response business from recording false and wrong accounts. As shown in Figure 1, the low-voltage interactive response terminal collects the power consumption data of each smart home appliance in the user's home, and sends part of the data to the IoT platform through the WiFi module, and controls the smart home appliances to realize information interaction with users. At the same time, all the collected information is transmitted to the low-voltage interactive response management platform through the blockchain encryption link, and the acquired data are synchronized to the station-area node. The station-area node collects the data of all low-voltage interactive response terminals in the station area and makes consensus with other station-area nodes in the station area. The transaction data between different station areas are agreed and stored by the selected special station-area nodes. As the full node of the blockchain, the master station is responsible for synchronizing the node data of station areas and storing all the data in the whole system. There are four roles in the system: low-voltage users, grid companies, load aggregators, and regulators. Low-voltage users are the main participants in the trading. The grid company is mainly responsible for making decisions on electricity prices and smart contract writing. The load aggregator is responsible for aggregating user demand responses and other information. The regulatory authority supervises and manages the whole process.
Based on the blockchain architecture, we propose a reliable synchronous diffusion mechanism of transaction data based on sharding. Full nodes of the grid master station maintain a main chain, and the station-area node forms an alliance chain. The data of the alliance chain consensus is synchronously spread to full nodes of the master station, and full nodes maintain all data of the system. We design a hybrid consensus mechanism of "response strength + PoW + PBFT". Then the distributed trading processing is implemented based on the sharding technology to improve the scalability of the system. At last, we build a transaction system of users' low-voltage load demand response, and design a two-layer bidding model based on the maximization of users' interests and the lowest cost of grid companies. The upper level model is designed for the transaction matching stage, and the goal is to maximize the interests of all groups of users participating in demand response transactions. The lower level model corresponds to the settlement stage. It runs smart contracts, and achieves information release, transaction matching, transaction settlement, price incentive and other trading processes.The goal is to minimize the cost of the grid company.
To sum up, our main contributions are as follows.
• We propose a framework for credible and adjustable load resource trading, which uses blockchain technology to achieve reliable grid load resource scheduling and power resource trading for low-voltage users. • We propose a two-layer blockchain architecture based on the alliance chain. We design the mixed consensus mechanism and distributed trading processing based on sharding, in order to achieve reliable synchronization of blockchain node data. • For grid load trading, we design the trading rules and a twolayer bidding model, with the goal of making balance between different groups. • We conduct extensive experiments on blockchain prototype system. The experimental results show the effectiveness of our proposed framework.
The remainder of this paper is organized as follows. We summarize the related work in Section 2. The system model is presented in Section 3. We discuss about the synchronous diffusion mechanism of transactions in Section 4. We present the low-voltage load demand response trading scheme in Section 5. The experimental design and results are presented in Section 6. Finally, Section 7 presents the conclusion. Recently, researchers begin to use the alliance blockchain framework for credible and adjustable load resource trading. In [9,10], an alliance blockchain based system is proposed for reviewing and verifying transaction data. The schemes in [3][4][5] enable secure data sharing and storage in the internet of vehicles as well as the reliability and integrity of data transmission. In [6,7], an alliance chain for building a secure energy trading and an electric power trading system are proposed. [11] proposed a P2P energy blockchain system in the energy transaction scenario of the industrial Internet of things. [8] proposed a micro-grid energy auction method based on alliance blockchain to protect the privacy information of each participant. [12] proposed a security privacy protection scheme based on medical health network.
A large number of researchers have begun to increase the throughput of transactions on blockchain via sharding and improving the consensus mechanism. [13] proposed to use a three-tier architecture of shards to ensure the availability of consumers' data, limit competitors' access, and provide scalability for processing transaction loads. [14] proposed a polynomial coding sharding scheme, which realized the information's theoretical upper limit of storage efficiency, system throughput and trust. [15] proposed a novel two-layer scalable blockchain architecture. In the upper layer of the chain, sharing-oriented shards are used to achieve safe and efficient processing of macro-transactions on the chain. Off-chain layer is designed for handling real-time shared transactions. [16] proposed the membership-based hierarchical sharding system. [17] designed a layered and fragmented consensus based on the collaboration between multiple partitions.
For the demand response system, many researchers begin to pay a lot of attention to the competition model that maximizes the interests of all parties. For instance, an interactive system is designed in the context of power trading market using distributed controllers and centralized auction trading markets in [18][19][20][21]. [22] studied the operation models of multiple virtual power plants. [23] designed a distributed iterative algorithm that converges to the variational decomposition of the generalized nash equilibrium problem and a supplementary demand side management program. [24] proposed the optimal bidding model of electric vehicle aggregator based on the relationship between market price and bidding price. [25] proposed an optimal bidding strategy model for implementing the demand response program. [26] formed a daily demand curve or minimize peak demand.
[27] modelled demand response bidding in the realtime balanced market. [28] proposed to manage the power distribution (charging and discharging) of plug-in electric vehicles that support vehicles to the power grid. [29] proposed an optimal control strategy and an optimal bidding strategy. [30] proposed a one-way adjustment algorithm for aggregators. [31] proposed a new scheme to optimize virtual power plant operation and bidding strategy. [32] devised a short-term planning framework that predicts the load under dynamic electricity prices via building a bidding curve. [33] proposed a robust optimal bidding strategy based on risk measurement. [34] proposed the concepts of just-intime transmission and process-gate bidding. [35] proposed a compensation mechanism of load aggregators to perform the direct thermostat control program. [36] proposed a two-stage process based on robust optimization. [37] established a new method in to analyze the economic impact of vehicle-to-grid regulatory reserves.

System model
The blockchain system in smart grid consists of a main chain and alliance chains. The main chain is composed of nodes in the cloud data center of the grid company. Each node is a full node in the blockchain and stores all data of the whole system. An alliance chain is composed of station-area nodes, where each station-area node manages the low-voltage users of the corresponding zone and stores all the transaction data of those users. Each household uses intelligent terminal equipment to manage household power consumption and join the alliance chain as a lightweight node. It is noted that the number of low-voltage users is huge, and various power load transactions and incentive response businesses incur a considerable amount of data. If the traditional blockchain is used, all nodes need to broadcast data to the whole system to reach a consensus before they can successfully add data to the main chain. This will not only consume a lot of computing resources, but also affect the data transmission efficiency. In order to improve the throughput and scalability of the entire blockchain system, we take the main chain of the grid company as the beacon chain, and build an alliance chain for each station area. A station area contains multiple station-area nodes. Each station-area node manages multiple lightweight low-voltage user nodes. Each lightweight low-voltage user node conducts various business transactions with the station-area node by controlling the low-voltage interactive response terminal equipped by the family. The alliance chain diffuses the data to the main chain, and the main chain performs the data synchronization of the whole network. The advantage of designing lightweight interactive nodes for users lies in their strong real-time performance, which can accurately record the electric energy transactions of low-voltage users in a timely manner. The data transmission mechanism optimized layer by layer by vertical structure can improve the operation efficiency of the blockchain system.
The blockchain system in smart grid takes smart contract as the main body. The main chain has strict requirements on data integrity, privacy, security, and supervision, because it involves all data of power consumption and demand response. The business responses of the grid companies, load aggregators, lightweight low-voltage users and other implementation entities must be uploaded to the regional alliance chain before being synchronized to the main chain network. The function of the alliance chain is to connect a large number of demand response terminals, at the same time, collect the demand response services of various low-voltage users, thereby improving the data throughput and scalability of the entire system.
As shown in Figure 2, the blockchain-based smart grid is mainly divided into three layers: hardware layer, core layer and application layer.

The hardware layer
The hardware layer is composed of intelligent appliances, gateways, low-voltage interactive response terminals, station-area nodes and master stations. The main control chip inside the intelligent gateway uploads the collected data such as voltage, current, power, household appliance switching time and household appliance status to the terminal. Considering the hardware storage and performance problems, the low-voltage interactive response terminal only stores the power consumption information related to the home, and joins the alliance chain where the station area is located as a lightweight node. In general, the user's transaction, electricity information and other data are synchronously diffused from the low-voltage interactive response terminal to the station-area nodes in this station area. One stationarea node manages multiple intelligent terminal devices. Each terminal device is bound to each user. Finally, the data is synchronously spread from the station-area node to full nodes of the master station.

The core layer
The station-area nodes are organized into an alliance chain according to geographical regions. Each alliance chain stores and maintains all transactions and data of users associated with lowvoltage interactive response terminals in the chain, and runs its own consensus mechanism independently. These alliance chains will synchronously spread all data to full nodes of the main chain, make consensus on the main chain and store it on the chain. The main chain, as a beacon chain, sends corresponding demand response instructions to the network and records the response results of all station-area nodes. Full nodes of the main chain will audit and evaluate the response effect according to the implementation requirements of the deployed smart contract, and maintain the data of the entire system. All data information stored on the chain cannot be changed. Users can view their own related transactions, electricity and other information on the chain. To improve the efficiency of the whole blockchain-based grid system, we also adopt blockchain sharding technology to design a reliable synchronization mechanism for cross-station-area transactions, which enables users from different station areas to conduct trusted transactions.
At the core level, there are three entity roles: load aggregator, grid company and regulatory authority. The load aggregator is responsible for aggregating the demand response and other information of low-voltage users. The grid company is mainly responsible for making decisions on electricity price and smart contract. The regulatory authority supervises and manages the whole trading process and the operation of the grid system. When the grid company needs to release new power data, it will synchronously spread the data to each low-voltage user's intelligent interactive device with the help of blockchain network broadcast service information, and feed back to the user through the lowvoltage interactive response APP on the mobile terminal. Similarly, when users conduct transactions, the information needs to be uploaded to the main chain, which integrates the transactions and power consumption data within a period of time and broadcasts them to the whole network. In this process, the regulatory authority can meet user needs at any time to view and trace relevant transaction data to ensure the security of data on the chain.

The application layer
The low-voltage interactive response APP receives the interactive response demand from the grid company, collects and reports the bidding response information from users in a unified way, and realizes the low-voltage user interactive response business processing, interactive response strategy generation, user management, and data query and display. Low-voltage users will generate their own independent user codes when accessing the blockchain network, and control the low-voltage interactive response terminals loaded in the home through the low-voltage interactive response APP, so as to meet the needs of low-voltage users in the same or another station area. For example, a low-voltage user works overtime tonight, so the household electricity load is small during this period. After this situation is reported to the system, the system will release the invitation information and distribute the power to other low-voltage users who have successfully bid; The low-voltage interactive response APP will reward or punish users according to their performance, thus reducing the peak pressure of power consumption in the whole grid. Users can view their own uplink historical data, which cannot be changed or deleted. However, to protect the privacy of each lowvoltage user, users cannot view others' uplink data. When the system generates a new block, it also generates a large number of rewards, that is, power incentive points. The points will be managed by the grid company in a unified way. Low-voltage users can reasonably allocate their own peak power consumption interval by participating in the inductive load reduction compensation notice invitation sent by the power supplier, so as to reduce the power load and respond to the power supply, thus ensuring the stability of the grid. On the other hand, in combination with the incentive compatibility demand in the new energy electric vehicle Internet, the battery of the electric vehicle is used as a distributed energy storage system to select discharge at the peak load and charge at the low load, balance the peak load of energy, reduce the fluctuation level of resource supply, and realize the scheduling and commercial use of intelligent energy. In addition, photovoltaic new energy technology is used to realize the self-use of photovoltaic power generation. Excess electricity can be sold to grid companies at the discretion of lowvoltage users. Each low-voltage user will have the credit value of his/ her own account. By actively responding to the energy-saving incentive plan, accurately reporting electricity information, and conducting power resource transactions among users in good faith, high credit points can be maintained. Reliable users with integrity will get more preferential rights and interests, while users with low integrity will not only be included in the credit file, but also have some impact on personal daily electricity use.

Synchronous diffusion mechanism of transaction data based on sharding
In this section, we study the synchronous diffusion mechanism of transaction data. We make full use of the tamper-resistant feature of the blockchain to ensure the accuracy of transactions, and achieve reliable synchronization of blockchain data. All nodes of the power grid master station maintain a main chain, and the low-voltage interactive response terminal synchronously diffuses the generated comprehensive energy service data to the nodes of the local station area. Nodes of the same station area reach a consensus on the data. Each alliance chain is associated with the main chain, and the data are synchronously diffused from the station-area node to all nodes of the master station. All nodes agree and store the data in the main chain, which can ensure the synchronous diffusion of demand response transaction data in the station area. When the block is coming out, the grid company will calculate the demand response strength of each station according to the detailed information of the demand response report during the block out period and the user feedback data, and determine the bookkeeping node in each station area.

Design of consensus mechanism
The grid system is based on the alliance chain. The nodes themselves have independent identification codes and have certain credibility with each other. We design a hybrid consensus mechanism of "response strength + PoW + PBFT", which groups the nodes according to the transaction granularity, reduces the number of nodes participating in the consensus, and improves the consensus efficiency. The response mechanism of the station-area nodes is based on the response value of the station-area node within the station area to the business needs of grid companies. If a user actively Frontiers in Physics frontiersin.org 05 participates in the energy conservation incentive plan of the grid, he/ she will obtain high response value. The higher the response value, the more incentive points, and the higher the credit certificate. The full name of PoW is Proof of Work. All nodes in the station region use their computing power to solve a mathematical problem. The nodes that get the correct results will be eligible to generate new blocks, thus obtaining the accounting right of the block. PBFT is a distributed system consensus algorithm that can tolerate Byzantine errors. Its purpose is to improve the node fault tolerance of the blockchain network and improve the throughput of cross-region transactions.
In the hybrid consensus mechanism, because of the credibility provided by the alliance chain, the station-area node does not need to do more PoW consensus proof, which can avoid the formation of computing power competition and resource waste in the whole network and reduce the computing pressure of nodes. The rewards obtained from the blocks will be uniformly recovered and managed by the grid, and then a certain amount of power incentive points will be issued according to the credit value and the response business strength. Considering the strong interconnection of the station-area nodes on the physical equipment, in order to get a better experience when users interact with the blockchain grid using lightweight interactive terminals, nodes in the blockchain can be divided into groups via the sharding technology. Each partition processes transactions in parallel, which can significantly improve the throughput and scalability of the blockchain.

Trading process within the station area
The transactions within the station are all in the same alliance chain. Each user node only stores the transaction data related to itself. The station-area node stores the data of the entire station. The synchronization consensus is completed within the station area. In order to facilitate users to manage and operate their own nodes in the mobile device and lightweight network environment, the low-voltage interactive response terminal will only store key information related to users, such as user name, password, power equipment, and power quota statistics, and redundant data will be uploaded to the station. For example, in a certain period of time, low-voltage users A and B conduct demand response transactions: A has a small demand for electricity, which is reported to the system to respond to, and B purchases the electricity. If two users are judged to belong to the same station, user B confirms whether A's credit value is lower than the penalty threshold and whether his balance is sufficient. After confirmation, both parties can quickly conduct transactions. A needs to save the submitted response power within this time period. After the transaction is completed, the smart contract will compare the response value submitted by user A with the actual load of user A obtained from the low-voltage interactive response terminal, in order to determine whether user A performs. According to the performance of users, corresponding rewards and punishments will be given.

Cross-area Trading process
We propose the reliable synchronous blockchain model for cross-area transactions based on blockchain sharding. Existing blockchain sharding methods can be divided into two types: full sharding and partial sharding. In the full sharding model, each node only stores the transaction data in its own shard. Hence cross-shard transactions will incurs large time and communication overhead. In the partial sharding model, cross-shard nodes store data of multiple shards. Even if the sender and receiver of a transaction are located in two different shards, the cross-shard nodes can verify the legitimacy and atomicity of the transaction based on their own kept data, without the cross-shard communication. In this way, the crossshard transactions are transformed into intra-shard transactions, thereby reducing time cost. Therefore, we choose partial shards. The nodes in each state area comprise a shard. We divide the station-area nodes into two categories. The station-area nodes used for cross-area interaction are called cross-nodes, and other nodes are called normal-nodes. Cross-nodes store data of different shards, and they are not resident. They are selected by the credit mechanism and then re-selected periodically in the area. Power incentive points will be awarded to corresponding lightweight users.
According to the total credit value and the variance of credit value of users in the station area, we combine the two factors to select the station-area node with a stable upward trend in credit value. These key nodes use the client driven mechanism to submit crossarea transactions, store all cross-area transaction data, and complete cross-area consensus, storage, and communication. As shown in Figure 3, when a user sends a request for the cross-area transaction, the node of the area where the user belongs to will initiate a crossarea consensus and call a universal smart contract that supports cross-area transactions.
A cross-area transaction means that both low-voltage users of the transaction are not in the same station area. If both parties to the transaction are judged to be located in different areas, they will initiate a transaction request at the cross-node in their respective station. It is worth mentioning that since transactions in different areas are asynchronous, data synchronization across areas is required. In addition, the atomicity of cross-area transactions must be guaranteed. The process of cross-area transactions is as follows.
(1) After a low-voltage user node in area A sends a cross-area transaction request, he/she broadcasts the request to the alliance Reliable synchronous diffusion mechanism of transaction data.
Frontiers in Physics frontiersin.org 06 chain of A. For example, if user B works overtime tonight and does not use electricity at home, he/she will report the situation to the system and distribute electricity to the user A in different areas.
(2) Cross-nodes i and j, both located in areas A and B, will initially verify the legitimacy and atomicity of the transaction after receiving the request. Atomicity means that the sender has enough balance, so that the sender has enough expenses to pay. The receiver actually saved the response power within the specified time according to the content agreed in the smart contract. Therefore, the alliance chain of the sender must confirm that there is enough balance in user A's account to pay, and the alliance chain of the receiver must confirm that user B has saved the response power in this period of time. If the user fails to perform, the user can be warned and powered off. (3) After the transaction, all nodes of the grid company will judge whether user B performs according to the provisions of the smart contract, and give corresponding rewards or punishments to users according to the performance. Finally, the two crossnodes, i and j, will package all the transaction data into blocks after completing the consensus of the A's and B's areas, and broadcast them to the alliance chains to complete the synchronization of cross region data. At the same time, the cross-node will synchronize the block to all nodes of the main chain, and the block will recorded on the main chain after all nodes have reached a consensus.

Tracing and querying blockchain Transactions
To ensure the authenticity and reliability of transaction data, we have provided low-voltage users with query services for tracing blockchain transactions, blocks, transaction time, by making use of the openness and transparency of blockchain data. For business transaction data in question, low-voltage users can first submit a query service request to nodes of their own areas. In order to protect the privacy of other low-voltage users, the data queried are limited to those existing with them. If it is found that the sender or receiver of the transaction to be queried is not in this area, the relevant request shall be submitted to the regulatory authority, which will view the main chain information of the grid company and feed back the detailed transaction data records on the user chain.
To achieve transaction traceability, it is necessary to increase the transparency of data governance. The trusted and queriable transaction system can open the door to new digital reliability sharing services. All online data are processed with encryption technology to fully protect the privacy of low-voltage users. A transaction chain governance model is established to provide network supervision, so as to optimize the reliable synchronous diffusion mechanism of the entire transaction data.

Low-voltage load demand response trading
Low-voltage load demand response of users refers to the power consumption adjustment made by users according to the demand response of the grid when the power consumption peak or low peak occurs due to the unbalanced load of the grid. The user completes the demand response transaction based on the principle of signing a contract before demand response and clearing after demand response according to the point to point transaction power consumption time and load of his own demand. Low-voltage load demand response of users is realized by running the smart contract in the lightweight blockchain system. The grid companies, low-voltage users, aggregators and regulators in the system run the smart contract to achieve information release, transaction matching, transaction settlement, price incentive and other functions to complete the trading process. The trading system consists of three modules: lowvoltage side adjustable capacity resource pool, trading rules and price incentive mechanism. Among them, the response volume and expected price provided by users during bidding form a low-voltage side adjustable capacity resource pool, which together with the terminal equipment provides the data source for the smart contract. When users run the smart contract, they will match and conduct point-to-point transactions according to the data and transaction rules of the resource pool, and settle after the end of the demand response cycle. The transaction matching and transaction settlement constitute a twolevel bidding model with the goal of maximizing the interests of users and systems. After the demand response cycle is completed, the price incentive mechanism will be implemented when verifying whether the user performs the contract. A corresponding proportion of price incentives will be given to the users who perform the contract, and economic penalties will be given to the users who break the contract.
In the low-voltage load demand response trading system, the grid company issues demand response signals according to the load dispatching demand; low-voltage users independently choose to participate in the demand response trading process according to the optimal strategy provided by the signal and bidding model. The aggregator conducts transaction settlement with the goal of maximizing the return of users and grid demand response. The regulatory authority is responsible for formulating trading rules and supervising the process of trading. The specific transaction system is shown in Figure 4. We present a two-level bidding model in subsection 5.1. As shown in Figure 4, this model is used for transaction matching and transaction settlement. Next, we present the details of the trading process based on smart contracts. The two-level bidding model is the theoretical basis of transaction processing.

A Two-level bidding model to maximize the interests of users and minimize the cost of grid companies
The bidding model consists of two levels: the upper level corresponds to the transaction matching stage, with the goal of maximizing the interests of all groups of users participating in demand response transactions; The lower level model corresponds to the settlement stage, and the optimization goal is to minimize the cost of the grid company.

The upper level model
The upper level model aims to maximize the interests of group users under the constraints of communication cost, signing and Frontiers in Physics frontiersin.org 07 actual power load, signing and actual power price. We use I users to denote the income of low-voltage users. We use a and b to denote the buyer and seller of point-to-point transactions, respectively. i and j denote the number of the station where low-voltage users are located. t denotes the time. C denotes the comfort cost. W tia represents the load signed by the seller in the i station at time t. p tia denotes the unit price of the seller's contracted electricity in the i station at time t, and tia W tia p tia denotes total contract amount in the system, namely W tia and p tia product. Correspondingly, we use W tjb to denote the actual power load of the buyer in the j station at time t. However, it should be noted that the power load may exceed the contracted load at this time due to the possibility of the seller's breach of contract. We use p tjb to denote the unit price of the buyer's actual power load in the j − th station at time t, so the sum of the demand response amount in the system can also be expressed by the sum of the product of the two (W tjb and p tjb ). Therefore, we use tia W tia p tia − tjb W tjb p tjb to denote the difference between the sum of the contract amount in the system and the sum of the demand response amount. It also means the amount and profit generated by the point-to-point transactions of the total low-voltage user groups in the entire demand response system. After the subtraction of the cost of comfort, it can be used to express the goal of maximizing the interests of group users. As shown in Eqs 2, 3, we use D to denote the communicate cost, Temp to denote temperature, α tTemp to denote comfort coefficient, X to denote the time cost of a single communication between a cross-node and a node in a station, and Y to denote the communication time cost between two cross-nodes in different station. In the system, the comfort cost of low-voltage users equivalent to the power supply side in demand response is mainly considered. The cost affected by natural factors such as temperature and time can be obtained by summing the product of comfort coefficient and actual power load, that is, α tTemp · W tjb . The communication cost needs to be discussed according to the situation of different stations. When users of both sides of the transaction are in the same station, after submission and confirmation, the communication time cost is twice the time cost of a single communication, that is, 2X. If both parties are in different station, the communication time cost should be added to the communication between two CrossNodes in different stations, that is, 2X + Y. Then the comfort cost can be calculated by the cost affected by natural factors and communication cost, namely C tTemp α tTemp · tjb W tjb + D. In Eq 4-7, we set the contracted load and its unit price. Eq. 4 makes the constraint that the total load signed by sellers must be non-negative. Eq. 5 makes the constraint that the total actual power load of buyers must be non-negative. Eq. 6 makes the constraint that the total price of the seller's contracted electricity must be non-negative. Eq. 7 makes the constraint that the total price of buyer's actual power load must be non-negative. In Eq. 8, we use B to denote the comfort budget, representing the upper limit of the comfort cost in the system.

The lower level model
The lower level model aims to minimize the cost of grid companies under the constraint of marginal generation cost price. We use I CSG to denote the cost of the grid company, p tjm to denote the generation price of the grid beyond the demand response plan, and β to denote the real-time price adjustment coefficient. If all users fulfill the agreement, the cost of the grid Frontiers in Physics frontiersin.org 08 will just offset the settlement amount of the user's participation in the demand response. However, in the settlement stage, when a user defaults, there may be two situations: excessive power consumption and failure to reach the agreed power load. Therefore, we use | tjb W tjb − tia W tia | to denote the unplanned power load. As shown in Eq. 10, when tia W tia > tjb W tjb , the grid actually provided more power to users than the planned load, and the cost that could not be offset came from the cost of these multiple generating loads. So the real-time price adjustment coefficient was 0.
When tia W tia ≤ tjb W tjb , the situation of excessive power consumption by low-voltage users can be expressed. We use tjm p tjm − tjb β.p tjb to denote the marginal cost price of grid generation. The product of the unplanned power load and the marginal cost price of grid generation can represent the cost of the grid, as shown in Eq. 9. In addition, it should also ensure that the grid generation price is non negative, that is, Eq. 11.

Trading process
The trading process can be generally divided into five stages: user registration, information release, transaction matching, transaction settlement and price incentive. The specific trading process is shown in Figure 5.

User registration stage
Firstly, all roles involved in the user low-voltage load demand response trading system are registered in the blockchain system, including grid companies, aggregators, regulatory companies, and low-voltage users. According to the different roles of registration, they perform different functions in the lowvoltage load response trading system. After registering in the blockchain system, users can participate in demand response through smart contracts.

Release demand response stage
The initialization function Initial(): according to the load scheduling demand, the grid company sends a demand signal to all users in the blockchain system through the Initial() function. A global variable of boolean type will be set in the function. If the variable is true, it means that it is allowed to participate in this demand response.
Information collection function GetUsersInformation(): the aggregator collects the information of low-voltage users participating in this demand response point-to-point transaction using the information collection function GetUsersInformation(). The information collected is divided into two parts: buyer information and seller information. The information collected from these two parties is used to calculate the maximum profit of the user in the transaction matching of the bidding model. The Frontiers in Physics frontiersin.org 09 buyer information includes the demand load, the price acceptable to the user, the desired response time, and the station area where the user is located. The seller information includes the load, price, response time, user's station area and user's credit value that the seller intends to provide.
Qualification verification function QualificationVerification(): at the same time, it is necessary to ensure that the seller is qualified to provide demand response quantity, so it should be verified by the function QualificationVerification().

Transaction matching stage
Profit maximization function for low-voltage users MaxUsersProfit(): At this stage, the aggregator calculates the maximum profit of the user through the function MaxUsersProfit() and lists the matching pairs of transactions under the condition of maximizing the benefits. This trading pair is fed back to the user so that the user can decide whether to choose the trading matching result, which is implemented by the bidding model. The variables calculated by the user are from the information collection function.
Submission function Confirmtransaction(): After the aggregator calculates the user's maximum profit, the Confirmtransaction() function is required for the user to submit.
Confirmation function Confirm(): To ensure the user's privacy, the confirmation function Confirm() needs to be confirmed by the buyer and the seller respectively. After the buyer and the seller confirm respectively, the aggregator collects the confirmation results and submits them to the blockchain system for the next stage of transaction settlement.

Transaction settlement stage
Credit value settlement function SettlementCredit(): according to the comparison between the data obtained from the user intelligent terminals of the buyer and the seller after the completion of the demand response phase and the electricity quantity in the contract, if the contract is performed, the credit value of the user in this transaction will be increased by two points. If the contract is breached, the credit value will be decreased by four points for the settlement of credit value.
Amount settlement function SettlementAmount(): the load and price at the time of signing the demand response contract and after the completion of the demand response phase are compared. The point-to-point trading parties settle the transaction amount. The real-time electricity price at the time of demand response is priced by the grid company with the lowest cost as the optimization goal.

Price incentive stage
Price incentive function PriceIncentives(): in this stage, according to the credit value obtained by the user whether to perform the contract in the transaction settlement and the realtime electricity price in response, the reward and penalty prices for normal electricity use in the later period are calculated by the RP price incentive model based on the user's credit value.
Penalty function Punish(): according to the user's credit value when completing the transaction, it can judge whether the lowvoltage user has reached the power outage threshold. That is, if the credit value is lower than 50, the intelligent terminal will be controlled to power off.

Evaluation
In the evaluation, we test the reliable synchronous blockchain model. Notice that this synchronous blockchain model is built on partial sharding where cross-nodes store transactions of different station areas. Hence, we compare the partial sharding with the full sharding technique.

Experiment settings
Experimental data sets. The experimental settings are shown in Table 1 s represents the number of shards, n represents the number of nodes, and m represents the number of transactions. The number of shards varies in [2,3,4,5,6,7,8,9,10], and the number of nodes varies in [2,3,4,5]. In the storage overhead experiment, assuming that the number of transactions stored in different shards is the same. The number of transactions in each shard varies in [250,500,750,1000]. The number of slices varies in [2,3,4]. The blockchain accounts participating in the power points transaction are distributed in different shards according to the station area they are located in. The cross-node stores transactions in their own regions and cross-district transactions, while a normal-node only stores cross-sharding transactions in their own regions and related transactions. Transactions are generated by a blockchain prototype systems 1 .
Metrics. Time cost and storage cost are used to evaluate the performance of the methods. In terms of time cost, when the number of shards is fixed, the more nodes, the more consensus time may be required, and the time cost will increase accordingly. When the number of nodes is fixed, the more shards there are, the more consensus time may be required. In terms of storage overhead, since a cross-node needs to store two or more pieces of data, the storage overhead will be much higher than that of a cross-node in the sharding. As the number of shards increases, the storage overhead of the cross-node will increase accordingly.
Experimental environment. A blockchain prototype system has been built for the evaluation. The prototype system runs in a server with a 12th Gen Intel ® Core ™ i7-12700F processor and 128 GB memory. We use the Ubuntu22.04 operating system. All algorithms were coded with Java. Multiple virtual nodes were generated with Docker.
Competitors. We tested the time cost and the storage cost. We tested the influence of the number of nodes and the number of shards. We compare two sharding methods: full sharding and partial sharding. The sharding methods used in this paper is partial shard. We also tested the storage overhead of the two types of nodes, that is,
Frontiers in Physics frontiersin.org 11 normal-node and cross-node, in the partial sharding method. The full sharding storage model only contains normal-nodes, and the entire blockchain ledger is divided into several disjoint ledgers and stored in normal-nodes. Each shard maintains its own ledger, and all shards of the entire blockchain network have a complete ledger together. In the partial sharding storage model, a cross-node stores data of multiple shards and processes cross-sharding transactions, so as to shorten the consensus time, but this may bring a huge storage. In this experiment, we fixed the number of shards as 2,3,4,5,6,7,8,9, and 10, respectively. We tested the time cost required for full shards and partial shards, respectively. The experimental results are shown in Figures 6-8.
From the experimental results, we can see that the time cost of full shards is much higher than that of partial shards, and with the increase of the number of nodes, the time cost shows an overall upward trend. The main reason is that the increase in the number of nodes will affect the consensus time. We use s = 2 as an example. When n = 2, the time cost of partial shards is 54.3% of that of full shards. When n = 3, the time cost of partial shards is 51.9% of that of full shards. When n = 4, the time cost of partial shards is 54.3% of that of full shards. When n = 5, the time cost of partial shards is 75.5% of that of full shards.

Influence of the number of shards on time cost
In this experiment, we fixed the number of nodes as 2, 3, and 4, respectively. When the number of shards is in [2,3,4,5]. We compare the time cost of the cross-chain transaction between full shards and partial shards. Figure 9 shows the impact of the number s of shards on the time cost of cross-chain transactions of full shards and partial shards. The time cost of cross-chain transactions of full shards is much higher than that of partial shards. With the increase in the number of shards, the time cost of full shards is on the rise as a whole, while the partial shards are relatively stable. The main reason is that the increase in the number of shards involved in cross-chain transactions will lead to an increase in  Frontiers in Physics frontiersin.org consensus and communication time for full shards. However, because partial shards use cross-nodes to store multiple pieces of data, the consensus needs to be conducted only once. We use n = 2 as an example. When s = 2, the time cost of partial shards is 47.5% of that of full shards. When s = 3, the time cost of partial shards is 28.7% of that of full shards. When s = 4, the time cost of partial shards is 16.6% of that of full shards. When s = 5, the time cost of partial shards is 17.1% of that of full shards.

Storage overhead
We compare the storage overhead required by a normal-node and a cross-node in partial sharding model. The number of transactions is in [250,500,750,1000]. We assume that each shard stores the same number of transactions. The results of the experiment are shown in Figure 10. We can see that the storage overhead of a cross-node is much higher than that of a normal-node. With the increase in the number of partitions, the storage overhead of a cross-node will continue to increase. This is because a cross-node will store all the data of the shards, so the storage overhead must be higher than that of a normalnode. When s = 2, the storage overhead of a normal-node is 50% of that of a cross-node. When s = 3, the storage overhead of the a normal-node is 33.5% of that of a cross-node. When s = 4, the storage overhead of a normal-node is 25% of that of a cross-node.

Conclusion of the experiments
With respect to the time cost, for full shards, with the increase of the number of nodes or the number of shards, the time cost becomes larger. For partial sharding, the time cost increases slightly with the number of nodes. When the number of shards involved in crosschain transactions is more, the time cost of partial shards will be far less than that of full shards. Therefore, partial sharding performs better than full sharding. With the increase in the number of shards, the storage of a cross-node will become larger.

Conclusion
We have proposed a credible and adjustable load resource trading framework based on blockchain. The blockchain system uses the master station as the full node and the intelligent interactive terminal/module as the lightweight node. To realize the reliable synchronization of blockchain data, we have proposed a synchronous diffusion mechanism. Combined with the low-voltage side adjustable capacity resource pool and market trading rules, We have constructed the user low-voltage load demand response trading system. A two-level bidding model based on maximizing the interests of users and minimizing the cost of grid companies is proposed. The upper-level model corresponds to the transaction matching stage, and the lower-level model corresponds to the settlement stage. We have tested the proposed method on the blockchain platform, and the experimental results demonstrates the effectiveness of our method.

Data availability statement
The original contributions presented in the study are included in the article/supplementary material further inquiries can be directed to the corresponding author.