Data Interaction Method, Device, Equipment and Storage Medium
By building a blockchain network in the power grid, using smart contracts and digital certificate verification, combining message authentication codes and timestamps to optimize data interaction, the problem of resource limitations in small distributed energy systems is solved, computing efficiency and security are improved, and automated scheduling of the power grid is promoted.
Patent Information
- Application Number
- CN202510571657.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-06
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2045-05-06
AI Technical Summary
When a small distributed energy system is connected to the power grid, it is limited by resources such as computing power, storage space and power consumption, and cannot support traditional complex and resource-intensive algorithms, resulting in a decrease in computing efficiency and affecting the automated scheduling and operation of the power grid.
By building a blockchain network in the power grid, using smart contracts for access authentication, digital certificate encryption verification, and using message authentication code to verify data packet integrity, combining the data interaction timestamp to calculate the on-time rate and dynamically adjust the interaction priority, reducing the number of data interactions and resource consumption.
It improves the computing efficiency and data processing efficiency of distributed energy systems and power grids, enhances safety and reliability, and promotes the automated scheduling and operation of the power grid.
Smart Images

Figure CN120105491B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of power grid dispatching automation, and particularly to a data interaction method, apparatus, device and storage medium. Background Art
[0002] With the large-scale access of small distributed energy sources to the power grid, in this scenario, the distributed energy system needs to interact a large amount of data with different nodes (such as the power grid dispatching center and the substation) in real time, and also needs to ensure the security and integrity of these data during the transmission process. This has led to a sharp increase in communication frequency and the complication of data dimensions. However, at the same time, small distributed energy systems are limited by deployment costs and the environment, and generally have limitations in computing power, storage space, power consumption, etc., and cannot support traditional complex and resource-intensive algorithms. Traditional algorithms usually involve a large number of mathematical operations, and under the limited computing resources of small distributed energy systems, it will greatly reduce the computing efficiency of distributed energy systems and the power grid. Summary of the Invention
[0003] The purpose of the embodiments of this application is to provide a data interaction method, apparatus, device and storage medium, which can effectively improve data processing efficiency and computing efficiency through reasonable allocation of data interaction.
[0004] To achieve the above purpose, the first aspect of the embodiments of this application provides a data interaction method, which is applied to a power grid and includes:
[0005] Based on the smart contract in the blockchain, perform access authentication on the authentication data set generated by the distributed energy system, obtain the access authentication result, and allow the distributed energy system to access according to the access authentication result;
[0006] Perform encryption verification on the digital certificate uploaded by the connected distributed energy system to confirm the authenticity of the identity of the connected distributed energy system;
[0007] Receive the data packet transmitted by the connected distributed energy system, and verify the integrity of the data packet during the transmission process through a message authentication code;
[0008] Calculate the on-time rate of the connected distributed energy system according to the data interaction timestamp, and dynamically adjust the interaction priority, where the data interaction timestamp includes the upload timestamp and the arrival timestamp of the data packet.
[0009] Compared with the prior art, a data interaction method provided by an embodiment of the present application has the following beneficial effects: By using smart contracts in the power grid blockchain to perform access authentication on the distributed energy system, the number of data interactions and resource consumption are reduced, the computing efficiency is improved, and an audit traceability basis is provided; Further, the power grid encrypts and verifies the digital certificates of the distributed energy systems that have been connected, ensuring the authenticity of identities and enhancing communication security; Further, the power grid uses a message authentication code to verify data packets, ensuring the integrity and reliability of data transmission and improving the interaction quality; Further, the power grid calculates the punctuality rate based on timestamps and dynamically adjusts the interaction priorities to achieve reasonable allocation of data interactions, improving the processing efficiency and response speed. Therefore, this method enhances the security and reliability of the distributed energy system accessing the power grid through various technical means, and at the same time improves the computing efficiency and data processing efficiency of the distributed energy system and the power grid, thereby promoting the automated scheduling and operation of the power grid.
[0010] In some embodiments, performing access authentication on the authentication data set generated by the distributed energy system based on the smart contract in the blockchain, obtaining an access authentication result, and allowing the distributed energy system to access according to the access authentication result includes:
[0011] Construct a blockchain network in the power grid, store the authentication algorithm and the smart contract in the blockchain, enable the distributed energy system to download and use the authentication algorithm from the blockchain to calculate local data to generate an authentication data set, and enable the distributed energy system to write the authentication data set into the blockchain;
[0012] The smart contract parses the authentication data set according to preset conditions to obtain an access authentication result;
[0013] If the access authentication result is authentication passed, allow the distributed energy system to access according to the access authentication result of authentication passed.
[0014] In some embodiments, after performing access authentication on the authentication data set generated by the distributed energy system based on the smart contract in the blockchain, obtaining an access authentication result, and allowing the distributed energy system to access according to the access authentication result, the method further includes:
[0015] Generate a target block based on the authentication data set and send the target block to the consensus nodes in the blockchain network for verification;
[0016] When it is determined that the target block passes the verification based on the verification result returned by the consensus nodes, broadcast the target block to each node in the blockchain network.
[0017] In some embodiments, encrypting and verifying the digital certificate uploaded by the connected distributed energy system to confirm the authenticity of the identity of the connected distributed energy system includes:
[0018] Validating the validity of the signature of the digital certificate uploaded by the connected distributed energy system through the public key of the digital certificate issuing authority;
[0019] If the signature is valid and within the validity period, extract the user public key from the signature to encrypt the first random number to obtain an encrypted random number and send it to the connected distributed energy system, so that the connected distributed energy system decrypts the encrypted random number through the private key and returns a second random number;
[0020] Perform consistency verification on the first random number and the second random number to obtain a verification result. If the verification result is consistent, complete the identity authentication of the connected distributed energy system based on the consistent verification result.
[0021] In some embodiments, receiving the data packet transmitted by the connected distributed energy system and verifying the integrity during the data packet transmission through a message authentication code includes:
[0022] Receive the data packet sent by the connected distributed energy system, where the data packet includes a first message authentication code calculated by the connected distributed energy system based on a hash function;
[0023] Calculate a second message authentication code for the data packet based on the hash function, compare the first message authentication code and the second message authentication code to obtain a comparison result;
[0024] If the comparison result is a pass, determine that the data packet is complete based on the passed comparison result; otherwise, discard the data packet.
[0025] In some embodiments, calculating the punctuality rate of the connected distributed energy system based on the data interaction timestamp and dynamically adjusting the interaction priority includes:
[0026] The blockchain records the upload timestamp, arrival timestamp, and total number of data packets uploaded by the connected distributed energy system;
[0027] Determine whether the data packet is punctual based on the upload timestamp, a preset time threshold, and the arrival timestamp, and count the number of punctual data packets;
[0028] Calculate the punctuality rate according to the formula: Punctuality rate = Number of punctual data packets / Total number of data packets;
[0029] Dynamically adjust the interaction priority of the connected distributed energy systems based on the on-time rate, so that the power grid preferentially interacts with the connected distributed energy systems with a high on-time rate.
[0030] To achieve the above object, a second aspect of the embodiments of the present application provides a data interaction device, which is applied to a power grid and includes:
[0031] An authentication module, configured to perform access authentication on the authentication data set generated by the distributed energy system based on the smart contract in the blockchain, obtain the access authentication result, and allow the distributed energy system to access according to the access authentication result;
[0032] A processing module, configured to perform encryption verification on the digital certificate uploaded by the connected distributed energy system to confirm the authenticity of the identity of the connected distributed energy system;
[0033] A receiving module, configured to receive the data packet transmitted by the connected distributed energy system, and verify the integrity during the data packet transmission process through a message authentication code;
[0034] An adjustment module, configured to calculate the on-time rate of the connected distributed energy system according to the data interaction timestamp, and dynamically adjust the interaction priority, where the data interaction timestamp includes the upload timestamp and the arrival timestamp of the data packet.
[0035] In some embodiments, the authentication module includes:
[0036] A construction unit, configured to construct a blockchain network in the power grid, store the authentication algorithm and the smart contract in the blockchain, enable the distributed energy system to download and use the authentication algorithm from the blockchain to calculate local data to generate an authentication data set, and enable the distributed energy system to write the authentication data set into the blockchain;
[0037] An analysis unit, configured to analyze the authentication data set by the smart contract according to preset conditions to obtain the access authentication result;
[0038] An access unit, configured to, if the access authentication result is authentication passed, allow the distributed energy system to access according to the access authentication result of authentication passed.
[0039] In some embodiments, the data interaction device further includes:
[0040] A verification module, configured to generate a target block based on the authentication data set, and send the target block to the consensus nodes in the blockchain network for verification;
[0041] A broadcast module, configured to broadcast the target block to each node in the blockchain network when it is determined that the target block passes the verification based on the verification result returned by the consensus node.
[0042] In some embodiments, the processing module includes:
[0043] A verification unit, configured to verify the validity of the signature of the digital certificate uploaded by the distributed energy system that has been connected through the public key of the digital certificate issuing authority;
[0044] An extraction unit, configured to, if the signature is valid and within the validity period, extract the user public key from the signature to encrypt the first random number to obtain an encrypted random number and send it to the distributed energy system that has been connected, so that the distributed energy system that has been connected decrypts the encrypted random number through the private key and returns the second random number;
[0045] An authentication unit, configured to perform consistency verification on the first random number and the second random number to obtain a verification result, and if the verification result is consistent, complete the identity authentication of the distributed energy system that has been connected based on the verification result of consistency.
[0046] In some embodiments, the receiving module includes:
[0047] A receiving unit, configured to receive the data packet sent by the distributed energy system that has been connected, where the data packet includes the first message authentication code calculated by the distributed energy system that has been connected based on the hash function for the data packet;
[0048] A calculation unit, configured to calculate a second message authentication code for the data packet based on the hash function, compare the first message authentication code and the second message authentication code, and obtain a comparison result;
[0049] A determination unit, configured to, if the comparison result is a pass, determine that the data packet is complete based on the comparison result of a pass, otherwise discard the data packet.
[0050] In some embodiments, the adjustment module includes:
[0051] A recording unit, configured to record, in the blockchain, the upload timestamp, arrival timestamp, and total number of data packets of the data packet uploaded by the distributed energy system that has been connected;
[0052] A statistics unit, configured to determine whether the data packet is on time according to the upload timestamp, a preset time threshold, and the arrival timestamp, and count the number of on-time data packets;
[0053] A processing unit, configured to calculate the on-time rate according to the formula: on-time rate = number of on-time data packets / total number of data packets;
[0054] An interaction unit, configured to dynamically adjust the interaction priority of the distributed energy systems that have been connected based on the on-time rate, so that the power grid preferentially interacts with the distributed energy systems that have been connected and have a high on-time rate.
[0055] To achieve the above object, a third aspect of the embodiments of the present application provides an electronic device, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, the method described in the first aspect above is implemented.
[0056] To achieve the above object, a fourth aspect of the embodiments of the present application provides a computer-readable storage medium, which includes a stored computer program. When the computer program runs, it controls the device where the computer-readable storage medium is located to execute the method described in the first aspect above.
[0057] To achieve the above object, a fifth aspect of the embodiments of the present application provides a computer program product, which includes a computer program or computer instructions. When the computer program or the computer instructions are executed by a processor, the method described in the first aspect above is implemented. Description of the Drawings
[0058] Figure 1 is a flowchart of a data interaction method provided by an embodiment of the present application;
[0059] Figure 2 is Figure 1 a flowchart of step S101 in
[0060] Figure 3 is Figure 1 a flowchart of step S102 in
[0061] Figure 4 is Figure 1 a flowchart of step S103 in
[0062] Figure 5 is Figure 1 a flowchart of step S104 in
[0063] Figure 6 is a schematic structural diagram of a data interaction device provided by an embodiment of the present application;
[0064] Figure 7 is a schematic hardware structure diagram of an electronic device provided by an embodiment of the present application. Detailed Embodiments
[0065] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0066] In the description of the present application, it should be understood that the orientation or positional relationship indicated by the terms "center", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. is based on the orientation or positional relationship shown in the accompanying drawings, and is only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation to the present application.
[0067] The terms "first" and "second" are only used for descriptive purposes, and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the present application, unless otherwise specified, the meaning of "plurality" is two or more.
[0068] In the description of the present application, it should be noted that unless otherwise clearly defined and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense. For example, it may be a fixed connection, a detachable connection, or an integral connection; it may be a mechanical connection or an electrical connection; it may be directly connected, or indirectly connected through an intermediate medium, and it may be the communication inside two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to specific circumstances.
[0069] First, several terms involved in the present application are analyzed:
[0070] Small distributed energy system: It refers to an energy supply system with relatively small power (usually in the range of kilowatts to megawatts), arranged close to the user side geographically, and capable of independently outputting various forms of energy such as electric energy, thermal energy, and cold energy.
[0071] Block chain: It is a block-chain storage, tamper-proof, secure and trustworthy decentralized distributed ledger. The block chain combines technologies such as distributed storage, peer-to-peer transmission, consensus mechanism, and cryptography, and records resource exchange events and information through a continuously growing chain of data blocks (Blocks) to ensure the security and transparency of data.
[0072] Blockchain network: A decentralized distributed ledger technology composed of multiple nodes, each of which stores a complete copy of the ledger.
[0073] Certificate Authority (CA): A trusted third-party institution responsible for issuing and managing digital certificates. It verifies the identity of users and issues digital certificates containing information such as the user's public key to prove the authenticity of the user's identity and the legitimacy of the public key.
[0074] Digital certificate: An electronic document issued by a Certificate Authority (CA), containing the user's identity information, public key, and the CA's signature, etc. It is used to prove the user's identity and the ownership of the public key in network communication.
[0075] Signature: Digital signature is a technical means used to verify data integrity and source authenticity. In a digital certificate, the CA uses its private key to encrypt relevant information in the certificate, and the resulting encrypted result is the signature. By decrypting the signature with the CA's public key, the authenticity and integrity of the certificate can be verified.
[0076] Public key: A key in an asymmetric encryption algorithm, paired with a private key. The public key can be publicly distributed and is used to encrypt data or verify digital signatures.
[0077] Private key: The other key paired with the public key, which must be strictly confidential. The private key is used to decrypt data encrypted with the public key or generate digital signatures.
[0078] The power grid dispatching system is an important part of the power system, which is responsible for controlling and coordinating the operation of the power system. In the power grid dispatching system, communication is a key link connecting various nodes, transmitting data and instructions. Therefore, the security of communication and data integrity are crucial for the stable operation of the power grid dispatching system.
[0079] With the access of small-scale distributed energy sources, power grid dispatching communication faces more complex and diverse challenges. These communications not only need to transmit a large amount of data between different nodes (such as the power grid dispatching center and substations), but also need to ensure the security and integrity of this data during the transmission process. At the same time, due to resource limitations, especially in the scenario of small-scale distributed energy access, aspects such as the computing power, storage space, and power consumption of small-scale distributed energy systems are strictly restricted, and the hardware resources of the devices are limited and cannot support complex computing tasks or store a large amount of data. Traditional algorithms are relatively complex and resource-intensive, often requiring a large number of mathematical operations, resulting in a reduction in computing efficiency, and thus affecting the performance and power consumption of the devices. Some encryption algorithms need to store a large amount of keys or intermediate data, which poses a huge challenge to small-scale distributed energy systems with limited resources.
[0080] In the environment where small-scale distributed energy sources are connected to the power grid and resources are limited, the algorithms currently adopted generally have problems of being relatively complex and resource-intensive, seriously affecting the computing efficiency. By resource-intensive, it mainly means that algorithms or data processing tasks have high requirements for computing resources (such as CPU, memory, etc.), storage space, and power consumption. Taking traditional complex algorithms as an example, their operation often involves a large number of mathematical operations, which causes a large amount of computing resources such as the CPU to be occupied, resulting in a highly intensive use of computing resources. In terms of encryption algorithms, some algorithms need to store a large amount of keys or intermediate data, which undoubtedly causes an intensive use of storage space for small-scale distributed energy systems with limited storage space. These situations combined ultimately lead to a reduction in computing efficiency and limit the effective operation of small-scale distributed energy systems in the power grid environment.
[0081] Please refer to Figure 1 , Figure 1 which is an optional flowchart of the data interaction method provided by the embodiments of the present application. Figure 1 The method in
[0082] Step S101: Perform access authentication on the authentication data set generated by the distributed energy system based on the smart contract in the blockchain, obtain the access authentication result, and allow the distributed energy system to access according to the access authentication result;
[0083] Step S102: Encrypt and verify the digital certificate uploaded by the connected distributed energy system to confirm the authenticity of the identity of the connected distributed energy system;
[0084] Step S103: Receive the data packet transmitted by the connected distributed energy system, and verify the integrity of the data packet during the transmission process through a message authentication code;
[0085] Step S104: Calculate the punctuality rate of the distributed energy system that has been connected according to the data interaction timestamp, and dynamically adjust the interaction priority. The data interaction timestamp includes the upload timestamp and the arrival timestamp of the data packet.
[0086] Steps S101 to S104 illustrated in the embodiments of the present application perform access authentication on the distributed energy system through smart contracts in the power grid blockchain, reduce the number of data interactions and resource consumption, improve the computing efficiency, and provide an audit traceability basis. Further, the power grid performs encryption verification on the digital certificates of the distributed energy system that has been connected to ensure the authenticity of the identity and enhance communication security. Further, the power grid uses a message authentication code to verify the data packet to ensure the integrity and reliability of data transmission and improve the interaction quality. Further, the power grid calculates the punctuality rate according to the timestamp and dynamically adjusts the interaction priority to achieve a reasonable allocation of data interactions, improve the processing efficiency and response speed. Therefore, this method enhances the security and reliability of the distributed energy system accessing the power grid through various technical means, and at the same time improves the computing efficiency and data processing efficiency of the distributed energy system and the power grid, thereby promoting the automated scheduling and operation of the power grid.
[0087] In step S101 of some embodiments, the distributed energy system refers to an energy supply system with relatively small power, arranged close to the user side, and capable of independently outputting various forms of energy such as electric energy and heat energy. The distributed energy system can be a small distributed energy system or other types of distributed energy systems, and is not limited thereto.
[0088] Please refer to Figure 2 , in some embodiments, step S101 may include but is not limited to steps S201 to S203:
[0089] Step S201: Build a blockchain network in the power grid, store the authentication algorithm and smart contract in the blockchain, enable the distributed energy system to download and use the authentication algorithm from the blockchain to calculate local data to generate an authentication data set, and enable the distributed energy system to write the authentication data set into the blockchain;
[0090] Step S202: The smart contract parses the authentication data set according to preset conditions to obtain the access authentication result;
[0091] Step S203: If the access authentication result is authentication passed, allow the distributed energy system to access according to the access authentication result of authentication passed.
[0092] In step S201 of some embodiments, the authentication algorithm is an algorithm used to verify the identity and data legality of a distributed energy system. A smart contract is an automatically executed contract stored in the form of code on a blockchain. When preset conditions are met, the smart contract will automatically execute corresponding operations. The authentication data set is a data set generated by the distributed energy system through the authentication algorithm to calculate local data (such as device status, energy production, etc.), and is used to prove the identity and data legality of the distributed energy system. The authentication data set can also be a device data set, which includes publicly available data such as device status, number of devices, energy production, and scheduling range. Herein, the device refers to the device in a small distributed energy system, and the device status and number of devices vary according to the different devices in the small distributed energy system, and no specific limitation is made herein.
[0093] First, a blockchain network is constructed in the power grid. The authentication algorithm is written into the blockchain network, and the smart contract is saved to the blockchain. The distributed energy system downloads the authentication algorithm from the blockchain, calculates the local data through the authentication algorithm to generate an authentication data set, and writes it into the blockchain.
[0094] It should be noted that in the constructed blockchain network, the nodes can be servers participating in the blockchain network in the power grid.
[0095] In step S202 of some embodiments, the access authentication result can be the conclusion obtained by the smart contract parsing the authentication data set according to preset conditions to determine whether the distributed energy system can access the power grid, and the result is divided into authentication passed and authentication failed.
[0096] The smart contract is stored in the blockchain. When the authentication data set is written into the blockchain, the smart contract will automatically obtain the authentication data set. Then, the smart contract analyzes the authentication data set according to preset judgment conditions (such as data format requirements, data value ranges, etc.) to obtain the access authentication result.
[0097] In step S203 of some embodiments, if the access authentication result is authentication passed, it indicates that the distributed energy system meets the conditions for accessing the power grid. At this time, the power grid allows the distributed energy system to access the power grid, establishes a connection with the power grid, and performs subsequent data interaction, energy transmission and other operations. Additionally, if the access authentication result is authentication failed, the power grid rejects the distributed energy system from accessing.
[0098] It should be noted that the blockchain can record information such as the request timestamp of the distributed energy system, the judgment result of the smart contract, the judgment time, and the access timestamp, providing a basis for subsequent audit and traceability, etc.
[0099] In this application, a blockchain network is constructed in the power grid, and access authentication is performed using authentication algorithms and smart contracts, reducing multiple data interactions between the distributed energy system and the power grid. Only one interaction with the blockchain is required to complete the authentication process, improving the computing efficiency. At the same time, the immutable feature of the blockchain ensures the security and reliability of the authentication algorithm, smart contract, and authentication data set, reducing the requirements for the computing resources and storage space of the distributed energy system, and providing guarantee for the safe and efficient access of the distributed energy system to the power grid. In addition, the number of keys and intermediate data stored during data interaction can be reduced, greatly reducing the requirements for the distributed energy system and the consumption of computing resources.
[0100] Furthermore, since the distributed energy system downloads the authentication algorithm from the blockchain, only the authentication algorithm in the blockchain needs to be kept up-to-date. In the case of frequently updating the authentication model, etc., the process of multiple data interactions between the power grid and the distributed energy system for updating the authentication algorithm can be omitted, improving the computing efficiency. The smaller amount of data interaction also greatly reduces the possibility of data packets being attacked or tampered with, enhancing the security during the data interaction between the distributed energy system and the power grid.
[0101] Specifically, the server of the small distributed energy system calls the device information in the system, combines it with the authentication algorithm downloaded from the blockchain to generate an authentication data set. The authentication data set is broadcast to other nodes of the blockchain through the blockchain. The smart contract authenticates the small distributed energy system according to the data in the authentication data set. If the conditions are met, the authentication passes, and the authentication data set is written into a new block, indicating that the server of the small distributed energy system can interact with the server in the power grid for resource scheduling.
[0102] After step S101 in some embodiments, a target block is generated based on the authentication data set, and the target block is sent to the consensus nodes in the blockchain network for verification; when it is determined that the target block passes the verification based on the verification result returned by the consensus nodes, the target block is broadcast to each node in the blockchain network.
[0103] Specifically, in blockchain technology, a block is the basic unit for storing data, and a consensus node is a type of node in the blockchain network responsible for verifying and validating data according to a consensus algorithm and promoting the update of the blockchain ledger. The target block is a new block generated based on the authenticated data set after passing authentication and will be added to the blockchain. After generating the target block, it is sent to each consensus node in the network through the communication protocol of the blockchain network. After receiving the target block, these consensus nodes will check and verify the data in the target block according to the pre-set consensus algorithm and verification rules; after the consensus nodes complete the verification of the target block, they will return the verification result to the node that sent the target block. If the verification results returned by all consensus nodes indicate that the target block passes the verification (i.e., the data in the target block is legal, complete, and complies with the rules of the blockchain), then this node will send the target block to every node in the network through the broadcast mechanism of the blockchain network. In this way, all nodes in the blockchain network can receive and store this target block, thereby updating their respective blockchain ledgers.
[0104] Through the process of generating a target block based on the authenticated data set and passing through the verification of consensus nodes and network-wide broadcasting, this application ensures that the data related to the access authentication of the distributed energy system can be securely and reliably stored in the blockchain. On the one hand, the consensus mechanism of the blockchain guarantees the consistency and immutability of the data, enhancing the credibility of the authentication data; on the other hand, broadcasting the target block to all nodes enables each node in the blockchain network to obtain accurate authentication information, providing a solid data foundation for subsequent blockchain-based operations (such as energy dispatching, data tracing, etc.), and improving the security and reliability of the distributed energy system accessing the power grid.
[0105] In step S102 of some embodiments, this application verifies through digital certificates to prove the identity of the distributed energy system and the authenticity of the data, ensuring that the data obtained by the power grid is true and reliable.
[0106] Please refer to Figure 3 , in some embodiments, step S102 may include but is not limited to steps S301 to S303:
[0107] Step S301, verify the validity of the signature of the digital certificate uploaded by the connected distributed energy system through the public key of the digital certificate issuing authority;
[0108] Step S302, if the signature is valid and within the validity period, extract the user public key from the signature to encrypt the first random number to obtain an encrypted random number and send it to the connected distributed energy system, enabling the connected distributed energy system to decrypt the encrypted random number with the private key and return the second random number;
[0109] Step S303: Perform consistency verification on the first random number and the second random number to obtain a verification result. If the verification result is consistent, complete the identity authentication of the distributed energy system that has been connected based on the consistent verification result.
[0110] In step S301 of some embodiments, the distributed energy system that has been connected can be a distributed energy system that has been connected to the power grid. After the distributed energy system is connected to the power grid, the distributed energy system that has been connected uploads its digital certificate to the power grid. After the power grid obtains the digital certificate, it extracts the signature information therein. Then, the power grid uses the public key of the digital certificate issuing authority (CA) to decrypt the signature. If the decryption is successful and the information obtained after decryption matches other contents in the digital certificate (such as user identity information, public key, etc.), it indicates that the signature is valid; otherwise, the signature is invalid.
[0111] In step S302 of some embodiments, when the signature is verified to be valid and the digital certificate is still within the validity period, the power grid extracts the user public key from the signature of the digital certificate. Then, the power grid generates a random number (i.e., the first random number), encrypts the first random number using the extracted user public key to obtain an encrypted random number. Next, the power grid sends the encrypted random number to the distributed energy system that has been connected. After receiving the encrypted random number, the distributed energy system that has been connected decrypts it using its own private key to obtain the second random number, and returns the second random number to the power grid.
[0112] In step S303 of some embodiments, if the random number received by the power grid is the same as the generated random number, the authentication is successful, indicating that the distributed energy system that has been connected has the private key corresponding to the user public key in the digital certificate, and the identity is authentic and reliable, thereby completing the identity authentication of the distributed energy system that has been connected; otherwise, it indicates that the authentication fails.
[0113] Since the power grid only obtains the calculation results (i.e., the authentication data set) of the distributed energy system, while the actual data of the distributed energy system is stored locally in the system, although the security of the system data is ensured, it also reduces the authenticity of the calculation results of the distributed energy system. Digital certificates are generally issued by a third party. Therefore, if the digital certificate is valid, it indicates that the data provided by the distributed energy system is true and valid; otherwise, it indicates that the distributed energy system is no longer recognized by the third party, and the data provided by the system is suspect, and the access of the distributed energy system can be rejected again. Through this series of steps, the present application uses technical means such as digital certificates, public key encryption, and private key decryption to implement the identity authentication of the distributed energy system that has been connected. This authentication method is based on the credibility of the digital certificate issuing authority and the security of the asymmetric encryption algorithm, and can effectively confirm the authenticity of the system identity, prevent illegal devices from impersonating the connected system for data interaction, ensure the security and reliability of the communication between the power grid and the distributed energy system, and ensure that the data obtained by the power grid is true and valid.
[0114] In step S103 of some embodiments, in the data interaction stage, the power grid verifies the integrity of the data packets of the distributed energy system that has been connected.
[0115] Please refer to Figure 4 , in some embodiments, step S103 may include but is not limited to steps S401 to S403:
[0116] Step S401, receive the data packet sent by the distributed energy system that has been connected, and the data packet includes the first message authentication code calculated by the distributed energy system that has been connected based on the hash function for the data packet;
[0117] Step S402, calculate the second message authentication code for the data packet based on the hash function, compare the first message authentication code and the second message authentication code, and obtain a comparison result;
[0118] Step S403, if the comparison result is that the comparison passes, determine that the data packet is complete based on the comparison result that passes the comparison, otherwise discard the data packet.
[0119] In step S401 of some embodiments, a data packet is a data unit transmitted in network communication, containing various information for interaction between the distributed energy system and the power grid, such as the response to scheduling instructions, device status, device output, system logs, etc. Hash function: Also called a hashing function, it is a function that maps data of any length to data of a fixed length (hash value). Its feature is that for the same input data, it always gets the same hash value; the probability of different input data getting the same hash value (hash collision) is extremely low. In this solution, it is used to calculate the Message Authentication Code (Media Access Control, MAC). The first message authentication code can be the fixed-length hash value obtained by using the hash function to calculate the content of the data packet before the distributed energy system that has been connected sends the data packet, and it is used as the unique identifier of the data packet for subsequent verification of the integrity of the data packet.
[0120] Specifically, when the distributed energy system that has been connected outputs a data packet to the power grid, it writes the first message authentication code into the data packet, that is, the unique identifier obtained by calculating the content of the data packet through the hash function.
[0121] In step S402 of some embodiments, the second message authentication code can be the hash value obtained by the power grid recalculating the content of the data packet using the same hash function after receiving the data packet sent by the distributed energy system that has been connected.
[0122] Specifically, after the power grid receives the data packet, it extracts the content of the data packet and calculates the second message authentication code by using the same hash function as the distributed energy system that has been connected for the content of the data packet. Then, it compares the first message authentication code with the second message authentication code to check whether the two authentication codes are exactly the same. If they are the same, the comparison result is passed; if they are different, the comparison result is not passed.
[0123] In step S403 of some embodiments, if the comparison result is passed, it indicates that the content of the data packet has not been tampered with or damaged during the transmission process. At this time, it is determined that the data packet is complete and subsequent data processing operations can continue. If the comparison result is not passed, it indicates that the data packet may have been tampered with or damaged during the transmission process. To ensure the accuracy and security of the data, the data packet is discarded.
[0124] In step S104 of some embodiments, during the data interaction process between the distributed energy system that has been connected and the power grid, the power grid records the interaction time of the distributed energy system that has been connected each time, as well as the timestamp when the uploaded data packet arrives. It determines whether the data is on time according to a preset time threshold, records the frequency of on-time data packets during the interaction process of the distributed energy system that has been connected, and calculates the on-time rate of the distributed energy system that has been connected.
[0125] This application uses technical means of hash functions and message authentication codes to achieve integrity verification of data packets transmitted between an already-connected distributed energy system and the power grid. This verification method can quickly and accurately determine whether the data packets have been tampered with or damaged during transmission, effectively ensuring the security and reliability of the data.
[0126] Please refer to Figure 5 , in some embodiments, step S104 may include but is not limited to steps S501 to S504:
[0127] Step S501, the blockchain records the upload timestamp, arrival timestamp, and total number of data packets uploaded by the already-connected distributed energy system.
[0128] Step S502, determine whether the data packets are on time based on the upload timestamp, a preset time threshold, and the arrival timestamp, and count the number of on-time data packets.
[0129] Step S503, calculate the on-time rate according to the formula: on-time rate = number of on-time data packets / total number of data packets.
[0130] Step S504, dynamically adjust the interaction priority of the already-connected distributed energy system based on the on-time rate, so that the power grid preferentially interacts with the already-connected distributed energy systems with a high on-time rate.
[0131] In step S501 of some embodiments, the upload timestamp refers to the specific time point information when the already-connected distributed energy system uploads the data packet to the blockchain, which is recorded by the blockchain. The arrival timestamp refers to the specific time point information when the data packet arrives at the power grid or the relevant receiving end, which is recorded by the blockchain. The total number of data packets can be the sum of the numbers of all data packets uploaded by the already-connected distributed energy system to the blockchain within a certain time period.
[0132] Specifically, when the already-connected distributed energy system uploads a data packet to the blockchain, the relevant nodes in the blockchain network will automatically record the upload timestamp of the data packet. When the data packet arrives at the power grid (or the relevant receiving end), the blockchain records the arrival timestamp again. At the same time, the blockchain will count the data packets uploaded by the already-connected distributed energy system within a certain time period, calculate the total number of data packets, and store this information in the ledger of the blockchain.
[0133] In step S502 of some embodiments, the preset time threshold is a pre-set time standard value used as the time limit for determining whether the data packets arrive on time. When the difference between the upload time and the arrival time of the data packet is within this time threshold range, it can be considered that the data packet arrives on time. The number of on-time data packets refers to the number of data packets that arrive on time according to the preset time threshold within a certain time period.
[0134] Specifically, obtain the upload timestamp and arrival timestamp of each data packet from the information recorded in the blockchain, and calculate the time difference between the two. Then compare this time difference with a preset time threshold. If the time difference is less than or equal to the preset time threshold, it is determined that the data packet arrives on time; otherwise, it is determined that it does not arrive on time. After judging all data packets, count the number of data packets that arrive on time.
[0135] In step S503 of some embodiments, the on-time rate: a ratio calculated by the formula "on-time rate = number of on-time data packets / total number of data packets", which is used to measure the on-time degree of the data packets uploaded by the distributed energy system connected to the power grid. The on-time rate calculation formula can also be expressed as: , where F is the on-time rate, is the number of on-time data packets, is the total number of data packets.
[0136] Specifically, substitute the two values of the number of on-time data packets and the total number of data packets into the formula "on-time rate = number of on-time data packets / total number of data packets" for calculation to obtain the on-time rate of the data packets uploaded by the distributed energy system connected to the power grid.
[0137] In step S504 of some embodiments, the interaction priority refers to the priority order set for each distributed energy system connected to the power grid according to the rule of "the higher the on-time rate, the higher the priority" when the power grid performs data interaction and other operations with multiple distributed energy systems connected to it. The system with a higher priority will interact with the power grid first.
[0138] Specifically, sort multiple distributed energy systems connected to the power grid according to the on-time rate. Increase the interaction priority of the system with a high on-time rate and decrease the interaction priority of the system with a low on-time rate. When the power grid performs data interaction and other operations, it will preferentially select the distributed energy system connected to the power grid with a high interaction priority (i.e., a high on-time rate) for interaction to ensure the efficiency and timeliness of data interaction.
[0139] It should be noted that when the power grid interacts with the distributed energy system connected to the power grid with a high interaction priority, the data packets with a high degree of data urgency and importance will interact with the power grid first.
[0140] It should be noted that if the on-time rates of the data packets uploaded by multiple distributed energy systems connected to the power grid are the same, the power grid can select the distributed energy system connected to the power grid for interaction first according to the existing scheduling method, such as according to the load capacity of the distributed energy system connected to the power grid.
[0141] In this application, the power grid records the relevant time information and quantity of data packets through blockchain, judges the punctuality of data packets according to a preset time threshold, calculates the punctuality rate, and then dynamically adjusts the interaction priority, realizing the optimized management of data interaction between the power grid and the connected distributed energy system. This method can improve the efficiency of data interaction. Through the reasonable allocation of data interaction, the data processing efficiency and the computing efficiency can be effectively improved.
[0142] As described above, in this application, the power grid reduces the resource intensity of traditional algorithms and improves the computing efficiency by introducing blockchain and combining blockchain with smart contracts. The time cost of manual authentication and verification is reduced through an automated process. Further, by recording the timestamps of data packets and calculating the punctuality of data packets according to the timestamps, priority settings are made, and interaction objects are selected according to the priority during data interaction, further improving the computing efficiency. Further, in this application, the power grid also conducts data integrity verification through digital certificates to ensure the reliability of data sources and the integrity of data.
[0143] Please refer to Figure 6 , this embodiment of the application also provides a data interaction device, which can implement the above data interaction method. This device is applied to the power grid and includes:
[0144] An authentication module 601, configured to perform access authentication on the authentication data set generated by the distributed energy system based on the smart contract in the blockchain, obtain an access authentication result, and allow the distributed energy system to access according to the access authentication result;
[0145] A processing module 602, configured to perform encryption verification on the digital certificates uploaded by the connected distributed energy system to confirm the authenticity of the identity of the connected distributed energy system;
[0146] A receiving module 603, configured to receive the data packets transmitted by the connected distributed energy system and verify the integrity during the data packet transmission process through a message authentication code;
[0147] An adjustment module 604, configured to calculate the punctuality rate of the connected distributed energy system according to the data interaction timestamp and dynamically adjust the interaction priority, where the data interaction timestamp includes the upload timestamp and the arrival timestamp of the data packet.
[0148] The specific implementation manner of this data interaction device is basically the same as that of the specific embodiment of the above data interaction method, and will not be elaborated here.
[0149] In some embodiments, the authentication module includes:
[0150] A building unit is used to build a blockchain network in the power grid, store an authentication algorithm and a smart contract into the blockchain, enable a distributed energy system to download and use the authentication algorithm from the blockchain to calculate local data to generate an authentication data set, and enable the distributed energy system to write the authentication data set into the blockchain;
[0151] An analysis unit is used for the smart contract to analyze the authentication data set according to preset conditions to obtain an access authentication result;
[0152] An access unit is used to, if the access authentication result is authentication passed, allow the distributed energy system to access according to the access authentication result of authentication passed.
[0153] In some embodiments, the data interaction device further includes:
[0154] A verification module is used to generate a target block based on the authentication data set and send the target block to a consensus node in the blockchain network for verification;
[0155] A broadcast module is used to, when it is determined that the target block passes the verification based on the verification result returned by the consensus node, broadcast the target block to each node in the blockchain network.
[0156] In some embodiments, the processing module includes:
[0157] A verification unit is used to verify the validity of the signature of the digital certificate uploaded by the already-connected distributed energy system through the public key of the digital certificate issuing authority;
[0158] An extraction unit is used to, if the signature is valid and within the validity period, extract the user public key from the signature to encrypt the first random number to obtain an encrypted random number and send it to the already-connected distributed energy system, so that the already-connected distributed energy system decrypts the encrypted random number through the private key and returns the second random number;
[0159] An authentication unit is used to perform consistency verification on the first random number and the second random number to obtain a verification result. If the verification result is verification consistent, the identity authentication of the already-connected distributed energy system is completed based on the verification result of verification consistent.
[0160] In some embodiments, the receiving module includes:
[0161] A receiving unit is used to receive a data packet sent by the already-connected distributed energy system. The data packet includes a first message authentication code calculated by the already-connected distributed energy system based on a hash function;
[0162] A calculation unit is used to calculate a second message authentication code based on the hash function for the data packet, compare the first message authentication code and the second message authentication code to obtain a comparison result;
[0163] A determination unit, configured to determine that the data packet is complete based on the comparison result that passes the comparison if the comparison result is a pass, otherwise discard the data packet.
[0164] In some embodiments, the adjustment module includes:
[0165] A recording unit, configured to record in the blockchain the upload timestamp, arrival timestamp, and total number of data packets uploaded by the connected distributed energy system;
[0166] A statistics unit, configured to determine whether the data packet is on time according to the upload timestamp, a preset time threshold, and the arrival timestamp, and count the number of on-time data packets;
[0167] A processing unit, configured to calculate the on-time rate according to the formula: on-time rate = number of on-time data packets / total number of data packets;
[0168] An interaction unit, configured to dynamically adjust the interaction priority of the connected distributed energy system based on the on-time rate, so that the power grid preferentially interacts with the connected distributed energy system with a high on-time rate.
[0169] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, which works together with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an overall module or unit including the functions of the module or unit.
[0170] In a third aspect, the embodiments of the present application provide an electronic device. Refer to Figure 7 as shown, which is a schematic structural diagram of an electronic device provided by the present application.
[0171] As Figure 7 shown, the device includes:
[0172] A memory 31, configured to store a computer program;
[0173] A processor 32, configured to execute the computer program;
[0174] Wherein, when the processor 32 executes the computer program, it implements the data interaction method in any of the above embodiments.
[0175] Exemplarily, a computer program can be divided into one or more modules / units. One or more modules / units are stored in the memory 31 and executed by the processor 32 to complete the present application. One or more modules / units can be a series of computer program instruction segments capable of completing specific functions, and these instruction segments are used to describe the execution process of the computer program in the electronic device.
[0176] The so-called processor 32 can be a central processing unit (CPU), or can also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0177] The memory 31 can be used to store computer programs and / or modules. The processor 32 realizes various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory 31, and by invoking the data stored in the memory 31. The memory 31 mainly includes a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, phone book, etc.), etc. In addition, the memory 31 can include high-speed random access memory, and can also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0178] It should be noted that the above-mentioned electronic device includes a processor and a memory, but is not limited to a processor and a memory. Those skilled in the art can understand that Figure 7 The structural schematic diagram is only an example of the above-mentioned electronic device, and does not constitute a limitation on the electronic device. It can include more components than shown in the figure, or combine some components, or have different components.
[0179] Fourthly, an embodiment of the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed, the data interaction method of any of the above embodiments is implemented.
[0180] It should be understood that all or part of the processes of implementing the above data interaction method in the present application can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above data interaction method can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in relevant jurisdictions. For example, in some relevant jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.
[0181] Fifthly, an embodiment of the present application further provides a computer program product. The computer program product is stored in a storage medium, and the program product is executed by at least one processor to implement the data interaction method of any of the above embodiments.
[0182] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM, Read-Only Memory), or a random access memory (RAM), etc.
[0183] The above are the preferred embodiments of the present application. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present application, several improvements and refinements can be made, and these improvements and refinements are also regarded as the protection scope of the present application.
Claims
1. A data interaction method, characterized in that, Applied to the power grid, including: Performing access authentication on the authentication data set generated by the distributed energy system based on the smart contract in the blockchain, obtaining the access authentication result and allowing the distributed energy system to access according to the access authentication result; Performing encryption verification on the digital certificate uploaded by the accessed distributed energy system to confirm the authenticity of the identity of the accessed distributed energy system; Receiving the data packet transmitted by the accessed distributed energy system and verifying the integrity during the data packet transmission through the message authentication code; Calculating the punctuality rate of the accessed distributed energy system according to the data interaction timestamp and dynamically adjusting the interaction priority, where the data interaction timestamp includes the upload timestamp and the arrival timestamp of the data packet; The calculating the punctuality rate of the accessed distributed energy system according to the data interaction timestamp and dynamically adjusting the interaction priority includes: The blockchain records the upload timestamp, the arrival timestamp and the total number of data packets of the data packet uploaded by the accessed distributed energy system; Determining whether the data packet is punctual according to the upload timestamp, the preset time threshold and the arrival timestamp, and counting the number of punctual data packets; Calculating the punctuality rate according to the formula: punctuality rate = number of punctual data packets / total number of data packets; Dynamically adjusting the interaction priority of the accessed distributed energy system based on the punctuality rate, so that the power grid preferentially interacts with the accessed distributed energy system with a high punctuality rate.
2. The data interaction method according to claim 1, wherein The performing access authentication on the authentication data set generated by the distributed energy system based on the smart contract in the blockchain, obtaining the access authentication result and allowing the distributed energy system to access according to the access authentication result includes: Constructing a blockchain network in the power grid, storing the authentication algorithm and the smart contract in the blockchain, enabling the distributed energy system to download and use the authentication algorithm from the blockchain to calculate local data to generate an authentication data set, and enabling the distributed energy system to write the authentication data set into the blockchain; The smart contract parses the authentication data set according to preset conditions to obtain the access authentication result; If the access authentication result is authentication passed, allowing the distributed energy system to access according to the access authentication result of authentication passed.
3. The data interaction method according to claim 2, wherein After performing access authentication on the authentication data set generated by the distributed energy system based on the smart contract in the blockchain, obtaining the access authentication result and allowing the distributed energy system to access according to the access authentication result, the method further includes: Generating a target block based on the authentication data set and sending the target block to the consensus nodes in the blockchain network for verification; When it is determined that the target block passes the verification based on the verification result returned by the consensus node, broadcasting the target block to each node in the blockchain network.
4. The data interaction method according to claim 1, characterized in that The performing encryption verification on the digital certificate uploaded by the accessed distributed energy system to confirm the authenticity of the identity of the accessed distributed energy system includes: Validating the validity of the signature of the digital certificate uploaded by the accessed distributed energy system through the public key of the digital certificate issuing authority; If the signature is valid and within the validity period, extract the user public key from the signature, encrypt the first random number with it to obtain an encrypted random number, and send it to the connected distributed energy system, so that the connected distributed energy system decrypts the encrypted random number with the private key and returns a second random number; Perform consistency verification on the first random number and the second random number to obtain a verification result. If the verification result is consistent, complete the identity authentication of the connected distributed energy system based on the consistent verification result.
5. The data interaction method according to claim 1, wherein Receiving the data packet transmitted by the connected distributed energy system and verifying the integrity during the data packet transmission through a message authentication code, including: Receiving the data packet sent by the connected distributed energy system, where the data packet includes a first message authentication code calculated by the connected distributed energy system based on a hash function for the data packet; Calculating a second message authentication code for the data packet based on the hash function, comparing the first message authentication code and the second message authentication code, and obtaining a comparison result; If the comparison result is that the comparison passes, determine that the data packet is complete based on the passed comparison result, otherwise discard the data packet.
6. A data interaction device, characterized in that, Applied to the power grid, including: An authentication module, used to perform access authentication on the authentication data set generated by the distributed energy system based on the smart contract in the blockchain, obtain an access authentication result, and allow the distributed energy system to access according to the access authentication result; A processing module, used to perform encryption verification on the digital certificate uploaded by the connected distributed energy system to confirm the authenticity of the identity of the connected distributed energy system; A receiving module, used to receive the data packet transmitted by the connected distributed energy system and verify the integrity during the data packet transmission through a message authentication code; An adjustment module, used to calculate the punctuality rate of the connected distributed energy system according to the data interaction timestamp and dynamically adjust the interaction priority, where the data interaction timestamp includes the upload timestamp and the arrival timestamp of the data packet; The adjustment module includes: a recording unit, used to record in the blockchain the upload timestamp, the arrival timestamp, and the total number of data packets of the data packet uploaded by the connected distributed energy system; a statistics unit, used to determine whether the data packet is punctual according to the upload timestamp, a preset time threshold, and the arrival timestamp, and count the number of punctual data packets; a processing unit, used to calculate the punctuality rate according to the formula: punctuality rate = number of punctual data packets / total number of data packets; an interaction unit, used to dynamically adjust the interaction priority of the connected distributed energy system based on the punctuality rate, so that the power grid preferentially interacts with the connected distributed energy system with a high punctuality rate.
7. The data interaction device according to claim 6, wherein The authentication module includes: A construction unit, used to construct a blockchain network in the power grid, store the authentication algorithm and the smart contract in the blockchain, enable the distributed energy system to download and use the authentication algorithm from the blockchain to calculate local data to generate an authentication data set, and enable the distributed energy system to write the authentication data set into the blockchain; An analysis unit for the smart contract to analyze the authentication data set according to preset conditions to obtain an access authentication result; An access unit for, if the access authentication result is authentication passed, allowing the distributed energy system to access according to the access authentication result of authentication passed.
8. The data interaction device according to claim 6, wherein The data interaction device further includes: A verification module for generating a target block based on the authentication data set and sending the target block to a consensus node in the blockchain network for verification; A broadcast module for, when it is determined that the target block passes the verification based on the verification result returned by the consensus node, broadcasting the target block to each node in the blockchain network.
9. The data interaction device according to claim 6, characterized in that, The processing module includes: A verification unit for verifying the validity of the signature of the digital certificate uploaded by the already-accessed distributed energy system through the public key of the digital certificate issuing authority; An extraction unit for, if the signature is valid and within the valid period, extracting the user public key from the signature to encrypt the first random number to obtain an encrypted random number and sending it to the already-accessed distributed energy system, so that the already-accessed distributed energy system decrypts the encrypted random number through the private key and returns the second random number; An authentication unit for performing consistency verification on the first random number and the second random number to obtain a verification result, and if the verification result is verification consistent, completing the identity authentication of the already-accessed distributed energy system based on the verification result of verification consistent.
10. The data interaction device according to claim 6, wherein The receiving module includes: A receiving unit for receiving the data packet sent by the already-accessed distributed energy system, where the data packet includes a first message authentication code calculated by the already-accessed distributed energy system for the data packet based on a hash function; A calculation unit for calculating a second message authentication code for the data packet based on the hash function, comparing the first message authentication code and the second message authentication code to obtain a comparison result; A determination unit for, if the comparison result is comparison passed, determining that the data packet is complete based on the comparison result of comparison passed, otherwise discarding the data packet.
11. An electronic device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the data interaction method according to any one of claims 1 to 5.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, where, when the computer program runs, it controls the device where the computer-readable storage medium is located to execute the data interaction method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Intelligent internet-of-things system oriented to integrated energy system and trusted access method of intelligent internet-of-things system
CN116233162A
Distributed device identity authentication and access control method and system based on block chain
CN119363318A