Research and Application of Power Grid Control System Based on Blockchain

This paper systematically proposes a grid control method and application model based on the blockchain. The control platform system adopts a national-provincial two-level deployment scheme (the control system is a multi-node deployed cloud system). This method treats both the national cloud system and the provincial cloud system as nodes in the blockchain. The national cloud system is the leading role of the blockchain and is responsible for the maintenance of the entire network model structure and the update and release of smart contracts. When the model structure or data of any node changes, the provincial system synchronizes the information and updates the local model data. Each block stores the node’s model operation information (addition, deletion, modification, etc.) according to the time series. According to the information on the chain, the entire network model (node data) can be traced at any time.A blockchain-based model control system that treats both the national system and the provincial system as blockchain nodes. Through smart contracts, a model data chain containing the entire network model and model maintenance “ledgers” is created, and each node can synchronize information and obtain data in real time. Model data, across the entire network and at any time, can be traced through the “ledger”, which not only ensures data security and credibility, but also can be used for analysis, mining and business development. This method has good technical innovation and business practicability.


Introduction
Block-chain has become hot recently, and there are plenty of reasons for us to value it [1]. Block-chain, as an emerging accounting technology, would use distributed storage to record the transaction information of all participants in a chain structure, which would guarantee the integrity, nonrepudiation and immutability of transaction information. The block-chain applies cryptographic principles to handle ownership of the transaction process. More importantly, once the information recorded in the block-chain , it will be permanently stored [2].In recent years, the block chain has formed the typical and highly feasible technical solution, especially in the scenarios of new energy cloud, power trading, integrated energy, material procurement, safe production, and financial technology. Block-chain has many advantages. For example, its implementation can improve business level, reduce operation and maintenance costs, improve the efficiency of collaborative work, and can build a very trusted system [3]. The existing power grid control system is composed of national-provincial-regional multi-party systems and operates cooperatively. The system model maintenance method is old and traditional, the model synchronization / subscription process is long, the timeliness is poor, and it is difficult to ensure the consistency of the model. The grid control system basing on block-chain is a typical mulch-party participation platform, the technical characteristics of which are suitable for complex system scenarios with mufti-party participation. The distributed, immutable and multi-party ledger composed by blockchain technology is used to store encrypted data and form a huge immutable database.It will solve series of problems in grid regulation that carrying out research on the application of block-chain in the field of grid regulation.Meanwhile, it can accelerate the advancement of the energy industry that utilizing the technical advantages of high reliability of block-chain, decentralized distributed deployment and smart contracts 2. The Basic Structure of the Blockchain A typical blockchain goes from the underlying architecture to the upper application layer: it consists of the basic layer, core layer, management layer, service layer, application layer, etc. The system structure is shown in Figure 1 below.

Basic Layer
The base layer has the functions of recording, storing, verifying and disseminating information in the blockchain system network. Blockchain is a distributed system based on the propagation mechanism, verification mechanism and storage mechanism. The entire network has no centralized hardware or management mechanism. Any node has the opportunity to participate in the recording and verification of the general ledger, and broadcast the calculation results. And the damage or withdrawal of any node will not affect the operation of the entire system [4][5][14].

Core Layer
The core layer includes the consensus mechanism, ledger records, HASH algorithm, Encryption Algorithm, digital signature and Intelligent contract functions.

Consensus Mechanism.
Each node on the blockchain will have a ledger that records all transactions on the chain. When a new transaction is generated on the chain, the malicious node may publish some wrong information. The consensus mechanism effectively eliminates errors through the principle of "minority obeys majority" Information to ensure the consistency and validity of data It would be responsible for the information storage of the blockchain system in chronological order, including collecting transaction data, generating data blocks, verifying the legality of local data and adding the blocks to the chain. The account-based data model more conveniently record and query account-related information [14][15]. Including block ledger, status ledger and historical ledger [6].

HASH Algorithm (Electronic Data Summary).
The Hash algorithm can map arbitrary length strings to shorter fixed-length strings. There is a slight change in the input original string, and the output hash value will change greatly (avalanche effect). Hash values, also known as electronic data digests, protect sensitive private data, which guarantee authenticity, integrity, tamper-proof and traceable of data[14].

Encryption Algorithm.
Encryption uses cryptographic algorithms and keys to transform the original data to ensure that the confidentiality of the data is not compromised. The data transmission of each node of the blockchain adopts the national encryption algorithm (SM2, SM3, SM4) data encryption to ensure that data is not leaked during the message exchange process. In terms of privacy protection, the blockchain also supports the on-chain of ciphertext data and permission control based on password technology. Using key distribution methods, it is ensured that only designated personnel can view the data.

Digital
Signature. Using asymmetric key encryption technology, the data is "encrypted" with the private key. The encrypted result can only be generated by the owner of the private key. Others cannot forge it. At the same time, anyone can decrypt the data using the public key they hold. It call digital signature that the non-repudiation result. Each node of the blockchain is configured with a private key and digital certificate, and digital signatures are used in the message exchange and consensus process to ensure the identity of each node.

Smart
Contract. Smart contract would translate established real-world rules, constraints and conditions into machine language, Meanwhile it implement business logic in the form of compute code to complete automatic triggering with minimal human intervention [7][14].

Management Layer
2.3.1. Node Authentication and Authorization. The blockchain implements the alliance chain node access mechanism through CA certification and authorization. When a new member is allowed to join the alliance, he needs to send his public key and the necessary identification information to the certificate authority (CA). Then, the CA organization issues a certificate for the CA as a permission certificate for joining the alliance based on this information. The certificate is actually a user's public key certificate issued by the CA organization. When a new member sends a message, it needs to attach its own identity information. When other nodes receive the message from the member, they authenticate their identity. If the authentication fails, they cannot participate in accounting. Therefore, only members authorized by the CA will be recognized by other nodes in the alliance.

Application Access and Authorization.
The blockchain supports simple and easy-to-operate interfaces to implement certificate storage and Intelligent contract execution. Application access is authorized by means of keys. Application access and authorization modules provide functions such as adding, deleting, and authorizing applications.

Management and Monitoring Platform.
The blockchain provides a web management control platform that supports the operation and maintenance of the underlying platform, flexibly determines the scale of the deployment of the blockchain and the operating status of the nodes, and implements a full-featured API interface on top of the underlying system to implement upper-layer applicationbased Development [8]. The Web management control platform interacts with the blockchain through the API interface of the blockchain, thereby realizing real-time monitoring and alarming of blockchain nodes, real-time analysis of blockchain logs, real-time monitoring of block information, historical browsing, and intelligence Contract deployment, invocation and management functions.

Service Layer
Provide API interface, HTTP interface, data scheduling and other functions.

Application Layer
Provide trusted, secure and fast blockchain applications. You can use the blockchain to provide the target service you need. The blockchain implements functions such as application access, data storage, data query for application systems and so on.

Security
On the security design of blockchain, the unique services include multi-pronged privacy protection and domestic cryptographic algorithms. Privacy protection technologies include digital fingerprint technology and HASH value on-chain, which will ensure the integrity of data, support data transmission limited to specific authorized nodes, and support encryption and decryption to access user data with access control. Cross-chain technology further eliminates privacy concerns for external chain applications. The domestic cryptographic algorithm refers to the SM2, SM3, SM4 or other algorithms, the hardware implementation of the national secret algorithm and supporting mainstream encryption machines.

Toolkit
Nodes can use the toolkit provided in the blockchain to obtain the above-mentioned three levels of functional services and corresponding related applications and services. The toolkit runs through the entire blockchain system, and users only need to call specific interfaces to use the corresponding tools. The toolkit includes data management, development kit (SDK), configuration management, etc.

Objectives of the Model
The grid control system (that is the cloud system accurately) has established a unified model structure based on structured design. The model data from the source and the terminal is collected synchronized to the cloud system of province via the bus. The cloud system of province( that can be seem as the cloud node of a province) then aggregates the complete integrity data of the province to Cloud system of nation ,which forms a complete process to maintain network-wide model data . Cloud nodes in various provinces can obtain model data of other province nodes through subscriptions. However, they do not support real-time synchronization data update in various provinces and traceability of historical models data. Utilizing the characteristics of decentralization, anti-tampering, and traceability ,which are the feature of blockchain technology ,to establish a model data maintenance chain, which can effectively solve the problems of accidental deletion, modification, and misoperation in the model data maintenance process, using blockchain encryption technology and consensus The mechanism can provide real-time data updated and traceable on-chain model data, and provide a stable and reliable model data foundation for grid regulation and operation.

Modeling Logic
The traditional maintenance cloud model is as shown in Figure 2(a), and the maintenance model based on blockchain is shown in the following figure 2(b). The maintenance model system adopts the national -provincial two-level deployment scheme.The country cloud system and the province cloud system can be seem as the nodes in the block chain., and the country cloud system is the leading role node of the blockchain, which is responsible for the maintenance of the entire network model structure and the update and release of smart contracts. When the model structure or data of any node changes, the provincial cloud synchronizes information and updates local model data. Model operation information (operation information such as addition, deletion, modification, etc.) is stored in the each blockchain node, which anable we can trace information and data, at any target time,of any node from the whole network.  (1) Certificate of node data It adopt the blockchain-based modeling method, as shown in Figure 2(b), which treat Nation Cloud and each provincial cloud as a node in the blockchain, then choose each node as the target to establish a time-stamped blockchain. The node-related information is written into the corresponding block body by the compressing hash function. When necessary, through the Intelligent contract to create a model data chain containing the entire network model and model update "ledgers", each node can synchronize and obtain the model data of the entire network in real time, and can establish a model that traces any node at any time through the "ledgers", which guarantees that The data is credible and secure, and can be further used for responsibility tracing, mining analysis and business expansion.
(2) Security of node data Utilizing the characteristics of blockchain including distributed storage, mufti-node consensus synchronization, and file hash encryption storage, it can store ,dependably, the log including system's network operation monitoring, marketing production control, equipment production control and other and ledger data, scheduling data, equipment data, and inventory data Blockchain-based certification is performed to prevent tampering, subjective changes, and malicious deletions caused by network security threats, and effectively guarantee the reliability and authenticity of network security data.

Overall Scheme of Model
The maintenance system of blockchain including six parts: basic components, consensus algorithm, smart contracts, operating system, administration and application. shown in Figure 3: (1) Basic components The basic components include account book, communication mechanism and cryptographic algorithm.
(2) Consensus algorithm The consensus algorithm is responsible for coordinating and ensuring the data consistency of entire network node.
(3) smart contracts The smart contract is the core of interaction between blockchain and application. it's responsible for compiling and arranging by using rules achieved automatic execution. (4) operation and monitoring It is necessary to monitor each service module and node of the blockchain system, which would better maintain the normal operation of the platform. The operation and monitoring system can provide a variety of visual management tools to achieve blockchain data query, node status monitoring, service operation monitoring, system log query and other functions. (5) system management System management mainly includes alliance management, node management, member management and contract management. Alliance management: Realize the creation of alliance blockchain, purview management and other functions. Node management: Realize the functions of joining and exiting the blockchain nodes, as well as the monitoring of node operation status. Member management: Mainly provides the access control function of the blockchain system, manages the joining of users or blockchain nodes, and realizes the authentication and confirmation of identity and authority management. Contract management: Provides developers with the interface of smart contract deployment, test and update, which is convenient to view, add and delete different smart contracts (6) Functional layer Data storage: The existing organization data, container data, equipment data, network data, software data, primary energy data and public environment data in the HBase database are uploaded to the blockchain status database in the form of key value, which synchronizes the data of each node, completes the initialization of the blockchain ledger, and realizes the link up of the original data. Data maintenance: The upper application program can access and write the blockchain ledger data by calling SDK toolkit, update the status database of each node synchronously, ensure the consistency of data between each node, and realize the maintenance operation of model data addition, deletion, modification and query on the chain. Data audit: Each time the user performs an operation record on the model database, it will broadcast, synchronize and write to the block between nodes, realize the traceability and audit of the model data, and can trace the database status at any time according to the current blockchain ledger data. Sync tool: After the user operates the local database, an operation record is constructed and sent to the blockchain node synchronously. meanwhile, broadcast to the whole network and triggering the execution of the smart contract, updating the blockchain state database, ultimately achieve the data consistency of entire whole network node. Subscription tool: Modify the existing subscription tools and increase the data subscription channel on the chain. After the user subscribes to the data of other provinces, the data analysis service will obtain the latest status of the blockchain status database, and push the updated data in the status database to the corresponding provinces. After the data analysis processing, the updated data will be synchronized to the provincial model database.

Model Data Flow
Model data chain management is accomplished by developing and deploying smart contracts with corresponding functions. By writing smart contract code, business logic is managed on the model data chain, and then smart contract is deployed on the blockchain. When in use, the model operation is submitted to the blockchain node, triggering the smart contract and completing the update of the model data status database. The data format of the model in the smart contract is designed according to the structural design standard of the general data object of power dispatching. The smart contract includes the operation of adding, changing and deleting the model data.   Figure 4. Intra-province data flow.

1)
User A in A prince updates the model database; 2) The model database commits the updates to the sync service; 3) The sync service sends updates to intra-province blockchain nodes, and broadcasts to the whole network; 4) All blockchain nodes execute the updates after authentication, trigger the smart contract, and maintain local status database to keep data consistency. Figure 5. 1) Blockchain data resolve service monitor the network; 2) If a new block is created ,the data which are monitored will be read and analyzed by the resolve service; 3) If the new instruction contain A provincial updated data, the service will analyze and be send to B provincial database; 4) The local user from B region can get other region data (such as A region)by directly read the database of B region.

System
Deployment. The blockchain system platform consists of multiple blockchain nodes running blockchain software services, and each blockchain node is deployed on a host (which can be a physical machine, a virtual machine, or Docker).The blockchain nodes are deployed based on the regulatory cloud infrastructure. According to the geographic distribution of regulatory clouds 2+13, they are deployed at the State Grid Cloud Beijing site, Shanghai site, and various provincial clouds. The deployment structure is shown in the following figure 6. The software of each blockchain node is basically isomorphic, and is used to complete functions such as blockchain data update, ledger synchronization, and smart contract execution. The provincial cloud blockchain nodes receive the model data modification requests submitted locally, complete the onchain update of the model data and synchronize the ledger, and respond to local users' on-chain query requests for model data and return results.

Node Configuration.
From the perspective of overall deployment, the configuration and structure of each provincial cloud node is the same as that of the nation cloud node (State Grid cloud node).In terms of quantity, there are one provincial cloud node each, and the State Grid Cloud Beijing and Shanghai sites can be configured with multiple units. The specific configuration suggestions are as follows.  1) The user accesses the existing model maintenance system and issues operation instructions such as adding, deleting, and modifying model data; 2) The existing model system analyzes the operation instructions, and sends the instructions to the user's provincial cloud node through the network request using the synchronization tool; 3) The provincial node verifies and signs the maintenance operation, records it in the block, and broadcasts the block in the blockchain network; 4) Other nodes in the blockchain network will check the block and execute the operation after confirming that it is correct, triggering the smart contract, updating its own ledger status, and achieving data synchronization. If the local node is offline, you can also access the data by accessing the foreign node (the dotted line in the figure).

Model Data
Query. The process of users using the system for model data query is shown in the following figure 8.  3) After the provincial center node accepts the query request, it executes the smart contract corresponding operation function and returns the query result. Users in other regions can complete model data query through local nodes. If local nodes are offline, they can also be accessed through foreign nodes.

Model Structure
Maintenance. The process of users using the system to maintain the model table structure is shown in the following figure 9.  table structure; 2) The model maintenance system synchronizes the change information of the table structure and changes the code of the corresponding part of the smart contract through a synchronization tool, while generating installation instructions and sending them to the local node (State Grid Cloud); 3) The local node will install a new smart contract to replace the previous smart contract, and the local node will make the entire network node discover this update by broadcasting; 4) The model maintenance system constructs model structure update instructions and broadcasts them. After comparison with other nodes in the entire network, the previous smart contract will be replaced with a new smart contract, and the blockchain state database structure will be updated to achieve the maintenance of the model table structure and ensure the consistency of the node data throughout the network.

Conclusion
The traditional system model data maintains the status quo. It synchronizes the provincial model data to the national branch system relationship database through the vertical synchronization tool of the provincial system. In this mode, other provincial node data can be obtained only by requesting a subscription. It exists the shortcomings of being inefficient, out of sync and not being traceable. With the Innovation maintenance model based on the blockchain, both the national branch system and the provincial system are considered as blockchain nodes. Model data chain that include the entire network model and model maintenance "ledgers" are created through smart contracts, and each node can upload in real time. The status of the data and the model data obtained from the entire network, and the model data at any time can be traced through the "ledger" method, which not only guarantees data security but also can be further used for business mining analysis.

Prospects
This model can also be used for business development based on actual business requirements, such as applications in intelligent evaluation, deposit certification of operational behavior, and intelligent scheduling.
(1) Evaluation basing on smart contracts When the smart contract is evaluated, the data acquisition device is used to obtain the necessary power data of the subject being evaluated; the power data is stored in the service platform, which will store smart contract corresponding the power dispatching system evaluation; according to the smart contract, the power data in the blockchain service platform is processed to obtain an assessment result.
(2) Deposit certification of operational evidence Utilizing the decentration characteristics of the blockchain, the upper-level control instructions and lower-level execution dispatch instructions operate are store on chain to ensure that personnel at all levels are responsible for the correctness of the execution of dispatch instructions, and are responsible for grid site accidents, abnormalities, limit violations, delays and other changes information，which are processed in a timely and effective manner.

(3) Intelligent scheduling
The technical characteristics of the blockchain are suitable for complex system scenarios involving multiple parties. The characteristics of blockchain technology such as decentralization, traceability, and smart contracts are suitable for the requirements of complex systems. As a representative of emerging technologies, blockchain and power dispatch have highly matched application characteristics. Blockchain has the excellent properties of decentralization, openness (multi-party participation), immutability, consensus trust mechanism, anonymity, smart contract execution mechanism, and cross-platform. It is revolutionary in solving the problem of multi-party participation trust and solving the collaborative operation of large-scale systems.