Application of blockchain in integrated energy system transactions

. Blockchain technology is the underlying technology of Bitcoin, which is fair, transparent and decentralized. The integrated energy system has the characteristics of open interconnection, user-centered and distributed peer-to-peer sharing, and its energy trading model will also be developed centrally to distributed. The characteristics of blockchain technology make it naturally applicable to energy transactions in integrated energy systems. This article first analyzes the characteristics of the integrated energy system market and summarizes the participants in the market. Then, based on the existing research and analysis, a blockchain-based energy transaction architecture is designed, and a weakly centralized management method is introduced. finally, the problems and challenges faced by the application of blockchain in energy transactions are analyzed.


Introduction
Traditional energy trading is mainly a resource allocation method for centralized optimization and decision-making. It has the disadvantages of high cost, vulnerability, and difficulty in protecting user privacy. Energy Internet is a kind of pan-energy system. Under the guidance of new connotations such as open interconnection, user-centered and distributed peer-topeer sharing, its energy transactions will tend to diversify the subject, diversify commodities, decentralize decision-making, and make information transparent. The transaction will be instantaneous, and at the same time, there will be a trend of "three flows" of energy flow, information flow and value flow. Under the existing centralized transaction model, energy trading requires a large number of third-party management institutions to build and maintain transaction credit, which generates unnecessary high costs. Therefore, in order to promote the further development of the energy system under the Internet of Energy, it is necessary to reform the existing energy trading model and realize the change of the distributed market model instead of the centralized management model. In the distributed energy trading model, participants in the energy trading market are peer-to-peer, decentralized, and a variety of energy sources are autonomous and autonomous, eliminating the need for a third-party trust institution. Because of its fairness, transparency, and decentralization, blockchain technology will have a very broad application prospect in distributed energy transactions.
At present, the application scenarios of blockchain have been extended from the original financial field [1,3] to medical [4,5], the Internet of Things [6,8], logistics [9] and other fields, and they have also begun to emerge in the energy field. However, there is currently little research on the application of blockchain in the field of energy trading. However, there is currently little research on the application of blockchain in the field of energy trading. Reference [10] applied multi-signature technology, blockchain and anonymous information flow to distributed energy transactions, and proposed a solution to ensure transaction security when a third party is untrusted in a distributed smart grid; Reference [11] studies that in the housing society environment, a smart device as a blockchain node acts as a power trader and automatically completes device-to-device power transactions through technologies such as smart contracts. These studies have explored the application of blockchain technology in energy trading, but only realized electricity trading through blockchain technology, and regarded electricity as a general commodity, without considering the specificity of energy commodities. In addition, most literature only explores the transaction process, but few studies on energy trading systems are sufficient to solve the practical application problems of energy trading.
Therefore, based on existing research, this paper proposes a 3-layer energy transaction architecture based on blockchain technology, and analyzes the application of key technologies such as blockchain and smart contracts in the architecture. At the same time, the particularity of energy determines that energy trading is inseparable from certain regulations. Therefore, on the basis of distributed transactions, this paper introduces a weakly centralized management method. Weakly weak institutions are used as a special node in the blockchain network to perform necessary supervision on the entities involved in energy transactions and trading activities to ensure that the transaction went smoothly. Finally, we analyze the problems and challenges faced by blockchain-based energy trading applications.

Market characteristic
In the regional distribution market of integrated energy systems, consumers, energy sellers, energy storage companies, energy grid operators, and other entities have real-time decentralized, point-to-point transactions. The decision of the transaction is made by each transaction subject and will be executed automatically after the transaction is completed. It mainly has the following characteristics: (1) Decentralization: The regional distribution market of the integrated energy system is decentralized as a whole, the status of each subject is equal, and the transaction process has the characteristics of decentralization and point-to-point.
(2) Self-optimization: The transaction subject of the integrated energy system regional distribution market can decide whether to participate in the transaction and the amount and price information of the transaction declaration according to the value signal, so as to complete the self-optimization of the integrated energy regional distribution market, instead of just responding to the dispatch of the dispatch agency instruction.
(3) Automation: In the comprehensive energy regional distribution market, consumers, energy sellers, energy storage companies, and energy supply network operators, and other market entities have experienced real-time transactions before, and the value signals are constantly changing. Therefore, decision-making and implementation are required. The ability to respond automatically at all stages.
(4) Value response: The price signal in the comprehensive energy regional distribution market can reflect the supply and demand relationship of multiple types of energy, affect the volume and direction of transactions, and promote the real-time supply and demand balance of the market.

Market subject
Relevant market players in the integrated energy system regional distribution market mainly include the following aspects: (1) Ordinary consumers: Ordinary consumers refer to users who do not have the capacity to produce energy in the regional distribution market of the integrated energy system, and all their energy needs are met through energy supply network transactions. Common consumers include electricity consumers, hot and cold consumers, and gas consumers. Each of these categories can be divided into three levels: residential consumer, commercial consumer, and industrial consumer.
(2) Production consumers: Because distributed energy and energy storage can have separate operating entities and can be "implanted" with end users, there are production consumers in the regional energy distribution market. Production consumers have distributed energy, and users who meet part or all of their energy needs through their own distributed energy. Production consumers with excess energy can sell it on trading platforms. For production consumers, it is divided into two sub-categories of energy storage capacity and no energy storage capacity.
(3) Energy storage provider: An energy storage provider refers to an operating entity that operates services such as electricity storage, heat storage, cold storage, and gas storage. The main income of energy storage companies can be divided into two parts: direct income and indirect income. Direct income mainly refers to income from peak-to-valley spreads and government subsidies, while indirect income includes income from delays in upgrading integrated energy networks, improving user reliability, and promoting new energy consumption.
(4) Energy sellers: Energy sellers are the main energy suppliers in the regional market of integrated energy systems. Energy sellers can be independent market players, trade with other members, and participate in wholesale markets as users. The agent, that is, the energy seller, has both the agent attribute and the transaction attribute.
(5) Energy supply network operators: Energy supply network operators mainly refer to operators who operate energy supply networks such as distribution networks, heating networks, and gas pipeline networks. Under the regional market mechanism of the integrated energy system, the operator of the energy supply network can also participate in the transaction as an independent market entity and issue specific transaction requirements to users in the energy supply network. In addition, it still provides energy supply guarantee services for the region Energy supply expenses, owning energy network assets, responsible for planning, construction, maintenance, etc. That is, the energy supply network operator has both comprehensive energy network operation attributes and transaction attributes.
(6) Market operation platform: Under the regionally distributed market mechanism of the integrated energy system, the market operation platform is mainly responsible for organizing and processing market transactions, and storing and publishing market transaction information. In addition, in order to avoid transactions that violate security constraints and deliberately creating blockages to control the market, the market operation platform also has the power and responsibility to issue security warnings, tailor temporary transactions, and close transactions. The market operation platform monitors the market status in real time. When an illegal transaction is expected to occur, it can prompt the load of the corresponding line and transformer, or issue restrictions on the power output of the corresponding node; when the transaction is submitted to the market operation platform, its delivery violates system security When constrained, the market operation platform directly implements transaction tailoring and releases relevant information; when the system is under high load or unstable conditions, the market operation platform can even suspend transactions in accordance with market rules until the system returns to normal.
3 Blockchain-based energy trading system architecture

Architecture of Energy Trading System
Comprehensive energy trading strives to promote the efficient integration and open interconnection of multiple energy systems such as electricity, heat, gas, and electrified transportation. Therefore, a comprehensive energy trading platform capable of freely trading various energy sources is needed. The architecture of an energy trading system based on blockchain and combined with smart contracts is shown in the figure. The energy trading system consists of a transaction layer, an extension layer, and a blockchain layer. The blockchain layer is the underlying foundation of the architecture. At the same time, the transaction layer completes energy transactions between multiple systems with the technical support of the extension layer.  The transaction layer includes multiple systems including power systems, thermal systems, gas systems, and transportation systems. Each system is coupled and interconnected to form a hybrid energy system. In the case of distributed transactions, transaction entities include power plants, power companies, distributed energy producers, smart homes (producers and consumers), and other energy (coal, gas, oil, etc.) holders. Each entity initiates and completes energy transactions at this layer, sends the transaction data reached to the extension layer, forms a smart contract, and forms a feasible transaction through weakly centralized management. Finally, the relevant data is stored in the blockchain layer.
The extension layer has two functions, namely smart contracts and weakly centralized management. The transaction subject negotiates to reach a transaction intention and forms a smart contract. The contract is broadcast to each node of the blockchain via a peer-topeer (P2P) network. When the contract's execution conditions are reached, the contract is automatically executed, improving transaction efficiency. At the same time, energy is different from ordinary commodities and cannot be separated from the necessary management during the transaction. For example, in order to ensure the safe operation of the power grid, some global information must be mastered and judged by the central organization, and power transactions should be coordinated. It is difficult to completely solve the problem only by the enforcement of the system itself and smart contracts; related transaction standards and equipment safety standards need to be formulated by regulators.
The blockchain layer is the underlying technical foundation of the transaction architecture and consists of a P2P network and a blockchain storage device. The blockchain layer has a large number of network nodes. Each node is a storage point of the blockchain. Each node has its own storage device. The nodes are all peerto-peer and connected and interacted with each other in a flat topology. Each node undertakes functions such as network routing, verifying and propagating block data, storing data records, discovering new nodes, and the nodes can decide to join or withdraw from the network according to their own circumstances During the transaction process, the participants automatically generate smart contracts after reaching bilateral or multilateral transactions through games. Smart contracts should have attributes such as the identity of each party to the transaction, energy quota, price, transaction time, and default amount. At the same time, both parties to the transaction use the private key to sign, to ensure the validity of the contract. After the conclusion of the transaction smart contract, it will be announced to the blockchain network, and then the node will package the transaction smart contract received within a period of time into a block, and continue to broadcast to the entire network. Eventually, all nodes compete for the right to book and obtain the book The right node is responsible for putting the block into the blockchain storage and continues to accept subsequent blocks. In the process, weakly centralized institutions check each transaction and are always ready to terminate illegal transactions.

Blockchain-based smart contract execution mechanism
Generally speaking, the steps for building and executing smart contracts based on blockchain are shown in Figure  2.First, the two parties or multiple parties jointly formulate an energy trading contract according to the needs; after that, the parties to the contract agree on the contract content, the conditions for breach of contract, the liability for breach of contract, and the external verification data source. The P2P network spreads to the entire network of nodes and stores them. Finally, when the parties complete tasks according to agreed terms, the smart contracts stored in the blockchain are automatically executed. During the energy transaction process, after the participants reach bilateral and multilateral transactions through games, the platform automatically generates smart contracts, writes the attributes of the trader's identity, energy quota, price, transaction time, and default amount, and finally uses the private key for multiple signatures. To ensure that the contract cannot be tampered with. The smart contract generated by the transaction is not only defined by the code, but also enforced by the code. The two parties of the smart contract do not need to trust each other or the supervision of a trust intermediary. They are completely automatic and cannot intervene, which reduces the additional cost of the transaction. At the same time, once the smart contract is determined, its funds will be allocated according to the terms of the contract. This fund can be used only after the pre-set conditions of the contract are met. During the conclusion of the contract and after it takes effect, neither party can control or misappropriate the funds. Ensure the security of its transactions. In addition, the smart contracts stored in the blockchain are guaranteed by the nodes on the entire network that they cannot be tampered with, and the contract content can only be changed after obtaining the consent of all contract signing parties. The addition of smart contracts makes transactions have the advantages of distributed trust autonomy, fairness and justice, lower costs, high efficiency, and tamper-resistance.

Weakly Centralized Management
This paper introduces weakly centralized institutions for necessary management. Weak centralization means that the energy trading game process, determination of energy prices, and transaction records are all completed autonomously by participating nodes. Weak central institutions are a special node in the blockchain trading network. Compared with other nodes, weak central institutions It has the rights of account management and transaction supervision, such as transaction qualification confirmation and contract review, but it does not have the right to modify. Related changes need to obtain node consensus. Although the "central institution" exists in this model, its power is limited compared with the traditional one.
Every user in the blockchain has installed a unified blockchain client, which can implement information recording and communication with other nodes. For direct power generation and power users, the client will also associate with its smart meter and automatically record its power generation and power consumption data on the blockchain. First, the power trader reaches a transaction through a game, records it in the form of a smart contract, and spreads it to each node of the entire network through the P2P network. Each node in the entire network forms a consensus on the transactions reached through communication. Next, market participants perform distributed security checks on ad hoc transactions or security checks by central agencies. If the security check is passed, the transaction will be recorded on the blockchain.

Problems and challenges
At present, China is vigorously pursuing energy reforms, increasing the use of renewable new energy sources, gradually getting rid of its dependence on coal-based traditional energy sources, and promoting energy conservation and emission reduction. In the framework of the Energy Internet, this paper proposes a blockchainbased energy trading architecture and builds a free distributed trading market. However, removing the technical flaws of the blockchain [11] and some problems of the smart contract itself [12], there are still some problems that need to be solved.
(1) At present, China's energy trading is still managed and operated by state-owned enterprises, and the blockchain-based distributed energy trading system allows private users to directly conduct energy trading based on electricity, which does not meet China's national conditions, so it also requires government Discuss feasible implementation methods in depth and promulgate a series of reform measures.
(2) The combination of blockchain and smart contracts guarantees the security of energy transactions to a certain extent, but energy needs to be transmitted from one end to the other end through the physical network, such as power transmission through the power grid and natural gas transmission through pipelines. In this process, a series of human operations still exist. How to accurately collect and upload information needs to be discussed in depth to ensure the reliability of energy transactions during human operations.
(3) Once the blockchain-based energy trading platform performs actual market operations, the distributed market trading model will greatly increase the complexity of system scheduling, and the energy system will always conduct a large number of energy transactions. Achieving circulation through the transmission network places great demands on the transmission capacity, stability, and pressure resistance of the physical and information communication transmission network.  Fig. 3 Procedure of less centralized trading.

Conclusion
Energy Internet is the product of multi-energy fusion, cyber-physical fusion and multi-market integration. It will profoundly affect future energy production, transmission, storage and consumption, and promote the efficiency and cleanliness of production capacity and energy use. In such a large and complex system, how to make rich distributed energy sources obtain optimal resource allocation and build an energy-based energy trading mechanism that includes multiple energy sources is a question worthy of in-depth analysis. The emergence of blockchain technology has provided a good opportunity for the development and application of the Energy Internet. Its decentralization, openness, autonomy, and information cannot be tampered with have become the basis for building a "value energy Internet". This article introduces blockchain technology and combines smart contracts to achieve secure, credible and peer-to-peer energy transactions, effectively reducing costs, and at the same time introducing weakly centralized management methods to ensure the order of the energy market in view of the specificity of energy transactions. And the legitimacy of the transaction.
However, as far as the status quo is concerned, the Energy Internet, Blockchain, and Smart Contracts are at the forefront of technological research, all of which have certain limitations and need to be broken. Therefore, the real implementation of the "Blockchain + Smart Contract" application in the Energy Internet requires the joint efforts of multiple parties. On the one hand, the government needs to speed up the introduction of supporting policies, standardize and encourage the exploration of relevant theories and technologies, cultivate relevant talents, and keep up with the world's advanced level. On the other hand, experts and scholars should accelerate the pace based on existing research results, work hard to overcome difficulties, and strive to occupy more speaking power in related fields.