Methods and terminal devices for ensuring data storage integrity
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-10
- Publication Date
- 2026-08-14
AI Technical Summary
目前婚姻数据一般保存在本地数据库中或者专门的存储设备中,由于婚姻数据对日常人们办理业务比较重要,频繁地对婚姻数据地操作,可能导致婚姻数据地丢失或者损坏,导致严重影响人们的生活与工作,因此婚姻登记系统中的婚姻数据的存储完整性至关重要
[0038]本发明实施例与现有技术相比存在的有益效果是:与现有技术相比,本发明通过将待处理数据分别存储在本地数据库中以及区块链上;当接收到校验所述数据库中数据完整性的指令后,根据待处理数据的重要程度对所述数据库中的待处理数据进行校验;当校验结果为待处理数据不完整时,将所述区块链上保存的目标数据更新或者替换待处理数据。从而可以实现对不同重要程度的数据进行完整性校验,并在校验结果为数据不完整时,获取区块链上保存的目标数据更新或者替换所述待处理数据。
Smart Images

Figure CN114386056B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data processing technology, and in particular relates to a method and terminal device for ensuring the integrity of data storage. Background Technology
[0002] With the development of the internet, marriage registration systems now cover the entire country, resulting in a massive amount of data due to the large population base. Currently, marriage data is generally stored in local databases or dedicated storage devices. Because this data is crucial for people's daily business transactions, frequent operations on it could lead to data loss or corruption, severely impacting people's lives and work. Therefore, the integrity of marriage data storage in marriage registration systems is paramount. However, current methods for verifying data integrity typically apply the same verification method to all data, leading to either complex verification methods or inaccurate results due to overly simplistic methods.
[0003] Therefore, there is an urgent need for a method to verify the integrity of data storage and to recover incomplete data. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a method and terminal device for processing data storage integrity, which are intended to verify the integrity of data storage and recover incomplete data.
[0005] To achieve the above objectives, a first aspect of the present invention provides a method for processing data storage integrity, comprising:
[0006] Obtain the data to be processed;
[0007] The data to be processed is stored in a local database and on a blockchain, respectively.
[0008] Upon receiving an instruction to verify the integrity of data in the database, the data to be processed in the database is verified according to its importance.
[0009] When the verification result indicates that the data to be processed is incomplete, the target data stored on the blockchain will be updated or replaced with the marriage data to be processed.
[0010] As another embodiment of this application, the data to be processed is stored in a local database and on a blockchain, respectively, including:
[0011] The data to be processed is divided into multiple data blocks;
[0012] Calculate the data length and MD5 value of the data to be processed in each data block, and associate the calculated data length and MD5 value with the data to be processed in the corresponding data block to obtain the data to be stored.
[0013] The data to be stored is stored in both the database and the blockchain, and an association table is established to determine the storage locations of the same data in the database and the blockchain.
[0014] The relationship table is stored in the database.
[0015] As another embodiment of this application, dividing the data to be processed into multiple data blocks includes:
[0016] The data to be processed is divided according to the records of different users, resulting in a data block corresponding to each record;
[0017] Alternatively, the data to be processed can be divided according to the data acquisition time to obtain multiple data blocks.
[0018] As another embodiment of this application, the step of verifying the data to be processed in the database according to the importance of the data to be processed includes:
[0019] When the importance level of the data to be processed is the first level, the data length of the data to be processed is calculated; the first level is the lowest level of importance.
[0020] The length of the calculated data is consistent with the length of the data to be processed stored in the database.
[0021] When the calculated data length matches the data length corresponding to the data to be processed stored in the database, the verification result is determined to be that the data to be processed is complete; when the calculated data length does not match the data length corresponding to the data to be processed stored in the database, the verification result is determined to be that the data to be processed is incomplete.
[0022] As another embodiment of this application, the step of verifying the data to be processed in the database according to the importance of the data to be processed includes:
[0023] When the importance level of the data to be processed is the second level, the data length and MD5 value of the data to be processed are calculated respectively; the second level is a level whose importance is greater than the first level.
[0024] The system detects whether the calculated data length is consistent with the data length corresponding to the data to be processed stored in the database, and whether the calculated MD5 value is consistent with the MD5 value corresponding to the data to be processed stored in the database.
[0025] When the calculated data length matches the data length corresponding to the data to be processed stored in the database, and the calculated MD5 value matches the MD5 value corresponding to the data to be processed stored in the database, the verification result is determined to be that the data to be processed is complete; when the calculated data length does not match the data length corresponding to the data to be processed stored in the database, and / or the calculated MD5 value does not match the MD5 value corresponding to the data to be processed stored in the database, the verification result is determined to be that the data to be processed is incomplete.
[0026] As another embodiment of this application, the step of verifying the data to be processed in the database according to the importance of the data to be processed includes:
[0027] When the importance level of the data to be processed is the third level, and the data length and MD5 value of the data to be processed are both correct, the target data corresponding to the data to be processed stored on the blockchain is obtained according to the established association table; the third level is the highest level of importance.
[0028] The data to be processed is compared one by one with the target data obtained from the blockchain. When the data to be processed is exactly the same as the target data obtained from the blockchain, the verification result is determined to be that the data to be processed is complete; when the data to be processed is not exactly the same as the target data obtained from the blockchain, the verification result is determined to be that the data to be processed is incomplete.
[0029] In another embodiment of this application, after acquiring the data to be processed, the method further includes:
[0030] The data to be processed is processed using default values.
[0031] A second aspect of the present invention provides a data storage integrity processing apparatus, comprising:
[0032] The acquisition module is used to acquire data to be processed.
[0033] The storage module is used to store the data to be processed in a local database and on the blockchain, respectively.
[0034] The verification module is used to verify the data to be processed in the database according to the importance of the data to be processed when it receives an instruction to verify the integrity of the data in the database.
[0035] The processing module is used to update or replace the marriage data to be processed by storing the target data on the blockchain when the verification result indicates that the data to be processed is incomplete.
[0036] A third aspect of the present invention provides a terminal device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the data storage integrity processing method as described in any of the above embodiments.
[0037] A fourth aspect of the present invention provides a computer-readable storage medium, comprising: the computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of the data storage integrity processing method as described in any of the above embodiments.
[0038] The beneficial effects of this invention compared to existing technologies are as follows: Compared to existing technologies, this invention stores the data to be processed in a local database and on a blockchain respectively; upon receiving an instruction to verify the integrity of data in the database, the data to be processed in the database is verified according to its importance; when the verification result indicates that the data to be processed is incomplete, the target data stored on the blockchain is used to update or replace the data to be processed. This allows for integrity verification of data of different importance levels, and when the verification result indicates that the data is incomplete, the target data stored on the blockchain is retrieved to update or replace the data to be processed. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 This is a schematic diagram illustrating the implementation process of the data storage integrity processing method provided in this embodiment of the invention;
[0041] Figure 2 This is a schematic diagram of a method provided by an embodiment of the present invention for storing data to be processed in a local database and on a blockchain, respectively;
[0042] Figure 3 This is an example diagram of a data storage integrity processing device provided in an embodiment of the present invention;
[0043] Figure 4 This is a schematic diagram of a terminal device provided in an embodiment of the present invention. Detailed Implementation
[0044] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of the invention. However, those skilled in the art will understand that the invention can be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of the invention with unnecessary detail.
[0045] To illustrate the technical solution described in this invention, specific embodiments are described below.
[0046] Figure 1 The following is a detailed flowchart illustrating a method for handling data storage integrity according to an embodiment of the present invention.
[0047] Step 101: Obtain the data to be processed.
[0048] In this embodiment, we will use marriage data from the marriage registration system as an example to describe the data to be processed.
[0049] The marriage registration system stores marital data for both men and women who are currently in a marital relationship or who have been married in the past.
[0050] Optionally, after obtaining the data to be processed in this step, the data can be preprocessed before performing the operation in step 102. Here, preprocessing refers to processing the default values in the data to be processed to ensure that the data is complete.
[0051] Step 102: Store the data to be processed in a local database and on a blockchain, respectively.
[0052] Optional, such as Figure 2 As shown, this step may include the following process:
[0053] Step 201: Divide the data to be processed into multiple data blocks.
[0054] The data to be processed is divided according to the records of different users, resulting in a data block corresponding to each record;
[0055] Alternatively, the data to be processed can be divided into multiple data blocks according to the data acquisition time. For example, the data to be processed can be divided according to the marriage registration time, so that each record corresponds to a data block.
[0056] In this step, the marriage data is divided into multiple data blocks to convert large data into smaller data for processing. If the smaller data is lost or damaged during subsequent operations, it will have a smaller impact on other data, thereby improving the integrity of data storage.
[0057] Step 202: Calculate the data length and MD5 value of the data to be processed in each data block, and associate the calculated data length and MD5 value with the data to be processed in the corresponding data block to obtain the data to be stored.
[0058] Message-Digest Algorithm 5 (MD5) is a widely used cryptographic hash function that produces a 128-bit (16-byte) hash value to ensure the integrity and consistency of transmitted information.
[0059] In this step, the data length and MD5 value are associated with the marriage data in the corresponding data block and stored together. This way, when performing integrity verification on the marriage data, the data length or MD5 value corresponding to the marriage data can be directly obtained for judgment, saving verification time and improving verification efficiency.
[0060] Step 203: Save the data to be stored in the database and on the blockchain respectively, and establish an association table of the storage locations of the same data to be stored in the database and on the blockchain.
[0061] In essence, a blockchain is a shared database where the data or information stored has characteristics such as "unforgeable" and "traceable," thus ensuring the reliability of data stored on the blockchain.
[0062] After storing the data to be stored in the database and on the blockchain, it is necessary to establish a relationship table for the storage locations of the same data in the database and on the blockchain. This allows us to quickly find the location of the marriage data stored on the blockchain based on the relationship table.
[0063] Optionally, the association table can be a correspondence table between locations in the database and locations on the blockchain. The association table may also include key information such as marriage data stored in the database. In this embodiment, the data stored in the association table is not limited, but at a minimum, the correspondence between locations in the database and locations on the blockchain must be stored.
[0064] Step 204: Store the association table in the database.
[0065] Step 103: Upon receiving an instruction to verify the integrity of data in the database, the data to be processed in the database is verified according to its importance.
[0066] The frequency of data integrity verification can be set according to requirements, such as once a month, once a quarter, etc.
[0067] Optionally, the importance of the data to be processed can be classified into first level, second level, and third level, from low to high.
[0068] Optionally, in this embodiment, when verifying marriage data, the verification can be based on its importance. The higher the importance, the more complex the verification method and the higher the accuracy. When the importance level is first, only the data length of the marriage data can be verified. When the importance level is second, both the data length and MD5 value of the marriage data can be verified simultaneously. When the importance level is third, in addition to verifying both the data length and MD5 value of the marriage data, the marriage data stored in the database and the marriage data stored on the blockchain are compared one by one.
[0069] Optionally, this step may include:
[0070] When the importance level of the data to be processed is the first level, the data length of the data to be processed is calculated; the first level is the lowest level of importance.
[0071] The length of the calculated data is consistent with the length of the data to be processed stored in the database.
[0072] When the calculated data length matches the data length corresponding to the data to be processed stored in the database, the verification result is determined to be that the data to be processed is complete; when the calculated data length does not match the data length corresponding to the data to be processed stored in the database, the verification result is determined to be that the data to be processed is incomplete.
[0073] Optionally, this step may include:
[0074] When the importance level of the data to be processed is the second level, the data length and MD5 value of the data to be processed are calculated respectively; the second level is a level whose importance is greater than the first level.
[0075] The system detects whether the calculated data length is consistent with the data length corresponding to the data to be processed stored in the database, and whether the calculated MD5 value is consistent with the MD5 value corresponding to the data to be processed stored in the database.
[0076] When the calculated data length matches the data length corresponding to the data to be processed stored in the database, and the calculated MD5 value matches the MD5 value corresponding to the data to be processed stored in the database, the verification result is determined to be that the data to be processed is complete; when the calculated data length does not match the data length corresponding to the data to be processed stored in the database, and / or the calculated MD5 value does not match the MD5 value corresponding to the data to be processed stored in the database, the verification result is determined to be that the data to be processed is incomplete.
[0077] Optionally, this step may include:
[0078] When the importance level of the data to be processed is the third level, and the data length and MD5 value of the data to be processed are both correct, the target data corresponding to the data to be processed stored on the blockchain is obtained according to the established association table; the third level is the highest level of importance.
[0079] The data to be processed is compared one by one with the target data obtained from the blockchain. When the data to be processed is exactly the same as the target data obtained from the blockchain, the verification result is determined to be that the data to be processed is complete; when the data to be processed is not exactly the same as the target data obtained from the blockchain, the verification result is determined to be that the data to be processed is incomplete.
[0080] If the verification result indicates that the data to be processed is complete, it means that the data to be processed in the database has not been lost or damaged. If the verification result indicates that the data to be processed is incomplete, it means that the data to be processed in the database has been lost or damaged. In this case, data recovery needs to be performed according to step 104.
[0081] Step 104: When the verification result indicates that the data to be processed is incomplete, update or replace the data to be processed with the target data stored on the blockchain.
[0082] Here, the target data is the same as the data to be processed stored in the database. Based on the established association table, the target data corresponding to the data to be processed stored on the blockchain can be obtained.
[0083] The aforementioned method for handling data storage integrity involves storing the data to be processed in a local database and on a blockchain. Upon receiving an instruction to verify the integrity of data in the database, the data to be processed is verified according to its importance. If the verification result indicates that the data to be processed is incomplete, the target data stored on the blockchain is used to update or replace the data to be processed. This allows for integrity verification of data of varying importance, and when the verification result indicates incomplete data, the target data stored on the blockchain is retrieved to update or replace the data to be processed, thereby ensuring the integrity of the data stored in the database.
[0084] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0085] Corresponding to the data storage integrity processing method described in the above embodiments, Figure 3 An example diagram of a data storage integrity processing apparatus provided in an embodiment of the present invention is shown. Figure 3 As shown, the device may include: an acquisition module 301, a storage module 302, a verification module 303, and a processing module 304;
[0086] The acquisition module 301 is used to acquire data to be processed;
[0087] Storage module 302 is used to store the data to be processed in a local database and on a blockchain, respectively.
[0088] The verification module 303 is used to verify the data to be processed in the database according to the importance of the data to be processed after receiving an instruction to verify the integrity of the data in the database.
[0089] The processing module 304 is used to update or replace the marriage data to be processed by the target data stored on the blockchain when the verification result indicates that the data to be processed is incomplete.
[0090] Optionally, when the storage module 302 stores the data to be processed in a local database and on the blockchain respectively, it can be used for:
[0091] The data to be processed is divided into multiple data blocks;
[0092] Calculate the data length and MD5 value of the data to be processed in each data block, and associate the calculated data length and MD5 value with the data to be processed in the corresponding data block to obtain the data to be stored.
[0093] The data to be stored is stored in both the database and the blockchain, and an association table is established to determine the storage locations of the same data in the database and the blockchain.
[0094] The relationship table is stored in the database.
[0095] Optionally, when the storage module 302 divides the data to be processed into multiple data blocks, it is further used to:
[0096] The data to be processed is divided according to the records of different users, resulting in a data block corresponding to each record;
[0097] Alternatively, the data to be processed can be divided according to the data acquisition time to obtain multiple data blocks.
[0098] Optionally, when the verification module 303 verifies the data to be processed in the database according to the importance of the data to be processed, it can be used to:
[0099] When the importance level of the data to be processed is the first level, the data length of the data to be processed is calculated; the first level is the lowest level of importance.
[0100] The length of the calculated data is consistent with the length of the data to be processed stored in the database.
[0101] When the calculated data length matches the data length corresponding to the data to be processed stored in the database, the verification result is determined to be that the data to be processed is complete; when the calculated data length does not match the data length corresponding to the data to be processed stored in the database, the verification result is determined to be that the data to be processed is incomplete.
[0102] Optionally, when the verification module 303 verifies the data to be processed in the database according to the importance of the data to be processed, it can be used to:
[0103] When the importance level of the data to be processed is the second level, the data length and MD5 value of the data to be processed are calculated respectively; the second level is a level whose importance is greater than the first level.
[0104] The system detects whether the calculated data length is consistent with the data length corresponding to the data to be processed stored in the database, and whether the calculated MD5 value is consistent with the MD5 value corresponding to the data to be processed stored in the database.
[0105] When the calculated data length matches the data length corresponding to the data to be processed stored in the database, and the calculated MD5 value matches the MD5 value corresponding to the data to be processed stored in the database, the verification result is determined to be that the data to be processed is complete; when the calculated data length does not match the data length corresponding to the data to be processed stored in the database, and / or the calculated MD5 value does not match the MD5 value corresponding to the data to be processed stored in the database, the verification result is determined to be that the data to be processed is incomplete.
[0106] Optionally, when the verification module 303 verifies the data to be processed in the database according to the importance of the data to be processed, it can be used to:
[0107] When the importance level of the data to be processed is the third level, and the data length and MD5 value of the data to be processed are both correct, the target data corresponding to the data to be processed stored on the blockchain is obtained according to the established association table; the third level is the highest level of importance.
[0108] The data to be processed is compared one by one with the target data obtained from the blockchain. When the data to be processed is exactly the same as the target data obtained from the blockchain, the verification result is determined to be that the data to be processed is complete; when the data to be processed is not exactly the same as the target data obtained from the blockchain, the verification result is determined to be that the data to be processed is incomplete.
[0109] The processing module 304 can also be used to: perform default value processing on the data to be processed.
[0110] The aforementioned data storage integrity processing device stores the data to be processed in a local database and on a blockchain via a storage module. Upon receiving an instruction to verify the integrity of data in the database, the verification module verifies the data in the database according to its importance. If the verification result indicates that the data to be processed is incomplete, the processing module updates or replaces the data to be processed with target data stored on the blockchain. This allows for integrity verification of data of varying importance, and when the verification result indicates incomplete data, it retrieves target data stored on the blockchain to update or replace the data to be processed, thereby ensuring the integrity of the data stored in the database.
[0111] Figure 4 This is a schematic diagram of a terminal device provided in an embodiment of the present invention. Figure 4As shown, the terminal device 400 of this embodiment includes: a processor 401, a memory 402, and a computer program 403 stored in the memory 402 and executable on the processor 401, such as a program for processing the integrity of marital data storage. When the processor 401 executes the computer program 403, it implements the steps in the above-described embodiment of the method for processing the integrity of data storage, for example... Figure 1 Steps 101 to 104 shown, or Figure 2 In steps 201 to 204 shown, when the processor 401 executes the computer program 403, it implements the functions of each module in the above-described device embodiments, for example... Figure 3 The functions of modules 301 to 304 are shown.
[0112] For example, the computer program 403 can be divided into one or more program modules, which are stored in the memory 402 and executed by the processor 401 to complete the present invention. The one or more program modules can be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program 403 in the data storage integrity processing device or terminal device 400. For example, the computer program 403 can be divided into an acquisition module 301, a storage module 302, a verification module 303, and a processing module 304, with each module having specific functions as follows: Figure 3 As shown, I will not go into detail here.
[0113] The terminal device 400 may be a desktop computer, laptop, handheld computer, or cloud server, etc. The terminal device may include, but is not limited to, a processor 401 and a memory 402. Those skilled in the art will understand that... Figure 4 This is merely an example of terminal device 400 and does not constitute a limitation on terminal device 400. It may include more or fewer components than shown, or combine certain components, or different components. For example, the terminal device may also include input / output devices, network access devices, buses, etc.
[0114] The processor 401 may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0115] The memory 402 can be an internal storage unit of the terminal device 400, such as a hard disk or memory of the terminal device 400. The memory 402 can also be an external storage device of the terminal device 400, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the terminal device 400. Furthermore, the memory 402 can include both internal and external storage units of the terminal device 400. The memory 402 is used to store the computer program and other programs and data required by the terminal device 400. The memory 402 can also be used to temporarily store data that has been output or will be output.
[0116] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0117] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0118] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0119] In the embodiments provided by this invention, it should be understood that the disclosed apparatus / terminal devices and methods can be implemented in other ways. For example, the apparatus / terminal device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0120] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0121] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0122] If the integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0123] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A method for ensuring the integrity of data storage, characterized in that, include: Obtain the data to be processed; The data to be processed is stored in a local database and on a blockchain, respectively, and an association table is established to determine the storage locations of the same data in the database and on the blockchain. The relationship table is stored in the database; Upon receiving an instruction to verify the integrity of data in the database, the data to be processed in the database is verified according to its importance. This includes: when the importance level is first, verifying the data length of the data to be processed; when the importance level is second, verifying both the data length and MD5 value of the data to be processed; and when the importance level is third, in addition to verifying both the data length and MD5 value of the data to be processed, comparing the data to be processed stored in the database with the target data stored on the blockchain one by one. When the verification result indicates that the data to be processed is incomplete, the data to be processed in the database is updated or replaced based on the target data stored on the blockchain. The target data is the same as the data to be processed stored in the database. The target data corresponding to the data to be processed stored on the blockchain is obtained according to the established association table.
2. The method for processing data storage integrity as described in claim 1, characterized in that, The step of storing the data to be processed in a local database and on a blockchain includes: The data to be processed is divided into multiple data blocks; Calculate the data length and MD5 value of the data to be processed in each data block, and associate the calculated data length and MD5 value with the data to be processed in the corresponding data block to obtain the data to be stored. The data to be stored is stored in a database and on a blockchain, respectively.
3. The method for processing data storage integrity as described in claim 2, characterized in that, The step of dividing the data to be processed into multiple data blocks includes: The data to be processed is divided according to the records of different users, resulting in a data block corresponding to each record; Alternatively, the data to be processed can be divided according to the data acquisition time to obtain multiple data blocks.
4. The method for processing data storage integrity as described in claim 2, characterized in that, The step of validating the data to be processed in the database based on its importance includes: When the importance level of the data to be processed is the first level, the data length of the data to be processed is calculated; the first level is the lowest level of importance. The length of the calculated data is consistent with the length of the data to be processed stored in the database. When the calculated data length matches the data length corresponding to the data to be processed stored in the database, the verification result is determined to be that the data to be processed is complete; when the calculated data length does not match the data length corresponding to the data to be processed stored in the database, the verification result is determined to be that the data to be processed is incomplete.
5. The method for processing data storage integrity as described in claim 2, characterized in that, The step of validating the data to be processed in the database based on its importance includes: When the importance level of the data to be processed is the second level, the data length and MD5 value of the data to be processed are calculated respectively; the second level is a level whose importance is greater than the first level. The system detects whether the calculated data length is consistent with the data length corresponding to the data to be processed stored in the database, and whether the calculated MD5 value is consistent with the MD5 value corresponding to the data to be processed stored in the database. When the calculated data length matches the data length corresponding to the data to be processed stored in the database, and the calculated MD5 value matches the MD5 value corresponding to the data to be processed stored in the database, the verification result is determined to be that the data to be processed is complete; when the calculated data length does not match the data length corresponding to the data to be processed stored in the database, and / or the calculated MD5 value does not match the MD5 value corresponding to the data to be processed stored in the database, the verification result is determined to be that the data to be processed is incomplete.
6. The method for processing data storage integrity as described in claim 2, characterized in that, The step of validating the data to be processed in the database based on its importance includes: When the importance level of the data to be processed is the third level, and the data length and MD5 value of the data to be processed are both correct, the target data corresponding to the data to be processed stored on the blockchain is obtained according to the established association table; the third level is the highest level of importance. The data to be processed is compared one by one with the target data obtained from the blockchain. When the data to be processed is exactly the same as the target data obtained from the blockchain, the verification result is determined to be that the data to be processed is complete; when the data to be processed is not exactly the same as the target data obtained from the blockchain, the verification result is determined to be that the data to be processed is incomplete.
7. The method for processing data storage integrity as described in any one of claims 1-6, characterized in that, After acquiring the data to be processed, the process also includes: The data to be processed is processed using default values.
8. A processing apparatus for data storage integrity, characterized in that, include: The acquisition module is used to acquire data to be processed. The storage module is used to store the data to be processed in a local database and on the blockchain respectively, and to establish an association table of the storage locations of the same data to be stored in the database and on the blockchain. The relationship table is stored in the database; The verification module is used to verify the data to be processed in the database according to the importance of the data to be processed when it receives an instruction to verify the integrity of the data in the database. The verification module is used to verify the data length of the data to be processed when the importance level is first level; when the importance level is second level, it verifies both the data length and MD5 value of the data to be processed; and when the importance level is third level, it compares the data to be processed stored in the database with the target data stored on the blockchain one by one, in addition to verifying both the data length and MD5 value of the data to be processed. The processing module is used to update or replace the data to be processed in the database based on the target data stored on the blockchain when the verification result indicates that the data to be processed is incomplete. The target data is the same as the data to be processed stored in the database. The target data corresponding to the data to be processed is obtained from the blockchain according to the established association table.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Rural electronic commerce data authentication method
CN108833330A