A Method and Device for Tracing Power Data in a Blockchain

By generating key values, indexes and privacy lists, merging power data tables, and generating traceability models, the storage burden, inefficiency and privacy protection problems in power data traceability are solved, and an accurate and rapid traceability and optimized traceability process is achieved.

CN114490669BActive Publication Date: 2025-07-25STATE GRID JIANGSU ELECTRIC POWER CO LTD MARKETING SERVICE CENT +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210147435.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-17
Publication Date
2025-07-25
Estimated Expiration
2042-02-17

AI Technical Summary

Technical Problem

In the prior art, there are excessive storage burden, low traceability efficiency, insufficient privacy data protection, complex index establishment and invalid data redundancy in the process of power data traceability, and the existing blockchain methods have not constructed a traceability model based on the characteristics of power data.

Method used

By collecting the database table column names of power data, a key-value list, an index list and a privacy-related list are generated, the data is merged and a fusion table is generated, and a data traceability model is generated based on the requirements of the executor and activity.

Benefits of technology

It realizes the accuracy and speed of data traceability, reduces redundant data storage, protects private data, optimizes the traceability process of power data, and reduces the storage and query burden.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114490669B_ABST
    Figure CN114490669B_ABST
Patent Text Reader

Abstract

A method for tracing the source of power data in a blockchain, characterized in that the method comprises the following steps: Step 1, collect the database tables storing power data in the database, and obtain the set of column names of all database tables; Step 2, filter all the column names based on the executor type, activity type, and expert opinions, and respectively generate a key-value list, an index list, and a privacy-related list; Step 3, fuse the database tables based on the key-value list to generate a fusion table, and extract the fusion table with the indexes that meet the current executor's activity requirements extracted from the index list, so as to obtain a data traceability model. The method of the present invention can achieve the characteristics of accuracy and rapidness in the process of generating the data traceability model, and at the same time improve the effectiveness of the traceability model itself.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and more specifically, to a method and device for tracing the source of power data in a blockchain. Background Art

[0002] Currently, in order to meet the different needs of the digital age, many large companies adopt new technologies for big data processing and distributed infrastructures for collaborative data analysis. To ensure the safe and legal use of data, it is necessary to record and track the use of data, thereby establishing a reasonable accountability and protection mechanism. However, the rapid growth of data scale and the complexity of the network environment pose severe challenges to the implementation of distributed data accountability and protection mechanisms. To better achieve data accountability and protection, the data tracing mechanism, as an important means in a distributed system, provides an effective way for the capture, management, and utilization of tracing information.

[0003] However, there are still some problems in the data tracing technology itself. For example, as the data scale continues to grow, the content to be traced is also increasing, which not only increases the storage burden but also reduces the tracing efficiency. In addition, during the tracing process, it is inevitable to involve the privacy data of users. However, in the current data tracing process, such data cannot be reasonably and effectively protected. Third, in the data tracing process, it is necessary to first trace the records of an executor for a certain activity. In this tracing process, establishing an index process for the tracing target is a very complex matter. The quality of index establishment is not only directly related to the accuracy of obtaining tracing data but also directly related to the rapidity of establishing a tracing model. However, there is no reference in the prior art for the index establishment process of the tracing model. Finally, when tracing large-scale data, a tracing record is made before the data is modified, and when a single data is modified and distributed, a tracing record is made again, resulting in a large amount of invalid data redundancy in the tracing records themselves. This not only occupies a large amount of storage space, reduces the storage efficiency, but also reduces the tracing efficiency.

[0004] On the other hand, the existing data tracing methods based on blockchain cannot construct a data tracing model according to the characteristics of power data. For example, power data itself includes not only information of multiple parties such as electricity consumption units, electricity consumers, power supply parties, and power transmission parties, but also a large amount of redundant data with cross-repetition. In addition, power data itself has great reference value for many other fields. Therefore, there are often various demands for querying and requesting large-scale power data. However, the existing tracing methods cannot provide a targeted tracing method for the distribution, addition, deletion, and modification modes of power data in the power blockchain.

[0005] In view of the above problems, the present invention provides a new method for tracing the source of power data in a blockchain. Summary of the Invention

[0006] In order to solve the deficiencies in the prior art, the object of the present invention is to provide a method for tracing the source of power data in a blockchain. By aggregating the column names of database tables scattered in multiple blocks and generating a key-value list, an index list, and a privacy-related list, different types of data in the fusion table are processed in different ways, and finally a data tracing model is generated.

[0007] The present invention adopts the following technical solutions.

[0008] In the first aspect of the present invention, it relates to a method for tracing the source of power data in a blockchain. The method includes the following steps: Step 1, collect the database tables storing power data in the database and obtain the set of column names of all database tables; Step 2, screen all column names based on the executor type, activity type, and expert opinions, and generate a key-value list, an index list, and a privacy-related list respectively; Step 3, fuse the database tables based on the key-value list to generate a fusion table, and extract the fusion table from the index list by extracting the indexes that meet the current executor's activity requirements, thereby obtaining a data tracing model.

[0009] Preferably, in Step 1, the set of column names of all database tables is obtained by collecting the column names of all database tables and removing duplicates.

[0010] Preferably, removing duplicates also includes removing duplicates for column names with different names but the same essential content of the relevant data in the column names.

[0011] Preferably, the method for obtaining the key-value list in Step 2 is: extract the key values of each database table from the set of column names of all database tables to generate a key-value list.

[0012] Preferably, the key-value list includes the column name of the unit code and the column name of the household number in the power data.

[0013] Preferably, the method for generating the index list in Step 2 is: analyze the executor type and activity type to pre-generate the index content corresponding to each activity of each executor; for each executor and each activity, generate an index list based on the index content and corresponding column names in all cases.

[0014] Preferably, the index content has a one-to-one correspondence with one or more column names.

[0015] Preferably, the method for generating the privacy-related list in step 2 is as follows: extract the column names related to the privacy of the electricity user to generate a privacy-related list; or, automatically generate a privacy-related list based on pre-set expert opinions.

[0016] Preferably, the method for generating the fusion table in step 3 is as follows: Step 3.1.1, use the set of column names of all database tables as the column names of the fusion table, and use each key value in the key-value list as a row of the fusion table, and sum the other items in the database table and record them in the fusion table; Step 3.1.2, remove the column names in the key-value list from the set of column names, and sort the remaining column names and the electricity data content under these column names; Step 3.1.3, based on the privacy-related list, find the privacy column names from the remaining column names, and encrypt the electricity data content under the privacy column names.

[0017] Preferably, the sorting basis for the remaining column names and the electricity data content under these column names is: sort the remaining column names in descending order according to the number of times they appear in all database tables.

[0018] Preferably, the method for obtaining the data traceability model is as follows: Step 3.2.1, based on the current executor's activity requirements, extract the current index from the index list; Step 3.2.2, retrieve the fusion table based on the column name corresponding to the current index, and extract the relevant data from it; Step 3.2.3, use the current executor, the current activity, the current index, and the relevant data with the column name corresponding to the current index deleted as the original data to construct a data traceability model.

[0019] Preferably, the activity types are data distribution activities, data query activities, and data modification activities; among them, when the current activity is a data distribution activity, the method extracts the relevant data and distributes it, and at the same time executes the process of constructing the data traceability model in step 3.2.3; when the current activity is a data query activity, the method queries the relevant data and forwards it to the querying party, and does not execute the process of constructing the data traceability model in step 3.2.3; when the current activity is a data modification activity, the method extracts the relevant data and modifies it, and at the same time executes the process of constructing the data traceability model in step 3.2.2.

[0020] Preferably, the current index is a continuous index or a character index; among them, when the current index is a continuous index, the retrieval is performed based on the numerical data in the column name corresponding to the current index, and the rows corresponding to all numerical data covered by the continuous index range are extracted; when the current index is a character index, the retrieval is performed based on the character data in the column name corresponding to the current index, and the rows corresponding to all character data containing the string in the current index are extracted.

[0021] In a second aspect of the present invention, there is provided a device for tracing power data in a blockchain, wherein the device is used to implement the method for tracing power data in a blockchain described in the first aspect of the present invention.

[0022] The beneficial effects of the present invention are as follows. Compared with the prior art, the method for tracing power data in a blockchain according to the present invention can aggregate the column names of database tables scattered in multiple blocks, and generate a key-value list, an index list, and a privacy-related list, so as to process different types of data in the fusion table in different ways, thereby achieving accuracy, speed in the process of generating the data tracing model, and the effectiveness of the tracing model itself.

[0023] The beneficial effects of the present invention also include:

[0024] 1. During the process of data tracing in the present invention, redundant data is fully pre-merged and de-duplicated in advance, greatly reducing the storage space of invalid or redundant data. At the same time, when establishing the data tracing model, an indexing method is used to fully and accurately extract the effective relevant information in the massive data, making the tracing process simple and fast.

[0025] 2. The present invention fully considers the privacy of some data content. Therefore, before establishing the tracing model, by establishing a privacy-related list of data, the information of data with privacy attributes in a large amount of power consumption data is fully obtained, and through appropriate encryption, hashing, or key hashing and other methods, the privacy-related data is fully protected while reducing the storage space of the data.

[0026] 3. During the process of data tracing in the present invention, an accurate index can be established in advance according to the tracing process. This method can not only improve the accuracy of establishing the data tracing model, but also improve the speed of data tracing. Since the index list fully provides information such as the executor, activity, and column names to be retrieved, the process of screening useful data through the index is very fast and targeted. Due to the systematicness of the index list itself, when there are similar executors and similar activities, an index can be generated specifically according to the requirements. Moreover, the index list in the present invention also provides an opportunity to improve inaccurate indexes and data tracing models, enabling the tracing model to be improved according to the historical results achieved by multiple index generations and retrievals.

[0027] 4. The method of the present invention realizes the process of establishing a traceability model for the characteristics of power data, fully considering the characteristics of power data. Therefore, according to the characteristics that there are many business departments involved in power data, the degree of cross-redundancy between data contents is relatively high, and power data is often distributed on a large scale in various ways, a targeted traceability model is designed, making the traceability process more optimized, and at the same time reducing the burden of storage and query. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 It is a schematic flowchart of the steps of a method for tracing power data in a blockchain of the present invention;

[0029] Figure 2 It is a schematic structural diagram of the association relationship between entities, activities, and data in a method for tracing power data in a blockchain of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0030] The following further describes the present application with reference to the drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and cannot be used to limit the protection scope of the present application.

[0031] Figure 1 It is a schematic flowchart of the steps of a method for tracing power data in a blockchain of the present invention. As Figure 1 shown, a method for tracing power data in a blockchain, wherein the method includes Step 1 to Step 3.

[0032] Step 1, collect the database tables storing power data in the database and obtain the set of column names of all database tables.

[0033] In the present invention, in order to realize the aggregation of data in multiple database tables, the structures of multiple database tables can be analyzed first, that is, the set of column names of the database tables is extracted.

[0034] Preferably, the set of column names of all database tables in Step 1 is obtained by collecting the column names of all database tables and removing duplicates.

[0035] For multiple database tables, there may be the same column names and different column names. For the same column names, the duplicate column names are deleted in the step of extracting the set of column names. For different column names, analysis is required to find out whether there are cases where the names of two or more column names are different, but the data contents recorded therein are exactly the same.

[0036] Preferably, removing duplicates also includes removing duplicates for column names with different names but substantially the same content of the relevant data in the column names.

[0037] For such a situation of substantially the same as described above, it will also be considered the same column name, and the column names will be merged. The specific column name adopted after the merger can be achieved manually or automatically. For example, when the data content stored in the columns of two column naming methods is exactly the same or has a high probability of similarity, the two column names are considered to be substantially the same column names. This method of judging sameness or similarity can be achieved automatically.

[0038] In an embodiment of the present invention, Table 1 to Table 3 are database tables regarding power data in 3 databases respectively.

[0039]

[0040]

[0041] Table 1 First database table

[0042]

[0043] Table 2 Second database table

[0044]

[0045] Table 3 Third database table

[0046] As can be seen from the content of Table 1 to Table 3, through the method in the present invention, contents such as household number, household name, electricity consumption address, etc. are all duplicate items, and only need to be recorded once when recording the set of column names. In addition, the item "electricity consumption address" in Table 2 is substantially the same as the item "user address" in Table 1 and Table 3, so it can be considered to merge them into one record. Specifically, "user address" can be modified to "electricity consumption address" according to the frequency of the column name. For the volt code in Table 2, and column names such as contact information, power consumption change, and cost in Table 3 do not exist in other tables, so they also need to be added to the set of column names in turn.

[0047] As shown in the content of Table 1 to Table 3, the set of column names of the power data in the present invention can include various types of data items. It can include, for example, power transmission data such as electricity consumption type, transaction code, line number, etc., and can also include power consumption potential or power consumption party information of the power consumption unit or individual such as unit code, household number, electricity consumption address, contact information, etc., and can also include data distribution process information such as distribution object type, distribution information type, approval number, etc.

[0048] Step 2, screen all column names based on the executor type, activity type, and expert opinion, and generate a key value list, an index list, and a privacy-related list respectively.

[0049] After the establishment of the column name set in step 1 is completed, the content of the key value list, index list, and privacy-related list can be obtained according to the column name set.

[0050] Specifically, the content in the key value list and the privacy-related list is relatively simple and can basically be achieved by including only multiple different column names. For example, for the key value list, only the column names used as key values need to be listed. For the privacy-related list, after listing the column names, basic information such as the encryption method of the data content under each column name can be added. The index list is relatively more complex, and this part of the content will be described later.

[0051] Preferably, the method for obtaining the key value list in step 2 is: extracting the key value of each database table from the column name set of all database tables to generate a key value list.

[0052] In the present invention, when each database table is designed, the definition of the key value in each database table can be realized. And the key value list in the present invention is the set of key values in all database tables.

[0053] Preferably, the key value list includes the column names of the unit code and household number in the power data. In another way, the content that can represent the uniqueness of data in multiple tables, such as the unit code, can also be used as the key value. This way may not need to consider using the information that exists in all tables as the key value. However, for any database table, at least one or more of the multiple key values should exist in this database table.

[0054] Preferably, the method for generating the index list in step 2 is: analyzing the executor type and activity type to pre-generate the index content corresponding to each activity of each executor; for each executor and each activity, generating an index list based on the index content and corresponding column names in all cases.

[0055] Figure 2 It is a schematic structural diagram of the association relationship among entities, activities, and data in a power data traceability method in a blockchain of the present invention. As Figure 2 shown, in the present invention, in order to generate a data traceability model, it is necessary to establish the association relationship among entities, activities, data, and data parameters and data sets related to the data. For the present invention, the executor is a type of execution entity, the activity is the activity triggered by this entity of the executor, and the data is the data content extracted from multiple database tables distributedly stored in the present invention. The parameters of the data usually can include time parameters and space parameters, and these parameters can be the record parameters left during the distribution, transmission, and modification of multiple data in the database table.

[0056] In the present invention, the process of retrieving using an index is the process of extracting data from a dataset. Therefore, the establishment of the index in the present invention is of crucial importance.

[0057] The electricity consumption data in the present invention has various different reference values. For industrial production departments using electricity, these data can effectively guide such institutions to optimize their electricity consumption strategies and reduce the operating costs of enterprises. Additionally, the electricity data can also enable electricity sellers to improve power supply efficiency and enterprise benefits through data analysis. Moreover, the electricity consumption data can also help the government analyze various aspects of data related to macroeconomic trends and people's livelihoods, such as the industrial production situation, the vacancy rate of urban housing, and the electricity price subsidy policy.

[0058] Since the power system is closely related to people's livelihood, the types of executors in the present invention are also diverse. Some executors can be execution entities from different departments within the power grid, and some executors can also be from the government, companies, various organizations, the public, and individual electricity users, etc. And according to different executors, their requirements are also various. Some executors hope to collect the electricity consumption situation of a certain unit or region, and some executors need to overview the electricity consumption differences in all regions.

[0059] Therefore, in the present invention, before establishing a model, it is possible to pre-traverse or predict and evaluate the requirements of various different activities of multiple executors. According to such different requirements, appropriate indexes can be established respectively. For example, if some indexes are only for extracting the electricity consumption data of a certain region or a certain unit, the content of this index can only be related to the name of a certain region or a certain unit. Additionally, if some indexes are only for collecting a certain batch of data files, the content of this index can simply be to select the number range of this batch of data files.

[0060] Preferably, the index content has a one-to-one correspondence with one or more column names.

[0061] Regardless of the content of the index, during the retrieval process, the index should perform targeted retrieval on the data content under one or several column names. Therefore, during the establishment of the index list, a certain index can be established in correspondence with one or several column names.

[0062] For example, when retrieving according to a certain region or a certain unit, this index can correspond to the "electricity consumption address" or the "unit code ID". And when retrieving the file number, this index can be corresponded to the column name of "file number".

[0063] By establishing such an index list, the present invention can quickly implement the retrieval process and the establishment process of the data traceability model for different requirements.

[0064] Preferably, the method for generating the privacy-related list in step 2 is: extracting the column names related to the privacy of the electricity users to generate a privacy-related list; or automatically generating a privacy-related list based on the pre-set expert opinions.

[0065] In the present invention, all privacy-related data can be recorded in the privacy-related list. The reason why these data are privacy data can be marked automatically or manually with reference to expert opinions. After obtaining the privacy-related list, the method can conveniently implement the encrypted transmission of privacy data, thereby ensuring the security of data during the data fusion process.

[0066] Step 3: Fuse the database tables based on the key-value list to generate a fusion table, and extract from the index list the indexes that meet the current executor's activity requirements to extract the fusion table, thereby obtaining a data traceability model.

[0067] After completing the above three pre-established intermediate process tables, the present invention can realize the establishment of the fusion table. Specifically, in the present invention, first, multiple tables are fused according to the key-value list. However, useful data is extracted from the fusion table to obtain a traceability model.

[0068] Preferably, the method for generating the fusion table in step 3 is: Step 3.1.1: Take the set of column names of all database tables as the column names of the fusion table, and take each key value in the key-value list as a row of the fusion table, and sum the other items in the database table and record them in the fusion table; Step 3.1.2: Remove the column names in the key-value list from the set of column names, and sort the remaining column names and the power data content under these column names; Step 3.1.3: Based on the privacy-related list, find the privacy column names from the remaining column names, and encrypt the power data content under the privacy column names.

[0069] In the method of the present invention, the column names of the fusion table can be realized first. However, with the different contents in the key values, the fusion of multiple rows and multiple-party data can be realized. For example, Table 1 and Table 2 respectively record two electricity consumption data under a "household number", and during the data traceability process, the executor does not need the repeated electricity consumption situation, but only the deduplicated electricity consumption situation of the user under this "household number". Therefore, the substantially same electricity consumption data in Table 1 and Table 2 can be merged. In addition, in order to make the data comprehensive, the "volt code" that is not recorded in Table 1 but is recorded in Table 2 will also be merged into the fusion table.

[0070] Preferably, the sorting basis for the remaining column names and the power data content under these column names is: arranging the remaining column names in reverse order according to the number of times they appear in all database tables.

[0071] Specifically, in addition to the key values, it can be sorted with the column names in the order of priority. For example, "power consumption address" appears in both Table 1 and Table 2 with a relatively high frequency, so it can be arranged in a relatively front position in the table. While "volt code" only appears once, indicating that the importance of this information is relatively low, so it is arranged in a relatively rear position in the fusion table.

[0072] For the column names in the privacy-related list, all the data under this column name need to be encrypted after the fusion is achieved. Encryption can be performed in the manner recorded in the privacy-related list. During the transmission process, either the encrypted data ciphertext and the key can be selected for transmission, or only the hash value of the data can be selected for transmission.

[0073] In the embodiments of the present invention, contact information such as phone numbers or important information such as ID numbers can be considered as privacy data. Additionally, the marking of privacy data can be generated automatically or manually according to expert opinions.

[0074] Preferably, the method for obtaining the data traceability model is as follows: Step 3.2.1, based on the current executor's activity requirements, extract the current index from the index list; Step 3.2.2, based on the column name corresponding to the current index, retrieve the fusion table and extract the relevant data therefrom; Step 3.2.3, using the current executor, the current activity, the current index, and the relevant data with the column name corresponding to the current index deleted as the original data, construct the data traceability model.

[0075] In the present invention, after obtaining the fusion table, relevant data can also be extracted from the fusion table to form a traceability model. Specifically, in the present invention, based on the index list, according to the requirements of the executor's activity, the most suitable index can be extracted from the index list generated by traversing various requirement situations. Then, use this index as the retrieval feature to retrieve the data in the fusion table.

[0076] It should be noted that the method of the present invention does not establish indexes and retrieve data for each requirement. Only when large-scale data processing and data traceability are required in the system, will it be determined whether to use index conditions according to the pre-set conditions.

[0077] Preferably, the activity types are data distribution activities and data modification activities; among them, when the current activity is a data distribution activity, the method extracts the relevant data and distributes it, and at the same time executes the process of constructing the data traceability model in Step 3.2.3; when the current activity is a data query activity, the method queries the relevant data and forwards it to the querying party, and does not execute the process of constructing the data traceability model in Step 3.2.3; when the current activity is a data modification activity, the method extracts the relevant data and modifies it, and at the same time executes the process of constructing the data traceability model in Step 3.2.2.

[0078] In addition, the types of activities in the present invention are mainly divided into three categories. If it is a data query activity, since the data in the power system is accessed through a data middle platform, a large number of query operations are generated every day. If the traceability records of this type of operation are carried out, it will bring a relatively large workload to the blockchain system, and it may also be subject to frequent query attacks by malicious personnel, resulting in an overloaded middle platform. Therefore, in the present invention, the traceability records will not be carried out for this type of activity. Second, for the activities of adding, deleting, and modifying data in a general database, they all belong to the data modification activities in the present invention, and a data traceability model is required to monitor and trace the activities. Third, when the current activity is data distribution, the distribution is not formed based on the data access of a certain query. It may be an automatic distribution activity of the data owner. This type of activity includes the large-scale data forwarding process to external departments or internal departments. In order to track the illegal data forwarding, a data traceability model also needs to be constructed in the data distribution activities involved in the present invention.

[0079] Preferably, the current index is a continuous index or a character index; wherein, when the current index is a continuous index, the retrieval is performed based on the numerical data in the column name corresponding to the current index, and all the rows corresponding to the numerical data covered by the continuous index range are extracted; when the current index is a character index, the retrieval is performed based on the character data in the column name corresponding to the current index, and all the rows corresponding to the character data containing the string in the current index are extracted.

[0080] In the present invention, the continuous index is for some data table items with digital and continuous data content. The payment records that are often found in the power system, the file numbers and transaction numbers that are often found in the application for repair activities, etc. all meet the requirements of the continuous index. The character index is for data table items with string-form data content and the same substring in the data content. It mainly combines the regional characteristics of the power data itself. For example, the data belongs to a certain region. Therefore, the character index can be used in the electricity consumption address, unit address, etc.

[0081] For example, when a batch of content-related files are distributed within a power system, the file numbers of the files are often consecutive. At this time, the upper and lower bounds of the file numbers can be selected according to the index list and the consecutive information of the file numbers provided by the distribution system, such as 000010 and 000100, as the index content of the model. The remaining data content is jointly composed of a traceability record according to the method of the present invention and the traceability model. When a certain file is leaked and traceability accountability is required, for the traceability record with a corresponding index established, only according to the leaked file number and then comparing with the index upper and lower bounds, the content of all other files that may be leaked in the same batch can be traced. This process saves storage space and improves the efficiency of traceability search. In another example, when multiple transactions in the same batch are leaked and need to be traced, the column name "transaction code" can be selected for retrieval, and its index can be the code start value 4710 and the code end value 4766. After retrieval, all transaction data carried out between the two codes 4710 and 4766 can be extracted, for example, the relevant data in the transaction code 4750.

[0082] In another case, for example, some data may not have consecutive characteristics but have similar character characteristics. For example, when the power system often distributes and uses data in a certain area, the address-related content of this batch of data often shows character similarity. When tracing the data in a certain area, the address-related content, such as the data item of the electricity consumption address, is selected as the character index. The method can select the electricity consumption address data item according to the index list, and then determine the establishment of the index according to the character similarity information provided by the distribution system. According to the electricity consumption address content of this batch of data, the maximum matching substring is selected as the index content. For example, a string in a certain area of a certain city in a certain province, and the remaining data content jointly forms a traceability record according to the method proposed in this patent and the traceability model. When the electricity consumption data of a certain unit is leaked and traceability accountability is required, for the traceability record with a character index established, it is only necessary to determine whether the index is a substring of the unit data. In this embodiment, the column name "electricity consumption address" can also be selected for special retrieval, without retrieving the data content under other column names, which not only ensures the accuracy of the retrieval, prevents retrieval interference caused by similar string information in, for example, "electricity consumption unit", but also guarantees the speed of the retrieval.

[0083] The second aspect of the present invention relates to a traceability device for power data in a blockchain, wherein the device is used to implement the method for traceability of power data in a blockchain described in the first aspect of the present invention.

[0084] The beneficial effects of the present invention are as follows. Compared with the prior art, a method for tracing the source of power data in a blockchain according to the present invention can aggregate the column names of database tables scattered in multiple blocks, and generate a key-value list, an index list, and a privacy-related list, so as to process different types of data in the fusion table in different ways, thereby achieving accuracy and speed in the process of generating a data tracing model, as well as the effectiveness of the tracing model itself.

[0085] The applicant of the present invention has made a detailed description and illustration of the embodiments of the present invention in combination with the accompanying drawings of the specification. However, those skilled in the art should understand that the above embodiments are only the preferred implementation schemes of the present invention, and the detailed description is only to help readers better understand the spirit of the present invention, rather than a limitation on the protection scope of the present invention. On the contrary, any improvement or modification made based on the spirit of the present invention should fall within the protection scope of the present invention.

Claims

1. A method for tracing power data in a blockchain, characterized in that, The method includes the following steps: Step 1, collect the database tables storing power data in the database, and obtain the set of column names of all database tables; Step 2, screen all the column names based on the executor type, activity type, and expert opinions, and generate a key-value list, an index list, and a privacy-related list respectively; Among them, extract the key value of each database table from the set of column names of all database tables to generate the key-value list; Analyze the executor type and the activity type to pre-generate the index content corresponding to each activity of each executor; for each executor and each activity, generate an index list with the index content and the corresponding column names in all cases; Extract the column names related to the privacy of electricity users to generate a privacy-related list; or, automatically generate a privacy-related list based on the preset expert opinions; Step 3, fuse the database tables based on the key-value list to generate a fusion table, and extract the indexes that meet the current executor's activity requirements from the index list to extract the fusion table, so as to obtain a data traceability model.

2. The method for tracing the source of power data in a blockchain according to claim 1, wherein: The set of column names of all database tables in Step 1 is obtained by collecting the column names of all database tables and removing duplicates.

3. The method for tracing the source of power data in a blockchain according to claim 2, wherein: The duplicate removal also includes removing duplicates for column names with different names but the same essential content of the relevant data in the column names.

4. The method for tracing the source of power data in a blockchain according to claim 1, wherein: The key-value list includes the column name of the unit code and the column name of the household number in the power data.

5. The method for tracing the source of power data in a blockchain according to claim 1, wherein: The index content has a one-to-one correspondence with one or more column names.

6. The method for tracing the source of power data in a blockchain according to claim 1, wherein: The method for generating the fusion table in Step 3 is as follows: Step 3.1.1, use the set of column names of all database tables as the column names of the fusion table, use each key value in the key-value list as a row of the fusion table, and sum the other items in the database table and record them in the fusion table; Step 3.1.2, remove the column names in the key-value list from the set of column names, and sort the remaining column names and the power data content under this column name; Step 3.1.3, based on the privacy-related list, find the privacy column names from the remaining column names, and encrypt the power data content under the privacy column names.

7. The method for tracing the source of power data in a blockchain according to claim 6, wherein: The basis for sorting the remaining column names and the power data content under this column name is: Sort the remaining column names in reverse order according to the number of times they appear in all database tables.

8. The method for tracing the source of power data in a blockchain according to claim 1, wherein: The method for obtaining the data traceability model is: Step 3.2.1: Extract the current index from the index list based on the current executor's activity requirements. Step 3.2.2: Retrieve the fusion table based on the column name corresponding to the current index, and extract the relevant data therefrom. Step 3.2.3: Construct a data traceability model using the current executor, current activity, current index, and the relevant data with the column name corresponding to the current index deleted as the original data.

9. A method for tracing the source of power data in a blockchain according to claim 8, wherein: The activity types are data distribution activities, data query activities, and data modification activities; among them, When the current activity is a data distribution activity, the method extracts the relevant data and distributes it, and at the same time executes the process of constructing the data traceability model in step 3.2.

3. When the current activity is a data query activity, the method queries the relevant data and forwards it to the querying party, and does not execute the process of constructing the data traceability model in step 3.2.

3. When the current activity is a data modification activity, the method extracts the relevant data and modifies it, and at the same time executes the process of constructing the data traceability model in step 3.2.

2.

10. A method for tracing the source of power data in a blockchain according to claim 9, wherein: The current index is a continuous index or a character index; among them, When the current index is a continuous index, the retrieval is performed based on the numerical data in the column name corresponding to the current index, and the rows corresponding to all the numerical data covered by the continuous index range are extracted. When the current index is a character index, the retrieval is performed based on the character data in the column name corresponding to the current index, and the rows corresponding to all the character data containing the string in the current index are extracted.

11. A device for tracing the source of power data in a blockchain, wherein: The device is used to implement the method for tracing the source of power data in a blockchain described in any one of claims 1-10.

Citation Information

Patent Citations

  • Generation method of pre-join table on ring-shaped schema database

    CN102323947A

  • Construction and management method for secondary indexes of key value library

    CN102750356A