Blockchain-based data communication method for energy devices
By using the parent chain and child chain structure of the blockchain network for identity authentication and data sharing, the security risks of traditional IoT communication methods in home energy devices are resolved, and secure data transmission and efficient sharing are achieved.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- GUANGZHOU RIMSEA TECH CO LTD
- Filing Date
- 2025-12-29
- Publication Date
- 2026-07-09
Smart Images

Figure CN2025146435_09072026_PF_FP_ABST
Abstract
Description
A Blockchain-Based Data Communication Method for Energy Devices
[0001] Cross-references to related applications
[0002] This application claims priority to Chinese Patent Application No. 2025100126775, filed on January 6, 2025, entitled "A Data Communication Method for Energy Equipment Based on Blockchain", the entire contents of which are incorporated herein by reference. Technical Field
[0003] This disclosure relates to the field of energy storage battery system technology, and more specifically, to a method for switching control between grid-connected and off-grid energy storage batteries and an energy storage battery system. Background Technology
[0004] With the rapid development of IoT technology, more and more home energy devices are being connected to the network, forming a vast IoT ecosystem. However, traditional IoT data communication methods have many security risks, including trust issues, data privacy issues, and data integrity issues. In particular, home energy devices often come from different manufacturers, so how to effectively and securely use energy data and control various home energy devices is an urgent problem to be solved.
[0005] Application content
[0006] In view of this, the purpose of this application is to provide a blockchain-based energy device data communication method, device, electronic device and medium that can securely and efficiently store energy data of home energy devices and realize energy data interaction between home energy devices.
[0007] The primary objective of this application is to provide a blockchain-based data communication method for energy devices, the method comprising:
[0008] The system acquires energy data from energy devices that have registered on the blockchain network, and writes the energy data into a sub-chain of the blockchain network based on the type of energy data; different sub-chains store different types of energy data.
[0009] The target energy device responds to the preset data interaction conditions that meet the target control mode and initiates a first identity authentication request to the blockchain network, so that the parent chain of the blockchain network performs first identity authentication on the target energy device based on the first identity authentication request;
[0010] When the first identity authentication is successful, the target energy device generates a data sharing request for the target type of data based on the preset data interaction conditions of the target control mode, and sends the data sharing request to the blockchain network, so that the parent chain of the blockchain network performs a second identity authentication on the target energy device based on the data sharing request and the pre-configured identity authentication conditions.
[0011] When the second identity authentication is successful, the subchain in the blockchain network that matches the type of the target type data processes the data sharing request for the target type data based on the access rules for the target energy device in the smart contract, determines the target shared energy data that conforms to the access rules, and shares the target shared energy data with the target energy device.
[0012] In conjunction with the first objective, in the blockchain-based energy device data communication method described in this application, the target energy device, in response to a preset data interaction condition satisfying the target control mode, initiates a first identity authentication request to the blockchain network, so that the parent chain of the blockchain network performs first identity authentication on the target energy device based on the first identity authentication request, including:
[0013] The target energy device responds to the preset data interaction conditions that meet the target control mode and initiates a first identity authentication request to the blockchain network; the first identity authentication request includes first target identity information;
[0014] The parent chain of the blockchain network verifies the legitimacy of the target energy device based on the matching result between the first target identity information and the pre-stored device identity information;
[0015] If valid, the parent chain of the blockchain network generates a random challenge and sends the random challenge to the target energy device, so that the target energy device uses a pre-stored private key to digitally sign the random challenge and sends the result of the digital signature to the blockchain network.
[0016] The parent chain of the blockchain network uses the public key of the target energy device to verify the validity of the digital signature result. If the signature is valid, the first identity authentication of the target energy device is successful.
[0017] In conjunction with the first objective, the blockchain-based energy device data communication method described in this application involves the target energy device generating a data sharing request for target type data based on preset data interaction conditions of the target control mode, and sending the data sharing request to the blockchain network. This allows the parent chain of the blockchain network to perform a second identity authentication on the target energy device based on the data sharing request and pre-configured identity authentication conditions; including:
[0018] The target energy device acquires predefined attribute authentication information; the attribute authentication information is based on the attribute definition of the target energy device and corresponds to the identity authentication conditions.
[0019] Based on the attribute authentication information, the second target identity information of the target device, and the preset data interaction conditions of the target control mode, a data sharing request for the target type data is generated and sent to the blockchain network; the preset data interaction conditions of the target control mode are used to determine the shared energy data requested by the data sharing request.
[0020] The parent chain of the blockchain network verifies the attribute authentication information and the second target identity information based on pre-configured identity authentication conditions, and performs second identity authentication on the target energy device.
[0021] In conjunction with the first objective, the blockchain-based energy device data communication method described in this application, wherein the parent chain of the blockchain network verifies the attribute authentication information and the second target identity information based on pre-configured identity authentication conditions, and performs second identity authentication on the target energy device, including:
[0022] Determine the verification score corresponding to attribute authentication information at different levels; the verification score is different for attribute authentication information at different levels, and the verification score is determined based on the degree of influence of the attribute authentication information on identity verification;
[0023] Based on the verification scores corresponding to the attribute authentication information at different levels, the total attribute verification score of the attribute authentication information is determined.
[0024] Based on the comparison result between the total attribute verification score and the preset attribute security score threshold, and the second target identity information, a second identity authentication is performed on the target energy device. In some embodiments, in the blockchain-based energy device data communication method, the sub-chain in the blockchain network that matches the type of the target type data processes the data sharing request for the target type data based on the access rules for the target energy device in the smart contract, and determines the target shared energy data that conforms to the access rules, including:
[0025] The parent chain of the blockchain network sends the data sharing request for the target type data to the child chain that matches the type of the target type data;
[0026] The smart contract in the subchain that matches the type of the target type data determines, based on the access rules for the target energy device, whether the target energy device has the permission to access the target type data and whether it meets the preset access conditions for accessing the target type data.
[0027] If all conditions are met, then the target shared energy data corresponding to the data sharing request is determined.
[0028] In conjunction with the first objective, the blockchain-based energy device data communication method described in this application, which shares the target shared energy data with the target energy device, includes:
[0029] The smart contract in the subchain that matches the type of the target type data determines whether the target shared energy data needs to be encrypted based on the type of the target shared energy data and / or the type of the target energy device.
[0030] If necessary, the target shared energy data is encrypted based on the preset first encryption algorithm to obtain encrypted target shared energy data, and the encrypted target shared energy data is uploaded to the parent chain;
[0031] The parent chain shares the encrypted target shared energy data with the target energy device and records the traceability information of the encrypted target shared energy data.
[0032] In conjunction with the first objective, the blockchain-based energy device data communication method described in this application, before acquiring the energy data of the energy device that has completed registration on the blockchain network, further includes:
[0033] When an energy device is started up, it initiates a registration request to the blockchain network; the registration request includes the device's identity information.
[0034] The parent chain of the blockchain network processes the device identity information and generates a first hash value for the device identity information;
[0035] The parent chain of the blockchain network sends a verification request to the business server that has pre-stored device identity information in order to receive the second hash value generated by the business server in processing the device identity information;
[0036] The parent chain of the blockchain network verifies whether the first hash value and the second hash value are consistent;
[0037] If they match, the parent chain of the blockchain network determines that the energy device has been successfully identified, completes the registration of the energy device, and stores the device identity information of the energy device.
[0038] In conjunction with the first objective, the blockchain-based energy device data communication method described in this application, wherein writing the energy data into a sub-chain of the blockchain network based on the type of energy data, includes:
[0039] The energy data is encrypted using the second encryption algorithm to obtain encrypted energy data;
[0040] Generate a data digest of the encrypted energy data;
[0041] Based on the type of energy data, the encrypted energy data and data digest are uploaded to a subchain of the blockchain network.
[0042] A second objective of this application is to provide a blockchain-based energy equipment data processing device, the device comprising:
[0043] The acquisition module is used to acquire energy data of energy devices that have completed registration on the blockchain network, and write the energy data into a sub-chain of the blockchain network based on the type of energy data; different sub-chains store different types of energy data;
[0044] The first authentication module is used to initiate a first identity authentication request to the blockchain network when the target energy device responds to the preset data interaction conditions that meet the target control mode, so that the parent chain of the blockchain network can perform first identity authentication on the target energy device based on the first identity authentication request.
[0045] The second authentication module is used to generate a data sharing request for target type data based on the preset data interaction conditions of the target control mode when the first identity authentication is successful, and send the data sharing request to the blockchain network so that the parent chain of the blockchain network can perform a second identity authentication on the target energy device based on the data sharing request and the pre-configured identity authentication conditions.
[0046] The processing module is used to, when the second identity authentication is successful, process the data sharing request for the target type data in the sub-chain of the blockchain network that matches the type of the target type data based on the access rules for the target energy device in the smart contract, determine the target shared energy data that conforms to the access rules, and share the target shared energy data with the target energy device.
[0047] A third objective of this application is to provide an electronic device comprising: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and when the machine-readable instructions are executed by the processor, the steps of the blockchain-based energy device data communication method are performed.
[0048] The fourth objective of this application is to provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the blockchain-based energy device data communication method.
[0049] This application provides a blockchain-based energy device data communication method, apparatus, electronic device, and medium. The method involves acquiring energy data from energy devices registered on a blockchain network, writing the energy data into sub-chains of the blockchain network based on the data type, and storing different types of energy data in different sub-chains. A target energy device responds to preset data interaction conditions that satisfy a target control mode by initiating a first identity authentication request to the blockchain network, enabling the main chain of the blockchain network to perform first identity authentication on the target energy device based on the first identity authentication request. Upon successful first identity authentication, the target energy device generates a data sharing request for the target data type based on the preset data interaction conditions of the target control mode and sends the data sharing request to the blockchain network, enabling the main chain of the blockchain network to perform first identity authentication on the target energy device based on the first identity authentication request. The data sharing request and pre-configured identity authentication conditions perform a second identity authentication on the target energy device. When the second identity authentication is successful, the sub-chain in the blockchain network that matches the type of the target data processes the data sharing request for the target type of data based on the access rules for the target energy device in the smart contract, determines the target shared energy data that conforms to the access rules, and shares the target shared energy data with the target energy device. By utilizing the immutability, transparency, and security of the blockchain, the secure transmission and storage of IoT data is ensured. By storing different types of data based on the sub-chain, data isolation and privacy protection are achieved. This facilitates the formulation of access rules for each type of energy data according to its characteristics and needs, thereby improving data management effectiveness, data sharing efficiency, and data sharing security. Attached Figure Description
[0050] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0051] Figure 1 shows a flowchart of the blockchain-based energy equipment data communication method according to an embodiment of this application;
[0052] Figure 2 shows a flowchart of the method for writing energy data into a sub-chain of a blockchain network based on the type of energy data described in an embodiment of this application;
[0053] Figure 3 shows a flowchart of the method for performing first identity authentication on the target energy device according to an embodiment of this application;
[0054] Figure 4 shows a flowchart of a method for generating a data sharing request for target type data based on preset data interaction conditions of the target control mode according to an embodiment of this application;
[0055] Figure 5 shows a flowchart of the method for determining target shared energy data that conforms to the access rules according to an embodiment of this application;
[0056] Figure 6 shows a flowchart of the method for sharing the target shared energy data with the target energy device according to an embodiment of this application;
[0057] Figure 7 shows a schematic diagram of the structure of the blockchain-based energy equipment data communication device according to an embodiment of this application;
[0058] Figure 8 shows a schematic diagram of the structure of the electronic device described in an embodiment of this application. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the accompanying drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.
[0060] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0061] It should be noted that the term "comprising" will be used in the embodiments of this application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.
[0062] With the rapid development of IoT technology, more and more home energy devices are being connected to the network, forming a vast IoT ecosystem. However, traditional IoT data communication methods have many security risks, including trust issues, data privacy issues, and data integrity issues. In particular, home energy devices often come from different manufacturers, so how to effectively and securely use energy data and control various home energy devices is an urgent problem to be solved.
[0063] To address the data security issues in the Internet of Things (IoT), several main technical solutions exist: Security protocol-based solutions use security protocols such as TLS / SSL to encrypt data transmission. This approach can improve data security, but it cannot effectively solve trust and data integrity issues.
[0064] Identity-based authentication schemes verify the identity of devices through authentication mechanisms. This approach can reduce the risk of device attacks, but it cannot effectively solve data privacy issues. Data encryption-based schemes encrypt and store data to prevent data leakage. While this method can protect data privacy, it cannot solve data integrity issues.
[0065] To address these issues, this application provides a blockchain-based energy device data communication method, apparatus, electronic device, and medium. The method involves acquiring energy data from energy devices registered on a blockchain network, writing the energy data into sub-chains of the blockchain network based on its type, and storing different types of energy data in different sub-chains. A target energy device, responding to preset data interaction conditions that satisfy a target control mode, initiates a first identity authentication request to the blockchain network, enabling the main chain of the blockchain network to perform first identity authentication on the target energy device based on the first identity authentication request. Upon successful first identity authentication, the target energy device generates a data sharing request for the target data type based on the preset data interaction conditions of the target control mode and sends the data sharing request to the blockchain network, enabling the blockchain network to... The parent chain performs a second identity authentication on the target energy device based on the data sharing request and pre-configured identity authentication conditions. When the second identity authentication is successful, the sub-chain in the blockchain network that matches the type of data of the target type processes the data sharing request for the target type of data based on the access rules for the target energy device in the smart contract, determines the target shared energy data that conforms to the access rules, and shares the target shared energy data with the target energy device. By utilizing the immutability, transparency, and security of the blockchain, the secure transmission and storage of IoT data is ensured. By storing different types of data on the sub-chain, data isolation and privacy protection are achieved. It is also convenient to formulate access rules for each type of energy data according to the characteristics and needs of the energy data, thereby improving the data management effect, data sharing efficiency, and data sharing security.
[0066] Please refer to Figure 1, which shows a flowchart of the blockchain-based energy device data communication method according to an embodiment of this application; as shown in Figure 1, the method includes the following steps S101-S104:
[0067] S101. Obtain energy data of energy devices that have completed registration on the blockchain network, and write the energy data into a sub-chain of the blockchain network based on the type of energy data; different sub-chains store different types of energy data;
[0068] S102. The target energy device responds to the preset data interaction conditions that meet the target control mode and initiates a first identity authentication request to the blockchain network, so that the parent chain of the blockchain network performs first identity authentication on the target energy device based on the first identity authentication request.
[0069] S103. When the first identity authentication is successful, the target energy device generates a data sharing request for target type data based on the preset data interaction conditions of the target control mode, and sends the data sharing request to the blockchain network, so that the parent chain of the blockchain network performs a second identity authentication on the target energy device based on the data sharing request and the pre-configured identity authentication conditions.
[0070] S104. When the second identity authentication is successful, the sub-chain in the blockchain network that matches the type of the target type data processes the data sharing request for the target type data based on the access rules for the target energy device in the smart contract, determines the target shared energy data that conforms to the access rules, and shares the target shared energy data with the target energy device.
[0071] In step S101, energy data of energy devices that have completed registration on the blockchain network is obtained, and the energy data is written into a sub-chain of the blockchain network based on the type of energy data; different sub-chains store different types of energy data.
[0072] In this embodiment of the application, the energy device is a household energy device.
[0073] The energy equipment mentioned can be, for example, energy storage equipment, electrical equipment, power generation equipment, transmission equipment, or hybrid equipment. Hybrid equipment, when presented externally as a single device, can include transmission devices, power generation devices, energy storage devices, and electrical equipment. Energy information includes capacity information, demand information, supply information, identity information, type information, voltage information, current information, power information, energy information, spatiotemporal attribute information, controllability attribute information, and response time information.
[0074] For example, the electrical appliances include air conditioners, washing machines, smart home devices, etc.; the power generation equipment includes solar energy equipment, etc.
[0075] In this embodiment, the blockchain network includes a parent chain and child chains. The parent chain is the backbone of the system, and its main responsibilities include: global consensus: ensuring the security and consistency of the blockchain network through the Proof of Work (POW) consensus mechanism; identity authentication: managing the registration and identity authentication of devices to ensure the legitimacy of access devices; transaction verification: verifying the authenticity and integrity of uploaded transactions and data; and data traceability: recording the source and destination of data to ensure data traceability and transparency.
[0076] Subchains handle specific types of data and application logic, and their responsibilities include: Data classification: storing data on different subchains according to data type (such as temperature, power, on / off status, etc.) to improve data management efficiency; Data encryption: using the AES encryption algorithm to encrypt data to ensure data confidentiality; Smart contracts: running smart contracts related to specific data types to achieve automated data processing and sharing.
[0077] The subchain uses local consensus, which means that data consistency and security are ensured within the subchain through a simplified consensus mechanism (Practical Byzantine Fault Tolerance).
[0078] In this embodiment of the application, before obtaining the energy data of the energy device that has completed registration on the blockchain network, the method further includes:
[0079] When an energy device is started up, it initiates a registration request to the blockchain network; the registration request includes the device's identity information.
[0080] The parent chain of the blockchain network processes the device identity information and generates a first hash value for the device identity information;
[0081] The parent chain of the blockchain network sends a verification request to the business server that has pre-stored device identity information in order to receive the second hash value generated by the business server in processing the device identity information;
[0082] The parent chain of the blockchain network verifies whether the first hash value and the second hash value are consistent;
[0083] If they match, the parent chain of the blockchain network determines that the energy device has been successfully identified, completes the registration of the energy device, and stores the device identity information of the energy device.
[0084] As IoT devices, energy equipment registers with the blockchain network and obtains a unique identity before connecting to the blockchain network, and then compares and verifies this identity with data pre-stored in the cloud.
[0085] When an energy device starts up, such as a smart temperature control device, it sends a registration request to the blockchain network. The registration request contains device identity information, which can also be referred to as device attribute information, basic information, etc. The device identity information includes the device model, manufacturer information, and unique identification code.
[0086] The registration request can be issued by the energy device itself, by other energy devices interacting with the energy device, or by a client. For example, the registration request of a smart temperature control device can be issued by the smart temperature control device itself, sent to the blockchain by the gateway to which the smart temperature control device is connected, or sent to the blockchain by the client of the smart temperature control device (specifically, a mobile phone or other terminal with client software installed).
[0087] After receiving a registration request, the blockchain network will send the information provided by the device to the cloud business server for verification. Specifically, in this embodiment, the parent chain of the blockchain network generates a verification request based on at least some of the device identity information and sends the verification request to the business server.
[0088] The business server can be a cloud server (hereinafter referred to as the cloud); the business server can be an independent home energy equipment management platform or a server of the equipment manufacturer.
[0089] In the cloud, the business server retrieves the device information of the energy device from the pre-stored device identity information based on the verification information, and generates a second hash value by combining it with the SHA-256 encryption algorithm.
[0090] The parent chain of the blockchain network uses the SHA-256 encryption algorithm to perform a hash operation on the received device identity information, generating a unique first hash value.
[0091] After receiving the second hash value returned by the business server, the parent chain of the blockchain network compares it with the first hash value of the device identity information. If the two match, the verification is successful, the registration of the energy device is completed, and the device identity information of the energy device is stored.
[0092] If the first hash value and the second hash value are inconsistent, the verification fails.
[0093] In the device registration process described in this application embodiment, the blockchain network can verify whether the device identity information provided by the device is consistent with the backup identity information recorded by the business server, thereby ensuring the validity and authenticity of the device identity; at the same time, it utilizes the irreversibility and uniqueness of the SHA-256 encryption algorithm to ensure the security and integrity of the identity data.
[0094] SHA-256 encryption algorithm description:
[0095] SHA-256 is a secure hash algorithm that is the successor to the SHA-1 algorithm. It has higher security, faster speed and stronger collision resistance.
[0096] The SHA-256 algorithm uses iterative compression to convert input data of arbitrary length into fixed-length output data (256 bits). The specific steps of the SHA-256 algorithm are as follows:
[0097] Preprocessing: Puff the input data into 512-bit blocks;
[0098] Initialization: Initialize eight 32-bit registers, called working variables;
[0099] Compression: Divide each 512-bit block into 16 32-bit words and perform a series of non-linear operations on them with the working variables;
[0100] Output: The final 8 working variables are concatenated to form 256 bits of output data.
[0101] The SHA-256 algorithm has the following security features:
[0102] Collision property: It is difficult to find two different input data that have the same hash value;
[0103] Predictability: It is difficult to find input data whose hash value is a specified value;
[0104] Second preimage: It is very difficult to find a second input data whose hash value is the same as the hash value of the given input data.
[0105] The mathematical formulas for the SHA-256 algorithm are as follows: H=H0||H1||H2||H3||H4||H5||H6||H7; H(n)=H(n-1)+Σ(n)+K(n)+W(n); Σ(n)=Ch(n)+Maj(n); Ch(n)=(H(n-1)∧H(n-2))⊕(~H(n-1)∧H(n-3)); Maj(n)=(H(n-1)∧H(n-2))⊕(H(n-1)∧H(n-3))⊕(H(n-2)∧H(n-3)); K(n)=[K0,K1,……,K63]; W(n)=[W0,W1,……,W15]; W(n)=W(n-16)+σ1(W(n-14))+W(n-7)+σ0(W(n-2)); σ0(x)=(x>>7)⊕(x>>18)⊕(x>>3); σ1(x)=(x>>17)⊕(x>>19)⊕(x>>10).
[0106] H: Represents the final hash value (or digest, hash value) generated by the SHA-256 algorithm after processing the input message; H0, H1, H2, H3, H4, H5, H6, and H7 are the initial hash values (or initial hash values) used in the SHA-256 algorithm; in the formula H(n-1) + Σ(n) + K(n) + W(n), n refers to the current iteration step or round. In the SHA-256 algorithm, the message data is divided into multiple 512-bit blocks, and each block is further divided into multiple 32-bit words. In each iteration of the compression function, a series of complex nonlinear operations are performed, which update the current hash value.
[0107] Specifically, n refers to the nth iteration. In each iteration, the current hash value H(n) is calculated. This value depends on the hash value H(n-1) of the previous round, the message word W(n) of the current round, the constant K(n), and some intermediate values Σ(n) calculated from the message word.
[0108] The intermediate value Σ(n) is determined based on the selection function Ch(n) and the majority function Maj(n).
[0109] In the formula Ch(n)=(H(n-1)∧H(n-2))⊕(~H(n-1)∧H(n-3)), the symbol ~ represents the bitwise NOT operation. Specifically, (H(n-1)∧H(n-2)): bitwise AND operation, which means performing a AND operation on each bit of (H(n-1)∧H(n-2)); ~H(n-1): bitwise NOT operation, which means reversing each bit of ~H(n-1), that is, 0 becomes 1 and 1 becomes 0; (~H(n-1)∧H(n-3)): first performing a bitwise NOT operation on ~H(n-1), and then performing a bitwise AND operation on the result and H(n-3); (H(n-1)∧H(n-2))⊕(~H(n-1)∧H(n-3)) performs a bitwise XOR operation on the results of the above two parts.
[0110] Here are some examples of bitwise operations: Assume we have the following 32-bit binary numbers: H(n-1) = 11001010, H(n-1) = 10101100, H(n-1) = 11110000; ~H(n-1) = 00110101 (inverting each bit in H(n-1); (H(n-1)∧H(n-2)) = 10001000; (~H(n-1)∧H(n-3)) = 00110000; (H(n-1)∧H(n-2))⊕(~H(n-1)∧H(n-3)) = 10001000⊕00110000 = 10111000;
[0111] Therefore, the result of Ch(n) is the result of bitwise operations.
[0112] This operation is used in the SHA-256 algorithm to generate complex bit-level obfuscation, increasing the security of the hash function.
[0113] In the formula, K(n) = [K0, K1, ..., K63] is a set of 64 fixed constants used in each round (from round 0 to round 63) of the compression function operation; K(n) represents the constant array; K0, K1, ..., K63 represent the constants in the constant array; these constants are part of the SHA-256 algorithm and are used to increase the algorithm's complexity and security.
[0114] In the formula, W(n) = [W0, W1, ..., W15] represents the initial message word obtained directly from the message block.
[0115] The function definitions in the mathematical formula of the SHA-256 algorithm are summarized as follows: H represents the final hash value; H(n) represents the initial hash value; H0, H1, ..., H7 all represent specific initial hash values; Σ(n) represents the intermediate value; Ch(n) represents the selection function; Maj(n) represents the majority function; K(n) represents the constant array; K0, K1, ..., K63 all represent constants in the constant array; W(n) represents the message word array; W0, W1, ..., W15 represent message words in the message word array; σ0(x) represents the first circular shift function; σ1(x) represents the second circular shift function, and x represents the variables in the first and second circular shift functions.
[0116] The SHA-256 algorithm is a secure, reliable, and efficient hash algorithm with a wide range of applications. In the registration process of home energy devices, using the SHA-256 algorithm can effectively verify the authenticity and validity of the device's identity, ensuring the security of the Internet of Things (IoT) system.
[0117] During the operation of energy equipment, the energy data of the registered energy equipment needs to be uploaded to the blockchain. To ensure the encryption of the energy data, it is necessary to encrypt the energy data.
[0118] Specifically, in this embodiment of the application, the energy data is written into a sub-chain of the blockchain network that matches the type of energy data, thereby storing at least one type of energy data (such as temperature, power consumption, on / off status, etc.) in different sub-chains to improve the efficiency of data management.
[0119] In this embodiment of the application, please refer to Figure 2, which shows a flowchart of the method for writing energy data into a sub-chain of a blockchain network based on the type of energy data according to this embodiment of the application; as shown in Figure 2, writing energy data into a sub-chain of a blockchain network based on the type of energy data includes the following steps S201-S203:
[0120] S201. Encrypt the energy data based on the second encryption algorithm to obtain encrypted energy data;
[0121] S202. Generate a data digest of the encrypted energy data;
[0122] S203. Based on the type of energy data, upload the encrypted energy data and data digest to a sub-chain of the blockchain network.
[0123] In other words, home energy devices encrypt the collected energy data and generate a data digest to ensure the confidentiality and integrity of the energy data.
[0124] The energy data is encrypted based on the second encryption algorithm to obtain encrypted energy data, as follows: After the home energy device collects data and obtains various types of data (such as temperature, power consumption, on / off status, etc.), the energy device selects an encryption key, which is a key obtained through a security protocol exchange.
[0125] Finally, the collected data is encrypted using an encryption algorithm. For example, in this embodiment of the application, the home energy device can use AES (Advanced Encryption Standard) to encrypt the energy data to ensure the confidentiality of the energy data.
[0126] The data digest of the encrypted energy data is generated as follows: The SHA-256 hash algorithm is applied to the encrypted energy data to generate a hash value for the energy data. This hash value is also known as the data digest.
[0127] In this embodiment of the application, the generated data digest and the encrypted energy data are stored together in a sub-chain that matches the data type, so as to verify the integrity of the data later.
[0128] AES (Advanced Encryption Standard) is a symmetric encryption algorithm used to encrypt and decrypt data. The following explains the formula and principle of the AES encryption algorithm.
[0129] The formula for the AES encryption algorithm is as follows: Encryption process: Ciphertext = AES(plaintext, key); Decryption process: Plaintext = AES(ciphertext, key).
[0130] The AES encryption algorithm works as follows: AES uses a block cipher to divide plaintext data into fixed-length blocks, and then through a series of encryption operations, converts each block into a corresponding ciphertext block. Decryption is the reverse process, converting the ciphertext block back into plaintext.
[0131] The AES algorithm employs a Substitution-Permutation Network (SPN) structure and mainly includes the following steps:
[0132] Key Expansion: Generates a series of round keys based on the input key, which are used for subsequent round function operations;
[0133] Initial Round: Perform an XOR operation between the plaintext data block and the first round key;
[0134] Multi-round encryption (Rounds): Employs multiple rounds of iterative operations, each round consisting of four steps: byte substitution (SubBytes), row shifting (ShiftRows), column mixing (MixColumns), and round key addition (AddRoundKey);
[0135] Final Round: The final round does not include the column obfuscation step;
[0136] Ciphertext generation: Ciphertext data blocks are obtained after multiple rounds of encryption.
[0137] For example, the energy data encryption process in this application embodiment is as follows:
[0138] Suppose a home energy device collects temperature data of 25℃ and encrypts it using the AES encryption algorithm. The encryption process is as follows: Plaintext: 25℃; Key: Pre-stored encryption key; The device encrypts the plaintext data using AES to obtain the corresponding ciphertext data, for example: 0x3F7A2B9E65D12F8C...
[0139] For example, the specific process of generating a data digest of encrypted energy data is as follows: Apply the SHA-256 hash algorithm to the encrypted energy data to generate a hash value (data digest) of the energy data. For example, the generated hash value is: 0x9A457FACBE8216D3...
[0140] Based on the type of energy data, the encrypted energy data and data digest are uploaded to the blockchain network and to a sub-chain that matches the type of energy data. This ensures that the encrypted data and data digest are uploaded to the blockchain network, guaranteeing the immutability and transparency of the data.
[0141] Based on the type of energy data, the encrypted energy data and data digest are uploaded to a sub-chain of the blockchain network. The specific process of uploading data to the chain is described below:
[0142] Prepare transaction data: Prepare the encrypted energy data and its corresponding data summary for uploading to the blockchain network.
[0143] Creating a transaction: Package the prepared encrypted energy data and data summary into a transaction format; in some blockchain systems, transaction fees may need to be paid.
[0144] Broadcast transaction: Broadcast the created transaction to nodes in the blockchain network.
[0145] Transaction verification: Verification nodes in a blockchain network verify received transactions to ensure they comply with the network's rules and consensus mechanism. Verification includes checking the validity of the transaction, the integrity of the data, and related signature information.
[0146] Packaging transactions: Once a transaction is verified, the validating node packages it into a new block.
[0147] Block Confirmation: A new block containing the aforementioned transaction data is added to the blockchain's subchain. At this point, the data has been successfully uploaded to the blockchain.
[0148] Block synchronization: Nodes in the sub-chains of the entire blockchain network synchronize new blocks to ensure that all nodes in the sub-chains contain the latest data.
[0149] The following example illustrates the process of uploading energy data to the blockchain.
[0150] Preparing transaction data: Assume that the household energy device has collected temperature data of 25°C, and that the energy data has been encrypted and a data digest has been generated.
[0151] Create a transaction: Package the encrypted energy data and data digest into a transaction format, and include the necessary device information, such as the sender address and the receiver address.
[0152] Broadcast transaction: Broadcast the created transaction to nodes in the blockchain network.
[0153] Transaction verification: After receiving a transaction, the verification nodes in the blockchain network will verify the validity of the transaction, the integrity of the data, and other relevant information.
[0154] Packaging transactions: Once a transaction is verified, the validating node packages it into a new block.
[0155] Block confirmation: A new block is added to a subchain of the blockchain, containing the aforementioned transaction data, and the type of the energy data in the subchain and the transaction data matches.
[0156] Block synchronization: Nodes on this sub-chain in the blockchain network synchronize new blocks, ensuring that all nodes on the sub-chain contain the latest data of their corresponding data type. The main function of the sub-chain is to formulate different operating rules for different devices and application scenarios, such as transaction fees and verification processes, to meet specific business needs and achieve low-latency, high-efficiency operation independent of the parent chain.
[0157] Data in the child chain will be backed up to the parent chain, but the parent chain does not participate in the execution of the specific scheme.
[0158] Through this process, the energy data collected by home energy devices has been successfully uploaded to the blockchain, thereby ensuring the immutability and transparency of the data.
[0159] In step S102, the target energy device responds to the preset data interaction conditions that meet the target control mode and initiates a first identity authentication request to the blockchain network, so that the parent chain of the blockchain network performs first identity authentication on the target energy device based on the first identity authentication request.
[0160] The target control mode is the operating mode of the target energy device; for example, electricity cost priority mode, task priority mode, fine control mode, simple control mode, etc.; taking a smart drum washing machine as an example, in the electricity cost saving mode, historical electricity price data in the blockchain is obtained to predict when the electricity price will meet the requirements, so as to start when the electricity price is low; in the task priority mode, the electricity price will not be considered and it will start directly.
[0161] It should be noted that the target control mode can be for a single energy device or for an energy system composed of multiple energy devices, such as an energy system consisting of a solar power generation system (including a battery), multiple electrical devices, and an inlet switch.
[0162] The preset data interaction conditions are preset conditions for triggering the target energy device to obtain energy data. For example, when the smart drum washing machine starts, it is necessary to obtain the power consumption data and historical electricity price data of the smart drum washing machine in order to determine whether the drum washing machine's operation strategy is to start immediately or start after a delay (for example, start when the electricity price is lower at 10 pm).
[0163] Pre-configure the preset data interaction conditions for each energy device in each control mode; the preset data interaction conditions can be the same or different in different control modes.
[0164] The data types required by the energy equipment for each preset data interaction condition under each control mode are pre-configured. The data types corresponding to the same preset data interaction condition under different control modes of the energy equipment can be the same or different; the data types corresponding to different preset data interaction conditions under the same control mode of the energy equipment can be the same or different.
[0165] In other words, the target control mode and the preset data interaction conditions under the target control mode together determine what type of data the energy device needs to obtain from the blockchain at this time.
[0166] For example, in an energy system consisting of a solar power generation system (including a battery), multiple electrical devices, and a household switch, in the fine control mode, when triggering the preset data interaction condition of starting the drum washing machine, four types of energy data need to be obtained: the power consumption of the drum washing machine, historical electricity price, solar power generation, and battery storage capacity. In the simple control mode, when triggering the preset data interaction condition of starting the drum washing machine, only one type of data, historical electricity price, needs to be obtained.
[0167] It should be noted that the target control mode, the preset data interaction conditions of the target control mode, and the data type required by the corresponding energy equipment are configured according to the specific energy equipment in the home and the user's needs, and this application will not describe them in detail.
[0168] The target energy device responds to the preset data interaction conditions of the target control mode, which means that it wants to share data on the blockchain. Before the IoT device can interact with the data, it needs to perform the first identity authentication through the identity authentication mechanism on the blockchain network.
[0169] Identity authentication, also known as identity verification.
[0170] Identity authentication plays a crucial role in data communication for home energy devices, ensuring the security and trustworthiness of these communications. Blockchain-based identity authentication mechanisms leverage the immutability and security of blockchain to provide a reliable method for authenticating home energy devices.
[0171] Please refer to Figure 3, which shows a flowchart of the method for performing first identity authentication on a target energy device according to an embodiment of this application; the target energy device responds to the preset data interaction conditions that meet the target control mode and initiates a first identity authentication request to the blockchain network, so that the parent chain of the blockchain network performs first identity authentication on the target energy device based on the first identity authentication request, including the following steps S301-S303:
[0172] S301, the target energy device responds to the preset data interaction conditions that meet the target control mode and initiates a first identity authentication request to the blockchain network; the first identity authentication request includes first target identity information;
[0173] S302. The parent chain of the blockchain network verifies the legality of the target energy device based on the matching result of the first target identity information and the pre-stored device identity information;
[0174] S303. If valid, the parent chain of the blockchain network generates a random challenge and sends the random challenge to the target energy device, so that the target energy device uses a pre-stored private key to digitally sign the random challenge and sends the result of the digital signature to the blockchain network.
[0175] S304. The parent chain of the blockchain network uses the public key of the target energy device to verify the validity of the digital signature result. If the signature is valid, the first identity authentication of the target energy device is successful.
[0176] It should be noted that the interaction between home energy devices and the blockchain includes data uploading and data downloading. When uploading data, in some embodiments, it is also necessary to initiate a first identity authentication request to the blockchain network for identity verification.
[0177] The first target identity information refers to at least a portion of the device identity information that a home energy device needs to register with the blockchain network before connecting to the network.
[0178] The principle of First Identity Authentication is as follows: Before connecting to the network, each home energy device needs to register its identity information with the blockchain network. This information may include device ID, public key, certificate, etc. The registered identity information is stored in the blockchain's distributed ledger, ensuring that all nodes can access and verify this information. When a home energy device sends data (such as a First Identity Authentication request), it uses its private key to digitally sign the data, proving that the data's source is legitimate and trustworthy. The recipient uses the sender's public key to verify the validity of the digital signature and can also query the identity information on the blockchain to confirm the device's legitimacy.
[0179] The following details the process by which home energy devices need to perform initial identity authentication with the blockchain network:
[0180] Device initiates authentication request: Home energy devices send an identity authentication request to the blockchain network in order to exchange data with other devices;
[0181] Verify identity information: The main chain of the blockchain network queries the identity information of home energy devices stored on the blockchain, such as device ID and public key, and verifies their legitimacy;
[0182] Challenge generation: The mother chain of the blockchain network generates a random challenge and sends it to home energy devices;
[0183] Device response to the challenge: Home energy devices digitally sign the challenge using their own private keys and send the signature result to the blockchain network;
[0184] Signature Verification: The parent chain of the blockchain network uses the public key of the home energy device to verify the validity of the signature. If the signature is valid, the authentication is successful, and the home energy device can begin exchanging data.
[0185] Through the above steps, home energy devices have successfully verified their identity through a blockchain-based identity authentication mechanism, ensuring the security and trustworthiness of data exchange.
[0186] In step S103, when the first identity authentication is successful, the target energy device generates a data sharing request for target type data based on the preset data interaction conditions of the target control mode, and sends the data sharing request to the blockchain network, so that the parent chain of the blockchain network performs a second identity authentication on the target energy device based on the data sharing request and the pre-configured identity authentication conditions.
[0187] Once the initial identity authentication is successful, the target energy device sends a data sharing request, requesting to share data in the blockchain network.
[0188] Specifically, energy devices can achieve secure data sharing through smart contracts, ensuring the security and legitimacy of the data. Data sharing is one of the important mechanisms for data exchange and cooperation between IoT devices. Through smart contracts, devices can securely share data, ensuring its security and legitimacy.
[0189] The principle of data sharing is as follows:
[0190] A smart contract is an automated contract that executes on a blockchain and contains predefined rules and conditions that ensure the security and legality of data sharing.
[0191] Smart contracts can define which devices have the right to access shared data, and under what conditions they can access the data. Only devices that meet these conditions can obtain the shared data.
[0192] During data sharing, encryption algorithms can be used to encrypt the data to ensure its confidentiality. Only devices with the decryption key can decrypt and access the data.
[0193] Please refer to Figure 4, which shows a flowchart of a method for a target energy device to generate a data sharing request for target type data based on preset data interaction conditions of the target control mode, according to an embodiment of this application. The target energy device generates a data sharing request for target type data based on preset data interaction conditions of the target control mode and sends the data sharing request to the blockchain network, so that the parent chain of the blockchain network performs a second identity authentication on the target energy device based on the data sharing request and pre-configured identity authentication conditions; including the following steps S401-S403:
[0194] S401, The target energy device obtains predefined attribute authentication information of the target energy device; the attribute authentication information is based on the attribute definition of the target energy device and corresponds to the identity authentication conditions.
[0195] S402. Based on the attribute authentication information, the second target identity information of the target device, and the preset data interaction conditions of the target control mode, a data sharing request for the target type data is generated, and the data sharing request is sent to the blockchain network; the preset data interaction conditions of the target control mode are used to determine the shared energy data requested by the data sharing request.
[0196] S403. The parent chain of the blockchain network verifies the attribute authentication information and the second target identity information based on the pre-configured identity authentication conditions, and performs second identity authentication on the target energy device.
[0197] The attributes of the target energy device include network attributes, time attributes, geographical location attributes, etc.; the home energy device is installed in the home and sends requests through the home gateway. It is located in a fixed location. Some home energy devices trigger preset data interaction conditions by reaching a preset time, that is, such home energy devices will only send data sharing requests at fixed time points.
[0198] Therefore, based on these specific attributes of energy devices, the identity authentication conditions in smart contracts can be configured, and the corresponding attribute authentication information can be predefined in the energy devices.
[0199] In this way, the generated data sharing request includes not only the second target identity information of the target device, but also these specially defined attribute authentication information. The smart contract of the blockchain network's parent chain verifies the attribute authentication information and the second target identity information based on the pre-configured identity authentication conditions. If both the attribute authentication information and the second target identity information meet the corresponding identity authentication conditions, then the target energy device has passed the verification and can share data.
[0200] In this embodiment, based on specific attributes such as the fixed location of home energy equipment and the fixed gateway, identity authentication conditions targeting specific attributes are configured in the smart contract of the parent chain to further ensure the reliability of identity authentication.
[0201] Specifically, in this embodiment of the application, when performing authentication in conjunction with attribute authentication information, a scoring mechanism is used to verify and ensure the security of the device. Once the score reaches the preset security score, the second identity authentication is successfully verified.
[0202] Specifically, in some embodiments, in the blockchain-based energy device data communication method, the parent chain of the blockchain network verifies the attribute authentication information and the second target identity information based on pre-configured identity authentication conditions, and performs second identity authentication on the target energy device, including:
[0203] Determine the verification score corresponding to attribute authentication information at different levels; the verification score is different for attribute authentication information at different levels, and the verification score is determined based on the degree of influence of the attribute authentication information on identity verification;
[0204] Based on the verification scores corresponding to the attribute authentication information at different levels, the total attribute verification score of the attribute authentication information is determined.
[0205] Based on the comparison between the total attribute verification score and the preset attribute security score threshold, and the second target identity information, the target energy device is subjected to second identity authentication.
[0206] For example, the first level is the type of equipment, which is the basic level and accounts for 50 points out of 100; the second level is the geographical location attribute, which is divided according to city, province, etc., with the score decreasing in order of geographical location; the third level is the network attribute, with internal LAN > home network > public network, with the score decreasing in that order.
[0207] In this embodiment of the application, the data sharing request is a request initiated by the target energy device to the smart contract of the blockchain network, requesting access to specific data; the data sharing request typically includes the target energy device's second target identity information and the purpose of accessing the data.
[0208] The target energy device generates a data sharing request for target type data based on the preset data interaction conditions of the target control mode. Specifically, it generates a data sharing request for target type data based on the pre-configured data acquisition rules corresponding to the preset data interaction conditions of the target control mode. The data sharing request can determine the type and data content to be accessed.
[0209] In step S104, when the second identity authentication is successful, the subchain in the blockchain network that matches the type of the target type data processes the data sharing request for the target type data based on the access rules for the target energy device in the smart contract, determines the target shared energy data that conforms to the access rules, and shares the target shared energy data with the target energy device.
[0210] In this embodiment of the application, please refer to Figure 5, which shows a flowchart of the method for determining target shared energy data that conforms to the access rules according to this embodiment of the application. Specifically, the sub-chain in the blockchain network that matches the type of the target type data processes the data sharing request for the target type data based on the access rules for the target energy device in the smart contract, and determines the target shared energy data that conforms to the access rules, including the following steps S501-S503:
[0211] S501, The parent chain of the blockchain network sends the data sharing request for the target type data to the sub-chain that matches the type of the target type data;
[0212] S502. The smart contract in the sub-chain that matches the type of the target type data determines, based on the access rules for the target energy device, whether the target energy device has the permission to access the target type data and whether it meets the preset access conditions for accessing the target type data.
[0213] S503. If all conditions are met, then determine the target shared energy data corresponding to the data sharing request.
[0214] The smart contract of the subchain can define access rules, thereby defining which energy devices have the right to access the shared data in the subchain, and under what conditions they can access the data. Only devices that meet these conditions can obtain the shared data in the subchain.
[0215] The target shared energy data can be real-time data, historical data, or other forms of data.
[0216] Based on this, the access rules are used to define whether the target energy device has the permission to access each type of data in the subchain, and under what conditions it can access the data.
[0217] The access rules include the permissions of energy devices for each type of data in the subchain, as well as the corresponding preset access conditions.
[0218] Different types of data are stored in different subchains. The smart contract in each subchain determines whether the energy device has the permission to access the target type of data in that subchain and whether it meets the preset access conditions for accessing the target type of data. Only when these two conditions are met can the target shared energy data corresponding to the data sharing request in that subchain be obtained. This improves the management of energy data by storing different types of data in different subchains, as well as the efficiency of smart contracts in verifying the identity and permissions of energy devices.
[0219] Please refer to Figure 6, which shows a flowchart of the method for sharing the target shared energy data with the target energy device according to an embodiment of this application; in the blockchain-based energy device data communication method, sharing the target shared energy data with the target energy device includes the following steps S601-S603:
[0220] S601. The smart contract in the sub-chain that matches the type of the target type data determines whether the target shared energy data needs to be encrypted based on the type of the target shared energy data and / or the type of the target energy device.
[0221] S602. If necessary, the target shared energy data is encrypted based on the preset first encryption algorithm to obtain the encrypted target shared energy data, and the encrypted target shared energy data is uploaded to the parent chain.
[0222] S603. The parent chain shares the encrypted target shared energy data with the target energy device and records the traceability information of the encrypted target shared energy data.
[0223] If the target shared energy data needs to be transmitted in encrypted form, the smart contract in the subchain will encrypt the data and send the encrypted target shared energy data to the target energy device. Only devices with the decryption key can decrypt the data, further ensuring data security.
[0224] In this embodiment of the application, it can be determined whether the target shared energy data needs to be encrypted based on the type of the target shared energy data and / or the type of the target energy device.
[0225] The traceability information of the encrypted target shared energy data indicates the source and destination of the target shared energy data.
[0226] In this way, the source and destination of data can be traced through the blockchain network, ensuring the traceability and authenticity of the data, and especially guaranteeing data security, privacy and compliance.
[0227] The following example illustrates the specific steps for data sharing when a home energy device needs to share the electricity data it collects with other devices:
[0228] Target energy device requests data sharing: The target energy device initiates a data sharing request to the smart contract of the parent chain, requesting access to power data in order to share the data with other devices. For example, the target energy device is a smart home control system.
[0229] Smart contract verification request: Upon receiving the request, the parent chain's smart contract first verifies the identity of the target energy device, and the child chain's smart contract verifies the target energy device's permissions to the requested data. After confirming the device's legitimacy, the next step is performed.
[0230] Data encryption: If the power data needs to be encrypted, the smart contract will use an encryption algorithm to encrypt the power data and send the encrypted data to the device.
[0231] Data sharing: Smart contracts send encrypted electricity data to home energy devices according to predefined rules. This data can include real-time electricity usage or historical electricity statistics.
[0232] Data Usage: After receiving shared electricity data, home energy devices can process and utilize it according to their own needs. For example, smart home control systems can optimize energy use based on electricity data to achieve intelligent energy management.
[0233] Through the data sharing mechanism of smart contracts, home energy devices can securely share data with other devices, ensuring data security and legality, thereby improving the collaboration efficiency and data utilization value among IoT devices.
[0234] Data sharing between home energy devices based on blockchain technology not only ensures the authenticity and integrity of the data but also enables data traceability. The principle of data traceability is as follows:
[0235] The immutability of blockchain: A blockchain is a distributed database where data is linked together in the form of blocks, each containing the hash value of the previous block. This structure makes data impossible to tamper with or delete once it is written to the blockchain.
[0236] Data record storage: On a blockchain, data transactions are recorded in blocks and are publicly transparent. This means that anyone can view the historical record of data transactions, thus enabling data traceability.
[0237] The following details the steps involved in data tracing.
[0238] Data logging: After collecting and processing energy data, home energy devices record the data on the blockchain. Each data transaction is written into a new block and linked to the previous block.
[0239] Data verification: Once data is recorded on the blockchain, other devices or users can verify its authenticity and integrity. They can access the data's historical records through the blockchain network to view its origin and destination.
[0240] Data traceability: Through the blockchain network, the source and destination of data can be traced. That is, it is possible to see which device the data was generated from, what processing and transmission processes it went through, and where it finally arrived.
[0241] For example, if a home energy device collects electricity consumption data over a period of time and records this data on the blockchain, the following are the specific steps for data traceability:
[0242] Data Recording: Home energy devices record the collected electricity data on the blockchain, forming a new data transaction. This data transaction includes information such as the electricity data value and timestamp, and is written into a new block.
[0243] Data verification: Other devices or users can verify the authenticity and integrity of this data transaction through the blockchain network. They can view the hash value of the transaction and its link to previous blocks, thus ensuring that the data has not been tampered with.
[0244] Data traceability: Through the blockchain network, other devices or users can trace the source and destination of this data transaction, thereby seeing which home energy device initiated the transaction, what processing and transmission processes it went through, and how it was ultimately recorded on the blockchain.
[0245] Data traceability ensures that the source and destination of data collected by home energy devices are traceable, guaranteeing the authenticity and integrity of the data. This provides strong support for data security, privacy, and compliance, enhancing users' trust in and reliability of IoT data.
[0246] The blockchain-based energy device data communication method described in this application firstly initiates a first identity authentication request to the blockchain network for first identity authentication when the energy device interacts with the data. Then, it performs a second identity authentication based on the data sharing request sent by the target energy device. Through multi-level identity authentication, the security of data sharing is ensured.
[0247] Secondly, when performing secondary identity authentication based on the data sharing request sent by the target energy device, the identity authentication is performed based on the time attribute determined by the network attribute, geographical location attribute or the preset data interaction conditions of the target control mode unique to the home energy device, which further ensures the legitimacy of the home energy device's identity in data sharing.
[0248] Finally, when sharing data, this application encrypts specific energy data as needed, further ensuring the security of data sharing while also taking into account the efficiency of data sharing.
[0249] It is particularly noteworthy that in this embodiment, different types of data are stored on different subchains, and the target data type corresponding to the preset data interaction conditions of the target control mode generates a data sharing request for the target type data. Then, based on the smart contract of the subchain, the legality of the target energy device's permission for the target type data is detected, and the target type energy data is only shared with the target energy device with legal permission. This achieves efficient data sharing and permission management at the granularity of data type, improving the precision and flexibility of data sharing.
[0250] Based on the same concept, this application also provides a blockchain-based energy device data communication device corresponding to the blockchain-based energy device data communication method. Since the principle of the device in this application is similar to the blockchain-based energy device data communication method described above in this application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0251] Please refer to Figure 7, which shows a schematic diagram of the structure of the blockchain-based energy equipment data communication device according to an embodiment of this application; specifically, the device includes:
[0252] The acquisition module 701 is used to acquire energy data of energy devices that have completed registration on the blockchain network, and write the energy data into a sub-chain of the blockchain network based on the type of energy data; different sub-chains store different types of energy data;
[0253] The first authentication module 702 is used to initiate a first identity authentication request to the blockchain network when the target energy device responds to the preset data interaction conditions that meet the target control mode, so that the parent chain of the blockchain network performs first identity authentication on the target energy device based on the first identity authentication request.
[0254] The second authentication module 703 is used to, when the first identity authentication is successful, generate a data sharing request for target type data based on the preset data interaction conditions of the target control mode, and send the data sharing request to the blockchain network, so that the parent chain of the blockchain network performs second identity authentication on the target energy device based on the data sharing request and the pre-configured identity authentication conditions.
[0255] The processing module 704 is used to, when the second identity authentication is successful, process the data sharing request for the target type data in the blockchain network that matches the type of the target type data based on the access rules for the target energy device in the smart contract, determine the target shared energy data that conforms to the access rules, and share the target shared energy data with the target energy device.
[0256] In some embodiments, in the blockchain-based energy device data communication device, the first authentication module, when the target energy device responds to a preset data interaction condition that satisfies the target control mode and initiates a first identity authentication request to the blockchain network, so that the parent chain of the blockchain network performs first identity authentication on the target energy device based on the first identity authentication request, is specifically used for:
[0257] The target energy device responds to the preset data interaction conditions that meet the target control mode and initiates a first identity authentication request to the blockchain network; the first identity authentication request includes first target identity information;
[0258] The parent chain of the blockchain network verifies the legitimacy of the target energy device based on the matching result between the first target identity information and the pre-stored device identity information;
[0259] If valid, the parent chain of the blockchain network generates a random challenge and sends the random challenge to the target energy device, so that the target energy device uses a pre-stored private key to digitally sign the random challenge and sends the result of the digital signature to the blockchain network.
[0260] The parent chain of the blockchain network uses the public key of the target energy device to verify the validity of the digital signature result. If the signature is valid, the first identity authentication of the target energy device is successful.
[0261] In some embodiments, in the blockchain-based energy device data communication device, the second identity authentication module, when the target energy device generates a data sharing request for target type data based on preset data interaction conditions of the target control mode and sends the data sharing request to the blockchain network, so that the parent chain of the blockchain network performs second identity authentication on the target energy device based on the data sharing request and pre-configured identity authentication conditions, is specifically used for:
[0262] The target energy device acquires predefined attribute authentication information; the attribute authentication information is based on the attribute definition of the target energy device and corresponds to the identity authentication conditions.
[0263] Based on the attribute authentication information, the second target identity information of the target device, and the preset data interaction conditions of the target control mode, a data sharing request for the target type data is generated and sent to the blockchain network; the preset data interaction conditions of the target control mode are used to determine the shared energy data requested by the data sharing request.
[0264] The parent chain of the blockchain network verifies the attribute authentication information and the second target identity information based on pre-configured identity authentication conditions, and performs second identity authentication on the target energy device.
[0265] In some embodiments, in the blockchain-based energy device data communication device, the second identity authentication module, when verifying the attribute authentication information and the second target identity information based on pre-configured identity authentication conditions on the parent chain of the blockchain network to perform second identity authentication on the target energy device, is specifically used for:
[0266] Determine the verification score corresponding to attribute authentication information at different levels; the verification score is different for attribute authentication information at different levels, and the verification score is determined based on the degree of influence of the attribute authentication information on identity verification;
[0267] Based on the verification scores corresponding to the attribute authentication information at different levels, the total attribute verification score of the attribute authentication information is determined.
[0268] Based on the comparison between the total attribute verification score and the preset attribute security score threshold, and the second target identity information, the target energy device is subjected to second identity authentication.
[0269] In some embodiments, in the blockchain-based energy device data communication device, when the processing module processes the data sharing request for the target type data based on the access rules for the target energy device in the sub-chain of the blockchain network that matches the type of the target type data, and determines the target shared energy data that conforms to the access rules, it is specifically used for:
[0270] The parent chain of the blockchain network sends the data sharing request for the target type data to the child chain that matches the type of the target type data;
[0271] The smart contract in the subchain that matches the type of the target type data determines, based on the access rules for the target energy device, whether the target energy device has the permission to access the target type data and whether it meets the preset access conditions for accessing the target type data.
[0272] If all conditions are met, then the target shared energy data corresponding to the data sharing request is determined.
[0273] In some embodiments, the processing module in the blockchain-based energy device data communication device, when sharing the target shared energy data with the target energy device, is specifically used for:
[0274] The smart contract in the subchain that matches the type of the target type data determines whether the target shared energy data needs to be encrypted based on the type of the target shared energy data and / or the type of the target energy device.
[0275] If necessary, the target shared energy data is encrypted based on the preset first encryption algorithm to obtain encrypted target shared energy data, and the encrypted target shared energy data is uploaded to the parent chain;
[0276] The parent chain shares the encrypted target shared energy data with the target energy device and records the traceability information of the encrypted target shared energy data.
[0277] In some embodiments, the blockchain-based energy equipment data communication device further includes:
[0278] The registration module is used to initiate a registration request to the blockchain network when the energy device is started, before obtaining the energy data of the energy device that has completed registration on the blockchain network; the registration request includes device identity information.
[0279] The parent chain of the blockchain network processes the device identity information and generates a first hash value for the device identity information;
[0280] The parent chain of the blockchain network sends a verification request to the business server that has pre-stored device identity information in order to receive the second hash value generated by the business server in processing the device identity information;
[0281] The parent chain of the blockchain network verifies whether the first hash value and the second hash value are consistent;
[0282] If they match, the parent chain of the blockchain network determines that the energy device has been successfully identified, completes the registration of the energy device, and stores the device identity information of the energy device.
[0283] In some embodiments, in the blockchain-based energy device data communication device, the acquisition module, when writing the energy data into a sub-chain of the blockchain network based on the type of energy data, is specifically used for:
[0284] The energy data is encrypted using the second encryption algorithm to obtain encrypted energy data;
[0285] Generate a data digest of the encrypted energy data;
[0286] Based on the type of energy data, the encrypted energy data and data digest are uploaded to a subchain of the blockchain network.
[0287] Based on the same concept, this application also provides an electronic device corresponding to the blockchain-based energy device data communication method. Since the principle of solving the problem by the electronic device in this application is similar to the blockchain-based energy device data communication method described above, the implementation of the electronic device can refer to the implementation of the method, and the repeated parts will not be described again.
[0288] Please refer to Figure 8, which shows a schematic diagram of the structure of the electronic device according to an embodiment of this application. The electronic device 800 includes a processor 802, a memory 801, and a bus. The memory 801 stores machine-readable instructions executable by the processor 802. When the electronic device 800 is running, the processor 802 communicates with the memory 801 through the bus. When the machine-readable instructions are executed by the processor 802, the steps of the blockchain-based energy device data communication method are performed.
[0289] Based on the same concept, this application also provides a computer-readable storage medium corresponding to the blockchain-based energy device data communication method. Since the principle of the computer-readable storage medium in this application is similar to the blockchain-based energy device data communication method described above, the implementation of a computer-readable storage medium can refer to the implementation of the method, and the repeated parts will not be described again.
[0290] A computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the blockchain-based energy device data communication method.
[0291] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the method embodiments, and will not be repeated here. In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection can be through some communication interfaces; the indirect coupling or communication connection of devices or modules can be electrical, mechanical, or other forms.
[0292] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0293] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0294] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a platform server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0295] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A data communication method for energy devices based on blockchain, wherein, The method includes: The system acquires energy data from energy devices that have registered on the blockchain network, and writes the energy data into a sub-chain of the blockchain network based on the type of energy data; different sub-chains store different types of energy data. The target energy device responds to the preset data interaction conditions that meet the target control mode and initiates a first identity authentication request to the blockchain network, so that the parent chain of the blockchain network performs first identity authentication on the target energy device based on the first identity authentication request; When the first identity authentication is successful, the target energy device generates a data sharing request for the target type of data based on the preset data interaction conditions of the target control mode, and sends the data sharing request to the blockchain network, so that the parent chain of the blockchain network performs a second identity authentication on the target energy device based on the data sharing request and the pre-configured identity authentication conditions. When the second identity authentication is successful, the subchain in the blockchain network that matches the type of the target type data processes the data sharing request for the target type data based on the access rules for the target energy device in the smart contract, determines the target shared energy data that conforms to the access rules, and shares the target shared energy data with the target energy device.
2. The blockchain-based energy equipment data communication method according to claim 1, wherein, The target energy device responds to preset data interaction conditions that meet the target control mode and initiates a first identity authentication request to the blockchain network, so that the parent chain of the blockchain network performs first identity authentication on the target energy device based on the first identity authentication request, including: The target energy device responds to the preset data interaction conditions that meet the target control mode and initiates a first identity authentication request to the blockchain network; the first identity authentication request includes first target identity information; The parent chain of the blockchain network verifies the legitimacy of the target energy device based on the matching result between the first target identity information and the pre-stored device identity information; If valid, the parent chain of the blockchain network generates a random challenge and sends the random challenge to the target energy device, so that the target energy device uses a pre-stored private key to digitally sign the random challenge and sends the result of the digital signature to the blockchain network. The parent chain of the blockchain network uses the public key of the target energy device to verify the validity of the digital signature result. If the signature is valid, the first identity authentication of the target energy device is successful.
3. The blockchain-based energy equipment data communication method according to claim 1 or 2, wherein, The target energy device generates a data sharing request for target type data based on preset data interaction conditions of the target control mode, and sends the data sharing request to the blockchain network, so that the parent chain of the blockchain network performs a second identity authentication on the target energy device based on the data sharing request and pre-configured identity authentication conditions; including: The target energy device acquires predefined attribute authentication information; the attribute authentication information is based on the attribute definition of the target energy device and corresponds to the identity authentication conditions. Based on the attribute authentication information, the second target identity information of the target device, and the preset data interaction conditions of the target control mode, a data sharing request for the target type data is generated and sent to the blockchain network; the preset data interaction conditions of the target control mode are used to determine the shared energy data requested by the data sharing request. The parent chain of the blockchain network verifies the attribute authentication information and the second target identity information based on pre-configured identity authentication conditions, and performs second identity authentication on the target energy device.
4. The blockchain-based energy equipment data communication method according to claim 3, wherein, The parent chain of the blockchain network verifies the attribute authentication information and the second target identity information based on pre-configured identity authentication conditions, and performs second identity authentication on the target energy device, including: Determine the verification score corresponding to attribute authentication information at different levels; the verification score is different for attribute authentication information at different levels, and the verification score is determined based on the degree of influence of the attribute authentication information on identity verification; Based on the verification scores corresponding to the attribute authentication information at different levels, the total attribute verification score of the attribute authentication information is determined. Based on the comparison between the total attribute verification score and the preset attribute security score threshold, and the second target identity information, the target energy device is subjected to second identity authentication.
5. The blockchain-based energy equipment data communication method according to claim 3, wherein, The subchain in the blockchain network that matches the type of the target type data processes the data sharing request for the target type data based on the access rules for the target energy device in the smart contract, and determines the target shared energy data that conforms to the access rules, including: The parent chain of the blockchain network sends the data sharing request for the target type data to the child chain that matches the type of the target type data; The smart contract in the subchain that matches the type of the target type data determines, based on the access rules for the target energy device, whether the target energy device has the permission to access the target type data and whether it meets the preset access conditions for accessing the target type data. If all conditions are met, then the target shared energy data corresponding to the data sharing request is determined.
6. The blockchain-based energy equipment data communication method according to claim 5, wherein, Sharing the target shared energy data with the target energy device includes: The smart contract in the subchain that matches the type of the target type data determines whether the target shared energy data needs to be encrypted based on the type of the target shared energy data and / or the type of the target energy device. If necessary, the target shared energy data is encrypted based on the preset first encryption algorithm to obtain encrypted target shared energy data, and the encrypted target shared energy data is uploaded to the parent chain; The parent chain shares the encrypted target shared energy data with the target energy device and records the traceability information of the encrypted target shared energy data.
7. The blockchain-based energy equipment data communication method according to claim 1, wherein, Before acquiring energy data from energy devices that have completed registration on the blockchain network, the method further includes: When an energy device is started up, it initiates a registration request to the blockchain network; the registration request includes the device's identity information. The parent chain of the blockchain network processes the device identity information and generates a first hash value for the device identity information; The parent chain of the blockchain network sends a verification request to the business server that has pre-stored device identity information in order to receive the second hash value generated by the business server in processing the device identity information; The parent chain of the blockchain network verifies whether the first hash value and the second hash value are consistent; If they match, the parent chain of the blockchain network determines that the energy device has been successfully identified, completes the registration of the energy device, and stores the device identity information of the energy device.
8. The blockchain-based energy equipment data communication method according to claim 1, wherein, The process of writing the energy data into a sub-chain of the blockchain network based on the type of energy data includes: The energy data is encrypted using the second encryption algorithm to obtain encrypted energy data; Generate a data digest of the encrypted energy data; Based on the type of energy data, the encrypted energy data and data digest are uploaded to a subchain of the blockchain network.
9. A blockchain-based energy equipment data processing device, wherein, The device includes: The acquisition module is used to acquire energy data of energy devices that have completed registration on the blockchain network, and write the energy data into a sub-chain of the blockchain network based on the type of energy data; different sub-chains store different types of energy data; The first authentication module is used to initiate a first identity authentication request to the blockchain network when the target energy device responds to the preset data interaction conditions that meet the target control mode, so that the parent chain of the blockchain network can perform first identity authentication on the target energy device based on the first identity authentication request. The second authentication module is used to generate a data sharing request for target type data based on the preset data interaction conditions of the target control mode when the first identity authentication is successful, and send the data sharing request to the blockchain network so that the parent chain of the blockchain network can perform a second identity authentication on the target energy device based on the data sharing request and the pre-configured identity authentication conditions. The processing module is used to, when the second identity authentication is successful, process the data sharing request for the target type data in the sub-chain of the blockchain network that matches the type of the target type data based on the access rules for the target energy device in the smart contract, determine the target shared energy data that conforms to the access rules, and share the target shared energy data with the target energy device.
10. An electronic device, wherein, The electronic device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the blockchain-based energy device data communication method as described in any one of claims 1 to 8 are performed.