A blockchain-based energy device data communication method
By introducing blockchain technology and smart contracts into the Internet of Things system, the security risks of traditional IoT data communication methods in home energy equipment are solved, and the secure storage and efficient interaction of energy equipment data are achieved.
Patent Information
- Application Number
- CN202510012677.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-06
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2045-01-06
AI Technical Summary
Traditional IoT data communication methods have security risks in home energy equipment, including trust issues, data privacy issues and data integrity issues, making it difficult to achieve safe and efficient energy data storage and device control.
The blockchain-based energy equipment data communication method is adopted to register and authenticate energy equipment through the blockchain network, and use smart contracts to manage data sharing requests to ensure that data is tamper-proof, transparent and secure during storage and transmission in different sub-chains.
It realizes the safe and efficient storage and interaction of home energy equipment data, enhances the privacy protection and management efficiency of data, and improves the security and credibility of data sharing.
Smart Images

Figure CN119420784B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of energy information. Specifically, it relates to a method for energy device data communication based on blockchain. Background Art
[0002] With the rapid development of Internet of Things technology, more and more household energy devices are connected to the network, forming a huge Internet of Things ecosystem. However, traditional Internet of Things data communication methods have many security risks, including trust issues, data privacy issues, and data integrity issues, etc. Especially, household energy devices often belong to different manufacturers. How to effectively and securely use energy data and achieve the control of various household energy devices is an urgent problem to be solved. Summary of the Invention
[0003] In view of this, the purpose of this application is to provide a method, device, electronic device and medium for energy device data communication based on blockchain, which can securely and efficiently store the energy data of household energy devices and realize the energy data interaction between household energy devices.
[0004] A method for energy device data communication based on blockchain provided by an embodiment of this application, the method includes:
[0005] Obtain the energy data of the energy devices registered in the blockchain network, and write the energy data into the sub-chain of the blockchain network based on the type of the energy data; wherein, different sub-chains store different types of energy data;
[0006] The target energy device responds to the preset data interaction condition that meets the target control mode, and sends a first identity authentication request to the blockchain network, so that the main chain of the blockchain network performs the first identity authentication on the target energy device based on the first identity authentication request;
[0007] 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 condition of the target control mode, and sends the data sharing request to the blockchain network, so that the main chain of the blockchain network performs the second identity authentication on the target energy device based on the data sharing request and the pre-configured identity authentication condition;
[0008] 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 rule for the target energy device in the smart contract, determines the target shared energy data that meets the access rule, and shares the target shared energy data with the target energy device.
[0009] In some embodiments, in the energy device data communication method based on blockchain, the target energy device responds to the 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 a first identity authentication on the target energy device based on the first identity authentication request, including:
[0010] The target energy device responds to the preset data interaction condition that satisfies the target control mode, and initiates a first identity authentication request to the blockchain network; the first identity authentication request includes the first target identity information;
[0011] The parent chain of the blockchain network verifies the legitimacy of the target energy device based on the matching result of the first target identity information and the pre-stored device identity information;
[0012] If it is legal, 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;
[0013] The parent chain of the blockchain network uses the public key of the target energy device to verify the validity of the result of the digital signature. If the signature is valid, the first identity authentication of the target energy device is successful.
[0014] In some embodiments, in the energy device data communication method based on blockchain, the target energy device generates a data sharing request for target type data based on the preset data interaction condition 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 condition; including:
[0015] The target energy device acquires predefined attribute authentication information of the target energy device; the attribute authentication information is defined based on the attribute of the target energy device and corresponds to the identity authentication condition;
[0016] 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;
[0017] 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 a second identity authentication on the target energy device.
[0018] In some embodiments, in the blockchain-based energy device data communication method, the main chain of the blockchain network verifies the attribute authentication information and the second target identity information based on preconfigured identity authentication conditions, and performs a second identity authentication on the target energy device, including:
[0019] Determine the verification scores corresponding to the attribute authentication information at different levels; wherein, the verification scores of the attribute authentication information at different levels are different, and the verification score is determined based on the influence degree of this type of attribute authentication information on identity verification;
[0020] Based on the verification scores corresponding to the attribute authentication information at different levels, determine the total attribute verification score of the attribute authentication information;
[0021] Based on the comparison result between the total attribute verification score and the preset attribute security score threshold, and the second target identity information, perform a second identity authentication 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 meets the access rules, including:
[0022] The main 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;
[0023] The smart contract in the sub-chain that matches the type of the target type data determines 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 based on the access rules for the target energy device;
[0024] If both are met, determine the target shared energy data corresponding to the data sharing request.
[0025] In some embodiments, in the blockchain-based energy device data communication method, sharing the target shared energy data with the target energy device includes:
[0026] 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;
[0027] If it is necessary, encrypt the target shared energy data based on a preset first encryption algorithm to obtain the encrypted target shared energy data, and upload the encrypted target shared energy data to the main chain;
[0028] 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.
[0029] In some embodiments, in the blockchain-based energy device data communication method, before obtaining the energy data of the energy device registered in the blockchain network, the method further includes:
[0030] When the energy device starts up, send a registration request to the blockchain network; the registration request includes device identity information;
[0031] The parent chain of the blockchain network processes the device identity information to generate a first hash value of the device identity information;
[0032] The parent chain of the blockchain network sends a verification request to the business server pre-storing the device identity information to receive a second hash value generated by the business server processing the device identity information;
[0033] The parent chain of the blockchain network verifies whether the first hash value and the second hash value are consistent;
[0034] If they are consistent, the parent chain of the blockchain network determines that the energy device identity verification is successful, completes the registration of the energy device, and stores the device identity information of the energy device.
[0035] In some embodiments, in the blockchain-based energy device data communication method, writing the energy data into a sub-chain of the blockchain network based on the type of the energy data includes:
[0036] Encrypt the energy data based on a second encryption algorithm to obtain the encrypted energy data;
[0037] Generate a data digest of the encrypted energy data;
[0038] Based on the type of the energy data, upload the encrypted energy data and the data digest to a sub-chain of the blockchain network.
[0039] In some embodiments, there is also provided a blockchain-based energy device data processing apparatus, the apparatus includes:
[0040] An acquisition module, configured to acquire the energy data of the energy device registered in the blockchain network, and write the energy data into a sub-chain of the blockchain network based on the type of the energy data; wherein, different sub-chains store different types of energy data;
[0041] The first authentication module is used to initiate a first identity authentication request to the blockchain network when the target energy device responds to meet the preset data interaction conditions of the target control mode, so that the main chain of the blockchain network performs the first identity authentication on the target energy device based on the first identity authentication request;
[0042] The second authentication module is used to, 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 main chain of the blockchain network performs the second identity authentication on the target energy device based on the data sharing request and the pre-configured identity authentication conditions;
[0043] The processing module is used to, 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 meets the access rules, and shares the target shared energy data with the target energy device.
[0044] In some embodiments, an electronic device is further provided. 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 runs, the processor communicates with the memory through the bus. When the machine-readable instructions are executed by the processor, the steps of the blockchain-based energy device data communication method are executed.
[0045] In some embodiments, a computer-readable storage medium is further provided. A computer program is stored on the computer-readable storage medium. When the computer program is run by a processor, the steps of the blockchain-based energy device data communication method are executed.
[0046] The embodiment of the present application provides a blockchain-based energy device data communication method, device, electronic device and medium, which obtains energy data of energy devices that have completed registration in the blockchain network, and writes the energy data into a subchain of the blockchain network based on the type of energy data; wherein different subchains 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 a 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 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 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 meets the access rules, and shares the target shared energy data with the target energy device, using the immutability, transparency and security of the blockchain to ensure the secure transmission and storage of IoT data, store different types of data based on the sub-chain, achieve data isolation and privacy protection, and facilitate the formulation of access rules for each type of energy data according to the characteristics and needs of energy data, thereby improving data management effects and data sharing efficiency, as well as the security of data sharing. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0048] Figure 1 A flowchart of a blockchain-based energy device data communication method according to an embodiment of the present application is shown;
[0049] Figure 2 A flow chart of a method for writing energy data into a subchain of a blockchain network based on the type of energy data according to an embodiment of the present application is shown;
[0050] Figure 3 A flow chart of a method for performing a first identity authentication on a target energy device according to an embodiment of the present application is shown;
[0051] Figure 4The flowchart shows the method for the target energy device according to the embodiments of the present application to generate a data sharing request for target type data based on the preset data interaction conditions of the target control mode;
[0052] Figure 5 The flowchart shows the method for determining the target shared energy data that meets the access rules according to the embodiments of the present application;
[0053] Figure 6 The flowchart shows the method for sharing the target shared energy data with the target energy device according to the embodiments of the present application;
[0054] Figure 7 The schematic diagram shows the structure of the energy device data communication device based on blockchain according to the embodiments of the present application;
[0055] Figure 8 The schematic diagram shows the structure of the electronic device according to the embodiments of the present application. Detailed implementation manners
[0056] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. It should be understood that the accompanying drawings in the present application are only for the purposes of illustration and description, and are not used to limit the protection scope of the present application. In addition, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in the present application show the operations implemented according to some embodiments of the present application. It should be understood that the operations in the flowchart may not be implemented in sequence, and the steps without logical context may be reversed or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart or remove one or more operations from the flowchart under the guidance of the content of the present application.
[0057] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application described and shown in the accompanying drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application to be protected, but only represents the selected embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without creative efforts belong to the protection scope of the present application.
[0058] It should be noted that the term "including" will be used in the embodiments of the present application to indicate the existence of the features stated thereafter, but does not exclude the addition of other features.
[0059] With the rapid development of Internet of Things (IoT) technology, more and more home energy devices are connected to the network, forming a huge IoT ecosystem. However, there are many security risks in traditional IoT data communication methods, including trust issues, data privacy issues, and data integrity issues, etc. Especially, home energy devices often belong to different manufacturers. How to effectively and securely use energy data and achieve the control of various home energy devices is an urgent problem to be solved.
[0060] To address the IoT data security problem, there are several main technical solutions currently: The security protocol-based solution uses security protocols such as TLS / SSL to encrypt data transmission. This solution can improve data security, but it cannot completely solve the trust problem and data integrity problem.
[0061] The identity authentication-based solution verifies the identity of devices through an identity authentication mechanism. This solution can reduce the risk of device attacks, but it cannot effectively solve the data privacy problem. The data encryption-based solution encrypts data for storage to prevent data leakage. Although this method can protect data privacy, it cannot solve the data integrity problem.
[0062] In summary, the above technical solutions have improved the security of IoT data to a certain extent, but there are still the following deficiencies: First, insufficient security: The existing technologies cannot completely solve the trust problem, data privacy problem, and data integrity problem in the IoT, and there is still a risk of being attacked and tampered with. Second, low efficiency: These solutions usually increase additional computing and storage overheads, reducing the system efficiency. Especially in a large-scale IoT environment, this efficiency problem is more prominent. Third, lack of scalability: The existing technical solutions are difficult to meet the rapidly expanding needs of the IoT scale and cannot effectively cope with the increasing number of devices and data volume.
[0063] In order to solve these problems, the embodiments of the present application provide a blockchain-based energy device data communication method, device, electronic device and medium, which obtain energy data of energy devices registered in the blockchain network, and write the energy data into a subchain of the blockchain network based on the type of energy data; wherein different subchains 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 a 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 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 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 meets the access rules, and shares the target shared energy data with the target energy device, using the immutability, transparency and security of the blockchain to ensure the secure transmission and storage of IoT data, store different types of data based on the sub-chain, achieve data isolation and privacy protection, and facilitate the formulation of access rules for each type of energy data according to the characteristics and needs of energy data, thereby improving data management effects and data sharing efficiency, as well as the security of data sharing.
[0064] Please refer to Figure 1 , Figure 1 The flowchart of the energy device data communication method based on blockchain described in the embodiment of the present application is shown; Figure 1 As shown, the method includes the following steps S101-S104:
[0065] S101. Obtain energy data of energy equipment that has completed registration in the blockchain network, and write the energy data into a subchain of the blockchain network based on the type of the energy data; wherein different subchains store different types of energy data;
[0066] S102, the target energy device responds to the preset data interaction condition that meets 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 a first identity authentication on the target energy device based on the first identity authentication request;
[0067] S103. When the first identity authentication succeeds, the target energy device generates a data sharing request for the 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;
[0068] 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 complies with the access rules, and shares the target shared energy data with the target energy device.
[0069] In step S101, energy data of energy equipment registered in the blockchain network is obtained, and the energy data is written into a sub-chain of the blockchain network based on the type of the energy data; wherein different sub-chains store different types of energy data.
[0070] In the embodiment of the present application, the energy device is a household energy device.
[0071] The energy device is, for example, an energy storage device, an electrical device, a power generation device, a transmission device or a hybrid device, wherein the hybrid device is externally treated as a device, which may include a transmission device, a power generation device, an energy storage device and an electrical device, etc. Energy information includes capability information, demand information, supply information, identity information, type information, voltage information, current information, power information, energy information, spatiotemporal attribute information, adjustable attribute information, response time information, etc.
[0072] Exemplarily, the electrical equipment includes: air conditioners, washing machines, smart home devices, etc.; the power generation equipment includes solar energy equipment, etc.
[0073] In the embodiment of the present application, the blockchain network includes a parent chain and a child chain, wherein 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 POW (Proof of Work) 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 all uploaded transactions and data; data traceability: recording the source and destination of data to ensure the traceability and transparency of data.
[0074] The sub-chain processes specific types of data and application logic, and its responsibilities include: data classification: storing data on different sub-chains according to data types (such as temperature, power, switch status, etc.) to improve the efficiency of data management; 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 processing and sharing of data.
[0075] The sub-chain adopts local consensus, that is, within the sub-chain, through a simplified consensus mechanism (Practical Byzantine Fault Tolerance), it ensures the consistency and security of data.
[0076] In the embodiments of this application, before obtaining the energy data of the energy device registered in the blockchain network, the method further includes:
[0077] When the energy device starts up, send a registration request to the blockchain network; the registration request includes device identity information;
[0078] The main chain of the blockchain network processes the device identity information and generates a first hash value of the device identity information;
[0079] The main chain of the blockchain network sends a verification request to the business server that pre-stores the device identity information to receive the second hash value generated by the business server processing the device identity information;
[0080] The main chain of the blockchain network verifies whether the first hash value and the second hash value are consistent;
[0081] If they are consistent, the main chain of the blockchain network determines that the energy device identity verification is successful, completes the registration of the energy device, and stores the device identity information of the energy device.
[0082] As an Internet of Things device, before accessing the blockchain network, the energy device registers with the blockchain network to obtain a unique identity identifier and compares and verifies it with the data pre-stored in the cloud.
[0083] When the energy device starts up, for example, when a smart temperature control device starts up, it will send a registration request to the blockchain network. The registration request contains device identity information, which can also be called the attribute information, basic information, etc. of the device; the device identity information includes the model of the device, manufacturer information, and unique identification code, etc.
[0084] The registration request can be sent by the energy device itself, or by other energy devices interacting with the energy device, or by the client. Exemplarily, the registration request of the intelligent temperature control device can be sent by the intelligent temperature control device itself, or may be sent by the gateway connected to the intelligent temperature control device to the blockchain, or may also be sent by the client of the intelligent temperature control device (specifically, terminals such as mobile phones installed with client software) to the blockchain.
[0085] After the blockchain network receives the registration request, it will send the information provided by the device to the cloud business server for verification; specifically, in the embodiments of the present application, the main chain of the blockchain network generates a verification request based on at least part of the device identity information and sends the verification request to the business server.
[0086] The business server can be a cloud server (abbreviated as the cloud); the business server can be an independent home energy device management platform or the server of the device manufacturer.
[0087] In the cloud, based on the verification information, the business server queries the device information of the energy device from the pre-stored device identity information and generates a second hash value in combination with the SHA-256 encryption algorithm.
[0088] The main chain of the blockchain network performs a hash operation on the received device identity information using the SHA-256 encryption algorithm to generate a unique first hash value.
[0089] After the main chain of the blockchain network receives the second hash value returned by the business server, it compares it with the first hash value of the device identity information. If the two are consistent, the verification passes, the registration of the energy device is completed, and the device identity information of the energy device is stored.
[0090] If the first hash value and the second hash value are inconsistent, the verification fails.
[0091] In the device registration process described in the embodiments of the present application, 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, using the irreversibility and uniqueness of the SHA-256 encryption algorithm, the security and integrity of the identity data are guaranteed.
[0092] SHA-256 encryption algorithm description:
[0093] SHA-256 is a secure hash algorithm, the successor of the SHA-1 algorithm, with higher security, faster speed, and stronger collision resistance.
[0094] The SHA-256 algorithm uses an iterative compression method to convert input data of any length into output data of a fixed length (256 bits). The specific steps of the SHA-256 algorithm are as follows:
[0095] Preprocessing: Pad the input data into 512-bit blocks;
[0096] Initialization: Initialize 8 32-bit registers, called working variables;
[0097] 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;
[0098] Output: Concatenate the final 8 working variables to form 256-bit output data.
[0099] The SHA-256 algorithm has the following security features:
[0100] Collision resistance: It is difficult to find two different input data with the same hash value;
[0101] Preimage resistance: It is difficult to find an input data with a specified hash value;
[0102] Second preimage resistance: It is difficult to find a second input data with the same hash value as the given input data.
[0103] The mathematical formulas of the SHA-256 algorithm are as follows:
[0104] H = H0 || H1 || H2 || H3 || H4 || H5 || H6 || H7;
[0105] H(n) = H(n-1) + Σ(n) + K(n) + W(n);
[0106] Σ(n) = Ch(n) + Maj(n);
[0107] Ch(n) = (H(n-1) ∧ H(n-2)) ⊕ (~H(n-1) ∧ H(n-3));
[0108] Maj(n) = (H(n-1) ∧ H(n-2)) ⊕ (H(n-1) ∧ H(n-3)) ⊕ (H(n-2) ∧ H(n-3));
[0109] K(n) = [K0, K1, ……, K63];
[0110] W(n) = [W0, W1, ……, W15];
[0111] W(n) = W(n - 16) + σ1(W(n - 14)) + W(n - 7) + σ0(W(n - 2));
[0112] σ0(x) = (x >> 7) ⊕ (x >> 18) ⊕ (x >> 3);
[0113] σ1(x) = (x >> 17) ⊕ (x >> 19) ⊕ (x >> 10).
[0114] Wherein, H: represents the final hash value (or called digest, hash value) generated after the SHA-256 algorithm processes the input message; H0, H1, H2, H3, H4, H5, H6, H7 are the initial hash values (or called hash initial values) used in the SHA-256 algorithm; n in the formula H(n - 1) + Σ(n) + K(n) + W(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 then each block is further divided into multiple 32-bit words. In each step of the iteration of the compression function, a series of complex non-linear operations are performed, and these operations will update the current hash value.
[0115] Specifically, n refers to the nth round of iteration. In each round of iteration, the current hash value H(n) is calculated, and this value depends on the previous round's hash value H(n - 1), the message word W(n) of the current round, the constant K(n), and some intermediate values Σ(n) calculated from the message words.
[0116] The intermediate value Σ(n) is determined based on the selection function Ch(n) and the majority function Maj(n).
[0117] In the formula Ch(n) = (H(n - 1) ∧ H(n - 2)) ⊕ (~H(n - 1) ∧ H(n - 3)), the symbol ~ represents the bitwise negation operation; specifically, (H(n - 1) ∧ H(n - 2)): the bitwise AND operation, which means performing the AND operation on each bit of (H(n - 1) ∧ H(n - 2)); ~H(n - 1): the bitwise negation operation, which means reversing each bit of ~H(n - 1), that is, changing 0 to 1 and 1 to 0; (~H(n - 1) ∧ H(n - 3)): first perform the bitwise negation operation on ~H(n - 1), and then perform the bitwise AND operation on the result and H(n - 3); (H(n - 1) ∧ H(n - 2)) ⊕ (~H(n - 1) ∧ H(n - 3)) performs the bitwise exclusive OR operation on the results of the above two parts.
[0118] An example of bitwise operation is as follows: Suppose there are 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;
[0119] Therefore, the result of Ch(n) is the result of bitwise operation.
[0120] This operation is used in the SHA-256 algorithm to generate complex bit-level confusion and increase the security of the hash function.
[0121] K(n) = [K0, K1, ……, K63] in the formula is a set of 64 fixed constants, which are used in the compression function operation for each round (from round 0 to round 63); 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 complexity and security of the algorithm.
[0122] W(n) = [W0, W1, ……, W15] in the formula represents the initial message words directly obtained from the message block.
[0123] The function definitions in the mathematical formula of the above 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 the constants in the constant array; W(n) represents the message word array; W0, W1, ……, W15 represent the message words in the message word array; σ0(x) represents the first cyclic shift function; σ1(x) represents the second cyclic shift function, and x represents the variable in the first cyclic shift function and the second cyclic shift function.
[0124] The SHA-256 algorithm is a secure, reliable, and efficient hash algorithm with a wide range of application scenarios. During the registration process of home energy devices, using the SHA-256 algorithm can effectively verify the authenticity and validity of device identities and ensure the security of the IoT system.
[0125] During the operation of energy equipment, it is necessary to upload the energy data of the registered energy equipment to the blockchain. To ensure the encryption of energy data, the energy data needs to be encrypted.
[0126] Specifically, in the embodiments of the present application, based on the type of energy data, the energy data is written into a sub-chain in the blockchain network that matches its type, so as to store at least one type of energy data (such as temperature, power, switch status, etc.) in different sub-chains, thereby improving the efficiency of data management.
[0127] In the embodiments of the present application, please refer to Figure 2 , Figure 2 which shows the flowchart of the method for writing the energy data into the sub-chain of the blockchain network based on the type of energy data in the embodiments of the present application; as Figure 2 shown, writing the energy data into the sub-chain of the blockchain network based on the type of energy data includes the following steps S201 - S203:
[0128] S201. Encrypt the energy data based on the second encryption algorithm to obtain the encrypted energy data;
[0129] S202. Generate a data digest of the encrypted energy data;
[0130] S203. Based on the type of the energy data, upload the encrypted energy data and the data digest to the sub-chain of the blockchain network.
[0131] That is to say, the home energy equipment encrypts the collected energy data and generates a data digest to ensure the confidentiality and integrity of the energy data.
[0132] Encrypt the energy data based on the second encryption algorithm to obtain the encrypted energy data, specifically as follows: After the home energy equipment collects various types of data (such as temperature, power, switch status, etc.), the energy equipment selects an encryption key, which is obtained through a secure protocol exchange.
[0133] Finally, use the encryption algorithm to encrypt the collected data. Exemplarily, in the embodiments of the present application, the home energy equipment can use AES (Advanced Encryption Standard) to encrypt the energy data to ensure the confidentiality of the energy data.
[0134] Generate a data digest of the encrypted energy data, specifically as follows: Apply the SHA-256 hash algorithm to the encrypted energy data to generate a hash value of the energy data. This hash value is also called the data digest.
[0135] In the embodiments of the present application, the generated data digest is stored together with the encrypted energy data in a sub-chain that matches the data type, so as to verify the integrity of the data subsequently.
[0136] AES (Advanced Encryption Standard) is a symmetric encryption algorithm used for encrypting and decrypting data. The formula and principle of the AES encryption algorithm are specifically described below.
[0137] The formula of the AES encryption algorithm is as follows: Encryption process: Ciphertext = AES(Plaintext, Key); Decryption process: Plaintext = AES(Ciphertext, Key).
[0138] The principle of the AES encryption algorithm is as follows: The AES algorithm uses the method of block cipher, divides the plaintext data into data blocks of a fixed length, and then through a series of encryption operations, converts each data block into a corresponding ciphertext data block. The decryption operation is the reverse process of the encryption operation, converting the ciphertext data block back into the plaintext data block.
[0139] The AES algorithm adopts a Substitution-Permutation Network (SPN) structure, which mainly includes the following steps:
[0140] Key Expansion: Generates a series of round keys according to the input key for subsequent round function operations;
[0141] Initial Round: Performs an exclusive OR operation on the plaintext data block and the first round key;
[0142] Rounds: Adopts multiple rounds of iterative operations, and each round includes four steps: SubBytes, ShiftRows, MixColumns, and AddRoundKey;
[0143] Final Round: The last round does not include the MixColumns step;
[0144] Ciphertext Generation: Obtains the ciphertext data block after multiple rounds of encryption.
[0145] Exemplarily, the energy data encryption process in the embodiments of the present application is as follows:
[0146] Suppose the temperature data collected by a household energy device is 25°C and is encrypted using the AES encryption algorithm. The specific encryption process is as follows: Plaintext: 25°C; Key: The pre-stored encryption key; The device performs AES encryption on the plaintext data to obtain the corresponding ciphertext data, for example: 0x3F7A2B9E65D12F8C…….
[0147] Exemplarily, the specific process of generating a data digest of the 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. Exemplarily, the generated hash value is: 0x9A457FACBE8216D3…….
[0148] Based on the type of the energy data, upload the encrypted energy data and the data digest to the sub-chain in the blockchain network that matches the type of the energy data, so that the encrypted data and the data digest are uploaded to the blockchain network, ensuring the immutability and transparency of the data.
[0149] Based on the type of the energy data, upload the encrypted energy data and the data digest to the sub-chain of the blockchain network. The following specifically describes the specific process of data uploading to the chain:
[0150] Prepare transaction data: Prepare the encrypted energy data and its corresponding data digest for uploading to the blockchain network.
[0151] Create a transaction: Package the prepared encrypted energy data and the data digest into a transaction format; In some blockchain systems, transaction fees may be required.
[0152] Broadcast the transaction: Broadcast the created transaction to the nodes in the blockchain network.
[0153] Transaction verification: The verification nodes in the blockchain network verify the received transaction to ensure that it complies with the network rules and consensus mechanism. The verification includes checking the validity of the transaction, the integrity of the data, and relevant signature information, etc.
[0154] Package the transaction: Once the transaction passes verification, the verification nodes package it into a new block.
[0155] Block confirmation: The new block is added to the sub-chain of the blockchain, and this block contains the above transaction data. At this time, the data has been successfully uploaded to the chain.
[0156] Block synchronization: The nodes of the sub-chain in the entire blockchain network synchronize the new block to ensure that all nodes of the sub-chain contain the latest data.
[0157] The following exemplarily describes the process of energy data uploading to the chain.
[0158] Prepare transaction data: Assume that the home energy device collects temperature data of 25°C, and has encrypted the energy data and generated a data summary.
[0159] Create transaction: Pack the encrypted energy data and data summary into a transaction format and include other necessary device information, such as sender address, receiver address, etc.
[0160] Broadcast transaction: Broadcast the created transaction to the nodes in the blockchain network.
[0161] Transaction verification: After receiving a transaction, the verification node in the blockchain network will verify the validity of the transaction, the integrity of the data, and other relevant information.
[0162] Packaging transactions: Once a transaction is verified, the verification node packages it into a new block.
[0163] Block confirmation: A new block is added to the sub-chain of the blockchain and contains the above transaction data, and the type of energy data in the sub-chain and the transaction data matches.
[0164] Block synchronization: The nodes of the subchain in the blockchain network synchronize new blocks to ensure that all nodes of the subchain contain the latest data of their corresponding data types. The main function of the subchain is to formulate different operating rules for different devices and application scenarios, such as transaction fees, verification processes, etc., to meet specific business needs and achieve low-latency and efficient operation without the parent chain.
[0165] The data in the child chain will be synchronized to the parent chain for backup, but the parent chain does not participate in the specific execution of the plan.
[0166] Through this process, the energy data collected by household energy devices has been successfully uploaded to the chain, thus ensuring the data’s immutability and transparency.
[0167] 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 a first identity authentication on the target energy device based on the first identity authentication request.
[0168] The target control mode is the operating mode of the target energy device; for example, electricity price priority mode, task priority mode, fine control mode, simple control mode, etc.; taking the smart drum washing machine as an example, in the electricity saving mode, the historical electricity price data in the blockchain is obtained to predict when the electricity price meets the requirements, so as to start when the electricity price is lower; in the task priority mode, the electricity price will not be considered and it will be started directly.
[0169] 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, for example, an energy system composed of a solar power generation system (including batteries), multiple electrical devices, and household switches.
[0170] The preset data interaction conditions are preset conditions for triggering the target energy device to obtain energy data. For example, when a smart drum washing machine is started, the power consumption data and historical electricity price data of the smart drum washing machine must be obtained to determine whether the operation strategy of the drum washing machine is immediate drive or delayed start (for example, starting at 10 pm when the electricity price is lower).
[0171] Pre-configure the preset data interaction conditions for each energy device in each control mode; the preset data interaction conditions in different control modes can be the same or different.
[0172] Pre-configure the data type of the data required by the energy device corresponding to each preset data interaction condition in each control mode. The data type corresponding to the same preset data interaction condition in different control modes of the energy device can be the same or different; the data type corresponding to different preset data interaction conditions in the same control mode of the energy device can be the same or different.
[0173] That is to say, the target control mode and the preset data interaction conditions under the target control mode jointly determine what type of data the energy device needs to obtain from the blockchain at this time.
[0174] For example, for an energy system consisting of a solar power generation system (including batteries), multiple electrical appliances, and household switches, in the fine control mode, when the preset data interaction condition of starting the drum washing machine is triggered, four energy data items need to be obtained, namely, the power consumption of the drum washing machine, historical electricity prices, solar power generation, and battery storage capacity. In the simple control mode, when the preset data interaction condition of starting the drum washing machine is triggered, only the historical electricity price data needs to be obtained.
[0175] 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 user needs, and this application does not describe this in detail.
[0176] The target energy device responds to the preset data interaction conditions that meet the target control mode, which means that the data on the blockchain needs to be shared. Before the IoT device interacts with the data, it needs to perform the first identity authentication through the identity authentication mechanism on the blockchain network.
[0177] Identity authentication can also be called identity verification.
[0178] Identity authentication plays a vital role in the data communication of home energy devices, ensuring the security and credibility of the communication. The blockchain-based identity authentication mechanism takes advantage of the immutability and security of blockchain to provide a reliable authentication method for home energy devices.
[0179] Please refer to Figure 3 , Figure 3 A flow chart of a method for performing a first identity authentication on a target energy device according to an embodiment of the present application is shown; the target energy device responds to the 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 a first identity authentication on the target energy device based on the first identity authentication request, including the following steps S301-S303:
[0180] S301, the target energy device responds to the preset data interaction condition that meets the target control mode, and initiates a first identity authentication request to the blockchain network; the first identity authentication request includes the first target identity information;
[0181] S302, the parent chain of the blockchain network verifies the legitimacy of the target energy device based on the matching result of the first target identity information and the pre-stored device identity information;
[0182] S303. If it is legal, 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;
[0183] S304. The parent chain of the blockchain network uses the public key of the target energy device to verify the validity of the result of the digital signature. If the signature is valid, the first identity authentication of the target energy device is successful.
[0184] It should be noted that the interaction between the home energy device 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.
[0185] The first target identity information is at least part of the device identity information that the home energy device needs to register with the blockchain network before accessing the network.
[0186] The principle of the first identity authentication is as follows: Before each household energy device accesses the network, it needs to register its identity information with the blockchain network. This information may include device ID, public key, certificate, etc. The registered identity information will be stored in the distributed ledger of the blockchain to ensure that all nodes can access and verify this information. When a household energy device sends data (such as a first identity authentication request), it will use its private key to digitally sign the data to prove that the source of the data is legal and trustworthy. The receiving party will use the public key of the sending party to verify the validity of the digital signature and can query the identity information on the blockchain to confirm the legitimacy of the device.
[0187] The following specifically describes the process by which a household energy device needs to perform the first identity authentication with the blockchain network:
[0188] The device initiates an authentication request: The household energy device sends an identity authentication request to the blockchain network for data exchange with other devices;
[0189] Verify identity information: The main chain of the blockchain network queries the identity information of the household energy device stored on the blockchain, such as device ID and public key, etc., and verifies its legitimacy;
[0190] Generate a challenge: The main chain of the blockchain network generates a random challenge and sends it to the household energy device;
[0191] The device responds to the challenge: The household energy device uses its private key to digitally sign the challenge and sends the signature result to the blockchain network;
[0192] Verify the signature: The main chain of the blockchain network uses the public key of the household energy device to verify the validity of the signature. If the signature is valid, the authentication is successful and the household energy device can start data exchange.
[0193] Through the above steps, the household energy device has successfully passed the identity authentication mechanism based on the blockchain, ensuring the security and credibility of data exchange.
[0194] 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 main 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.
[0195] When the first identity authentication is successful, the target energy device sends a data sharing request to request to share data in the blockchain network.
[0196] Specifically, energy devices can achieve secure data sharing through smart contracts, ensuring the security and legality of data. Data sharing is one of the important mechanisms for data exchange and cooperation among Internet of Things devices. Through smart contracts, devices can securely share data, ensuring the security and legality of data.
[0197] The principle of data sharing is as follows:
[0198] A smart contract is an automated contract executed on a blockchain, which contains predefined rules and conditions that can ensure the security and legality of data sharing.
[0199] Smart contracts can define which devices are authorized to access the shared data and under what conditions they can access the data. Only devices that meet these conditions can obtain the shared data.
[0200] During the data sharing process, 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.
[0201] Please refer to Figure 4 , Figure 4 , which shows the method flowchart of the target energy device generating a data sharing request for target type data based on the preset data interaction conditions of the target control mode; 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 main 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; including the following steps S401 - S403:
[0202] S401. The target energy device obtains the predefined attribute authentication information of the target energy device; the attribute authentication information is defined based on the attributes of the target energy device and corresponds to the identity authentication conditions;
[0203] 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, generate a data sharing request for target type data and send the data sharing request 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;
[0204] S403. The main 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 a second identity authentication on the target energy device.
[0205] 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, sends requests through the gateway in the home, is located at a fixed location, and for some home energy devices, the preset data interaction condition triggered is to reach the preset time, that is, this type of home energy device will only send data sharing requests at fixed time points.
[0206] Therefore, based on these specific attributes of the energy device, the identity authentication conditions in the smart contract can be configured, and the corresponding attribute authentication information can be predefined in the energy device in advance.
[0207] In this way, in addition to the second target identity information of the target device, the generated data sharing request also includes this specially defined attribute authentication information. The smart contract of the parent chain of the blockchain network verifies the attribute authentication information and the second target identity information based on the preconfigured identity authentication conditions. If both the attribute authentication information and the second target identity information meet the corresponding identity authentication conditions, the target energy device passes the verification and can share data.
[0208] In the embodiments of the present application, according to the specific attribute characteristics such as the fixed location of the home energy device and the fixed gateway, the identity authentication conditions for the specific attribute characteristics are configured in the smart contract of the parent chain, further ensuring the reliability of identity authentication.
[0209] Specifically, in the embodiments of the present application, when performing authentication in combination with the attribute authentication information, a scoring mechanism is used to verify to ensure the security of the device. After the score reaches the preset security score, the second identity authentication is successfully verified.
[0210] Specifically, in some embodiments, in the method for data communication of energy devices based on blockchain, the parent chain of the blockchain network verifies the attribute authentication information and the second target identity information based on the preconfigured identity authentication conditions, and performs a second identity authentication on the target energy device, including:
[0211] Determine the verification scores corresponding to the attribute authentication information at different levels; among them, the verification scores of the attribute authentication information at different levels are different, and the verification scores are determined based on the influence degree of this type of attribute authentication information on identity verification;
[0212] Based on the verification scores corresponding to the attribute authentication information at different levels, determine the total attribute verification score of the attribute authentication information;
[0213] Based on the comparison result between the total attribute verification score and the preset attribute security score threshold, and the second target identity information, perform a second identity authentication on the target energy device.
[0214] Exemplarily, the first level is the device type, 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 cities, provinces, etc., and the scores for different ranges of geographical attribution decrease in turn; the third level is the network attribute, where internal local area network > home network > public network, and the scores decrease in turn.
[0215] In the embodiment of the present application, the data sharing request is a request initiated by the target energy device to the smart contract of the blockchain network to request access to specific data; the data sharing request usually includes the second target identity information of the target energy device and the purpose of accessing the data.
[0216] 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, based on the data acquisition rules corresponding to the preset data interaction conditions of the target control mode configured in advance, a data sharing request for target type data is generated, and the data sharing request can determine the type and data content to be accessed.
[0217] In step 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 meets the access rules, and shares the target shared energy data with the target energy device.
[0218] In the embodiment of the present application, please refer to Figure 5 , Figure 5 shows the method flow chart of determining the target shared energy data that meets the access rules in the embodiment of the present 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, determines the target shared energy data that meets the access rules, including the following steps S501 - S503:
[0219] S501. The main 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;
[0220] S502. The smart contract in the sub-chain that matches the type of the target type data determines 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 based on the access rules for the target energy device;
[0221] S503. If both are met, the target shared energy data corresponding to the data sharing request is determined.
[0222] The smart contract of the sub-chain can define access rules, thereby defining which energy devices are authorized to access the data shared in the sub-chain and under what conditions the data can be accessed. Only the devices that meet these conditions can obtain the data shared in the sub-chain.
[0223] The target shared energy data can be real-time data, historical data, or other forms of data.
[0224] 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 sub-chain and under what conditions the data can be accessed.
[0225] The access rules include the permissions of the energy device for each type of data in the sub-chain and the corresponding preset access conditions.
[0226] Different types of data are stored in different sub-chains. The smart contract in each sub-chain determines whether the energy device has the permission to access the target type of data in the sub-chain 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 the sub-chain be obtained, thereby improving the management of energy data by storing different types of data in different sub-chains respectively, as well as the verification efficiency of the identity and permissions of energy devices by the smart contract.
[0227] Please refer to Figure 6 , Figure 6 shows the flowchart of the method for sharing the target shared energy data with the target energy device according to the embodiment of the present application; in the energy device data communication method based on the blockchain, sharing the target shared energy data with the target energy device includes the following steps S601 - S603:
[0228] S601. The smart contract in the sub-chain that matches the type of the target type of 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;
[0229] S602. If it is necessary, encrypt the target shared energy data based on a preset first encryption algorithm to obtain the encrypted target shared energy data, and upload the encrypted target shared energy data to the parent chain;
[0230] 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.
[0231] If the target shared energy data needs to be transmitted encrypted, the smart contract in the sub-chain encrypts the data and sends the encrypted target shared energy data to the target energy device. Only the device with the decryption key can decrypt the data, further ensuring data security.
[0232] In the embodiments of the present application, it is possible to determine 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.
[0233] The traceability information of the encrypted target shared energy data is the source and destination of the target shared energy data.
[0234] In this way, through the blockchain network, the source and destination of the data can be traced, ensuring the traceability and authenticity of the data, especially guaranteeing data security, privacy, and compliance.
[0235] The following is an example to illustrate the specific steps of data sharing when a home energy device needs to share the electricity data it has collected with other devices:
[0236] The target energy device requests data sharing: The target energy device sends a data sharing request to the smart contract of the parent chain, requesting access to the electricity data in order to share the data with other devices. Exemplarily, the target energy device is a smart home control system.
[0237] The smart contract verifies the request: After receiving the request, the smart contract of the parent chain first verifies the identity of the target energy device, and the smart contract of the sub-chain verifies the permission of the target energy device for the requested data. After confirming that the device is legal, continue with the next step.
[0238] Data encryption: If the electricity data needs to be encrypted, the smart contract uses an encryption algorithm to encrypt the electricity data and sends the encrypted data to the device.
[0239] Data sharing: The smart contract sends the encrypted electricity data to the home energy device according to predefined rules. These data can include real-time electricity usage or historical electricity statistics.
[0240] Data usage: After receiving the shared electricity data, the home energy device can process and utilize it according to its own needs. For example, the smart home control system can optimize energy utilization based on the electricity data to achieve intelligent energy management.
[0241] Through the data sharing mechanism of the smart contract, the home energy device can securely share data with other devices, achieving data security and legality, thereby improving the collaboration efficiency and data utilization value among IoT devices.
[0242] Implementing data sharing among household energy devices based on blockchain not only ensures the authenticity and integrity of data but also enables data traceability. The principle of data traceability is as follows:
[0243] Immutability of blockchain: Blockchain is a distributed database where data is linked together in the form of blocks, and each block contains the hash value of the previous block. This structure makes it impossible to tamper with or delete data once it is written into the blockchain.
[0244] Storage of data records: On the blockchain, all data transactions are recorded in blocks and are publicly transparent. This means that anyone can view the historical records of data transactions, thus enabling data traceability.
[0245] The following specifically describes the steps of data traceability.
[0246] Data recording: After household energy devices collect and process energy data, they record the energy data on the blockchain. Each data transaction is written into a new block and linked to the previous block.
[0247] Data verification: Once the data is recorded on the blockchain, other devices or users can verify the authenticity and integrity of the data. They can access the historical records of the data through the blockchain network and view the source and destination of the data.
[0248] Data tracing: Through the blockchain network, the source and destination of the data can be traced. That is, it is possible to view which device the data was generated from, what processing and transmission processes it has gone through, and where it finally reaches.
[0249] For example, household energy devices have collected electricity data over a period of time and recorded this data on the blockchain. The following are the specific steps of data traceability:
[0250] Data recording: Household energy devices record the collected electricity data on the blockchain, forming a new data transaction. This data transaction contains information such as the value of the electricity data and the timestamp, and is written into a new block.
[0251] 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 this transaction and its link relationship with the previous blocks to ensure that the data has not been tampered with.
[0252] Data tracing: Through the blockchain network, other devices or users can trace the source and destination of this data transaction, and thus can view which household energy device this transaction was initiated from, what processing and transmission processes it has gone through, and finally it is recorded on the blockchain.
[0253] Through data traceability, it is possible to ensure that the source and destination of the data collected by home energy devices are traceable, and to guarantee the authenticity and integrity of the data. This provides strong support for data security, privacy, and compliance, enhancing users' trust and reliability in IoT data.
[0254] In the energy device data communication method based on blockchain according to the embodiments of the present application, when energy devices perform data interaction, they directly initiate a first identity authentication request to the blockchain network for the first identity authentication, and then perform 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.
[0255] Secondly, when performing the second identity authentication based on the data sharing request sent by the target energy device, identity authentication is performed based on the network attributes unique to home energy devices, geographical location attributes, or time attributes determined by preset data interaction conditions of the target control mode, further ensuring the legal identity of the home energy devices sharing data.
[0256] Finally, when the present application performs data sharing, specific energy data is encrypted according to requirements, further ensuring the security of data sharing and taking into account the efficiency of data sharing.
[0257] It should be particularly noted that in the embodiments of the present application, different types of data are stored on different sub-chains, and for the target data type corresponding to the preset data interaction conditions of the target control mode, a data sharing request for the target type of data is generated; then, based on the smart contract of the sub-chain, it is detected whether the permission of the target energy device for the target type of data is legal, and only the target energy devices with legal permissions are allowed to share the target type of energy data. High-efficiency sharing of data and permission management during sharing are carried out at the granularity of data types, improving the fineness and flexibility during data sharing.
[0258] Based on the same inventive concept, in the embodiments of the present application, there is also provided a blockchain-based energy device data communication device corresponding to the blockchain-based energy device data communication method. Since the principle of solving problems by the device in the embodiments of the present application is similar to that of the above-mentioned blockchain-based energy device data communication method in the embodiments of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0259] Please refer to Figure 7 , Figure 7 which shows the structural schematic diagram of the blockchain-based energy device data communication device described in the embodiments of the present application; specifically, the device includes:
[0260] The acquisition module 701 is used to acquire energy data of energy devices registered in the blockchain network, and write the energy data into a subchain of the blockchain network based on the type of the energy data; different subchains store different types of energy data;
[0261] 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 condition that meets the target control mode, so that the parent chain of the blockchain network performs a first identity authentication on the target energy device based on the first identity authentication request;
[0262] The second authentication module 703 is used for, when the first identity authentication succeeds, the target energy device generates a data sharing request for the 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;
[0263] 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 sub-chain 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 complies with the access rules, and share the target shared energy data with the target energy device.
[0264] In some embodiments, in the energy device data communication device based on blockchain, the first authentication module, when the target energy device responds to the preset data interaction condition that satisfies the target control mode, initiates a first identity authentication request to the blockchain network, so that the parent chain of the blockchain network performs a first identity authentication on the target energy device based on the first identity authentication request, is specifically used to:
[0265] The target energy device responds to the preset data interaction condition that satisfies the target control mode, and initiates a first identity authentication request to the blockchain network; the first identity authentication request includes the first target identity information;
[0266] The parent chain of the blockchain network verifies the legitimacy of the target energy device based on the matching result of the first target identity information and the pre-stored device identity information;
[0267] If it is legal, 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;
[0268] The parent chain of the blockchain network uses the public key of the target energy device to verify the validity of the result of the digital signature. If the signature is valid, the first identity authentication of the target energy device is successful.
[0269] In some embodiments, in the blockchain-based energy device data communication device, when the second identity authentication module 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, it is specifically used for:
[0270] The target energy device obtains the predefined attribute authentication information of the target energy device; the attribute authentication information is defined based on the attributes of the target energy device and corresponds to the identity authentication conditions;
[0271] 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, generate a data sharing request for target type data and send the data sharing request 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;
[0272] 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 to perform a second identity authentication on the target energy device.
[0273] In some embodiments, in the blockchain-based energy device data communication device, when the second identity authentication module verifies the attribute authentication information and the second target identity information based on the pre-configured identity authentication conditions by the parent chain of the blockchain network to perform a second identity authentication on the target energy device, it is specifically used for:
[0274] Determine the verification scores corresponding to the attribute authentication information at different levels; where the verification scores of the attribute authentication information at different levels are different, and the verification scores are determined based on the influence degree of this type of attribute authentication information on identity verification;
[0275] Based on the verification scores corresponding to the attribute authentication information at different levels, determine the total attribute verification score of the attribute authentication information;
[0276] Based on the comparison result between the total attribute verification score and the preset attribute security score threshold, and the second target identity information, perform a second identity authentication on the target energy device.
[0277] In some embodiments, in the blockchain-based energy device data communication device, when the processing module processes a data sharing request for target type data based on the access rules for the target energy device in the smart contract in a sub-chain in the blockchain network that matches the type of the target type data, and determines target shared energy data that complies with the access rules, it is specifically configured to:
[0278] The main chain of the blockchain network sends the data sharing request for the target type data to a sub-chain that matches the type of the target type data;
[0279] 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;
[0280] If both are met, the target shared energy data corresponding to the data sharing request is determined.
[0281] In some embodiments, when the processing module in the blockchain-based energy device data communication device shares the target shared energy data with the target energy device, it is specifically configured to:
[0282] The smart contract in the sub-chain that matches the type of the target type data determines, based on the type of the target shared energy data and / or the type of the target energy device, whether the target shared energy data needs to be encrypted;
[0283] If it is necessary, the target shared energy data is encrypted based on a preset first encryption algorithm to obtain the encrypted target shared energy data, and the encrypted target shared energy data is uploaded to the main chain;
[0284] The main 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.
[0285] In some embodiments, in the blockchain-based energy device data communication device, the device further includes:
[0286] A registration module, configured to send a registration request to the blockchain network when an energy device is started before obtaining the energy data of the energy device registered in the blockchain network; the registration request includes device identity information;
[0287] The main chain of the blockchain network processes the device identity information to generate a first hash value of the device identity information;
[0288] The main chain of the blockchain network sends a verification request to the business server pre-storing device identity information to receive the second hash value generated by the business server processing the device identity information;
[0289] The main chain of the blockchain network verifies whether the first hash value and the second hash value are consistent;
[0290] If they are consistent, the main chain of the blockchain network determines that the energy device identity verification is successful, completes the registration of the energy device, and stores the device identity information of the energy device.
[0291] In some embodiments, in the blockchain-based energy device data communication device, when the obtaining module writes the energy data into the sub-chain of the blockchain network based on the type of the energy data, it is specifically used for:
[0292] Encrypt the energy data based on the second encryption algorithm to obtain the encrypted energy data;
[0293] Generate a data digest of the encrypted energy data;
[0294] Based on the type of the energy data, upload the encrypted energy data and the data digest to the sub-chain of the blockchain network.
[0295] Based on the same inventive concept, an electronic device corresponding to the blockchain-based energy device data communication method is further provided in an embodiment of the present application. Since the principle of solving problems by the electronic device in the embodiment of the present application is similar to that of the blockchain-based energy device data communication method in the above embodiment of the present application, the implementation of the electronic device can refer to the implementation of the method, and the repeated parts will not be described again.
[0296] Please refer to Figure 8 , Figure 8 shows a schematic structural diagram of the electronic device described in the embodiment of the present 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 runs, the processor 802 communicates with the memory 801 through the bus, and when the machine-readable instructions are executed by the processor 802, the steps of the blockchain-based energy device data communication method are executed.
[0297] Based on the same inventive concept, a computer-readable storage medium corresponding to the blockchain-based energy device data communication method is further provided in an embodiment of the present application. Since the principle of solving problems by the computer-readable storage medium in the embodiment of the present application is similar to that of the blockchain-based energy device data communication method in the above embodiment of the present application, 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.
[0298] A computer-readable storage medium stores a computer program thereon. When the computer program is run by a processor, it executes the steps of the blockchain-based energy device data communication method described above.
[0299] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the systems and devices described above can refer to the corresponding processes in the method embodiments, and will not be elaborated herein. In the several embodiments provided in the present 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 the modules is only a logical function division, and there may be other division methods in actual implementation. For another example, 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 couplings or direct couplings or communication connections to each other can be through some communication interfaces. The indirect couplings or communication connections of the devices or modules can be in electrical, mechanical, or other forms.
[0300] The modules described as separate components may or may not be physically separated. The components shown as modules may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0301] In addition, in each embodiment of the present application, the functional units can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit.
[0302] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can 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 the present application. The aforementioned storage medium includes: USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical discs, etc., which can store program codes.
[0303] The above are only the specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present application can easily think of changes or substitutions, which should all be covered within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A blockchain-based energy equipment data communication method, characterized in that: The method comprises: Obtaining energy data of energy devices registered in the blockchain network, and writing the energy data into a subchain of the blockchain network based on the type of the energy data; wherein different subchains store different types of energy data; The target energy device responds to the 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 a first identity authentication on the target energy device based on the first identity authentication request; When the first identity authentication succeeds, the target energy device generates a data sharing request for the 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; When the second identity authentication succeeds, 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 meets the access rules, and shares the target shared energy data with the target energy device; The target energy device generates a data sharing request for target type data based on the preset data interaction condition 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 condition; including: The target energy device acquires predefined attribute authentication information of the target energy device; the attribute authentication information is defined based on the attribute of the target energy device and corresponds to the identity authentication condition; Based on the attribute authentication information, the second target identity information of the target energy 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; 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 a second identity authentication on the target energy device.
2. The energy equipment data communication method based on blockchain according to claim 1 is characterized in that: The target energy device responds to the 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 a 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 condition that satisfies the target control mode, and initiates a first identity authentication request to the blockchain network; the first identity authentication request includes the first target identity information; The parent chain of the blockchain network verifies the legitimacy of the target energy device based on the matching result of the first target identity information and the pre-stored device identity information; If it is legal, 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 result of the digital signature. If the signature is valid, the first identity authentication of the target energy device is successful.
3. The energy equipment data communication method based on blockchain according to claim 1 is characterized in that: 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 the second identity authentication on the target energy device, including: Determine verification scores corresponding to attribute authentication information at different levels; wherein the verification scores of attribute authentication information at different levels are different, and the verification scores are determined based on the degree of influence of the attribute authentication information on identity authentication; Determining a total attribute verification score of the attribute authentication information based on the verification scores corresponding to the attribute authentication information at different levels; Based on the comparison result of the attribute verification total score and the preset attribute security score threshold, as well as the second target identity information, a second identity authentication is performed on the target energy device.
4. The energy equipment data communication method based on blockchain according to claim 1 is characterized in that: 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 meets 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 matching the type of the target type data; The smart contract in the subchain matching the type of the target type data determines whether the target energy device has the authority to access the target type data and meets the preset access conditions for accessing the target type data based on the access rules for the target energy device; If all are met, the target shared energy data corresponding to the data sharing request is determined.
5. The energy equipment data communication method based on blockchain according to claim 4 is characterized in that: Sharing the target shared energy data to the target energy device includes: The smart contract in the subchain matching 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, encrypt the target shared energy data based on a preset first encryption algorithm to obtain the encrypted target shared energy data, and upload the encrypted target shared energy data 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.
6. The energy equipment data communication method based on blockchain according to claim 1 is characterized in that: Before obtaining the energy data of the energy equipment registered in the blockchain network, the method further includes: When the energy device is started, a registration request is initiated to the blockchain network; the registration request includes device identity information; The parent chain of the blockchain network processes the device identity information to generate a first hash value of the device identity information; The parent chain of the blockchain network sends a verification request to the business server that pre-stores the device identity information to receive a second hash value generated by the business server 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 are consistent, the parent chain of the blockchain network determines that the identity authentication of the energy device is successful, completes the registration of the energy device, and stores the device identity information of the energy device.
7. The energy equipment data communication method based on blockchain according to claim 1 is characterized in that: The step of writing the energy data into a subchain of the blockchain network based on the type of the energy data includes: Encrypting the energy data based on a second encryption algorithm to obtain encrypted energy data; generating a data summary of the encrypted energy data; Based on the type of the energy data, the encrypted energy data and the data summary are uploaded to a subchain of the blockchain network.
8. A blockchain-based energy equipment data processing device, characterized in that: The device comprises: An acquisition module, used to acquire energy data of energy devices registered in the blockchain network, and write the energy data into a subchain of the blockchain network based on the type of the energy data; wherein different subchains store different types of energy data; A 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 condition that meets the target control mode, so that the parent chain of the blockchain network performs a first identity authentication on the target energy device based on the first identity authentication request; A second authentication module, configured to, when the first identity authentication succeeds, generate a data sharing request for target type data based on the preset data interaction conditions of the target control mode by the target energy device, and send 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; A processing module, configured to, when the second identity authentication succeeds, process the data sharing request for the target type data in the blockchain network, based on the access rules for the target energy device in the smart contract, by the subchain matching the type of the target type data, determine the target shared energy data that complies with the access rules, and share the target shared energy data with the target energy device; The target energy device generates a data sharing request for target type data based on the preset data interaction condition 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 condition; including: The target energy device acquires predefined attribute authentication information of the target energy device; the attribute authentication information is defined based on the attribute of the target energy device and corresponds to the identity authentication condition; Based on the attribute authentication information, the second target identity information of the target energy 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; 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 a second identity authentication on the target energy device.
9. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory through 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 7 are performed.
Citation Information
Patent Citations
Building networking data management method based on block chain multi-chain and attribute encryption
CN115459901A
Network security access method and device, equipment and storage medium
CN118555120A