Block chain-based power grid data management method and device, computer equipment and readable storage medium

By adopting a blockchain-based power grid data management method in the power grid business system, the problem of inefficient data management is solved, efficient data partitioning, preprocessing and encryption are achieved, and data management efficiency and security are improved.

CN119691071AActive Publication Date: 2025-03-25GUIZHOU POWER GRID CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411742596.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-03-25
Estimated Expiration
2044-11-29

AI Technical Summary

Technical Problem

Power companies face a complex management environment with massive data, and existing technologies are difficult to effectively improve the data management efficiency of power grid business systems.

Method used

The blockchain-based power grid data management method is adopted, and the data of the power grid business system is obtained and partitioned according to geographical locations is distributed on different blockchain nodes for pre-processing and merging. Data deduplication and denoising are used with improved encryption algorithms and Simhash algorithms, combined with smart contracts and fine-grained access control mode for data access verification.

Benefits of technology

It improves the management efficiency of data in power grid business system, accelerates data encryption and processing through parallel processing and improvement of algorithms, reduces the number of iterations, reduces storage costs, and enhances the security and reliability of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119691071A_ABST
    Figure CN119691071A_ABST
Patent Text Reader

Abstract

The invention relates to a power grid data management method and device based on a block chain, computer equipment and a readable storage medium. The method comprises the following steps: firstly, acquiring data of a power grid service system, partitioning the data according to geographic positions, preprocessing the corresponding data on partitioned nodes, and merging the partitioned and preprocessed data; a prime number p, an integer g and a positive integer x are randomly selected, and g is the original root of p, 1lt; glt; p-1, 1lt; xlt; p-1; the index x is subjected to 2k system, y = gxmod p is calculated, y serves as a public key, and x serves as a private key; an integer r is randomly selected, a ciphertext pair (c1, c2) is generated through the public key in a grouping mode, the ciphertext pair is signed through the private key, and an encrypted data packet is obtained, rlt; the packet length is smaller than lbp, gcd (r, p-1) = 1, c1 = g 'mod p, and c2 = (myr) mod p, broadcasting the encrypted data packet to the outside and initiating a consensus, after a consensus layer reaches the consensus, storing the encrypted data packet in an under-chain database, and returning the storage address of the encrypted data packet to the chain for storage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of blockchain technology, and in particular, to a method, device, computer device, and readable storage medium for power grid data management based on blockchain. 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 method, device, computer device, and readable storage medium for power grid data management based on blockchain that can improve the data management efficiency of power grid business systems.

[0004] In a first aspect, this application provides a method for power grid data management based on blockchain, and the method includes:

[0005] Obtain the data of the power grid business system, and partition the data according to 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 x

[0006] 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;

[0009] Broadcast the encrypted data packet externally and initiate consensus;

[0010] 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.

[0011] In one of the embodiments, the step of preprocessing the data on the corresponding node includes:

[0012] In one of the embodiments, the step of preprocessing the data on the corresponding node includes:

[0013] Use one or more algorithms such as Z-score method, IQR method, box plot method, and isolation forest method to detect and process abnormal data values ​​in the data and eliminate abnormal data;

[0014] After removing abnormal data, perform word segmentation, word frequency statistics, stop word removal, and word vectorization to determine the word segmentation results;

[0015] For the word segmentation results, the Simhash algorithm is used to remove duplicates and noise;

[0016] After deduplication and denoising, perform data splicing and process the missing values ​​in the spliced ​​data;

[0017] Among them, the missing values ​​of power grid equipment operation data can be filled by the mean or median algorithm, and the missing values ​​of asset management data can be supplemented based on machine learning algorithms.

[0018] In one embodiment, the data of the power grid business system includes geographic location information, and the data is partitioned according to the geographic location to distribute the data in different partitions to different blockchain nodes, including:

[0019] Randomly select K initial geographic location cluster centers and calculate the distance from the geographic location information corresponding to each data to each initial geographic location cluster center;

[0020] According to the distance, the data is assigned to the cluster to which the cluster center of the nearest starting geographic location belongs, and the center of each cluster is recalculated until the cluster center no longer changes or the preset number of iterations is reached;

[0021] According to the clustering results, the data of the power grid business system is divided into different geographical partitions according to the clusters they belong to, and distributed on the blockchain nodes closest to different partitions.

[0022] In one embodiment, the method further comprises:

[0023] If a data access request is received, it will be verified using a fine-grained access control model based on the access rights and access rules agreed upon in advance by the smart contract;

[0024] If the attributes of the current access user meet the access rights and access rules, the verification is successful and the corresponding ciphertext is returned;

[0025] Exchange data plaintext to the blockchain service layer based on ciphertext 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 rights and access rules, an alarm will be issued.

[0027] In a second aspect, a power grid data management device based on a blockchain is provided. The device includes:

[0028] A data partition processing module, configured to obtain data from a power grid service system, partition the data according to geographical locations, so as to distribute the data under different partitions to different blockchain nodes;

[0029] A data processing and merging module, configured to preprocess the data on the corresponding node and merge the preprocessed data after partitioning;

[0030] 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;

[0031] A key generation module, configured to binaryize the exponent x and calculate y = g^x mod p, use y as the public key, and x as the private key; k x x A data encryption module, configured to randomly select an integer r, 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 each group is less than lbp and gcd(r, p - 1) = 1, c1 = g^r mod p, c2 = (m * y^r) mod p;

[0032] An on-chain request module, configured to broadcast the encrypted data packet externally to initiate consensus;

[0033] 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 chain for storage.

[0034] In one embodiment, the data processing and merging module includes:

[0035] A data cleaning unit, configured to detect and process abnormal data values in the data by using one or more algorithms among the Z-score method, the IQR method, the box plot method, and the isolation forest, and剔除异常数据;

[0036] 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;

[0037] A denoising and duplicate removal unit, configured to perform duplicate removal and denoising on the word segmentation result by using the Simhash algorithm;

[0038]

[0039]

[0039] A missing value processing unit is used to perform data splicing on the deduplicated and denoised data, and process the missing values ​​in the spliced ​​data;

[0040] Among them, the missing values ​​of power grid equipment operation data can be filled by the mean or median algorithm, and the missing values ​​of asset management data can be supplemented based on machine learning algorithms.

[0041] In one embodiment, the data of the power grid service system includes geographic location information, and the data partition processing module includes:

[0042] A cluster initialization unit is used to randomly select K initial geographic location cluster centers and calculate the distance between the geographic location information corresponding to each data and each initial geographic location cluster center;

[0043] An iterative execution unit, used to distribute the data to the cluster to which the cluster center of the closest starting geographic location belongs according to the distance, and recalculate the center of each cluster until the cluster center no longer changes or a preset number of iterations is reached;

[0044] 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 to which they belong based on the clustering results, and distribute them on the blockchain nodes closest to different partitions.

[0045] In one embodiment, the above device further comprises:

[0046] The verification module is used to verify the data access request based on the access rights and access rules agreed in advance by the smart contract using a fine-grained access control mode;

[0047] The ciphertext pair acquisition module is used to verify that the attributes of the current access user meet the access rights and access rules, pass the verification and return the corresponding ciphertext pair;

[0048] The on-chain data acquisition module is used to exchange data plaintext with the blockchain service layer based on ciphertext to obtain the data of the power grid business system stored on the blockchain;

[0049] The abnormal alarm module is used to issue an alarm when the attributes of the current access user do not meet the access rights and access rules.

[0050] In a third aspect, a computer device is provided, including a memory and a processor, wherein 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, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0052] The power grid data management method fully considers the characteristics of the massive data processing scenario of the power grid business system, partitions the acquired data according to the geographical location, and pre-processes it on the blockchain node after partitioning, improves the processing efficiency by parallel processing, and adopts an improved algorithm in the encryption process. k The exponential sequence length is reduced by base 2, thereby reducing the number of iterations and increasing the speed of data encryption, thereby improving the management efficiency of the blockchain-based power grid business system data. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0054] Figure 1 A flowchart of a power grid data management method based on blockchain in one embodiment;

[0055] Figure 2 It is a schematic flow chart of the steps of preprocessing data on a corresponding node on a corresponding node in one embodiment;

[0056] Figure 3 A flowchart of the steps of partitioning data according to geographic location in one embodiment to distribute data in different partitions to different blockchain nodes;

[0057] Figure 4 A schematic diagram of a flow chart of a power grid data management method based on blockchain in another embodiment;

[0058] Figure 5 It is a structural block diagram of a power grid data management device based on blockchain in one embodiment;

[0059] Figure 6 is an internal structure diagram of a computer device in one embodiment;

[0060] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in another embodiment. DETAILED DESCRIPTION

[0061] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0062] In a first aspect, the present application provides a blockchain-based power grid data management method. As Figure 1 shown, the method includes:

[0063] S100: Obtain data from 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. The data in the power grid business system may include geographical location information. Based on the geographical location information, blockchain nodes are matched. The matching between the two can be based on clustering or on a preset geographical location information-blockchain node mapping relationship table.

[0064] S200: Preprocess the data on the corresponding nodes and merge the preprocessed data of different partitions. Distributing the data under different partitions to different blockchain nodes can reduce the computing power requirements for a single blockchain node and enable multi-node simultaneous operations. For the massive data characteristics of the power grid business system, data preprocessing can be carried out quickly. After preprocessing, in order to achieve uploading to the blockchain, the preprocessed data of different partitions can be merged again. The merging can be achieved by data transfer between some blockchain nodes, or by sorting multiple blockchain nodes in descending order according to the remaining computing resources and aggregating the data to the blockchain node with the largest remaining computing resources.

[0065] S300: 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. If g is a primitive root of p, it means that for all integers i satisfying 1 ≤ i < p - 1, the results of gi mod p are pairwise different, that is, the remainders of the powers of g modulo p traverse all integers between 1 and p - 1, and g^(p - 1) ≡ 1 (mod p) holds only when the exponent is p - 1. That is, g generates all non-zero elements of the multiplicative group modulo p under the multiplication operation modulo p.

[0066] S400: Binaryize the exponent x and calculate y = g k mod p, and use y as the public key and x as the private key. Binaryizing the exponent x means representing x in the form with 2 x as the base. The processing process can be as follows: k Binaryizing the exponent x means representing x in the form with 2 k as the base. 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 . Here, mod means the remainder of dividing the number on the left by the number on the right.

[0069] Add r (which may need to be converted to the corresponding symbol or character if the binary has a specific symbol set) to the front of the result list (or string). k Update (the integer part of x divided by 2

[0070] Update (the integer part of x divided by 2 k ).

[0071] Stop when x becomes 0.

[0072] In each step, the remainder r ranges from 0 to 2 k - 1. Finally, the elements in the result list (or string) (read from the back to the front) are the representation of x in base 2 k system.

[0073] Assume k = 2, x = 15, then we want to convert x to the form with base 4. 15 divided by 4 gives a quotient of 3 and a remainder of 3, record 3. 3 divided by 4 gives a quotient of 0 and a remainder of 3, record 3 (note that at this time the quotient is 0, but there is still a remainder to be recorded). The result is 33 (read from the back to the front), so 15 in base 2 k , k = 2 system is 33.

[0074] S500, randomly select an integer r, and generate a ciphertext pair (c1, c2) in groups through the public key, and sign the ciphertext pair using the private key to obtain an encrypted data packet, where 1 < r < p - 1, the length of the group is less than lbp (bits) and gcd(r, p - 1) = 1 (indicating that the greatest common divisor (GCD) of the integer r and p - 1 is 1), c1 = g’ mod p, c2 = (myr) mod p; 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. Based on the public key, at least part of the data in the data is encrypted in groups to generate a ciphertext pair, and then the ciphertext is signed using the private key to obtain an encrypted data packet, preparing for the data to be uploaded to the chain.

[0075] S600, broadcast the encrypted data packet externally to initiate consensus. This process may specifically include encapsulating the encrypted data packet into a transaction request and sending it to the consensus nodes in the blockchain network. The consensus node with the permission to generate a block receives the transaction request, and the consensus node verifies the received transaction request, including format verification of the transaction request, signature validity (verification using the private key), etc., to ensure the legality and validity of the transaction, and includes the encrypted data packet corresponding to the transaction request that passes the verification into the new block. In this process, a consensus mechanism (such as PoW, PoS, PBFT, etc.) is used to make the whole network nodes reach a consensus on the new block.

[0076] S700, after the consensus layer reaches a 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 chain for storage.

[0077] Blockchain networks usually have limited storage capacity, especially when the network scales up, the on-chain storage cost will increase significantly. By storing a large amount of data in the off-chain database and only storing the storage address (such as hash value or reference link) on the chain, the on-chain storage space can be greatly saved, allowing the blockchain network to focus on the storage and verification of the core data of the power grid business system, which is suitable for the massive data management needs of the power grid business system.

[0078] Traditional blockchain data encryption uses power remainder calculation, which is too time-consuming and will cause low algorithm operation efficiency. The embodiment of the present application provides a blockchain-based power grid data management method, which fully considers the characteristics of the massive data processing scenario of the power grid business system, partitions the acquired data according to the geographical location, and pre-processes it on the partitioned blockchain node, improves the processing efficiency through parallel processing, and adopts an improved algorithm in the encryption process, by exponential 2 k The exponential sequence length is reduced by base 2, thereby reducing the number of iterations and increasing the speed of data encryption, thereby improving the management efficiency of the blockchain-based power grid business system data.

[0079] In one embodiment, the method further includes:

[0080] For the core data in the power grid business system, the blockchain is stored. For non-core data, the following is performed: Figure 1 The off-chain database storage shown stores its address on the chain.

[0081] In one embodiment, if Figure 2 As shown, the step of preprocessing the data on the corresponding node on the corresponding node includes:

[0082] S201, using one or more algorithms selected from the Z-score method, the IQR method, the box plot method, and the isolation forest method to detect and process abnormal data values ​​in the data and eliminate the abnormal data.

[0083] The steps of using the Z-score method to detect and process abnormal data values ​​in the data include:

[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 data set, the 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 mean of the variable, and SD is the standard deviation of the variable.

[0086] Identify outliers in a data set based on the calculated Z-score value and the set threshold (configurable based on the scenario).

[0087] Among them, the IQR method is used to detect and process abnormal data values ​​in the data, and the steps of eliminating abnormal data include:

[0088] Calculate Q1 (first quartile): Determine if 25% of the data points are less than or equal to this value, i.e. the data that is located at the 25% position after the data is arranged from small to large.

[0089] Calculate Q3 (third quartile): Determine that 75% of the data points are less than or equal to this value, that is, the data is located at the 75% position after the data is arranged from small to large.

[0090] IQR (interquartile range) is defined as the difference between Q3 and Q1, that is, IQR=Q3-Q1.

[0091] Compute lower and upper bounds for outliers:

[0092] Lower bound: Q1 - k * IQR, upper bound: Q3 + k * IQR, where k is a constant.

[0093] The calculated lower and upper limits of outliers are used to scan the data of the power grid business coefficient, and all data points that are less than the lower limit or greater than the upper limit are found, and these data points are marked as outliers and removed.

[0094] S202, for the data after the abnormal data is removed, word segmentation, word frequency statistics, stop word removal and word vectorization are performed to determine the word segmentation result.

[0095] Use word segmentation tools such as jieba, HanLP, pkuseg, space word segmentation, or NLTK's tokenizer, and load the corresponding libraries or modules to perform word segmentation on Chinese and English in the data of the power grid business system. Store the word segmentation results as a list or other data structures convenient for subsequent processing. Traverse the list of words obtained after word segmentation, use a dictionary to record each word and its occurrence times. Each time a word is encountered, update its count in the dictionary, sort the word frequencies, and output the words with the highest word frequencies and their frequencies. Stop words are those words that appear frequently in the text but do not make substantial contributions, such as "de", "le", "zai", etc. Removing stop words can improve the efficiency and effect of data text processing. Adopt unsupervised learning models such as Word2Vec or GloVe to train word vector models on a large amount of data of the power grid business system. Based on the trained word vector model, obtain the vector representation of each word, and use the obtained word vectors for subsequent NLP tasks, such as text classification, etc. The word segmentation results include the results produced by each part of the above steps in the processing process.

[0096] S203. For the word segmentation results, use the Simhash algorithm to perform deduplication and denoising. Based on the word segmentation and word frequency statistics results, obtain the weight of each word segmentation in the text, and select representative words from the word segmentation results as features. It can be the top N words with the highest word frequencies, or words after a certain screening (such as removing stop words, retaining words with part-of-speech as nouns or verbs, etc.). Assign weights to each selected feature word. The weight can be its word frequency or TF-IDF value. Select one or more hash functions for each feature word 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 determine the value (0 or 1) of the Simhash value at this bit according to the positive or negative of the final sum value. Use the Hamming distance to calculate the similarity between the Simhash values of two data. The smaller the Hamming distance, the more similar the two data are. By setting a threshold, when the Hamming distance between two data is less than the threshold, it is considered that they are duplicates, and only one of them can be retained. Consider the documents that are not similar to most documents as noise (possibly outliers or incorrect data) and filter them accordingly.

[0097] S204. For the data after deduplication and denoising, perform data splicing and handle the missing values in the spliced data; among them, for the missing values in the power grid equipment operation data, the mean or median algorithm can be used for filling, and for the missing values in the asset management data, they are supplemented based on machine learning algorithms.

[0098] Data preprocessing and labeling are very important steps before data is uploaded to the chain, and their purpose is to ensure the accuracy, completeness and consistency of the data. The method provided in the embodiment of the present application adopts the data preprocessing in the above steps, first removes abnormal data from the data, then performs deduplication and denoising based on word segmentation to reduce the amount of data, and performs missing value processing based on the spliced ​​data. The execution is carried out in sequence, which can speed up the data cleaning efficiency and ensure clear results, and is suitable for data preprocessing needs in the application scenario of massive data in the power grid.

[0099] In one embodiment, the data of the power grid service system includes geographic location information, such as Figure 3 As shown, the data is partitioned according to geographical location to distribute the data in different partitions to different blockchain nodes, including:

[0100] S301, randomly select K initial geographic location cluster centers, and calculate the distance from the geographic location information corresponding to each data to each initial geographic location cluster center. First, the number of clusters K can be determined by using the elbow rule, silhouette coefficient method, etc. From all the geographic location data, randomly select K different data points as initial cluster centers, and these points can be any geographic location data, such as longitude and latitude coordinates.

[0101] S302, according to the distance, the data is assigned to the cluster to which the cluster center of the nearest initial geographic location belongs, and the center of each cluster is recalculated until the cluster center no longer changes or the preset number of iterations is reached. The calculation of this distance can use the Haversine distance, which takes into account the influence of the earth's curvature and has higher accuracy. Assuming that there are two geographic location points A (lat1, lon1) and B (lat2, lon2), and a cluster center C (lat_c, lon_c), the Haversine distance d from point A to cluster center C can be calculated by the following formula (simplified here, more complex trigonometric functions may be involved in the actual calculation):

[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). Based on the calculated distance, each data point is assigned to the cluster to which the nearest cluster center belongs.

[0104] S303: Based on the clustering results, the data of the power grid business system is divided into different geographical partitions according to the clusters to which they belong, and distributed on the blockchain nodes closest to different partitions.

[0105] For example, suppose there is data from a city's power grid business system, including the power consumption of each area and the corresponding longitude and latitude 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 partition, so the city can be divided into 5 areas according to geographical location, and the partitioned data can be cleaned in parallel on these 5 servers to speed up the data upload.

[0106] The blockchain-based power grid data management method provided in the embodiment of the present application performs data partitioning based on clustering and adopts a distributed data processing method, which can support parallel processing of data of the power grid business system, improve data processing efficiency, and further improve blockchain management efficiency of massive data.

[0107] In one embodiment, if Figure 4 As shown, the above-mentioned blockchain-based power grid data management method also includes:

[0108] S401, if a data access request is received, the fine-grained access control mode is used for verification based on the access rights and access rules agreed in advance by the smart contract. Based on the verifiable query of data A under the fine-grained access control mode, the query returns the results in three cases: there is a record matching A in the database, and the user can access the record (that is, the user meets the access policy of the record), there is a matching record in the database, but the user has no access (the user does not meet the access policy of the record), and there is no record matching A.

[0109] S402: If it is verified that the attributes of the current access user meet the access rights and access rules, the verification is passed and the corresponding ciphertext is returned.

[0110] S403, exchanging 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;

[0111] S404: If the attributes of the current access user do not meet the access rights and access rules, an alarm is issued.

[0112] Among them, during the verification process using the fine-grained access control mode, if there is a record in the database that matches the data targeted by the data access request and the user can access the record, it is considered that the attributes of the current accessing user meet the access rights and access rules; otherwise, it is considered that the attributes of the current accessing user do not meet the access rights and access rules.

[0113] The blockchain-based power grid data management method provided in the embodiment of the present application verifies data access requests by adopting a fine-grained access control mode. The verification is passed only when there is a record in the database that matches the data to be accessed and the user can access the record, thereby improving the security of the data access process.

[0114] The blockchain-based power grid data management method adopted in the embodiment of the present application utilizes data cleaning and improved algorithm encryption before being uploaded to the chain, taking into account both the processing efficiency of massive data and the authenticity of data before being uploaded to the chain. In addition, a fine-grained access control mode is adopted to verify the permissions and access rules of visitors to avoid tampering with the on-chain data and ensure the authenticity of the on-chain data.

[0115] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0116] Based on the same inventive concept, the embodiment of the present application also provides a blockchain-based power grid data management device for implementing the blockchain-based power grid data management method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more blockchain-based power grid data management device embodiments provided below can refer to the limitations of the blockchain-based power grid data management method above, and will not be repeated here.

[0117] In an exemplary embodiment, Figure 5 As shown, 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] Among them, the data partition processing module is used to 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;

[0119] A data processing and merging module, which is used to preprocess the data on the corresponding node and merge the preprocessed data of partitions;

[0120] A parameter configuration module, which is used 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;

[0121] A key generation module, which is used to convert the exponent x into binary and calculate y = g^x mod p, and use y as the public key and x as the private key; k x mod p, and use y as the public key and x as the private key;

[0122] A data encryption module, which is used to randomly select an integer r and generate a ciphertext pair (c1, c2) in groups through the public key, and sign the ciphertext pair 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;

[0123] An on-chain request module, which is used to broadcast the encrypted data packet externally and initiate consensus;

[0124] A storage and execution module, which is used 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.

[0125] In one embodiment, the data processing and merging module includes:

[0126] A data cleaning unit, which is used to detect and process abnormal data values in the data by using one or more algorithms such as the Z-score method, the IQR method, the box plot method, and the isolation forest, and剔除 abnormal data;

[0127] A word segmentation unit, which is used to perform word segmentation, word frequency statistics, stop word removal, and word vectorization on the data after剔除 abnormal data to determine the word segmentation result;

[0128] A denoising and duplicate removal unit, which is used to perform duplicate removal and denoising on the word segmentation result by using the Simhash algorithm;

[0129] A missing value processing unit, which is used to splice the data after duplicate removal and denoising and process the missing values in the spliced data;

[0130] 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 machine learning algorithms.

[0131] ​In one embodiment, the data of the power grid service system includes geographic location information, and the data partition processing module includes:

[0132] A cluster initialization unit is used to randomly select K initial geographic location cluster centers and calculate the distance between the geographic location information corresponding to each data and each initial geographic location cluster center;

[0133] An iterative execution unit, used to distribute the data to the cluster to which the cluster center of the closest starting geographic location belongs according to the distance, and recalculate the center of each cluster until the cluster center no longer changes or a preset number of iterations is reached;

[0134] 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 to which they belong based on the clustering results, and distribute them on the blockchain nodes closest to different partitions.

[0135] In one embodiment, the above device further comprises:

[0136] The verification module is used to verify the data access request based on the access rights and access rules agreed in advance by the smart contract using a fine-grained access control mode;

[0137] The ciphertext pair acquisition module is used to verify that the attributes of the current access user meet the access rights and access rules, pass the verification and return the corresponding ciphertext pair;

[0138] The on-chain data acquisition module is used to exchange data plaintext with the blockchain service layer based on ciphertext to obtain the data of the power grid business system stored on the blockchain;

[0139] The abnormal alarm module is used to issue an alarm when the attributes of the current access user do not meet the access rights and access rules.

[0140] Each module in the above-mentioned blockchain-based power grid data management device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0141] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 6As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as ciphertext pairs, private keys, public keys, and encrypted data packets. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a power grid data management method based on blockchain is implemented.

[0142] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 7 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (Near Field Communication, NFC) or other technologies. When the computer program is executed by the processor, a power grid data management method based on blockchain is implemented.

[0143] Those skilled in the art will understand that Figure 6-Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0144] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps of the above-mentioned blockchain-based power grid data management method when executing the computer program.

[0145] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned blockchain-based power grid data management method are implemented.

[0146] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the steps of the above-mentioned blockchain-based power grid data management method.

[0147] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the 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. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0148] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0149] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A power grid data management method based on blockchain, characterized in that: The method includes: Obtaining data from the power grid business system, partitioning the data according to geographical locations, and distributing the data under different partitions to different blockchain nodes; Preprocessing the data on the corresponding nodes 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; Exponentiation x by 2 k Convert to binary and calculate y=g x mod p, using y as the public key and x as 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^r mod p, c2 = (m * y^r) mod 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.

2. The method according to claim 1, characterized in that The step of preprocessing the data on the corresponding nodes includes: Using one or more algorithms among 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; Using the Simhash algorithm for the word segmentation result to remove duplicates and noise; Performing data splicing on the data after removing duplicates and noise, and processing missing values in the spliced data; Among them, the missing values of power grid equipment operation data can be filled using the mean or median algorithm, and the missing values of asset management data are supplemented based on machine learning algorithms.

3. The method according to claim 2, 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 and distributing 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 piece of 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 different partitions.

4. The method according to claim 1, characterized in that: The method further includes: If a data access request is received, verifying it using a fine-grained access control mode based on the access permissions and access rules agreed upon in advance by the smart contract; If it is verified that the attributes of the current access user satisfy the access permissions and access rules, the verification passes and the corresponding ciphertext is returned; Exchanging 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 current access user do not satisfy the access permissions and access rules, an alarm is issued.

5. A blockchain-based power grid data management device, characterized in that: The device includes: A data partitioning processing module, which is used to obtain data from 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, which is used to preprocess the data on the corresponding node and merge the preprocessed data after partitioning; A parameter configuration module, which is used 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 2 the exponent x k Convert to binary and calculate y=g x mod p, using y as the public key and x as the private key; A data encryption module, which is used to randomly select an integer r and generate ciphertext pairs (c1, c2) in groups through a public key, and sign the ciphertext pairs 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^r mod p, c2 = (m * y^r) mod p; An on-chain request module, which is used to broadcast the encrypted data packet externally and initiate consensus; A storage and execution module, which is used to store the encrypted data packet in an off-chain database after the consensus layer reaches a consensus, and return the storage address of the encrypted data packet to the chain for storage.

6. The device according to claim 5, characterized in that The data processing and merging module includes: A data cleaning unit, which is used 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, which is used 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, which is used to perform duplicate removal and denoising on the word segmentation result by using the Simhash algorithm; A missing value processing unit, which is used to splice the data after duplicate removal and denoising, and process the missing values 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 machine learning algorithms.

7. The device according to claim 6, 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, which is used to randomly select K initial geographical location clustering centers and calculate the distances from the geographical location information corresponding to each piece of data to each initial geographical location clustering center; An iterative execution unit, which is used to allocate the data to the cluster where the nearest initial geographical location clustering center is located according to the distances, and recalculate the center of each cluster until the clustering center no longer changes or reaches a preset number of iterations; A data distribution and storage unit, which is used to divide the data of the power grid business system into different geographical partitions according to the clustering results and distribute them on the blockchain nodes closest to different partitions.

8. The method according to claim 5, characterized in that The device further includes: A verification module, which is used to perform verification in a fine-grained access control mode based on the access permissions and access rules agreed in advance by the smart contract when receiving a data access request; A ciphertext pair acquisition module, used to verify that the attributes of the current access user meet the access rights and access rules, and return the corresponding ciphertext pair; The on-chain data acquisition module is used to exchange data plaintext with the blockchain service layer based on ciphertext to obtain the data of the power grid business system stored on the blockchain; The abnormal alarm module is used to generate an alarm when it is verified that the attributes of the current access user do not meet the access rights and access rules.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Information sharing and secure multi-party computing model based on block chain

    CN109388960A

  • Data file consensus method, system and device based on block chain, and medium

    CN113378207A

  • Block chain covert communication method based on generative steganography network and image double steganography

    CN116527278A

  • Data processing method, computing device and computer readable storage medium

    CN118797742A

  • Blockchain cross-chain regulation method for governance of chain by chain

    WO2023201927A1