An editable blockchain structure based on sequence tag values and updating method

By introducing sequence tag values ​​and a dual-chain structure, the problems of ledger consistency and multiple edits in editable blockchains are solved, enabling efficient blockchain editing operations and making it suitable for application scenarios with multiple editing requirements.

CN116595022BActive Publication Date: 2025-11-21XI'AN PETROLEUM UNIVERSITY
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310584462.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-23
Publication Date
2025-11-21
Estimated Expiration
2043-05-23

AI Technical Summary

Technical Problem

Existing editable blockchain technology suffers from ledger consistency issues during editing operations, especially when the same block needs to be edited multiple times. Furthermore, consensus-based solutions are inefficient and costly, making it difficult to meet the needs of practical applications.

Method used

The concept of sequence tag values ​​is introduced, and a dual-chain structure is adopted. The main chain is used to store blockchain data, and the correction chain is used to store the data of blocks that have been edited over time. Block updates are achieved through sequence tag values, which solves the ledger consistency problem and supports multiple edits of the same block.

Benefits of technology

It achieves consistent maintenance of the blockchain ledger, supports multiple editing of the same block, improves editing efficiency, reduces editing costs, is suitable for application scenarios with repeated editing, and is compatible with existing editable blockchain solutions based on the chameleon hash function.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116595022B_ABST
    Figure CN116595022B_ABST
Patent Text Reader

Abstract

The application discloses an editable block chain structure based on sequence mark values and an updating method.The block chain structure is a double-chain structure, one of which is a main chain B used for storing data of the block chain, and the other is a correction chain BC used for storing data of edited blocks in the past; the updating method comprises the following steps: defining editable areas and editable permissions of the block chain; constructing the double-chain structure of the editable block chain, wherein each block in the main chain is marked by a one-way increasing block sequence mark value which does not participate in block hash calculation; when a new block is added to the correction chain, the new block is added to the correction chain through a consensus mechanism of the correction chain; when the main chain is updated, the editing blocks and related block sequence mark values of the main chain are updated in sequence through the correction chain, the updating operation of the editable block chain is completed, and the consistency of data on the chain is ensured; the application not only meets the editable characteristics of the block chain, but also guarantees the consistency of the block chain data, and is suitable for block chain application scenarios with multiple editing requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of blockchain technology, and in particular to an editable blockchain structure and update method based on sequence tag values. Background Technology

[0002] Blockchain technology is characterized by decentralization and immutability. However, the immutability of blockchain data makes it difficult to modify or delete data on the chain using conventional methods. Once harmful, erroneous, or redundant data appears on the blockchain, it must be modified or deleted through techniques such as hard forks and rollbacks, which are difficult and costly to implement. Therefore, there is an urgent practical need for blockchain to have a certain degree of editability.

[0003] Currently, editable blockchain schemes based on chameleon hash functions have attracted widespread attention due to their low editing cost and high efficiency. However, these schemes are prone to leading to the coexistence of old and new versions of the same block with the same hash value, which challenges the consistency of the blockchain ledger and seriously affects the security of the blockchain system. Alternatively, consensus-based blockchain modification schemes can also achieve the editability of the blockchain. Marsalek A et al., in their paper "A correctable public blockchain," proposed an editable dual-chain structure where the data chain stores the original data and the correction chain stores the modified data. The submission of the correction data is completed through decentralized voting. Deuber D et al., in their paper "Redactable blockchain in the permissionless setting," proposed a dual-hash chain structure, where the completion of corrections also relies on consensus-based voting. These schemes suffer from drawbacks such as long voting cycles and high editing costs, which to some extent reduce the efficiency and usability of editable blockchain systems. Furthermore, these consensus-based editable blockchain schemes and structures do not consider the problem of repeated editing of a single block. However, in real-world applications, since there are multiple transactions under the Merkle tree, the need for multiple edits of different transactions within the same block and the need to edit already edited transactions again are all reasonable requirements. Therefore, the characteristic of repeated block editing needs to be considered in the design of editable blockchains.

[0004] Patent application CN202210745036.7 discloses a fine-grained blockchain editing method supporting rapid state updates. The steps include: for each first-executed transaction in an editable blockchain, generating fast execution code for the transaction based on its execution process information and recording the read and write sets of the transaction execution process; after an edit event occurs where the blockchain editing permission holder edits a historical transaction on the blockchain, optimistically executing transactions whose states have changed compared to the initial execution, and using the fast execution code generated during the initial execution of that transaction to accelerate transaction execution. After updating all transactions in block B, the state tree, transaction tree, and receipt tree information in the block headers of block B and all blocks previously affected by this update are updated in parallel. However, the patent's drawback is that, based on a consensus-based editing mechanism chain structure, it presents a blockchain editing method that supports rapid state updates, which essentially achieves state updates through a hard fork. Regardless of whether a transaction requires editing, the read and write sets of each transaction's execution process need to be recorded, which adds extra overhead. Therefore, there is an urgent need to design an editable blockchain structure and update method that can both ensure ledger data consistency and adapt to blockchain application scenarios where the same block needs to be edited repeatedly. Summary of the Invention

[0005] To overcome the shortcomings of the prior art, the present invention aims to propose an editable blockchain structure and update method based on sequence tag values, which solves the problems of repeated editing and data consistency in the field of editable blockchains. By introducing the concept of sequence tag values, and adding a sequence tag value independent of each block, and using a two-chain structure, the block update operation is implemented based on the latest sequence tag value, thus solving the ledger consistency problem caused by the editing operation using the chameleon hash function.

[0006] To achieve the above objectives, the technical solution adopted by the present invention is as follows:

[0007] An editable blockchain structure based on sequence tag values ​​is a dual-chain structure, with one main chain B used to store blockchain data and the other a correction chain BC used to store the data of blocks that have been edited in previous iterations.

[0008] Main chain B consists of {seq i B i} is composed of i∈[0,m], m is the height of the latest block in the main chain, and B i The main chain block, seq i For block B i The sequence marker value is unidirectionally increasing, modifiable, and does not participate in the calculation of the block hash value; Block B i The structure can be simply represented as Bi =<s i ,x i ,ctr,CH(a iη )>,i∈[0,m],s i ∈{0,1} K x represents the hash value of the previous block, which is K bits in length. i ∈{0,1} * This represents uneditable data of arbitrary length within a block; ctr represents the consensus mechanism of the main chain; a iη For block B i Data within the editable region η, CH(a) iη (a) is editable data iη The chameleon hash value;

[0009] The modified chain BC structure is represented as {BC j}, j∈[0,n], where n is the height of the latest block in the correction chain. The block structure is simply represented as BC j =<sc j ,xc j ,ctrc>, where sc j ∈{0,1} k To correct the hash value of the previous block of length k on the chain, xc j ∈{0,1} * This represents block data for a correction chain of arbitrary length, where ctrc represents the consensus mechanism of the correction chain. Block data xc j ={seq′ j B′ j}, seq′ j Represents encapsulated in block data xc j The sequence marker value in the main chain block B i =<s i ,x i ,ctr,CH(a iη After editing, it was successfully submitted to the correction chain and became B'. j =<s i ,x i ,ctr,CH(a′ iη )>,a′ iη This represents the modified data.

[0010] An editable blockchain update method based on sequence tag values ​​includes the following steps:

[0011] S1: Before building the blockchain, define the editable areas and editable permissions of the blockchain, specifically including:

[0012] S1.1: Define the editable area of ​​the blockchain. The editable area is defined at different granularities from the data item level to the block level according to the scenario, and the editable content is encapsulated using the Chameleon Hash Function.

[0013] S1.2: Defines the editing permissions for the blockchain, stipulating that both parties to the transaction have the right to modify additional information about the transaction, and can submit the edit block to the correction chain after obtaining the other party's consent.

[0014] S2: Construct a dual-chain structure for an editable blockchain. One chain is the main chain B, which stores the complete ledger of the entire blockchain, with each block marked by a block sequence tag value seq. The other chain is the correction chain BC, which stores the block data of each successfully edited block in the main chain. First, create the genesis block of the main chain and the genesis block of the correction chain respectively. Create the genesis block B0 of the main chain and mark it with seq0, where seq0 = 1. Pack and encapsulate {seq0, B0} to form the genesis block BC0 of the correction chain.

[0015] S3: Perform a consistency check on the main chain block sequence tag value.

[0016] The steps are as follows:

[0017] S3.1: Check if the genesis block B0 of the main chain exists and if the sequence tag value seq0 of the genesis block is 1; if B0 does not exist, create the genesis block B0 and assign the sequence tag value seq0 of the genesis block to 1;

[0018] S3.2: By comparing the sequence marker values ​​of the main chain, check if there are any errors in the main chain's sequence markers. The principle is: if the sequence marker value of the previous block is greater than the sequence marker value of the next block, it indicates that there is an error in the main chain's block sequence markers. Assign the sequence marker values ​​of all blocks to the sequence marker value of the genesis block, i.e., seq. i =1, i∈[1,m];

[0019] S3.3: By comparing the sequence tag value (seq) of the latest block in the main chain. m and the sequence number (seq) of the latest block encapsulated in the correction chain n The size of ' is used to check for errors in the main chain sequence marking. The principle is:

[0020] If seq m >seq′ n This indicates that the sequence value of the marked block in the main chain is in an incorrect state, and all sequence values ​​in the main chain need to be reset to 1, i.e., seq. i =1, i∈[1,m];

[0021] If seq m <seq′ nThis indicates that some blocks in the main chain have been modified, but the main chain has not yet been updated from the correction chain. The main chain update mechanism needs to be activated, and the system needs to switch to S4.

[0022] If seq m ==seq′ n This indicates that all edit blocks in the main chain have been updated;

[0023] S3.4: When a new block B is added to the main chain m+1 At that time, the sequence tag value seq′ is encapsulated in the latest block of the correction chain. n Mark the newly added block B m+1 ;

[0024] S3.5: Steps S3.1-3.5 are completed, and the consistency check of the main chain sequence tag value is finished.

[0025] S4: Add a new block to the correction chain. The correction chain stores the block data from all successful edits of the main chain. After a correction block is successfully submitted, a new block is added to the correction chain through its consensus mechanism. The steps are as follows:

[0026] S4.1: Check if the genesis block BC0 of the correction chain exists. If it does not exist, create BC0, where BC0 = <sc0, xc0, ctrc>, sc0 is empty, xc0 represents the block data encapsulated in the genesis block of the correction chain, which consists of the genesis block of the main chain and its sequence tag value xc0 = {seq0, B0}, where seq0 = 1, and ctrc represents the consensus mechanism of the correction chain; if the genesis block of the correction chain exists, proceed to S4.2.

[0027] S4.2: The editor uses the Chameleon hash function to store the main chain block B. i Editable data a in the editable region η iη Change to a′ iη , i∈[1,m], satisfying hash collision CH(a iη )==CH(a′ iη ), encapsulated to form a new block B' i And submit it to the correction chain;

[0028] S4.3: Correction Chain miners inspect the submitted edited block B' i Whether the requirements are met includes whether the block hash values ​​before and after the edit are the same, and whether the chameleon hash values ​​before and after the content modification are the same. If H(B i )==H(B' i And CH(a) iη )==CH(a′ iη If ), then proceed to S3.4;

[0029] S4.4: Get the latest block BC of the correction chainn Encapsulated tag sequence value seq′ n Then the modified chain adds a new block BC. n+1 sequence tag value seq′ n+1 =seq′ n +1;

[0030] S4.5: Construct a new block BC in the corrected chain n+1 Data item xc n+1 , will {seq′ n+1 B′ n+1 Package into xc n+1 In, B′ n+1 =B′ i ;

[0031] S4.6: Block BC is generated through the modified chain's consensus mechanism ctrc. n+1 Added to the correction chain; block addition complete.

[0032] S5: Update the main chain. Based on the data in the correction chain blocks, the main chain updates the sequence marker values ​​of the editable blockchain blocks and related blocks to ensure the consistency of the editable blockchain ledger. The specific steps are as follows:

[0033] S5.1: Read the correction chain BC n The latest block height n, for any modified chain block BC j =<sc j ,xc j ,ctrc>,xc j ={seq′ j ,B′ j}, initialize j = 1;

[0034] S5.2: Traverse the main chain and find the relationship with B′. j Block B with the same hash value x That is, H(B′) j )==H(B x );

[0035] S5.3: Using the correction chain B′ j Replace main chain block B x and B x The sequence tag value of all blocks thereafter is updated to seq′. j j++;

[0036] S5.4: If j≤n, proceed to S5.2. Otherwise, proceed to S5.5.

[0037] S5.5: Check the sequence tag value (seq) of the latest block in the main chain. m The sequence tag value seq′ of the latest block encapsulated in the correction chainn Whether they are equal, i.e., check seq m ==seq′ n Check if the condition is met; if not, an error occurs and the operation is terminated; otherwise, the main chain update is complete.

[0038] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0039] 1. This invention introduces the concept of sequence marker values. By adding a sequence marker value independent of the block to each block, and using a dual-chain structure, the block update operation is implemented based on the latest sequence marker value, thus solving the ledger consistency problem caused by the editing operation using the chameleon hash function. At the same time, compared with the editable blockchain solution based on the consensus mechanism, this invention is not limited by the consensus mechanism, is compatible with most editable block structures based on the chameleon hash function, and the editing granularity is adjustable, realizing the repeated editing of the same block. It is suitable for blockchain application scenarios with multiple repeated editing requirements.

[0040] 2. The update method of the editable blockchain of the present invention is divided into two parts. The first part is to store the edited block into the correction chain, that is, the process of adding a block to the correction chain; the second part is the process of the main chain maintaining the consistency of the ledger by updating the edited block and the block sequence marker value, that is, the update mechanism of the main chain. Since there are currently a variety of key distribution management schemes for editable blockchains based on the chameleon hash function, the two-part structure and method adopted in the present invention can be largely compatible with these schemes. Attached Figure Description

[0041] Figure 1 This is a schematic diagram of the block editing process of the present invention.

[0042] Figure 2 This is a schematic diagram of a Merkle tree provided for an embodiment of the present invention.

[0043] Figure 3 This is a flowchart illustrating the process of adding a new block to the modified chain in this invention.

[0044] Figure 4 This is a flowchart of the main chain update mechanism of the present invention. Detailed Implementation

[0045] To enable those skilled in the art to better understand the technical solution of the present invention, the technical solution of the present invention will be further described below with reference to the accompanying drawings.

[0046] An editable blockchain structure based on sequence tag values ​​is a dual-chain structure, with one main chain B used to store blockchain data and the other a correction chain BC used to store the data of blocks that have been edited in previous iterations.

[0047] seqi Main chain B consists of {seq i B i} is composed of i∈[0,m], m is the height of the latest block in the main chain, and B i The main chain block is block B. i The sequence marker value is unidirectionally increasing, modifiable, and does not participate in the calculation of the block hash value; Block B i The structure can be simply represented as B i =<s i ,x i ,ctr,CH(a iη )>,i∈[0,m],s i ∈{0,1} K x represents the hash value of the previous block, which is K bits in length. i ∈{0,1} * This represents uneditable data of arbitrary length within a block; ctr represents the consensus mechanism of the main chain; a iη For block B i Data within the editable region η, CH(a) iη (a) is editable data iη The chameleon hash value;

[0048] The modified chain BC structure is represented as {BC j}, j∈[0,n], where n is the height of the latest block in the correction chain. The block structure is simply represented as BC j =<sc j ,xc j ,ctrc>, where sc j ∈{0,1} k To correct the hash value of the previous block of length k on the chain, xc j ∈{0,1} * This represents block data for a correction chain of arbitrary length, where ctrc represents the consensus mechanism of the correction chain. Block data xc j ={seq′ j B′ j}, seq′ j Represents encapsulated in block data xc j The sequence marker value in the main chain block B i =<s i ,x i ,ctr,CH(a iη After editing, it was successfully submitted to the correction chain and became B'. j =<s i ,x i ,ctr,CH(a′ iη )>,a′ iη This represents the modified data.

[0049] An editable blockchain structure and update method based on sequence tag values, such as Figure 1 As shown, it includes the following steps:

[0050] S1: Before building the blockchain, define the editable areas and editable permissions.

[0051] S1.1: Define the editable area and encapsulate the editable content using a chameleon hash function. Without compromising ledger security, the editable area can be defined at different granularities, from the data item level to the block level, depending on the scenario. This embodiment uses a Merkle tree structure for illustration, with the editing granularity at the data item level. (See attached...) Figure 2 In transaction data T1, an editable field 'a' encapsulated with a chameleon hash function is provided. T1 ;

[0052] S1.2: Defines the editing permissions for the blockchain, stipulating that both parties to the transaction have the right to modify additional information about the transaction, and can submit the edit block to the correction chain after obtaining the other party's consent.

[0053] S2: Construct a two-chain structure for an editable blockchain: a main chain B, which stores the complete ledger of the entire blockchain, with each block marked by a block sequence identifier (seq); and a correction chain BC, which stores the block data from each successful edit of the main chain. First, create the genesis block for the main chain and the genesis block for the correction chain. Create the main chain genesis block B0 and mark it with seq0, where seq0 = 1. Package and encapsulate {seq0, B0} to form the correction chain genesis block BC0.

[0054] S3: As attached Figure 3 As shown, a consistency check of the sequence tag value is performed on the main chain block. The main chain is used to store the complete ledger of the entire blockchain, and each block is marked by a sequence tag value. The main chain structure is highly compatible with the existing editable block structure based on the chameleon hash function. Before adding a new block to the main chain, a consistency check of the sequence tag value must be performed. Step S3 specifically includes:

[0055] S3.1: First, check if the main chain and the correction chain have a genesis block. If not, generate the genesis block B0 of the main chain and the genesis block BC0 of the correction chain respectively. Check if the genesis block B0 of the main chain exists and if the sequence tag value seq0 of the genesis block is 1. If B0 does not exist, create the genesis block B0 and assign the sequence tag value seq0 of the genesis block to 1.

[0056] S3.2: In the main chain, by comparing the size relationships of the main chain sequence marker values, the system checks for errors in the main chain sequence markers. It checks each block's sequence marker value against the sequence marker value of the next block. If the sequence marker value is greater than the sequence marker value of the next block, it indicates an error in the main chain's sequence marker values, and the seq value of all blocks in the main chain must be changed to 1; that is, the seq value... i =1, i∈[1,m];

[0057] S3.3: In the main chain, before adding a new block, main chain miners need to compare the sequence tag value (seq) of the latest block in the main chain. m and the seq′ in the latest block encapsulated in the correction chain n Size:

[0058] If seq m >seq′ n This indicates that the sequence value of the marked block in the main chain is in an incorrect state, and all sequence values ​​in the main chain need to be reset to 1, i.e., seq. i =1, i∈[1,m];

[0059] If seq m <seq′ n This indicates that some blocks in the main chain have been modified, but the main chain has not yet been updated from the correction chain. The main chain update mechanism needs to be activated, and the system needs to transition to S5.

[0060] If seq m ==seq′ n This indicates that all edit blocks in the main chain have been updated;

[0061] S3.4: After the comparison is complete, the miner uses the consensus protocol to add block B. m+1 Add to the main chain, B m+1 Use seq′ n Marker, seq′ n This is the sequence tag value encapsulated in the latest block of the correction chain;

[0062] S3.5: Steps S3.1-3.5 are completed, and the consistency check of the main chain sequence tag value is finished.

[0063] In the update operation of an editable blockchain, the entire update process is divided into two steps. The first step is to store the modified block into the correction chain, which is the process of adding a new block to the correction chain used to store the modified block. The second step is the process of updating the block data on the main chain to maintain the consistency of the ledger, which is the update mechanism of the main chain.

[0064] S4: After the correction chain miners verify the legality of this modification, they add a correction chain block through the correction chain consensus mechanism. The correction chain stores data from all successfully edited blocks on the main chain. Once a correction block is successfully submitted, the correction chain miners add the block through the correction chain consensus mechanism, as shown in the attached diagram. Figure 3 As shown, adding a new correction chain block involves the following steps:

[0065] S4.1: Check if the genesis block BC0 of the correction chain exists. If it does not exist, create BC0, where BC0 = <sc0, xc0, ctrc>, sc0 is empty, xc0 represents the data encapsulated in the genesis block, which consists of the genesis block of the main chain and its sequence marker value xc0 = {seq0, B0}, seq0 = 1; ctrc represents the consensus mechanism of the correction chain. If the genesis block of the correction chain exists, proceed to S4.2;

[0066] S4.2: Assume main chain block B i T1 contains transaction data of user Alice transferring money to user Bob. Now Alice needs to edit the editable field 'a' in the transaction data. T1 Change to a′ T1 The editor used the Chameleon hash function to hash the main chain block B. i Editable data a in the editable region η iη Change to a′ iη , i∈[1,m], satisfying hash collision CH(a iη )==CH(a′ iη ), encapsulated to form a new block B' i And submit it to the correction chain;

[0067] S4.3: Correction chain miners check submitted block B' i Whether it is valid includes whether the block hash value before and after the edit is the same, and whether the chameleon hash value before and after the content modification is the same. If both are true, H(B) i )==H(B' i And CH(a) iη )==CH(a′ iη ), believes B' i It is a valid modified block; if B' i If the correction condition is not met, then discard B'. i End this editing operation;

[0068] S4.4: Read the latest block height of the correction chain as n, seq′ n To correct the sequence tag value encapsulated in the latest block on the chain, {seq′ n+1 ,B′ n+1 Packing into the newly added block BC of the correction chainn+1 Data item xc n+1 In, i.e., xc n+1 ={seq′ n+1 ,B′ n+1}, where seq′ n+1 =seq′ n +1, B′ n+1 =B′ i ;

[0069] S4.5: Construct a new block BC in the corrected chain n+1 Data item xc n+1 , will {seq′ n+1 B′ n+1 Package into xc n+1 In, B′ n+1 =B′ i ;

[0070] S4.6: Modified Chain miners pass the block BC through the Modified Chain consensus mechanism ctrc. n+1 Added to the correction chain; block addition complete.

[0071] S5: The main chain update mechanism is an important method to ensure the consistency of editable blockchain ledgers, as shown in the appendix. Figure 4 As shown, the main chain update method mainly involves the following steps:

[0072] S5.1: Read the correction chain BC n The latest block height n, for any modified chain block BC j =<sc j ,xc j ,ctrc>,xc j ={seq′ j ,B′ j}, initialize j = 1;

[0073] S5.2: Traverse the main chain and find the relationship with B′. j Block B with the same hash value x That is, H(B′) j )==H(B x );

[0074] S5.3: Using the correction chain B′ j Replace main chain block B x and B x The sequence tag value of all blocks thereafter is updated to seq′. j j++;

[0075] S5.4: If j≤n, proceed to 5.2; otherwise, proceed to 5.5;

[0076] S5.5: Check the sequence tag value (seq) of the latest block in the main chain. m The sequence tag value seq′ of the latest block encapsulated in the correction chain n Whether they are equal, i.e., check seq m ==seq′ n Check if the condition is met. If not, an error occurs and the operation is terminated; otherwise, the main chain update is complete.

[0077] It should be noted that this invention can adopt a variety of different consensus mechanisms, the editing granularity is adjustable, it can meet a variety of editing schemes based on the chameleon hash function, it has good portability, and it has a wide range of application scenarios.

Claims

1. A method for updating an editable blockchain based on sequence tag values, characterized in that, Includes the following steps: S1: Before building a blockchain, define the editable areas and editable permissions of the blockchain; S2: Construct a two-chain structure for an editable blockchain, with one main chain B used to store the complete ledger of the entire blockchain, and each block marked by the block sequence tag value seq; One is the correction chain BC, which is used to store the block data of each successful edit of the main chain; first, the genesis block of the main chain and the genesis block of the correction chain are created respectively; Create the main chain genesis block B0 and mark it with seq0, where seq0 = 1. Pack and encapsulate {seq0, B0} to form the modified chain genesis block BC0. S3: Main Chain Block Sequence Tag Value Consistency Check S4: Add a correction chain block. The correction chain is used to store the block data of the main chain that has been successfully edited in previous times. When the correction block is successfully submitted, a new block is added to the correction chain through the consensus mechanism of the correction chain. S5: Update the main chain. Based on the data in the correction chain block, the main chain updates the sequence marker values ​​of the main chain edit block and related blocks, thereby ensuring the consistency of the editable blockchain ledger. The main chain B consists of {seq i B i } is composed of i∈[0,m], m is the height of the latest block in the main chain, and B i The main chain block, seq i For block B i The sequence marker value is unidirectionally increasing, modifiable, and does not participate in the calculation of the block hash value; Block B i The structure can be simply represented as B i =<s i ,x i ,ctr,CH(a iη )>,i∈[0,m],s i ∈{0,1} K x represents the hash value of the previous block, which is K bits in length. i ∈{0,1} * This represents uneditable data of arbitrary length within a block; ctr represents the consensus mechanism of the main chain; a iη For block B i Data within the editable region η, CH(a) iη (a) is editable data iη The chameleon hash value; The modified chain BC structure is represented as {BC j }, j∈[0,n], where n is the height of the latest block in the correction chain; the block structure is simply represented as BC j =<sc j ,xc j ,ctrc>, where sc j ∈{0,1} k To correct the hash value of the previous block of length k on the chain, xc j ∈{0,1} * This represents block data of a correction chain of arbitrary length; ctrc represents the consensus mechanism of the correction chain; block data xc j ={seq′ j B′ j }, seq′ j Represents encapsulated in block data xc j The sequence marker value in the main chain block B i =<s i ,x i ,ctr,CH(a iη After editing, it was successfully submitted to the correction chain and became B'. j =<s i ,x i ,ctr,CH(a′ iη )>,a′ iη This represents the modified data.

2. The editable blockchain update method based on sequence tag values ​​according to claim 1, characterized in that, Step S1 specifically involves: S1.1: Define the editable area of ​​the blockchain. The editable area is defined at different granularities from the data item level to the block level according to the scenario, and the editable content is encapsulated using the Chameleon Hash Function. S1.2: Defines the editing permissions for the blockchain, stipulating that both parties to the transaction have the right to modify additional information about the transaction, and can submit the edit block to the correction chain after obtaining the other party's consent.

3. The editable blockchain update method based on sequence tag values ​​according to claim 1, characterized in that, Step S3 specifically involves: S3.1: Check if the genesis block B0 of the main chain exists and if the sequence tag value seq0 of the genesis block is 1; if B0 does not exist, create the genesis block B0 and assign the sequence tag value seq0 of the genesis block to 1; S3.2: By comparing the sequence marker values ​​of the main chain, check if there are any errors in the main chain's sequence markers. The principle is: if the sequence marker value of the previous block is greater than the sequence marker value of the next block, it indicates that there is an error in the main chain's block sequence markers. Assign the sequence marker values ​​of all blocks to the sequence marker value of the genesis block, i.e., seq. i =1, i∈[1,m]; S3.3: By comparing the sequence tag value (seq) of the latest block in the main chain. m and the sequence number (seq) of the latest block encapsulated in the correction chain n The size of ' is used to check for errors in the main chain sequence marking. The principle is: If seq m >seq′ n This indicates that the sequence value of the marked block in the main chain is in an incorrect state, and all sequence values ​​in the main chain need to be reset to 1, i.e., seq. i =1, i∈[1,m]; If seq m <seq′ n This indicates that some blocks in the main chain have been modified, but the main chain has not yet been updated from the correction chain; the main chain update mechanism needs to be activated and the process switched to S4. If seq m ==seq′ n This indicates that all edit blocks in the main chain have been updated; S3.4: When a new block B is added to the main chain m+1 At that time, the sequence tag value seq′ is encapsulated in the latest block of the correction chain. n Mark the newly added block B m+1 ; S3.5: Steps S3.1-3.5 are completed, and the consistency check of the main chain sequence tag value is finished.

4. The editable blockchain update method based on sequence tag values ​​according to claim 1, characterized in that, Step S4 specifically involves: S4.1: Check if the genesis block BC0 of the correction chain exists. If it does not exist, create BC0, where BC0 = <sc0, xc0, ctrc>, sc0 is empty, xc0 represents the block data encapsulated in the genesis block of the correction chain, which consists of the genesis block of the main chain and its sequence tag value xc0 = {seq0, B0}, where seq0 = 1, and ctrc represents the consensus mechanism of the correction chain; if the genesis block of the correction chain exists, proceed to S4.

2. S4.2: The editor uses the Chameleon hash function to store the main chain block B. i Editable data a in the editable region η iη Change to a′ iη , i∈[1,m], satisfying hash collision CH(a iη )==CH(a′ iη ), encapsulated to form a new block B' i And submit it to the correction chain; S4.3: Correction Chain miners inspect the submitted edited block B' i Whether the requirements are met includes whether the block hash values ​​before and after the edit are the same, and whether the chameleon hash values ​​before and after the content modification are the same; if H(B i )==H(B' i And CH(a) iη )==CH(a′ iη If ), then proceed to S3.4; S4.4: Get the latest block BC of the correction chain n Encapsulated tag sequence value seq′ n Then the modified chain adds a new block BC. n+1 sequence tag value seq′ n+1 =seq′ n +1; S4.5: Construct a new block BC in the corrected chain n+1 Data item xc n+1 , will {seq′ n+1 B′ n+1 Package into xc n+1 In, B′ n+1 =B′ i ; S4.6: Block BC is generated through the modified chain's consensus mechanism ctrc. n+1 Added to the correction chain; block addition complete.

5. The editable blockchain update method based on sequence tag values ​​according to claim 1, characterized in that, Step S5 specifically involves: S5.1: Read the correction chain BC n The latest block height n, for any modified chain block BC j =<sc j ,xc j ,ctrc>,xc j ={seq′ j ,B′ j }, initialize j = 1; S5.2: Traverse the main chain and find the relationship with B′. j Block B with the same hash value x That is, H(B′) j )==H(B x ); S5.3: Using the correction chain B′ j Replace main chain block B x and B x The sequence tag value of all blocks thereafter is updated to seq′. j j++; S5.4: If j≤n, proceed to S5.

2. Otherwise, proceed to S5.

5. S5.5: Check the sequence tag value (seq) of the latest block in the main chain. m The sequence tag value seq′ of the latest block encapsulated in the correction chain n Whether they are equal, i.e., check seq m ==seq′ n Check if the condition is met; if not, an error occurs and the operation is terminated; otherwise, the main chain update is complete.

Citation Information

Patent Citations

  • Block chain fine-grained editing method supporting rapid state updating

    CN114840545A

  • Editable block chain system and method based on multi-authorization center attribute encryption

    CN110457297A

  • Method and system for constructing decentralized editable block chain with controllable fine granularity

    CN113536389A