Blockchain-based power grid data management method and device, computer device, and readable storage medium
By using blockchain-based data partitioning and improved encryption algorithms in the power grid business system, the problem of inefficiency in the management of massive amounts of data in power companies has been solved, and efficient and secure data management has been achieved.
Patent Information
- Application Number
- CN202411742596.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2044-11-29
AI Technical Summary
Power companies face challenges in managing massive amounts of data, including data complexity and inefficiency. This is especially true in power grid business systems, where existing technologies struggle to effectively manage and accelerate data processing.
A blockchain-based power grid data management approach is adopted, which involves storing data in partitions according to geographical location, preprocessing the data on the partitioned blockchain nodes, and using improved encryption algorithms such as 2k base-2k, combined with fine-grained access control modes to improve data management efficiency and security.
It improves the management efficiency of power grid business system data, reduces the number of iterations, enhances the speed of data encryption operation, and ensures data security and authenticity through fine-grained access control.
Smart Images

Figure CN119691071B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of blockchain technology, and in particular, to a blockchain-based power grid data management method, apparatus, computer device, and readable storage medium. Background Art
[0002] With the development of power enterprise informatization, especially the rapid practice of power big data, the types and quantities of enterprise data have increased sharply, and the data environment faced by power enterprises has become increasingly complex; under the massive data, it is very important to manage it effectively. Summary of the Invention
[0003] Based on this, in view of the above technical problems, it is necessary to provide a blockchain-based power grid data management method, apparatus, computer device, and readable storage medium that can improve the data management efficiency of the power grid business system.
[0004] In a first aspect, this application provides a blockchain-based power grid data management method, and the method includes:
[0005] Obtain the data of the power grid business system, and partition the data according to the geographical location, so as to distribute the data under different partitions to different blockchain nodes;
[0006] Preprocess the data on the corresponding node, and merge the preprocessed data of the partitions;
[0007] Randomly select a prime number p, an integer g, and a positive integer x, where g is a primitive root of p, and 1 < g < p - 1, 1 < x < p - 1;
[0008] Convert the exponent x to binary, and calculate y = g ^ x mod p, take y as the public key and x as the private key; k mod p, take y as the public key and x as the private key; x mod p, take y as the public key and x as the private key;
[0009] Randomly select an integer r, and generate ciphertext pairs (c1, c2) in groups through the public key, and sign the ciphertext pairs with the private key to obtain an encrypted data packet, where 1 < r < p - 1, the length of the group is less than lbp and gcd(r, p - 1) = 1, c1 = g ^ r mod p, c2 = (m * y ^ r) mod p; [[ID=3…]]
[0010] Broadcast the encrypted data packet externally and initiate consensus;
[0011] After the consensus layer reaches a consensus, store the encrypted data packet in an off-chain database, and return the storage address of the encrypted data packet to the chain for storage.
[0012] In one embodiment, the step of preprocessing the data on the corresponding node includes:
[0013] Detect and process the abnormal data values in the data by using one or more algorithms of Z-score method, IQR method, boxplot method, and isolation forest, and eliminate the abnormal data;
[0014] For the data after eliminating the abnormal data, perform word segmentation, word frequency statistics, stop word removal, and word vectorization processing to determine the word segmentation result;
[0015] For the word segmentation result, use the Simhash algorithm to remove duplicates and noise;
[0016] For the data after removing duplicates and noise, perform data splicing and process the missing values in the spliced data;
[0017] Among them, the missing values of the power grid equipment operation data can be filled by using the mean or median algorithm, and the missing values of the asset management data can be supplemented based on the machine learning algorithm.
[0018] In one of the embodiments, the data of the power grid business system includes geographic location information, and the data is partitioned according to geographic location to distribute the data under different partitions to different blockchain nodes, including:
[0019] Randomly select K initial geographic location clustering centers, and calculate the distance from the geographic location information of each data to each initial geographic location clustering center;
[0020] According to the distance, the data is assigned to the cluster to which the nearest initial geographic location clustering center belongs, and the center of each cluster is recalculated until the clustering center no longer changes or the preset iteration number is reached;
[0021] According to the clustering result, the data of the power grid business system is divided into different geographic partitions according to the cluster to which it belongs, and is distributed to the nearest blockchain node in different partitions.
[0022] In one of the embodiments, the above method further includes:
[0023] If a data access request is received, the access permission and access rule agreed in advance based on the smart contract are verified by using the fine-grained access control mode;
[0024] If the attributes of the current access user meet the access permission and access rule, the verification is passed and the corresponding ciphertext is returned;
[0025] Based on the ciphertext, the data plaintext is exchanged to the blockchain service layer to obtain the data of the power grid business system stored on the blockchain;
[0026] If the attributes of the current access user do not meet the access permission and access rule, an alarm is given.
[0027] In a second aspect, a blockchain-based power grid data management device is provided, the device comprising:
[0028] a data partition processing module configured to obtain data of a power grid business system and partition the data according to geographical locations to distribute data in different partitions to different blockchain nodes;
[0029] a data processing and merging module configured to pre-process data on a corresponding node and merge partitioned and pre-processed data;
[0030] a parameter configuration module configured to randomly select a prime number p, an integer g and a positive integer x, wherein g is a primitive root of p and 1 < g < p-1 and 1 < x < p-1;
[0031] a key generation module configured to convert the exponent x into base 2, calculate y = g k mod p, and use y as a public key and x as a private key; x
[0032] a data encryption module configured to randomly select an integer r, generate a ciphertext pair (c1, c2) through the public key in a grouped manner, sign the ciphertext pair using the private key to obtain an encrypted data packet, wherein 1 < r < p-1, the length of the group is less than lbp and gcd(r, p-1) = 1, c1 = g' mod p and c2 = (myr) mod p;
[0033] an on-chain request module configured to broadcast the encrypted data packet and initiate consensus;
[0034] a storage and execution module configured to store the encrypted data packet in an off-chain database after the consensus layer reaches consensus and return the storage address of the encrypted data packet to the on-chain for storage.
[0035] In one embodiment, the data processing and merging module comprises:
[0036] a data cleaning unit configured to detect and process abnormal data values in the data using one or more algorithms such as the Z-score method, the IQR method, the boxplot method and the isolation forest, and eliminate abnormal data;
[0037] a word segmentation unit configured to perform word segmentation, word frequency statistics, stop word removal and word vectorization processing on the data after the abnormal data is eliminated to determine a word segmentation result;
[0038] a denoising and deduplication unit configured to use the Simhash algorithm to remove duplicates and denoise the word segmentation result;
[0039] The missing value processing unit is configured to splice the data after deduplication and denoising, and process the missing values in the spliced data.
[0040] The missing values of the power grid equipment operation data are filled by using a mean value or median value algorithm, and the missing values of the asset management data are supplemented based on a machine learning algorithm.
[0041] In one of the embodiments, the data of the power grid business system includes geographic location information, and the data partition processing module includes:
[0042] The cluster initialization unit is configured to randomly select K initial geographic location cluster centers, and calculate the distances from each data to the initial geographic location cluster centers;
[0043] The iteration execution unit is configured to assign the data to the cluster to which the nearest initial geographic location cluster center belongs according to the distances, and recalculate the center of each cluster until the cluster center no longer changes or the preset iteration number is reached.
[0044] The data distribution storage unit is configured to divide the data of the power grid business system into different geographic partitions according to the clusters to which the data belong, and distribute the data on the nearest blockchain nodes in different partitions according to the cluster results.
[0045] In one of the embodiments, the apparatus further includes:
[0046] The verification module is configured to verify the access request based on the access permission and the access rule agreed in advance by the smart contract using a fine-grained access control mode when the data access request is received.
[0047] The ciphertext pair acquisition module is configured to return the corresponding ciphertext pair when the verification is passed after verifying that the attributes of the current access user meet the access permission and the access rule.
[0048] The on-chain data acquisition module is configured to exchange data plaintext with the blockchain service layer based on the ciphertext pair to obtain the data of the power grid business system stored on the blockchain.
[0049] The exception alarm module is configured to alarm when the attributes of the current access user do not meet the access permission and the access rule.
[0050] In a third aspect, a computer device is provided, including a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0051] In a fourth aspect, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to implement the steps of the above method.
[0052] The power grid data management method fully considers the characteristics of the massive data processing scene of the power grid business system, stores the obtained data according to geographical positions, pre-processes the data on the partitioned blockchain nodes, improves the processing efficiency through parallel processing, and in the encryption process, uses an improved algorithm to reduce the length of the exponential sequence by converting it into base 2 k The power grid data management method fully considers the characteristics of the massive data processing scene of the power grid business system, stores the obtained data according to geographical positions, pre-processes the data on the partitioned blockchain nodes, improves the processing efficiency through parallel processing, and in the encryption process, uses an improved algorithm to reduce the length of the exponential sequence by converting it into base 2 BRIEF DESCRIPTION OF DRAWINGS
[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related art, the drawings needed to be used in the description of the embodiments of the present application or the related art will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other related drawings can also be obtained without creative labor.
[0054] Figure 1 A flowchart of a power grid data management method based on a blockchain in an embodiment;
[0055] Figure 2 A flowchart of a step of pre-processing data on a corresponding node in an embodiment;
[0056] Figure 3 A flowchart of a step of partitioning data according to geographical positions in an embodiment to distribute data under different partitions to different blockchain nodes;
[0057] Figure 4 A flowchart of a power grid data management method based on a blockchain in another embodiment;
[0058] Figure 5 A block diagram of a power grid data management device based on a blockchain in an embodiment;
[0059] Figure 6 An internal structure diagram of a computer device in an embodiment;
[0060] Figure 7 An internal structure diagram of a computer device in another embodiment. DETAILED DESCRIPTION
[0061] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in combination with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not to limit the present application.
[0062] In a first aspect, the present application provides a blockchain-based power grid data management method, as shown in the accompanying drawings, which comprises: Figure 1
[0063] S100, acquiring data of a power grid business system and partitioning the data according to geographical positions to distribute the data under different partitions to different blockchain nodes. The data of the power grid business system can include geographical position information, and the blockchain nodes are matched according to the geographical position information. The matching between the two can be based on clustering or a pre-set geographical position information-blockchain node mapping relationship table.
[0064] S200, preprocessing the data on the corresponding node on the corresponding node and merging the partitioned and preprocessed data. Distributing the data under different partitions to different blockchain nodes can reduce the computing power requirement of a single blockchain node and realize multi-node simultaneous operation. For the massive data characteristics of the power grid business system, the data preprocessing can be quickly performed. After preprocessing, the partitioned and preprocessed data can be merged to realize chaining. The merging can be data intercommunication between some blockchain nodes, or the data can be aggregated to the blockchain node with the largest remaining computing resource according to the size of the remaining computing resource from large to small.
[0065] S300, randomly selecting a prime number p, an integer g and a positive integer x, wherein g is a primitive root of p, and 1
[0066] S400, converting the exponent x into a 2 k binary number and calculating y=g x mod p, taking y as the public key and x as the private key. Converting the exponent x into a 2 k binary number is to express x in the form of base 2 k . The processing process can be as follows:
[0067] Initialize an empty list (or string) to store the result.
[0068] Calculate the remainder r=x mod 2 k . Wherein, mod represents the remainder of the left number divided by the right number.
[0069] Add r (possibly converted to the corresponding symbol or character if 2 k is the base) to the front of the result list (or string).
[0070] Update (x divided by 2 k 's integer part).
[0071] Stop when x becomes 0.
[0072] At each step, the remainder r ranges from 0 to 2 k -1. Eventually, the elements in the result list (or string) read from back to front are the representation of x in base 2 k .
[0073] Suppose k = 2 and x = 15. We want to convert x to base 4. 15 divided by 4 gives quotient 3 and remainder 3, record 3. 3 divided by 4 gives quotient 0 and remainder 3, record 3 (note that the quotient is 0, but there is still a remainder to record). The result is 33 (read from back to front), so 15 in base 2 k , k = 2 is 33.
[0074] S500, randomly select an integer r, and generate a ciphertext pair (c1, c2) through the public key in a grouped manner, sign the ciphertext pair by using the private key to obtain an encrypted data packet, wherein 1
[0075] S600, broadcast the encrypted data packet to the outside and initiate consensus. This process can specifically include encapsulating the encrypted data packet into a transaction request and sending it to the consensus node in the blockchain network. The consensus node with the right to generate a block receives the transaction request, and the consensus node verifies the received transaction request, including format verification, signature validity (private key verification) verification and the like, to ensure the legality and validity of the transaction, and the encrypted data packet corresponding to the transaction request that passes the verification is included in the new block. In this process, a consensus mechanism (such as PoW, PoS, PBFT, etc.) is used to reach a consensus on the new block among all network nodes.
[0076] S700, after the consensus layer reaches consensus, the encrypted data packet is stored in the off-chain database, and the storage address of the encrypted data packet is returned to the on-chain for storage.
[0077] The blockchain network usually has limited storage capacity, and the on-chain storage cost will increase significantly when the network scale expands. By storing a large amount of data in the off-chain database and only storing the storage address (such as a hash value or a reference link) on the chain, the storage space on the chain can be greatly saved, so that the blockchain network can focus on the storage and verification of the core data of the power grid business system, and is suitable for the massive data management needs of the power grid business system.
[0078] The traditional blockchain data encryption adopts power residue calculation, which consumes too much time and causes low algorithm running efficiency. The embodiment of the present application provides a power grid data management method based on a blockchain, which fully considers the characteristics of the massive data processing scenario of the power grid business system, stores the obtained data according to geographical location, and pre-processes on the partitioned blockchain node, improves the processing efficiency through parallel processing, and in the encryption process, an improved algorithm is adopted, which converts the index 2 k to decimal, reduces the length of the index sequence, thereby reducing the number of iterations and improving the data encryption running speed, and further improving the management efficiency of the data of the power grid business system based on the blockchain.
[0079] In one embodiment, the above method further comprises:
[0080] For the core data in the data of the power grid business system, on-chain storage is performed on the blockchain. For non-core data, off-chain database storage is performed as shown in Figure 1 , and its address is stored on the chain.
[0081] In one embodiment, as shown in Figure 2 , the step of pre-processing the data on the corresponding node on the corresponding node includes:
[0082] S201, using one or more algorithms of Z-score method, IQR method, box plot method, and isolated forest, detecting and processing the abnormal data values in the data, and eliminating the abnormal data.
[0083] The step of detecting and processing the abnormal data values in the data using the Z-score method includes:
[0084] The average value of each variable in the set formed by the data of the power grid business system is calculated, and the standard deviation of each variable is calculated.
[0085] For each data point in the dataset, its Z-score value is calculated using the Z-score formula. The Z-score formula is: Z = (X - Mean) / SD, where X is the value of the data point, Mean is the average value of the variable, and SD is the standard deviation of the variable.
[0086] According to the calculated Z-score value and the set threshold value (which can be configured based on the scene), the outliers in the dataset are identified.
[0087] Among them, the IQR method is used to detect and process the abnormal data values in the data, and the steps of eliminating abnormal data include:
[0088] Calculate Q1 (the first quartile): determine that 25% of the data points are less than or equal to this value, i.e. the data is arranged from small to large and located at the 25% position.
[0089] Calculate Q3 (the third quartile): determine that 75% of the data points are less than or equal to this value, i.e. the data is arranged from small to large and located at the 75% position.
[0090] IQR (interquartile range) is defined as the difference between Q3 and Q1, i.e. IQR = Q3 - Q1.
[0091] Calculate the lower and upper limits of the outliers:
[0092] Lower limit (lower bound): Q1 - k * IQR, upper limit (upper bound): Q3 + k * IQR, where k is a constant.
[0093] Use the calculated lower and upper limits of the outliers to scan the data of the power grid business coefficient, find all data points less than the lower limit or greater than the upper limit, mark these data points as outliers and eliminate them.
[0094] S202, for the data after eliminating abnormal data, perform word segmentation, word frequency statistics, stop word removal and word vectorization processing to determine the word segmentation result.
[0095] jieba, HanLP, pkuseg, and other word segmentation tools, space segmentation, or NLTK tokenizer are used to load the corresponding library or module to perform word segmentation on the English and Chinese in the data of the power grid business system. The word segmentation results are stored as a list or other data structure for subsequent processing. The word list obtained after word segmentation is traversed, and a dictionary is used to record each word and its frequency. Each time a word is encountered, its count is updated in the dictionary, the word frequency is sorted, and the word with the highest frequency and its frequency are output. Stop words are those that appear frequently in text but do not contribute substantially, such as "of", "was", "in", etc. Removing stop words can improve the efficiency and effectiveness of data text processing. Word2Vec or GloVe unsupervised learning models are used to train word vector models on a large amount of power grid business system data. Based on the trained word vector model, the vector representation of each word is obtained, and the obtained word vector is used for subsequent NLP tasks such as text classification. The word segmentation results include the results produced by each part of the processing process in the above steps.
[0096] S203, for the word segmentation results, use Simhash algorithm to remove duplicates and noise. Based on the word segmentation and word frequency statistics, the weight of each word in the text is obtained, and representative words are selected as features from the word segmentation results. It can be the top N words with the highest frequency, or it can be words after certain filtering (such as removing stop words, keeping words with the part of speech as nouns or verbs, etc.). Assign a weight to each selected feature word, which can be its word frequency or TF-IDF value. For each feature word, select one or more hash functions to map the word to a hash bucket, and generate a Simhash value for each document according to the weight of the feature word and the output of the hash function. This usually involves weighted summation of the values in each hash bucket (the weight is the weight of the corresponding feature word), and the value (0 or 1) of the Simhash value at that bit is determined according to the positive or negative of the final sum. The Hamming distance is used to calculate the similarity between the Simhash values of two data. The smaller the Hamming distance, the more similar the two data. By setting a threshold, when the Hamming distance of two data is less than the threshold, they are considered to be duplicates and only one of them is kept. Those documents that are not similar to most documents are considered as noise (may be outliers or error data), and are filtered accordingly.
[0097] S204, for the data after deduplication and denoising, perform data splicing and handle missing values in the spliced data; for missing values of power grid equipment operation data, use mean or median algorithm to fill, for missing values of asset management data, use machine learning algorithm to supplement.
[0098] Data preprocessing and labeling is a very important step before data chaining, which aims to ensure the accuracy, integrity and consistency of data. The method provided by the embodiment of the application can ensure the efficiency and clarity of data cleaning by performing the data preprocessing in the above steps, i.e., first removing abnormal data, then performing deduplication and denoising based on word segmentation, reducing the data volume, and performing missing value processing based on the spliced data.
[0099] In one of the embodiments, the data of the power grid business system includes geographic location information, as shown in the following table, and the data is partitioned according to the geographic location to distribute the data in different partitions to different blockchain nodes, including: Figure 3
[0100] S301, randomly select K initial geographic location clustering centers, and calculate the distance from each data corresponding geographic location information to each initial geographic location clustering center. First, the elbow rule, contour coefficient method, etc. can be used to determine the number of clusters K. From all the geographic location data, randomly select K different data points as initial clustering centers, which can be any geographic location data, such as latitude and longitude coordinates.
[0101] S302, according to the distance, the data is assigned to the cluster to which the nearest initial geographic location clustering center belongs, and the center of each cluster is recalculated until the clustering center no longer changes or the preset iteration number is reached. The calculation of this distance can use the Haversine distance, which takes into account the influence of the curvature of the earth, and has higher accuracy. Assuming that there are two geographic location points A (lat1, lon1) and B (lat2, lon2), and a clustering center C (lat_c, lon_c), the Haversine distance d of point A to clustering center C can be calculated by the following formula (here the processing is simplified, in actual calculation it may involve more complex trigonometric function operation):
[0102]
[0103] Where r is the radius of the earth, Δlat = lat2−lat1, Δlon = lon2−lon1 (for the distance from A to C, replace lat2, lon2 with lat_c, lon_c). According to the calculated distance, each data point is assigned to the cluster to which the nearest clustering center belongs.
[0104] S303, according to the clustering result, the data of the power grid business system is divided into different geographic partitions according to the cluster to which it belongs, and is distributed to the nearest blockchain node in different partitions.
[0105] For example, assuming there is a city power grid business system data, including the power consumption of each area and the corresponding latitude and longitude coordinates. If there are 5 servers as blockchain nodes, when using K-Means clustering, K=5 can be set, and after clustering, 5 clusters are obtained. Each cluster represents a geographical division, so the city can be divided into 5 regions according to geographical location, and the partitioned data is processed in parallel on the 5 servers to speed up the data chaining speed.
[0106] The power grid data management method based on the blockchain provided by the embodiments of the present application divides data based on clustering, adopts a distributed data processing mode, can support parallel processing of data of the power grid business system, improves data processing efficiency, and further improves the efficiency of blockchain management of massive data.
[0107] In one of the embodiments, as shown in Figure 4 The power grid data management method based on the blockchain further includes:
[0108] S401, if a data access request is received, the access permission and access rule agreed in advance by the smart contract are verified based on the fine-grained access control mode. Based on the verifiable query of data A in the fine-grained access control mode, the result returned by the query includes three cases: there is a record matching A in the database, and the user can access the record (i.e., the user meets the access policy of the record), there is a matching record in the database, but the user has no access right (the user does not meet the access policy of the record), and there is no record matching A.
[0109] S402, if the attributes of the current access user meet the access permission and access rule, the verification is passed and the corresponding ciphertext is returned.
[0110] S403, based on the ciphertext, the data plaintext is exchanged with the blockchain service layer to obtain the data of the power grid business system stored on the blockchain.
[0111] S404, if the attributes of the current access user do not meet the access permission and access rule, an alarm is given.
[0112] In the verification process using the fine-grained access control mode, if there is a record in the database that matches the data access request, and the user can access the record, it is considered that the attributes of the current access user meet the access permission and access rule, otherwise, it is considered that the attributes of the current access user do not meet the access permission and access rule.
[0113] The power grid data management method based on the blockchain provided by the embodiments of the present application improves the security in the data access process by verifying the data access request by using the fine-grained access control mode. Only when there is a record in the database that matches the data to be accessed and the user can access the record, the verification is passed.
[0114] The power grid data management method based on the blockchain provided by the embodiments of the present application improves the security in the data access process by verifying the data access request by using the fine-grained access control mode. Only when there is a record in the database that matches the data to be accessed and the user can access the record, the verification is passed.
[0115] It should be understood that, although each step in the flowchart involved in each embodiment as described above is displayed in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, at least part of the steps in the flowchart involved in each embodiment as described above can include multiple steps or stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence of these steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least part of other steps or steps or stages in other steps.
[0116] Based on the same inventive concept, the embodiments of the present application also provide a blockchain-based power grid data management device for implementing the above-mentioned power grid data management method based on the blockchain. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so the specific limitations in one or more power grid data management device embodiments based on the blockchain provided below can refer to the limitations of the power grid data management method based on the blockchain in the above text, and will not be repeated here.
[0117] In one exemplary embodiment, as shown in Figure 5 A blockchain-based power grid data management device is provided, including: a data partition processing module 100, a data processing merging module 200, a parameter configuration module 300, a key generation module 400, a data encryption module 500, an on-chain request module 600, and a storage execution module 700.
[0118] The data partition processing module is configured to obtain data of a power grid business system, and partition the data according to geographical positions to distribute data under different partitions to different blockchain nodes.
[0119] The data processing and merging module is configured to pre-process data on the corresponding node and merge the pre-processed data of the partition;
[0120] The parameter configuration module is configured to randomly select a prime number p, an integer g and a positive integer x, wherein g is a primitive root of p, and 1 < g < p-1 and 1 < x < p-1;
[0121] The key generation module is configured to convert the exponent x into base 2 k and calculate y = g x mod p, wherein y is used as a public key and x is used as a private key;
[0122] The data encryption module is configured to randomly select an integer r, and generate a ciphertext pair (c1, c2) through the public key in a grouped manner, and sign the ciphertext pair by using the private key to obtain an encrypted data packet, wherein 1 < r < p-1, the length of the group is less than lbp and gcd(r, p-1) = 1, c1 = g' mod p and c2 = (myr) mod p;
[0123] The on-chain request module is configured to broadcast the encrypted data packet and initiate consensus;
[0124] The storage execution module is configured to store the encrypted data packet in an off-chain database after the consensus layer reaches consensus, and return the storage address of the encrypted data packet to the on-chain for storage.
[0125] In one embodiment, the data processing and merging module comprises:
[0126] The data cleaning unit is configured to detect and process abnormal data values in the data by using one or more algorithms of Z-score method, IQR method, box plot method and isolation forest, and eliminate abnormal data;
[0127] The word segmentation unit is configured to perform word segmentation, word frequency statistics, stop word removal and word vectorization processing on the data after the abnormal data is eliminated, and determine a word segmentation result;
[0128] The denoising and deduplication unit is configured to perform deduplication and denoising on the word segmentation result by using a Simhash algorithm;
[0129] The missing value processing unit is configured to splice the data after the deduplication and denoising, and process missing values in the spliced data;
[0130] The missing values of the power grid equipment operation data can be filled by using a mean or median algorithm, and the missing values of the asset management data can be supplemented based on a machine learning algorithm.
[0131] In one of the embodiments, the data of the power grid business system comprises geographical location information, the data partition processing module comprises:
[0132] a cluster initialization unit configured to randomly select K initial geographical location cluster centers and calculate the distance from the geographical location information corresponding to each data to each initial geographical location cluster center;
[0133] an iteration execution unit configured to assign the data to the cluster to which the nearest initial geographical location cluster center belongs according to the distance and recalculate the center of each cluster until the cluster center no longer changes or the preset iteration number is reached;
[0134] a data distribution storage unit configured to divide the data of the power grid business system into different geographical partitions according to the cluster result and distribute the data on the nearest blockchain node in each partition.
[0135] In one of the embodiments, the device further comprises:
[0136] a verification module configured to verify based on the access permission and access rule agreed in advance by the smart contract using the fine-grained access control mode when receiving the data access request;
[0137] a ciphertext pair acquisition module configured to return the corresponding ciphertext pair when the attribute of the current access user satisfies the access permission and access rule and the verification is passed;
[0138] an on-chain data acquisition module configured to exchange data plaintext with the blockchain service layer based on the ciphertext pair to acquire the data of the power grid business system stored on the blockchain;
[0139] an exception alarm module configured to alarm when the attribute of the current access user does not satisfy the access permission and access rule.
[0140] Each module in the above-mentioned power grid data management device based on the blockchain can be realized by software, hardware and their combinations in whole or in part. The above-mentioned modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so as to be called and executed by the processor to perform the operations corresponding to each module.
[0141] In one exemplary embodiment, a computer device, which can be a server, is provided, and the internal structure diagram thereof can be as shown in Figure 6As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores encrypted pairs, private keys, public keys, encrypted data packets, and other data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a blockchain-based power grid data management method.
[0142] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 7 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a blockchain-based power grid data management method.
[0143] Those skilled in the art will understand that Figures 6-7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0144] In an exemplary embodiment, a computer device is provided, comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the above blockchain-based power grid data management method when executing the computer program.
[0145] In an exemplary embodiment, a computer device is provided, comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the above blockchain-based power grid data management method when executing the computer program.
[0146] In an exemplary embodiment, a computer device is provided, comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the above blockchain-based power grid data management method when executing the computer program.
[0147] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer readable storage medium, and when executed, can include the processes of the above-mentioned embodiment methods. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. The non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. The volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration but not limitation, the RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a central processing unit, a graphics processing unit, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., without being limited thereto.
[0148] The technical features of the above embodiments can be combined in any manner. To make the description concise, not all possible combinations of the technical features in the above embodiments are described, but as long as the combinations of the technical features do not exist contradictions, they should be considered as the scope of the present application.
[0149] The above-described embodiments are merely illustrative of several embodiments of the present application, and the description is relatively specific and detailed, but should not be understood as a limitation on the scope of the patent. It should be noted that for those skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the scope of the present application. Therefore, the scope of protection of the present application should be subject to the appended claims.
Claims
1. A blockchain-based power grid data management method, characterized in that, The method includes: Obtaining data from the power grid business system, and partitioning the data according to geographical locations, so as to distribute the data under different partitions to different blockchain nodes; Preprocessing the data on the corresponding node, and merging the preprocessed data after partitioning; Randomly selecting a prime number p, an integer g, and a positive integer x, where g is a primitive root of p, and 1 < g < p - 1, 1 < x < p - 1; Divide the exponent x by 2 k Convert to base 2 and calculate y=g x mod p, where y is the public key and x is the private key; Randomly selecting an integer r, and generating a ciphertext pair (c1, c2) in groups through a public key, and signing the ciphertext pair with a private key to obtain an encrypted data packet, where 1 < r < p - 1, the length of the group is less than lbp and gcd(r, p - 1) = 1, c1 = g’ mod p, c2 = (myr) mod p; where gcd(r, p - 1) = 1 means that the greatest common divisor of the integer r and p - 1 is 1, g′ mod p means the remainder obtained by dividing the integer g′ by p, and (myr) mod p means the remainder obtained by dividing myr by p; Broadcasting the encrypted data packet externally to initiate consensus; After the consensus layer reaches a consensus, storing the encrypted data packet in an off-chain database, and returning the storage address of the encrypted data packet to the chain for storage; The step of preprocessing the data on the corresponding node includes: Using one or more algorithms such as the Z-score method, IQR method, box plot method, and isolation forest to detect and process abnormal data values in the data, and removing abnormal data; For the data after removing abnormal data, performing word segmentation, word frequency statistics, stop word removal, and word vectorization processing to determine the word segmentation result; For the word segmentation result, using the Simhash algorithm to perform deduplication and denoising; Performing data splicing on the data after deduplication and denoising, and processing the missing values in the spliced data; Among them, the missing values of the power grid equipment operation data can be filled using the mean or median algorithm, and the missing values of the asset management data are supplemented based on machine learning algorithms.
2. The method according to claim 1, characterized in that, The data of the power grid business system includes geographical location information. The step of partitioning the data according to geographical locations so as to distribute the data under different partitions to different blockchain nodes includes: Randomly selecting K initial geographical location clustering centers, and calculating the distances from the geographical location information corresponding to each data to each initial geographical location clustering center; According to the distances, allocating the data to the cluster where the nearest initial geographical location clustering center belongs, and recalculating the center of each cluster until the clustering center no longer changes or reaches a preset number of iterations; According to the clustering result, dividing the data of the power grid business system into different geographical partitions according to the clusters to which they belong, and distributing them to the blockchain nodes closest to the different partitions.
3. The method according to claim 1, characterized in that, The method further includes: If a data access request is received, based on the access permissions and access rules agreed in advance by the smart contract, using a fine-grained access control mode for verification; If it is verified that the attributes of the currently accessing user meet the access permissions and access rules, the verification passes and the corresponding ciphertext is returned; Exchange the data plaintext with the blockchain service layer based on the ciphertext to obtain the data of the power grid business system stored on the blockchain; If it is verified that the attributes of the currently accessing user do not meet the access permissions and access rules, an alarm is issued.
4. A blockchain-based power grid data management device, characterized in that, The device includes: A data partitioning processing module, configured to obtain the data of the power grid business system, and partition the data according to geographical locations, so as to distribute the data under different partitions to different blockchain nodes; A data processing and merging module, configured to preprocess the data on the corresponding node, and merge the preprocessed data after partitioning; A parameter configuration module, configured to randomly select a prime number p, an integer g, and a positive integer x, where g is a primitive root of p, and 1 < g < p - 1, 1 < x < p - 1; The key generation module is used to perform 2-factor operations on the exponent x. k Convert to base 2 and calculate y=g x mod p, where y is the public key and x is the private key; A data encryption module, configured to randomly select an integer r, and generate a ciphertext pair (c1, c2) in groups through a public key, and sign the ciphertext pair with a private key to obtain an encrypted data packet, where 1 < r < p - 1, the length of the group is less than lbp and gcd(r, p - 1) = 1, c1 = g’ mod p, c2 = (myr) mod p; where gcd(r, p - 1) = 1 represents that the greatest common divisor of the integer r and p - 1 is 1, g′ mod p represents the remainder obtained by dividing the integer g′ by p, and (myr) mod p represents the remainder obtained by dividing myr by p; An on-chain request module, configured to broadcast the encrypted data packet externally and initiate consensus; A storage execution module, configured to store the encrypted data packet in an off-chain database after the consensus layer reaches consensus, and return the storage address of the encrypted data packet to the chain for storage; The data processing and merging module includes: A data cleaning unit, configured to detect and process abnormal data values in the data by using one or more algorithms of the Z-score method, the IQR method, the box plot method, and the isolation forest, and剔除异常数据; A word segmentation unit, configured to perform word segmentation, word frequency statistics, stop word removal, and word vectorization processing on the data after abnormal data is剔除异常数据, and determine the word segmentation result; A denoising and duplicate removal unit, configured to perform duplicate removal and denoising on the word segmentation result by using the Simhash algorithm; A missing value processing unit, configured to splice the data after duplicate removal and denoising, and process the missing values existing in the spliced data; Among them, the missing values of the power grid equipment operation data can be filled by using the mean or median algorithm, and the missing values of the asset management data are supplemented based on the machine learning algorithm.
5. The apparatus according to claim 4, characterized in that, The data of the power grid business system includes geographical location information, and the data partitioning processing module includes: A clustering initialization unit, configured to randomly select K initial geographical location clustering centers, and calculate the distances from the geographical location information corresponding to each data to each initial geographical location clustering center; The iterative execution unit is used to allocate the data to the cluster to which the nearest initial geographical location cluster center belongs based on distance, and recalculate the center of each cluster until the cluster center no longer changes or the preset number of iterations is reached; The data distribution storage unit is used to divide the data of the power grid business system into different geographical partitions according to the clusters they belong to, and distribute them on the blockchain nodes that are closest to each partition.
6. The apparatus according to claim 4, characterized in that, The device further includes: The verification module is used to verify data access requests in a fine-grained access control mode based on the access permissions and access rules agreed upon in advance by the smart contract. The ciphertext pair acquisition module is used to verify that the attributes of the current accessing user meet the access permissions and access rules, and return the corresponding ciphertext pair upon successful verification. The on-chain data acquisition module is used to exchange plaintext data with the blockchain service layer based on ciphertext in order to obtain data from the power grid business system stored on the blockchain. The anomaly alarm module is used to issue an alarm when the attributes of the currently accessing user do not meet the access permissions and access rules.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 3.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Information sharing and secure multi-party computing model based on block chain
CN109388960A
Block chain covert communication method based on generative steganography network and image double steganography
CN116527278A