A method and system for preventing data tampering based on blockchain technology

By segmenting and exchanging hash values ​​of blockchain data blocks, constructing polygon arrays, and generating complex hash fingerprints, the problem of low data tampering security in blockchain technology is solved, and the difficulty and detection capability of data tampering are improved.

CN120632924BActive Publication Date: 2026-03-24JIANGXI SHUYI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

Existing blockchain technology has low security in preventing data tampering, especially when the amount of data is small and the computing power is sufficient, data tampering may be achieved by modifying a large number of nodes.

Method used

By dividing a data block into sub-data blocks, calculating hash values, exchanging hash values ​​among multiple data blocks according to preset rules, constructing a polygon array, and generating a hash array before and after the exchange using the hash values ​​before and after the exchange, the hash fingerprint of the data block is generated through the complex structure of the polygon array and the dynamic replacement of hash values.

Benefits of technology

This increases the difficulty of data tampering, ensures that data tampering is detectable, and improves data security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120632924B_ABST
    Figure CN120632924B_ABST
Patent Text Reader

Abstract

The application discloses a method and system for preventing data tampering based on a blockchain technology, which comprises the following steps: dividing data blocks to be uploaded to a blockchain distributed network into sub-data blocks according to a rule, and storing the sub-data blocks to form a plurality of data blocks; performing a hash operation on the sub-data blocks to generate hash values, and exchanging the hash values of the data blocks according to a rule to form a final corresponding relationship; counting the number of exchanges, and constructing a polygon array of a corresponding specification according to the number of exchanges, and recording the hash values of each block before and after the exchange; filling the hash values before and after the exchange into an array according to a rule to generate a hash array before and after the exchange, and replacing corresponding elements of the hash array after the exchange with part of elements of the hash array before the exchange to form a sequence, which is used as a hash fingerprint of the data block. The application solves the problem of low safety in preventing data tampering in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing, and in particular to a method and system for preventing data tampering based on blockchain technology. Background Technology

[0002] Blockchain is a distributed database technology that stores data in a chain-like data structure, where each data block is linked to the previous one, forming a continuously growing data chain. Each data block contains a certain amount of transaction information or other data, which is encrypted and verified before being added to the blockchain.

[0003] Each block stores a hash value generated from its corresponding data content, essentially a "data fingerprint" for that data content. Each block also stores the hash value of the previous block, forming a tightly linked chain. If an attempt is made to tamper with the data in the Nth block, that block's hash value will change, causing the hash value of the previous block (the original hash value of the Nth block) stored in the (N+1)th block to mismatch with the tampered hash value of the Nth block. Due to the distributed storage nature of blockchain, tampering with the data on a single node is ineffective. However, because the logic for generating hash values ​​for data blocks is public, when the amount of data in the blockchain is small and the computing power is sufficient, it may be possible to tamper with the data on a large number of nodes, leading to low data security. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide a method and system for preventing data tampering based on blockchain technology, which aims to solve the problem of low security in the prior art when preventing data tampering.

[0005] The embodiments of the present invention are implemented as follows:

[0006] A method for preventing data tampering based on blockchain technology, the method comprising:

[0007] The data block to be uploaded to the blockchain-based distributed network is obtained, and the data block is divided into multiple sub-data blocks according to preset rules. The multiple sub-data blocks are stored in the distributed network to obtain multiple data blocks.

[0008] The hash values ​​of the sub-data blocks within a data block are obtained by performing hash operations on them. The hash values ​​of multiple data blocks are then exchanged according to a preset rule to obtain the final correspondence between data blocks and hash values.

[0009] Obtain the number of hash value exchanges between multiple data blocks, build a polygon array of corresponding size based on the number of hash value exchanges between multiple data blocks, and obtain the hash value of each data block before and after the exchange.

[0010] The elements in the hash values ​​before and after the swap are filled into the polygon array according to a preset rule to obtain the corresponding front hash array and back hash array. Then, some elements in the front hash array are used to replace some elements in the back hash array to obtain the corresponding sequence, and the sequence is used as the hash fingerprint of the corresponding data block.

[0011] Furthermore, in the aforementioned method for preventing data tampering based on blockchain technology, the step of exchanging the hash values ​​of multiple data blocks according to preset rules to obtain the final correspondence between data blocks and hash values ​​includes:

[0012] Configure the corresponding sequence number for the data block according to the combination order between the sub-data blocks;

[0013] According to the configured sequence number, the hash values ​​of data blocks are swapped pairwise at preset intervals to obtain the final correspondence between data blocks and hash values; or

[0014] Two data blocks are randomly selected to form a data block group until all data blocks are extracted. Then, the hash values ​​of the data blocks in the data block group are swapped pairwise to obtain the final correspondence between the data blocks and the hash values.

[0015] Furthermore, in the aforementioned method for preventing data tampering based on blockchain technology, the step of obtaining the number of hash value exchanges between multiple data blocks and establishing a polygon array of corresponding specifications based on the number of hash value exchanges between multiple data blocks includes:

[0016] Obtain the number of hash value exchanges between multiple data blocks, determine the number of sides of the polygon based on the number of exchanges, and construct a regular polygon with the corresponding number of sides;

[0017] Using the geometric center of the regular polygon as the origin, rays are emitted from each vertex to form multiple grid regions within the regular polygon area, resulting in a polygon array.

[0018] Furthermore, in the aforementioned method for preventing data tampering based on blockchain technology, the step of filling the elements in the hash values ​​before and after the exchange into a polygon array according to a preset rule to obtain the corresponding pre-hash array and post-hash array includes:

[0019] The elements in the hash value before the swap are sequentially filled into the grid area within the polygon array according to the order of the elements, until all the elements in the hash value before the swap are filled.

[0020] The elements in the swapped hash values ​​are sequentially filled into the grid area within the polygon array according to their arrangement order, until all elements in the swapped hash values ​​are filled.

[0021] During filling, the process starts from the initial grid area according to a predetermined rotation order, filling each grid with one element and then repeating the filling cycle until all elements are filled.

[0022] Furthermore, in the aforementioned method for preventing data tampering based on blockchain technology, the step of replacing some elements in the later hash array with some elements in the previous hash array to obtain a corresponding sequence, and using the sequence as the hash fingerprint of the corresponding data block, includes:

[0023] Select the same number of grid regions in both the front hash array and the back hash array, and replace the elements in the grid regions selected in the back hash array with the elements in the grid regions selected in the front hash array.

[0024] The hash array is restored according to the filling order of the filling elements to obtain the corresponding sequence as the hash fingerprint of the corresponding data block.

[0025] Furthermore, the aforementioned method for preventing data tampering based on blockchain technology further includes, before selecting the same number of grid regions in the front hash array and the back hash array respectively:

[0026] Rotate one of the front hash array and the back hash array by a preset angle.

[0027] Furthermore, in the aforementioned method for preventing data tampering based on blockchain technology, the step of dividing the data block into multiple sub-data blocks according to preset rules includes:

[0028] The data block can be divided into equal intervals according to the preset number of segments, or into multiple sub-data blocks according to the required data length.

[0029] Another object of the present invention is to provide a system for preventing data tampering based on blockchain technology, the system comprising:

[0030] The segmentation module is used to obtain the data block to be uploaded to the blockchain-based distributed network, segment the data block into multiple sub-data blocks according to preset rules, and store the multiple sub-data blocks in the distributed network to obtain multiple data blocks.

[0031] The exchange module is used to perform hash operations on the sub-data blocks within a data block to obtain the corresponding hash values, and to exchange the hash values ​​between multiple data blocks according to preset rules to obtain the final correspondence between data blocks and hash values;

[0032] A module is established to obtain the number of hash value exchanges between multiple data blocks. A polygon array of corresponding specifications is established based on the number of hash value exchanges between multiple data blocks, and the hash values ​​of each data block before and after the exchange are obtained respectively.

[0033] The replacement module is used to fill the elements in the hash values ​​before and after the swap into the polygon array according to preset rules to obtain the corresponding front hash array and back hash array, and use some elements in the front hash array to replace some elements in the back hash array to obtain the corresponding sequence, and use the sequence as the hash fingerprint of the corresponding data block.

[0034] Another object of the present invention is to provide a readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the methods described above.

[0035] Another object of the present invention is to provide an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the steps of the method described above.

[0036] This invention generates a hash value for each sub-data block and exchanges these hash values ​​among multiple data blocks according to preset rules, forming a final correspondence between data blocks and hash values. This hash value exchange hides the direct association between sub-data blocks, increasing the difficulty for attackers to analyze the data structure. A polygonal array is constructed based on the number of hash value exchanges. The hash values ​​before and after the exchanges are filled into the array, generating a pre-hash array and a post-hash array. The complex structure of the polygonal array and the dynamic replacement of hash values ​​further obfuscate the data relationships. Parts of the pre-hash array are used to replace parts of the post-hash array, generating a final data block hash fingerprint. This hash fingerprint is stored in the current data block and the next data block, and verification nodes only need to compare the hash fingerprints of the data blocks. This significantly increases the difficulty of data tampering while ensuring that data tampering is detectable. It solves the problem of low security in preventing data tampering in existing technologies. Attached Figure Description

[0037] Figure 1 This is a flowchart of a method for preventing data tampering based on blockchain technology in the first embodiment of the present invention;

[0038] Figure 2 This is a structural block diagram of a system for preventing data tampering based on blockchain technology in the third embodiment of the present invention.

[0039] The following detailed description, in conjunction with the accompanying drawings, will further illustrate the present invention. Detailed Implementation

[0040] To facilitate understanding of the present invention, a more complete description will be given below with reference to the accompanying drawings. Several embodiments of the invention are illustrated in the drawings. However, the invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.

[0041] It should be noted that when a component is said to be "fixed to" another component, it can be directly on the other component or there may be an intervening component. When a component is said to be "connected to" another component, it can be directly connected to the other component or there may be an intervening component. The terms "vertical," "horizontal," "left," "right," and similar expressions used in this document are for illustrative purposes only.

[0042] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.

[0043] Example 1

[0044] Please see Figure 1 The figure shows a method for preventing data tampering based on blockchain technology in the first embodiment of the present invention, the method including steps S10 to S13.

[0045] Step S10: Obtain the data block to be uploaded to the blockchain-based distributed network, divide the data block into multiple sub-data blocks according to preset rules, and store the multiple sub-data blocks in the distributed network to obtain multiple data blocks.

[0046] This process involves retrieving data from data sources (such as local file systems, databases, and network interfaces) to be uploaded to the distributed blockchain network. The retrieved data blocks are then divided into multiple sub-blocks according to preset rules. These preset rules can either divide the data blocks equidistantly based on a preset number of sub-blocks, or divide the data blocks according to the required data length.

[0047] The resulting sub-data blocks are uploaded to the distributed blockchain network for storage. Within the blockchain, each stored data block (i.e., a sub-data block) is encapsulated within a data block.

[0048] Step S11: Perform hash operation on the sub-data blocks within the data block to obtain the corresponding hash value, and exchange the hash values ​​between multiple data blocks according to preset rules to obtain the final correspondence between data blocks and hash values.

[0049] Specifically, for each sub-data block stored within a data block, a specific hash algorithm (such as SHA-256) is used to perform independent hash operations, generating a unique and fixed hash value for each sub-data block. This hash value accurately reflects the content characteristics of the corresponding sub-data block. Subsequently, according to preset rules, the hash values ​​generated by these sub-data blocks are exchanged among multiple data blocks. These preset rules can be set based on various factors, such as the storage order of data blocks and specific business logic requirements. Through this rule-based exchange, the association between data blocks and hash values ​​is reconstructed. The final correspondence between data blocks and hash values ​​not only reflects the integrity verification information of the sub-data blocks within each data block (through hash values) but also incorporates the association and specific logical relationships between multiple data blocks (through hash value exchange rules). This forms a more complex data storage and verification mechanism with specific business logic in the blockchain distributed network.

[0050] For example, the step of exchanging the hash values ​​of multiple data blocks according to preset rules to obtain the final correspondence between data blocks and hash values ​​includes:

[0051] Configure the corresponding sequence number for the data block according to the combination order between the sub-data blocks;

[0052] According to the configured sequence number, the hash values ​​of data blocks are swapped pairwise at preset intervals to obtain the final correspondence between data blocks and hash values; or

[0053] Two data blocks are randomly selected to form a data block group until all data blocks are extracted. Then, the hash values ​​of the data blocks in the data block group are swapped pairwise to obtain the final correspondence between the data blocks and the hash values.

[0054] The final correspondence between data blocks and hash values ​​is constructed by exchanging hash values ​​between data blocks in two ways. One method is to first assign a unique sequence number to each data block according to the combination order of the sub-data blocks. This sequence number clarifies the logical arrangement order of the data blocks. Then, according to a preset interval rule, such as every fixed number of sequence numbers (e.g., every 1, every 2, etc.), the hash values ​​of the corresponding data blocks are exchanged in pairs. Through this exchange operation based on sequence numbers and fixed intervals, the association between data blocks and hash values ​​is reorganized to form the final correspondence. The other method is to randomly select two data blocks from all data blocks to form a data block group. This extraction process is repeated until all data blocks are grouped. Then, the hash values ​​of the two data blocks in each data block group are exchanged in pairs. By using random grouping and intra-group exchange, the original simple correspondence between data blocks and hash values ​​is broken, and a correspondence between data blocks and hash values ​​with randomness and specific distribution characteristics is finally obtained. Both methods achieve the re-association of hash values ​​between data blocks.

[0055] Step S12: Obtain the number of hash value exchanges between multiple data blocks, establish a polygon array of corresponding specifications based on the number of hash value exchanges between multiple data blocks, and obtain the hash value of each data block before and after the exchange.

[0056] The process involves several steps. First, the total number of hash value exchanges between multiple data blocks is counted. This number reflects the complexity and scale of the re-association of hash values ​​between data blocks. Second, based on the counted number of exchanges, a polygon array with corresponding specifications is constructed. The specifications of the polygon array (such as dimensions and number of elements) are related to the number of exchanges and can be determined by a preset mapping rule. This array structure provides a specific data organization form for subsequent data processing and analysis. Finally, for each data block, its hash value before and after the hash value exchange operation is recorded.

[0057] Step S13: Fill the elements in the hash values ​​before and after the swap into the polygon array according to the preset rules to obtain the corresponding front hash array and back hash array. Replace some elements in the back hash array with some elements in the front hash array to obtain the corresponding sequence, and use the sequence as the hash fingerprint of the corresponding data block.

[0058] For each data block, according to preset rules (such as element position order, selection at specific intervals, and filtering based on element characteristics), the elements of the hash value before the swap are filled into a polygonal array to construct a pre-hash array. Simultaneously, following the same or similar preset rules, the elements of the swapped hash value are filled into another polygonal array to form a post-hash array. These two arrays respectively carry the characteristic information of the data block before and after the hash value swap. Then, some elements are selected from the constructed pre-hash array (selection methods can be based on randomness, fixed positions, or meeting specific conditions, etc.), and these selected elements are used to replace some elements in the post-hash array (replacement positions can also follow preset rules, such as replacement at the same position or replacement according to a specific pattern, etc.). After the replacement operation, a new sequence is obtained. Finally, this newly generated sequence is used as the hash fingerprint of the data block. Through the complex structure of the polygonal array and the dynamic replacement of hash values, data relationships are further obfuscated, and verification nodes only need to compare the hash fingerprint of the data block; while ensuring that data tampering is detectable, the difficulty of data tampering is increased.

[0059] In summary, the blockchain-based method for preventing data tampering in the above embodiments of the present invention generates a hash value for each sub-data block and exchanges these hash values ​​among multiple data blocks according to preset rules, forming a final correspondence between data blocks and hash values. This hash value exchange hides the direct association between sub-data blocks, increasing the difficulty for attackers to analyze the data structure. A polygon array is constructed based on the number of hash value exchanges, and the hash values ​​before and after the exchange are filled into the array to generate a pre-hash array and a post-hash array. The complex structure of the polygon array and the dynamic replacement of hash values ​​further obfuscate the data relationships. Finally, some elements of the pre-hash array are used to replace some elements of the post-hash array to generate a final data block hash fingerprint. This hash fingerprint is stored in the current data block and the next data block, and verification nodes only need to compare the hash fingerprints of the data blocks. This method increases the difficulty of data tampering while ensuring that data tampering is detectable. It solves the problem of low security in preventing data tampering in existing technologies.

[0060] Example 2

[0061] The method for preventing data tampering based on blockchain technology in this embodiment differs from the method for preventing data tampering based on blockchain technology in Embodiment 1 in the following ways:

[0062] The step of obtaining the number of hash value exchanges between multiple data blocks and establishing a polygon array of corresponding specifications based on the number of hash value exchanges between multiple data blocks includes:

[0063] Obtain the number of hash value exchanges between multiple data blocks, determine the number of sides of the polygon based on the number of exchanges, and construct a regular polygon with the corresponding number of sides;

[0064] Using the geometric center of the regular polygon as the origin, rays are emitted from each vertex to form multiple grid regions within the regular polygon area, resulting in a polygon array.

[0065] In this embodiment, the total number of hash value exchanges between multiple data blocks is counted, and the number of sides of the polygon is determined based on the number of exchanges. There is a certain correspondence between the number of exchanges and the number of sides of the polygon. In this embodiment, the number of exchanges can be used as the number of sides, or the range of the number of sides can be selectively set based on the size of the number of exchanges, for example, not exceeding a threshold. When the number of exchanges is large, the number of sides is obtained by taking the remainder of the number of exchanges with the maximum number of sides, and then a regular polygon with the determined number of sides is constructed.

[0066] Next, taking the geometric center of the regular polygon as the origin, rays are emitted from the origin to each vertex of the regular polygon. These rays connect the origin and the vertices, dividing the polygon into multiple grid regions. In other words, the regular polygon is divided into multiple grid regions using the diagonals of the regular polygon. These grid regions formed by the rays are combined to form a polygon array. This polygon array provides a specific spatial structure basis for subsequent data processing, feature extraction, or analysis operations.

[0067] Furthermore, the step of filling the elements in the hash values ​​before and after the swap into the polygon array according to a preset rule to obtain the corresponding before hash array and after hash array includes:

[0068] The elements in the hash value before the swap are sequentially filled into the grid area within the polygon array according to the order of the elements, until all the elements in the hash value before the swap are filled.

[0069] The elements in the swapped hash values ​​are sequentially filled into the grid area within the polygon array according to their arrangement order, until all elements in the swapped hash values ​​are filled.

[0070] During filling, the process starts from the initial grid area according to a predetermined rotation order, filling each grid with one element and then repeating the filling cycle until all elements are filled.

[0071] Specifically, for the hash values ​​before the swap, they are filled into the grid areas of the polygon array one by one according to their original order, until all the hash value elements before the swap are filled. Similarly, for the hash values ​​after the swap, they are also filled into the grid areas of the polygon array one by one according to their original order, until all the hash value elements after the swap are filled. During the filling process, a predetermined rotation order (such as clockwise rotation, counterclockwise rotation, etc.) is followed. Starting from the specified starting grid area in the polygon array, only one element is filled into each grid area. When all grid areas have completed one round of filling, if there are still remaining elements, the next round of filling starts from the starting grid area again, until all elements are filled. Through this filling method, the hash value elements before and after the swap are arranged in an orderly manner in the grid of the polygon array, forming the front hash array and the back hash array respectively.

[0072] In addition, in some optional embodiments of the present invention, the step of replacing some elements in the subsequent hash array with some elements in the previous hash array to obtain the corresponding sequence, and using the sequence as the hash fingerprint of the corresponding data block, includes:

[0073] Select the same number of grid regions in both the front hash array and the back hash array, and replace the elements in the grid regions selected in the back hash array with the elements in the grid regions selected in the front hash array.

[0074] The hash array is restored according to the filling order of the filling elements to obtain the corresponding sequence as the hash fingerprint of the corresponding data block.

[0075] Specifically, in both the front and back hash arrays, an equal number of grid regions are selected. Then, the elements in the selected grid regions of the front hash array are used to replace the corresponding elements in the selected grid regions of the back hash array, according to a one-to-one correspondence. This replacement operation changes part of the content of the back hash array, incorporating the feature information of the front hash array. Finally, based on the filling order followed when filling the polygon array grid regions (this order was determined when constructing the front and back hash arrays), the back hash array after the element replacement operation is restored. That is, the elements in the array are rearranged and reordered according to the filling order, resulting in a new sequence. This sequence integrates some feature information from the front and back hash arrays, and its generation process follows specific filling and replacement rules, making it unique and identifiable. Therefore, it is used as the hash fingerprint of the corresponding data block.

[0076] In practice, the corresponding grid area can be selected based on the positional relationship between the front hash array and the back hash array, and the elements in the grid area corresponding to the position can be replaced accordingly. Alternatively, the elements in the grid area corresponding to the position can be randomly shuffled and replaced based on randomness, or both the selection of the grid area and the replacement of the elements can be done randomly.

[0077] In addition, before selecting the same number of grid regions in the front hash array and the back hash array respectively, the process also includes:

[0078] Rotate one of the front hash array and the back hash array by a preset angle.

[0079] Before selecting the same number of grid regions from the front hash array and the back hash array respectively, either the front hash array or the back hash array is rotated at a preset angle (this preset angle can be determined according to specific needs and rules, such as 90 degrees, 180 degrees, 270 degrees, etc.). The relative positional relationship of the elements in the array is changed by the rotation operation. Then, the same number of grid regions are selected from the rotated front hash array (if the front hash array is rotated) or the rotated back hash array (if the back hash array is rotated) and the other unrotated array according to the corresponding rules.

[0080] In summary, the blockchain-based method for preventing data tampering in the above embodiments of the present invention generates a hash value for each sub-data block and exchanges these hash values ​​among multiple data blocks according to preset rules, forming a final correspondence between data blocks and hash values. This hash value exchange hides the direct association between sub-data blocks, increasing the difficulty for attackers to analyze the data structure. A polygon array is constructed based on the number of hash value exchanges, and the hash values ​​before and after the exchange are filled into the array to generate a pre-hash array and a post-hash array. The complex structure of the polygon array and the dynamic replacement of hash values ​​further obfuscate the data relationships. Finally, some elements of the pre-hash array are used to replace some elements of the post-hash array to generate a final data block hash fingerprint. This hash fingerprint is stored in the current data block and the next data block, and verification nodes only need to compare the hash fingerprints of the data blocks. This method increases the difficulty of data tampering while ensuring that data tampering is detectable. It solves the problem of low security in preventing data tampering in existing technologies.

[0081] Example 3

[0082] Please see Figure 2 The figure shows a system for preventing data tampering based on blockchain technology proposed in the third embodiment of the present invention. The system includes:

[0083] The segmentation module 100 is used to obtain the data block to be uploaded to the blockchain-based distributed network, segment the data block into multiple sub-data blocks according to preset rules, and store the multiple sub-data blocks in the distributed network to obtain multiple data blocks.

[0084] The exchange module 200 is used to perform hash operations on the sub-data blocks within the data block to obtain the corresponding hash values, and to exchange the hash values ​​between multiple data blocks according to preset rules to obtain the final correspondence between data blocks and hash values.

[0085] Module 300 is established to obtain the number of hash value exchanges between multiple data blocks. A polygon array of corresponding specifications is established based on the number of hash value exchanges between multiple data blocks, and the hash values ​​of each data block before and after the exchange are obtained respectively.

[0086] The replacement module 400 is used to fill the elements in the hash values ​​before and after the exchange into the polygon array according to preset rules to obtain the corresponding front hash array and back hash array, and use some elements in the front hash array to replace some elements in the back hash array to obtain the corresponding sequence, and use the sequence as the hash fingerprint of the corresponding data block.

[0087] The functions or operation steps implemented by the above modules are largely the same as those in the above method embodiments, and will not be repeated here.

[0088] Example 4

[0089] In another aspect, the present invention provides a readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the steps of the method described in any one of the above embodiments one to two.

[0090] Example 5

[0091] In another aspect, the present invention provides an electronic device, the electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of any one of the methods described in embodiments one to two above.

[0092] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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 specification.

[0093] Those skilled in the art will understand that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequential list of executable instructions for implementing logical functions, and can be embodied in any computer-readable storage medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable storage medium" can mean any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.

[0094] More specific examples (a non-exhaustive list) of computer-readable storage media include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable storage media can even be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.

[0095] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0096] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0097] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.

Claims

1. A method for preventing data tampering based on blockchain technology, characterized in that, The method includes: The data block to be uploaded to the blockchain-based distributed network is obtained, and the data block is divided into multiple sub-data blocks according to preset rules. The multiple sub-data blocks are stored in the distributed network to obtain multiple data blocks. The hash values ​​of the sub-data blocks within a data block are obtained by performing hash operations on them. The hash values ​​of multiple data blocks are then exchanged according to a preset rule to obtain the final correspondence between data blocks and hash values. Obtain the number of hash value exchanges between multiple data blocks, build a polygon array of corresponding size based on the number of hash value exchanges between multiple data blocks, and obtain the hash value of each data block before and after the exchange. The elements in the hash values ​​before and after the swap are filled into the polygon array according to a preset rule to obtain the corresponding front hash array and back hash array. Then, some elements in the front hash array are used to replace some elements in the back hash array to obtain the corresponding sequence, and the sequence is used as the hash fingerprint of the corresponding data block.

2. The method for preventing data tampering based on blockchain technology according to claim 1, characterized in that, The step of exchanging hash values ​​among multiple data blocks according to preset rules to obtain the final correspondence between data blocks and hash values ​​includes: Configure the corresponding sequence number for the data block according to the combination order between the sub-data blocks; According to the configured sequence number, the hash values ​​of data blocks are swapped pairwise at preset intervals to obtain the final correspondence between data blocks and hash values; or Two data blocks are randomly selected to form a data block group until all data blocks are extracted. Then, the hash values ​​of the data blocks in the data block group are swapped pairwise to obtain the final correspondence between the data blocks and the hash values.

3. The method for preventing data tampering based on blockchain technology according to claim 1, characterized in that, The step of obtaining the number of hash value exchanges between multiple data blocks and establishing a polygon array of corresponding specifications based on the number of hash value exchanges between multiple data blocks includes: Obtain the number of hash value exchanges between multiple data blocks, determine the number of sides of the polygon based on the number of exchanges, and construct a regular polygon with the corresponding number of sides; Using the geometric center of the regular polygon as the origin, rays are emitted from each vertex to form multiple grid regions within the regular polygon area, resulting in a polygon array.

4. The method for preventing data tampering based on blockchain technology according to claim 3, characterized in that, The step of filling the elements in the hash values ​​before and after the swap into the polygon array according to a preset rule to obtain the corresponding front hash array and back hash array includes: The elements in the hash value before the swap are sequentially filled into the grid area within the polygon array according to the order of the elements, until all the elements in the hash value before the swap are filled. The elements in the swapped hash values ​​are sequentially filled into the grid area within the polygon array according to their arrangement order, until all elements in the swapped hash values ​​are filled. During filling, the process starts from the initial grid area according to a predetermined rotation order, filling each grid with one element and then repeating the filling cycle until all elements are filled.

5. The method for preventing data tampering based on blockchain technology according to claim 4, characterized in that, The step of replacing some elements in the later hash array with some elements in the previous hash array to obtain the corresponding sequence, and using the sequence as the hash fingerprint of the corresponding data block, includes: Select the same number of grid regions in both the front hash array and the back hash array, and replace the elements in the grid regions selected in the back hash array with the elements in the grid regions selected in the front hash array. The hash array is restored according to the filling order of the filling elements to obtain the corresponding sequence as the hash fingerprint of the corresponding data block.

6. The method for preventing data tampering based on blockchain technology according to claim 5, characterized in that, Before selecting the same number of grid regions in the front hash array and the back hash array respectively, the following is also included: Rotate one of the front hash array and the back hash array by a preset angle.

7. The method for preventing data tampering based on blockchain technology according to claim 6, characterized in that, The step of dividing the data block into multiple sub-data blocks according to preset rules includes: The data block can be divided into equal intervals according to the preset number of segments, or into multiple sub-data blocks according to the required data length.

8. A system for preventing data tampering based on blockchain technology, characterized in that, The system includes: The segmentation module is used to obtain the data block to be uploaded to the blockchain-based distributed network, segment the data block into multiple sub-data blocks according to preset rules, and store the multiple sub-data blocks in the distributed network to obtain multiple data blocks. The exchange module is used to perform hash operations on the sub-data blocks within a data block to obtain the corresponding hash values, and to exchange the hash values ​​between multiple data blocks according to preset rules to obtain the final correspondence between data blocks and hash values; A module is established to obtain the number of hash value exchanges between multiple data blocks. A polygon array of corresponding specifications is established based on the number of hash value exchanges between multiple data blocks, and the hash values ​​of each data block before and after the exchange are obtained respectively. The replacement module is used to fill the elements in the hash values ​​before and after the swap into the polygon array according to preset rules to obtain the corresponding front hash array and back hash array, and use some elements in the front hash array to replace some elements in the back hash array to obtain the corresponding sequence, and use the sequence as the hash fingerprint of the corresponding data block.

9. A readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the method as described in any one of claims 1 to 7.

10. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the steps of the method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Blockchain-based DNA data storage method and system, and device

    CN108737501A

  • Managing verifiable, cryptographically strong transactions

    US20170366516A1