A difference fallback method and system for blockchain

Through difference algorithm and chain column and chain ring model verification, the problem of infinite loop and resource consumption when data error is rolled back in the blockchain is solved, fast and lightweight data rollback is realized, and recovery to any point in time is ensured. ability.

CN112487080BActive Publication Date: 2024-10-15BENNOCHAIN TECH (SHENZHEN) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN201910768310.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-08-20
Publication Date
2024-10-15
Estimated Expiration
2039-08-20

AI Technical Summary

Technical Problem

When data in the blockchain is incorrect, commonly used transaction reverse calculation methods can easily introduce rollback infinite loops, and in order to ensure data rollback, a large amount of processing time and storage space are consumed, and recovery to any point in time is limited.

Method used

It uses difference algorithm and chain column and chain link model verification, and records and calculates the change history of data through the difference manager to achieve fast and lightweight data rollback, avoid infinite loops, and reduce processing time and storage space consumption.

Benefits of technology

It achieves fast and lightweight data rollback, avoids infinite loops, reduces processing time and storage space consumption, and ensures recovery to any point in time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112487080B_ABST
    Figure CN112487080B_ABST
Patent Text Reader

Abstract

The present invention discloses a difference rollback method for blockchain, which comprises the following steps: firstly starting a node, and verifying the legitimacy of the data after receiving the data; secondly querying whether the node has the data locally and updating the data; then calculating the corresponding time and the corresponding data value through a difference algorithm to complete data recording; then broadcasting the data to the whole network to enter a rollback state and stop receiving requests for the data, merging and calculating the value when the data rollback request was initiated based on the change difference of the data, and starting to roll back the data after retrieving the legitimacy of the data; finally, after the data is rolled back, starting to clear the environment that exceeds the rollback time point and broadcasting the data to restore to normal, and starting to receive data processing normally. The present invention also proposes a difference rollback system for blockchain, comprising a data manager, a difference manager and a rollback manager, which realizes a fast, lightweight data rollback function without an infinite loop.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular to a difference fallback method and system for blockchain. Background Art

[0002] Blockchain is an important infrastructure in the credit era. This infrastructure will carry various activities of people. Although most of them are honest activities, in actual applications there will always be some abnormal activities due to operational errors, deliberate crossing of boundaries, or deliberate disruption. These activities may bring additional consumption to the blockchain infrastructure. Since the basic characteristics of blockchain are that data is safe and reliable and cannot be tampered with or forged, the data generated by abnormal activities will not be accepted by the blockchain.

[0003] However, although the original intention of blockchain design is not to accept abnormal data, and the code implementation is also based on this standard, in the specific implementation process, this "non-acceptance" treatment method may bring negative effects, and even affect the stability of the entire blockchain infrastructure. For example, in the accounting blockchain, since the nodes are constantly calculating accounts through transactions, when an accounting error occurs or a data error is found in the middle of a block calculation, the account may need to be restored. At this time, the common solution is transaction reverse calculation, but this will introduce a new problem, that is, how to recover if an error occurs during the transaction reverse calculation process? This is an endless dead loop and is not a practical and effective solution; in some solutions, the method of establishing key points will be adopted, and when the account needs to be restored, it will be directly restored to the key point, but this method has a premise that there must be a sufficient number of key points, otherwise it cannot be guaranteed that it can be restored to any time point in the past. At the same time, because the creation of key points consumes a lot of time and storage space, only a small number of key points will be retained in actual applications, which severely limits the recovery scenario of the account. So, how to ensure recovery to any point in the past without falling into an endless rollback loop and without consuming a lot of processing time and storage space has become an urgent problem to be solved. Summary of the invention

[0004] The present invention aims to propose a difference rollback method and system for blockchain, which solves the problem that rollback requires a long time of reconstruction when data errors occur in blockchain, solves the problem of huge extra processing time and storage space consumed in blockchain to ensure data rollback, and realizes a fast, lightweight data rollback function without infinite loop.

[0005] A difference fallback method for blockchain, including recording data and fallback data, the difference fallback method comprising:

[0006] S1. Start the node. When the node receives data, it verifies the legitimacy of the data. If the data is illegal, it is discarded. If the data is legal, it enters the next stage.

[0007] S2, query whether the node has the data locally, if not, add the data locally and record the time of adding, if the data exists, update the data and record the update time;

[0008] S3. Calculate the value of the corresponding time and the corresponding data by using a difference algorithm. If the value does not exist, add a new value. If the value exists, update the value and write the latest value to the specified location to complete data recording.

[0009] S4. When the data is allowed to be rolled back, broadcast the data to the entire network to enter the rollback state and stop receiving requests for the data. The value when the data rollback request was initiated is calculated based on the change difference of the data, and the data legitimacy is retrieved before rolling back the data.

[0010] S5. After the data is rolled back, the environment that exceeds the rollback time point is cleared and the broadcast data is restored to normal, and normal data reception and processing begins.

[0011] Furthermore, the data verification process includes chain column model verification and chain link model verification.

[0012] The chain column model verification is to verify the accuracy of the unique identification code of the last lock of the chain column, and then verify the accuracy of the unique characteristic code of the lock on the chain column stem in sequence;

[0013] The chain link model verification is to verify the accuracy of the unique identification code of the chain link lock; the unique identification code of the lock is generated by the unique identification codes of the first record and the last record.

[0014] Furthermore, the data rollback process includes: first extracting the change history and change difference of the data, then using a difference algorithm to combine and calculate the value of the corresponding data when the rollback data is initiated, and finally checking the legitimacy of the data under the corresponding value.

[0015] The present invention extends the above method and proposes a difference rollback system for blockchain, the system comprising:

[0016] Data Manager: used to manage business data, including various types of data under different conditions of blockchain application scenarios;

[0017] Difference Manager: used to manage the historical changes of data on the timeline. When the data changes, the difference is calculated based on the recorded information.

[0018] Rollback Manager: It is used to manage data rollback. When data rollback occurs, it calculates the data at the time when the rollback data was initiated through the difference data, and sets the calculated data as the data at a specified time point in the past.

[0019] In this system, when the data manager receives data, it verifies the legitimacy of the data. If the data is not available locally, the difference manager records the time when the data occurred and the difference corresponding to the data at that time. When the system needs to roll back the data, the rollback manager checks whether the data allows rollback. When the data allows rollback, the difference manager checks the historical difference records and notifies each component in the system to enter the rollback state. The data manager stops receiving data requests, and the difference manager extracts and calculates the change difference of the corresponding data. The rollback manager performs data rollback. The data manager, difference manager, and rollback manager are cross-meshed and can access data from each other.

[0020] Furthermore, the difference manager includes:

[0021] Time recording module: used to record the time when data changes, obtain the changed data, and cooperate with the difference recording module to record the specific changes;

[0022] Difference recording module: used to cooperate with the time recording module to record specific change records;

[0023] Difference calculation module: When rolling back data, the rollback timeline is found through the difference calculation module, and the difference recorded in the rollback timeline is extracted, and then the value of the rollback point is calculated and merged, and the final calculated value is returned to the rollback manager for use.

[0024] Furthermore, the data manager includes:

[0025] Data storage module: used to store data and updated data;

[0026] Data writing module: When data writing is required, the data writing module calls the difference recording module in the difference manager to record the first difference change and writes data according to the change;

[0027] Data deletion module: Delete the value according to the data changes recorded by the difference record module. The old data is recorded as deleted in the difference record.

[0028] The data storage module, data writing module and data deletion module work in coordination with each other during the process of adding, deleting and modifying.

[0029] Furthermore, the rollback manager includes:

[0030] State management module: used to notify the system that it will enter the data rollback state, and each component stops processing the data to be rolled back, and is responsible for completing the preparatory work for the data rollback operation;

[0031] Data update module: used to send a data rollback calculation request to the difference manager, and the difference manager returns the corresponding data rollback value. When the rollback manager verifies and confirms that it is correct, it starts to execute the data update operation;

[0032] Environment cleanup module: When the data update module completes the data update, it notifies the environment cleanup module to perform the environment cleanup operation and switch the environment of the system application to the rollback time point to ensure that the data environment has been rolled back to the value at that time.

[0033] The present invention reversely calculates the data at a specified rollback time point through a difference algorithm, and completes the data recording and data rollback operations through a combination of a data manager, a difference manager, and a rollback manager, thereby simplifying the data rollback operation process, greatly reducing the computing power and time consumed by the system, and realizing a fast, lightweight, and infinitely loop-free data rollback effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 This is a flow chart of the difference fallback method for blockchain mentioned in the present invention;

[0035] Figure 2 It is a schematic diagram of the composition of the difference fallback system for blockchain mentioned in the present invention;

[0036] Figure 3 It is a schematic diagram of the composition of the data manager mentioned in the present invention;

[0037] Figure 4 It is a schematic diagram of the composition of the difference manager mentioned in the present invention;

[0038] Figure 5 The following is a schematic diagram of the composition of the rollback manager mentioned in the present invention.

[0039] Wherein: 100 data manager; 200 difference manager; 300 rollback manager; 101 data storage module; 102 data writing module; 103 data deletion module; 201 time recording module; 202 difference recording module; 203 difference calculation module; 301 state management module; 302 data update module; 303 environment cleaning module DETAILED DESCRIPTION

[0040] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0041] like Figure 1 As shown, in order to avoid falling into a rollback dead loop, ensure recovery to any time point in the past, and not consume a lot of processing time and storage space, the present invention uses a difference algorithm to reversely calculate the data at the specified time.

[0042] To achieve this goal, the data difference back-off process includes:

[0043] S1. Start the node. When the node receives data, it verifies the legitimacy of the data. If the data is illegal, it is discarded. If the data is legal, it enters the next stage.

[0044] Blockchain data is highly iterative, and the previous data and the next data are closely related to each other to a certain extent. In the present invention, the chain column and chain ring models are preferably used for data verification, and the concept of unique feature code is introduced.

[0045] The chain column model verification is to verify the accuracy of the unique identification code of the last lock of the chain column, and then verify the accuracy of the unique characteristic code of the lock on the chain column stem in sequence;

[0046] The chain link model verification is to verify the accuracy of the unique identification code of the chain link lock; the unique identification code of the lock is generated by the unique identification codes of the first record and the last record.

[0047] S2, query whether the node has the data locally, if not, add the data locally and record the time of adding, if the data exists, update the data and record the update time;

[0048] S3. Calculate the value of the corresponding time and the corresponding data by using a difference algorithm. If the value does not exist, add a new value. If the value exists, update the value and write the latest value to the specified location to complete data recording.

[0049] S4. When the data is allowed to be rolled back, broadcast the data to the entire network to enter the rollback state and stop receiving requests for the data. The value when the data rollback request was initiated is calculated based on the change difference of the data, and the data legitimacy is retrieved before rolling back the data.

[0050] The process of data rollback includes: first extracting the change history and change difference of the data, then using the difference algorithm to merge and calculate the value of the corresponding data when the rollback data was initiated, and finally checking the legitimacy of the data under the corresponding value.

[0051] S5. After the data is rolled back, the environment that exceeds the rollback time point is cleared and the broadcast data is restored to normal, and normal data reception and processing begins.

[0052] Through the above-mentioned S1-S5 operations, the entire process from recording data to rolling back data is completed, and the environment of the entire application is switched to the specified time point of data rollback to ensure that the relevant environment of the corresponding data has rolled back to the value at that time.

[0053] like Figure 2-5 As shown, the present invention extends on this basis and proposes a difference rollback system for blockchain, which includes a data manager 100, a difference manager 200 and a rollback manager 300.

[0054] The data manager 100 further includes a data storage module 101, a data writing module 102 and a data deletion module 103. These three modules work together in the process of adding, deleting and modifying data. The usage and functions of these three modules are as follows:

[0055] Data storage module 101: used to store data and updated data;

[0056] Data writing module 102: When data writing is required, the data writing module 102 calls the difference recording module 202 in the difference manager 200 to record the first difference change and write data according to the change. Because it is the first difference change record, the record corresponding to the old data is empty at this time, and the difference is equal to the new data. Data addition and data modification belong to the same logical writing method, except that the old data is set to the previous data, and other operation links are consistent;

[0057] The data deletion module 103 performs a deletion operation according to the data changes recorded by the difference recording module 202, and the old data is recorded as deleted in the difference record.

[0058] The difference manager 200 further includes a time recording module 201, a difference recording module 202 and a difference calculation module 203. The usage and functions of these three modules are as follows:

[0059] Time recording module 201: used to record the time when data changes, obtain the changed data, and cooperate with difference recording module 202 to record the specific changes;

[0060] Difference recording module 202: used to cooperate with time recording module 201 to record specific change records;

[0061] Difference calculation module 203: When rolling back data, the rollback timeline is found through the difference calculation module 203, and the difference recorded in the rollback timeline is extracted, and then the value of the rollback point is calculated and combined, and the final calculated value is returned to the rollback manager 300 for use.

[0062] The rollback manager 300 further includes a state management module 301, a data update module 302, and an environment cleanup module 303. These three modules will cooperate with each other when data rollback is required. Their uses and functions specifically include:

[0063] State management module 301: used to notify the system that it will enter the data rollback state, and each component stops processing the data to be rolled back, and does not request the data manager 100 for the data or send data related to the data. When there is relevant data sent from the outside, it will enter the buffer and wait until the rollback manager 300 completes the rollback operation and notifies all components that the data is back to normal. It is responsible for completing the preparatory work for the data rollback operation;

[0064] Data update module 302: used to send a data rollback calculation request to the difference manager 200, and the difference manager 200 returns the corresponding data rollback value. When the rollback manager 300 verifies and confirms that it is correct, it starts to execute the data update operation;

[0065] The data update operation is consistent with the operation of the data writing module 102 in the data manager 100. It is listed separately in the present invention because the data writing module 102 is only used for processing in data rollback, which is convenient for tracking and troubleshooting problems to avoid falling into an infinite loop of data rollback.

[0066] Environment cleaning module 303: When the data writing module 102 completes the data update, it notifies the environment cleaning module 303 to perform the environment cleaning operation, switching the system application environment to the rollback time point to ensure that the data environment has been rolled back to the value at that time.

[0067] In this system, when the data manager 100 receives data, it verifies the validity of the data. If the data is not available locally, the difference manager 200 records the time when the data occurred and the difference corresponding to the data at that time. When the system needs to roll back the data, the rollback manager 300 checks whether the data allows rollback. When the data allows rollback, the difference manager 200 checks the historical difference records and notifies each component in the system to enter the rollback state. The data manager 100 stops receiving data requests, and the difference manager 200 extracts and calculates the change difference of the corresponding data. The rollback manager 300 performs data rollback. The data manager 100, the difference manager 200, and the rollback manager 300 are cross-meshed and can access data from each other.

[0068] The above description is only a preferred embodiment of the present invention and does not limit the technical scope of the present invention. Therefore, any changes or modifications made according to the claims and description of the present invention should fall within the scope of the patent of the present invention.

Claims

1. A difference fallback method for blockchain, comprising recording data and fallback data, characterized in that: The difference backoff method comprises: S1. Start the node. When the node receives data, it verifies the legitimacy of the data. If the data is illegal, it is discarded. If the data is legal, it enters the next stage. The data verification process includes chain column model verification and chain link model verification. The chain column model verification is to verify the accuracy of the unique identification code of the last lock of the chain column, and then verify the accuracy of the unique characteristic code of the lock on the chain column stem in sequence; The chain link model verification is to verify the accuracy of the unique identification code of the chain link lock; the unique identification code of the lock is generated by the unique identification codes of the first record and the last record; S2, query whether the node has the data locally, if not, add the data locally and record the time of adding, if the data exists, update the data and record the update time; S3. Calculate the value of the corresponding time and the corresponding data by using a difference algorithm. If the value does not exist, add a new value. If the value exists, update the value and write the latest value to the specified location to complete data recording. S4. When the data is allowed to be rolled back, broadcast the data to the entire network to enter the rollback state and stop receiving requests for the data, calculate the value when the data rollback request was initiated based on the change difference of the data, and start rolling back the data after retrieving the legitimacy of the data; S5. After the data is rolled back, the environment that exceeds the rollback time point is cleared and the broadcast data is restored to normal, and normal data reception and processing begins.

2. A difference fallback method for blockchain according to claim 1, characterized in that: The data rollback process includes: first extracting the change history and change difference of the data, then using a difference algorithm to combine and calculate the value of the corresponding data when the rollback data is initiated, and finally checking the legitimacy of the data under the corresponding value.

3. A difference rollback system for blockchain implementing the method as claimed in claim 1, characterized in that: The system comprises: Data Manager: used to manage business data, including various types of data under different conditions of blockchain application scenarios; Difference Manager: used to manage the historical changes of data on the timeline. When the data changes, the difference is calculated based on the recorded information. Rollback Manager: It is used to manage data rollback. When data rollback occurs, it calculates the data at the time when the rollback data was initiated through the difference data, and sets the calculated data as the data at a specified time point in the past. In this system, when the data manager receives data, it verifies the legitimacy of the data. If the data is not available locally, the difference manager records the time when the data occurred and the difference corresponding to the data at that time. When the system needs to roll back the data, the rollback manager checks whether the data allows rollback. When the data allows rollback, the difference manager checks the historical difference records and notifies each component in the system to enter the rollback state. The data manager stops receiving data requests, and the difference manager extracts and calculates the change difference of the corresponding data. The rollback manager performs data rollback. The data manager, difference manager, and rollback manager are cross-meshed and access data to each other.

4. A difference rollback system for blockchain according to claim 3, characterized in that: The difference manager comprises: Time recording module: used to record the time when data changes, obtain the changed data, and cooperate with the difference recording module to record the specific changes; Difference recording module: used to cooperate with the time recording module to record specific change records; Difference calculation module: When rolling back data, the rollback timeline is found through the difference calculation module, and the difference recorded in the rollback timeline is extracted, and then the value of the rollback point is calculated and merged, and the final calculated value is returned to the rollback manager for use.

5. A difference rollback system for blockchain according to claim 3, characterized in that: The data manager comprises: Data storage module: used to store data and updated data; Data writing module: When data writing is required, the data writing module calls the difference recording module in the difference manager to record the first difference change and writes data according to the change; Data deletion module: Delete the value according to the data changes recorded by the difference record module. The old data is recorded as deleted in the difference record. The data storage module, data writing module and data deletion module work in coordination with each other during the process of adding, deleting and modifying.

6. A difference rollback system for blockchain according to claim 3, characterized in that: The rollback manager includes: State management module: used to notify the system that it will enter the data rollback state, and each component stops processing the data to be rolled back, and is responsible for completing the preparatory work for the data rollback operation; Data update module: used to send a data rollback calculation request to the difference manager, and the difference manager returns the corresponding data rollback value. When the rollback manager verifies and confirms that it is correct, it starts to execute the data update operation; Environment cleanup module: When the data update module completes the data update, it notifies the environment cleanup module to perform the environment cleanup operation and switch the environment of the system application to the rollback time point to ensure that the data environment has been rolled back to the value at that time.

Citation Information

Patent Citations

  • Liquidation method and system for supporting partial returning

    CN106327332A

  • Database write-in method and system based on block chain network

    CN106611061A

  • Cross-chain relay platform-based cross-chain method and system

    CN108269190A

  • Graph data processing method and graph data calculation task distribution method

    CN108683738A

  • Block generation method and device, verification method and device, equipment and storage medium

    CN108960797A