Intelligent electric meter data credible acquisition method based on block chain
Through the smart meter data collection method based on the blockchain, hash values and smart contracts are used for data verification, which solves the tampering problem in the trusted collection of meter data, improves the credibility of the data, and achieves rapid warnings.
Patent Information
- Application Number
- CN202410746143.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2024-08-30
AI Technical Summary
There are few studies on trustworthy collection of meter data in the existing technology, and it is difficult to effectively avoid the problem of data being tampered with midway.
Adopt a trustworthy collection method of smart meter data based on blockchain, randomly generate secret keys and public keys, calculate the hash value of electric energy information, encrypt and decrypt it, use smart contracts for data verification, improve the credibility of the data, and Issue alerts when data is abnormal.
It realizes automatic analysis of data reliability, improves the credibility of data, and quickly issues warnings when data is abnormal, solving the problem of data being tampered with midway.
Smart Images

Figure CN118573379A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of blockchain, and in particular to a blockchain-based smart meter data trustworthy collection method. Background Art
[0002] As a new technology, blockchain technology is widely used in the fields of Internet of Things, finance, etc. The encrypted information transmission technology it provides greatly reduces the risk of tampering during data transmission. Existing technologies have provided a variety of information transmission technologies based on blockchain. Electricity use is a daily behavior of the public, and its electrical data is extremely large and complex, involving even greater funds, so it is crucial to avoid malicious electricity theft.
[0003] However, there is still little research on the trusted collection of electricity meter data in the existing technology. Summary of the invention
[0004] In order to overcome the shortcomings of the prior art, the purpose of the present invention is to provide a trusted data collection method for smart meters based on blockchain. By synchronously uploading electric energy data packets and verification data packets, a hash value is obtained by decryption using a smart contract to automatically analyze the reliability of the data, thereby improving the credibility of the data and quickly issuing an alarm when the data is abnormal.
[0005] To achieve the above object, the present invention provides the following solutions:
[0006] A blockchain-based smart meter data trusted collection method, applied to a blockchain network, includes:
[0007] Randomly generate a first secret key, a first public key, a second secret key, and a second public key;
[0008] Collecting a predetermined amount of electric energy information;
[0009] Calculate the hash value of each electric energy information using a fifth-generation message digest algorithm;
[0010] Using the first secret key, encrypt each of the electric energy information, basic information corresponding to the electric energy information, and the electric energy information hash value to obtain a predetermined number of electric energy encrypted data packets; the basic information includes: collection time and electric meter ID;
[0011] Sending all the electric energy encrypted data packets and the first public key to a preset server in sequence according to the collection time;
[0012] Integrate all the power information hash values and the basic information corresponding to the power information hash values and encrypt them using the second secret key to obtain a verification encrypted data packet;
[0013] Sending the verification encrypted data packet and the second public key to the server;
[0014] Decrypting all the electric energy encrypted data packets using the first public key through a preset contract program to obtain all the electric energy information and the basic information corresponding to the electric energy information and the electric energy information hash value;
[0015] Decrypting the verification encrypted data packet using the second public key through a preset contract program to obtain the basic information and the electric energy information hash value corresponding to the basic information;
[0016] Based on the preset contract program and the basic information, the hash values of the electric energy information obtained by decrypting the electric energy encrypted data packet and the verification encrypted data packet are compared to obtain a comparison result; the comparison result includes: data credibility and data anomaly.
[0017] Preferably, randomly generating the first secret key, the first public key, the second secret key and the second public key comprises:
[0018] Generate a first prime number and a second prime number that have been tested for Fermat primality based on a large integer algorithm;
[0019] Calculate a modulus and an Euler function based on the first prime number and the second prime number;
[0020] Based on the calculation result of the Euler function, a public key exponent and a secret key exponent are determined to obtain the first public key and the first secret key; the first public key includes the modulus and the public key exponent; the first secret key includes the modulus and the secret key exponent.
[0021] Preferably, collecting a predetermined amount of electric energy information includes:
[0022] Using a preset smart meter to collect voltage data and current data of the target line;
[0023] Calculating active power, reactive power, apparent power, voltage frequency and power consumption data of the target line based on the voltage data and current data;
[0024] The voltage data, the current data, the active power, the reactive power, the apparent power, the voltage frequency and the power consumption data are integrated into the power information.
[0025] Preferably, the fifth generation message digest algorithm is used to calculate the power information hash value of each of the power information, including:
[0026] Filling the electric energy information to obtain standard input;
[0027] Performing file grouping on the standard input to obtain at least one data group;
[0028] All the data groups are calculated based on a preset function set to obtain the electric energy information hash value; the preset function set includes a round function and at least one nonlinear function.
[0029] Preferably, all the electric energy encrypted data packets are decrypted using the first public key through a preset contract program to obtain all the electric energy information and the basic information corresponding to the electric energy information and the electric energy information hash value, including:
[0030] Decrypting the electric energy encrypted data packet using the first public key to obtain the electric energy information, the basic information and the electric energy information hash value;
[0031] Calculating the electric energy information using a fifth-generation message digest algorithm to obtain summary data;
[0032] Determine whether the power information hash value is consistent with the summary data; if they are consistent, store the power information, the basic information and the power information hash value in a preset memory of the server; if they are inconsistent, generate an abnormal event log.
[0033] Preferably, the power information hash value obtained by decrypting the power encrypted data packet and the verification encrypted data packet is compared based on the preset contract program and the basic information to obtain a comparison result, including:
[0034] Match the basic information of the power encrypted data packet and the verification encrypted data packet after decryption;
[0035] Determine the hash value of the electric energy information corresponding to the basic information in the decrypted data of the verification encrypted data packet as verification data;
[0036] Determine whether the hash value of the electric energy information corresponding to the basic information in the verification data and the decrypted data of the electric energy encrypted data packet is consistent. If they are consistent, determine that the comparison result is that the data is credible; if they are inconsistent, determine that the comparison result is that the data is abnormal.
[0037] Preferably, the operating platform of the blockchain network is the Hyperledger Fabric platform.
[0038] Preferably, the preset memory is a redundant disk array that is backed up regularly.
[0039] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0040] The present invention provides a trusted data collection method for smart meters based on blockchain. By synchronously uploading electric energy data packets and verification data packets, the reliability of the data is automatically analyzed using the hash value obtained by decryption of the smart contract, which solves the problem of data tampering in the middle, improves the credibility of the data, and realizes rapid warning when the data is abnormal. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0042] Figure 1 A trusted collection flow chart provided for an embodiment of the present invention. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0044] The purpose of the present invention is to provide a trusted data collection method for smart meters based on blockchain. By synchronously uploading electric energy data packets and verification data packets, a hash value is obtained by decryption using smart contracts to automatically analyze the reliability of the data, improve the credibility of the data, and quickly issue an alarm when the data is abnormal.
[0045] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0046] Figure 1 The trusted collection flow chart provided by the embodiment of the present invention is as follows: Figure 1 As shown, the present invention provides a blockchain-based smart meter data trusted collection method, which is applied to a blockchain network and includes:
[0047] Step 100, randomly generate a first secret key, a first public key, a second secret key, and a second public key;
[0048] Step 200, collecting a predetermined amount of electric energy information;
[0049] Step 300, using a fifth generation message digest algorithm to calculate the power information hash value of each of the power information;
[0050] Step 400, using the first secret key to encrypt each of the electric energy information and the basic information corresponding to the electric energy information and the hash value of the electric energy information, to obtain a predetermined number of electric energy encrypted data packets; the basic information includes: collection time and meter ID;
[0051] Step 500, sending all the electric energy encrypted data packets and the first public key to a preset server in sequence according to the collection time;
[0052] Step 600, integrating all the power information hash values and the basic information corresponding to the power information hash values and encrypting them with the second secret key to obtain a verification encrypted data packet;
[0053] Step 700, sending the verification encrypted data packet and the second public key to the server;
[0054] Step 800, decrypting all the electric energy encrypted data packets using the first public key through a preset contract program to obtain all the electric energy information and the basic information corresponding to the electric energy information and the electric energy information hash value;
[0055] Step 900, decrypting the verification encrypted data packet using the second public key through a preset contract program to obtain the basic information and the electric energy information hash value corresponding to the basic information;
[0056] Step 1000, based on the preset contract program and the basic information, compare the power information hash value obtained by decrypting the power encrypted data packet and the verification encrypted data packet to obtain a comparison result; the comparison result includes: data credibility and data anomaly.
[0057] Optionally, randomly generating a first secret key, a first public key, a second secret key, and a second public key includes:
[0058] Generate a first prime number and a second prime number that have been tested for Fermat primality based on a large integer algorithm;
[0059] Calculate a modulus and an Euler function based on the first prime number and the second prime number;
[0060] Based on the calculation result of the Euler function, a public key exponent and a secret key exponent are determined to obtain the first public key and the first secret key; the first public key includes the modulus and the public key exponent; the first secret key includes the modulus and the secret key exponent.
[0061] Specifically, collecting a predetermined amount of electric energy information includes:
[0062] Using a preset smart meter to collect voltage data and current data of the target line;
[0063] Calculating active power, reactive power, apparent power, voltage frequency and power consumption data of the target line based on the voltage data and current data;
[0064] The voltage data, the current data, the active power, the reactive power, the apparent power, the voltage frequency and the power consumption data are integrated into the power information.
[0065] Further, the fifth generation message digest algorithm is used to calculate the power information hash value of each of the power information, including:
[0066] Filling the electric energy information to obtain standard input;
[0067] Performing file grouping on the standard input to obtain at least one data group;
[0068] All the data groups are calculated based on a preset function set to obtain the electric energy information hash value; the preset function set includes a round function and at least one nonlinear function.
[0069] Specifically, all the electric energy encrypted data packets are decrypted using the first public key through a preset contract program to obtain all the electric energy information and the basic information corresponding to the electric energy information and the electric energy information hash value, including:
[0070] Decrypting the electric energy encrypted data packet using the first public key to obtain the electric energy information, the basic information and the electric energy information hash value;
[0071] Calculating the electric energy information using a fifth-generation message digest algorithm to obtain summary data;
[0072] Determine whether the power information hash value is consistent with the summary data; if they are consistent, store the power information, the basic information and the power information hash value in a preset memory of the server; if they are inconsistent, generate an abnormal event log.
[0073] Further, based on the preset contract program and the basic information, the power information hash value obtained by decrypting the power encrypted data packet and the verification encrypted data packet is compared to obtain a comparison result, including:
[0074] Match the basic information of the power encrypted data packet and the verification encrypted data packet after decryption;
[0075] Determine the hash value of the electrical energy information corresponding to the basic information in the decrypted data of the verified encrypted data packet as the verification data;
[0076] Determine whether the verification data is consistent with the hash value of the electrical energy information corresponding to the basic information in the decrypted data of the electrical energy encrypted data packet. If they are consistent, determine that the comparison result is that the data is trustworthy; if they are inconsistent, determine that the comparison result is that the data is abnormal.
[0077] Optionally, the operating platform of the blockchain network is the Hyperledger Fabric platform.
[0078] Specifically, the preset memory is a redundant disk array with regular backups.
[0079] Optionally, when the server detects data anomaly information, it will directly send the anomaly event log to the target maintenance personnel to facilitate early judgment of the event situation or rapid data maintenance.
[0080] Specifically, the RSA algorithm is used in this embodiment to generate the key pair, and the process is as follows:
[0081] Use the large integer algorithm to generate two different 1024-bit large prime numbers p and q, and perform the Fermat primality test after generation to ensure that the generated integers are prime numbers;
[0082] Calculate the modulus n = p * q and the Euler's totient function φ(n) = (p - 1)(q - 1);
[0083] Select an integer e that satisfies 1 < e < φ(n) and gcd(e, φ(n)) = 1 as the public key exponent e;
[0084] Select an integer d that satisfies d ≡ e^(-1) mod φ(n) as the private key exponent;
[0085] Finally, obtain the public key (n, e) and the private key (n, d).
[0086] Optionally, in order to reduce the pressure of data transmission in the blockchain network, after the smart meter collects electrical parameters once, it will first perform parameter calculations locally to obtain data such as voltage, current, and power, and store them in the register module of the smart meter. The smart meter performs data collection once a minute. When the stored data reaches 30 groups, the smart meter integrates these 30 groups of data and sends them to the server through the blockchain network.
[0087] Furthermore, the storage device used by the server in this embodiment adopts the sixth generation RAID redundant disk array, and distributed storage is performed when storing data to improve storage fault tolerance. In addition, in order to further improve data storage security, data loss retrieval is performed every 24 hours to compare the storage conditions of the same data on different storage hard disks. When the data storage condition of one of the hard disks is abnormal, the remaining normal data is used to overwrite and write;
[0088] Specifically, the operating voltage of the smart meter selected in this embodiment is 12±2V, and the average operating current is 100mA to 160mA, which meets the requirements of long-term low-power operation; it has a built-in arm linux blockchain service system and supports 4G network data transmission; in addition, a USB interface is also provided for program burning and modification.
[0089] The beneficial effects of the present invention are as follows:
[0090] The present invention synchronously uploads the power data packet and the verification data packet, and uses the hash value obtained by decryption of the smart contract to automatically analyze the reliability of the data, thereby improving the credibility of the data and being able to quickly issue an alarm when the data is abnormal.
[0091] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0092] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A blockchain-based smart meter data trustworthy collection method, characterized in that: Applied to blockchain networks, including: Randomly generate a first secret key, a first public key, a second secret key, and a second public key; Collecting a predetermined amount of electric energy information; Calculate the hash value of each electric energy information using a fifth-generation message digest algorithm; Using the first secret key, encrypt each of the electric energy information, basic information corresponding to the electric energy information, and the electric energy information hash value to obtain a predetermined number of electric energy encrypted data packets; the basic information includes: collection time and electric meter ID; Sending all the electric energy encrypted data packets and the first public key to a preset server in sequence according to the collection time; Integrate all the power information hash values and the basic information corresponding to the power information hash values and encrypt them using the second secret key to obtain a verification encrypted data packet; Sending the verification encrypted data packet and the second public key to the server; Decrypting all the electric energy encrypted data packets using the first public key through a preset contract program to obtain all the electric energy information and the basic information corresponding to the electric energy information and the electric energy information hash value; Decrypting the verification encrypted data packet using the second public key through a preset contract program to obtain the basic information and the electric energy information hash value corresponding to the basic information; Based on the preset contract program and the basic information, the hash values of the electric energy information obtained by decrypting the electric energy encrypted data packet and the verification encrypted data packet are compared to obtain a comparison result; the comparison result includes: data credibility and data anomaly.
2. According to a blockchain-based smart meter data trusted collection method according to claim 1, it is characterized in that: Randomly generate a first secret key, a first public key, a second secret key, and a second public key, including: Generate a first prime number and a second prime number that have been tested for Fermat primality based on a large integer algorithm; Calculate a modulus and an Euler function based on the first prime number and the second prime number; Based on the calculation result of the Euler function, a public key exponent and a secret key exponent are determined to obtain the first public key and the first secret key; the first public key includes the modulus and the public key exponent; the first secret key includes the modulus and the secret key exponent.
3. According to a blockchain-based smart meter data trusted collection method according to claim 1, it is characterized in that: Collecting a predetermined amount of electric energy information includes: Using a preset smart meter to collect voltage data and current data of the target line; Calculating active power, reactive power, apparent power, voltage frequency and power consumption data of the target line based on the voltage data and current data; The voltage data, the current data, the active power, the reactive power, the apparent power, the voltage frequency and the power consumption data are integrated into the power information.
4. According to a blockchain-based smart meter data trusted collection method according to claim 1, it is characterized in that: Calculating the power information hash value of each of the power information using the fifth generation message digest algorithm includes: Filling the electric energy information to obtain standard input; Performing file grouping on the standard input to obtain at least one data group; All the data groups are calculated based on a preset function set to obtain the electric energy information hash value; the preset function set includes a round function and at least one nonlinear function.
5. According to a blockchain-based smart meter data trusted collection method according to claim 1, it is characterized in that: Decrypting all the electric energy encrypted data packets using the first public key through a preset contract program to obtain all the electric energy information and the basic information corresponding to the electric energy information and the electric energy information hash value, including: Decrypting the electric energy encrypted data packet using the first public key to obtain the electric energy information, the basic information and the electric energy information hash value; Calculating the electric energy information using a fifth-generation message digest algorithm to obtain summary data; Determine whether the power information hash value is consistent with the summary data; if they are consistent, store the power information, the basic information and the power information hash value in a preset memory of the server; if they are inconsistent, generate an abnormal event log.
6. According to a blockchain-based smart meter data trusted collection method according to claim 1, it is characterized in that: The power information hash value obtained by decrypting the power encrypted data packet and the verification encrypted data packet is compared based on the preset contract program and the basic information to obtain a comparison result, including: Match the basic information of the power encrypted data packet and the verification encrypted data packet after decryption; Determine the hash value of the electric energy information corresponding to the basic information in the decrypted data of the verification encrypted data packet as verification data; Determine whether the hash value of the electric energy information corresponding to the basic information in the verification data and the decrypted data of the electric energy encrypted data packet is consistent. If they are consistent, determine that the comparison result is that the data is credible; if they are inconsistent, determine that the comparison result is that the data is abnormal.
7. According to a blockchain-based smart meter data trusted collection method according to claim 1, it is characterized in that: The operating platform of the blockchain network is the Hyperledger Fabric platform.
8. According to claim 5, a blockchain-based smart meter data trusted collection method is characterized in that: The preset storage is a redundant disk array that is backed up regularly.
