Heterogeneous block chain upgrading method and system based on data archiving service

By using data archiving services in the blockchain system, obtaining and archiving block information and contract status, and constructing new creation blocks, solving the problem that new nodes cannot synchronize historical blocks and compatible with historical transaction data in heterogeneous blockchain upgrades. The problem of this has achieved smooth upgrade and compatibility of the blockchain system.

CN118885191APending Publication Date: 2024-11-01LINGSHU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410910014.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-09
Publication Date
2024-11-01

AI Technical Summary

Technical Problem

During the heterogeneous upgrade of the blockchain system, new nodes cannot synchronize historical blocks and cannot be compatible with historical transaction data, and the existing technology fails to provide an effective solution.

Method used

Through a data archiving service method, the block height and hash information of the last block on the chain to be upgraded are obtained, the block information and contract status information are archived to the archive server, the information of the new chain is configured, and a new creation is constructed World block, ensure that the new chain can start from any block as a world block, and solve the problem of the historical block being out of synchronization.

Benefits of technology

The smooth upgrade of heterogeneous blockchain has been achieved, avoiding the upgrade failure caused by the abnormal synchronization of historical blocks, and ensuring that the new chain can be compatible with historical transaction data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885191A_ABST
    Figure CN118885191A_ABST
Patent Text Reader

Abstract

The invention discloses a heterogeneous block chain upgrading method and system based on a data archiving service. The method comprises the steps that the block height n of the last block needing to be upgraded is obtained on a chain to be upgraded, and hash information of the block n is obtained; archiving the block information on the chain to be upgraded into an archiving server; wherein the block information is block information from the creation block to the nth block; the contract state information and the configuration information meeting the same storage form are archived to the archiving server through an archiving interface; configuring information of a new chain, wherein the information of the new chain comprises the block height n of the last block on the chain of the node to be upgraded and the hash information of the nth block; starting a new chain, and constructing a new creation block; and operating the new chain. The block chain is designed to be a creation block from any block. By means of the method, the heterogeneous block chain can be upgraded very smoothly, and upgrading failure caused by the problem that historical blocks are not synchronous is avoided.
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 heterogeneous blockchain upgrade method and system based on data archiving services. Background Art

[0002] Due to the characteristics of blockchain, the data on the chain cannot be modified. Therefore, in the process of designing or optimizing the blockchain system, the adjustment of processing logic usually leads to incompatibility between versions, so some compromises have to be made in the optimization process. The consequences of these compromises are undoubtedly negative, and the quality of the code cannot be improved, which makes subsequent maintenance difficult. At the same time, we also found in the process of modifying some problems that because the logic of the previous and next versions was fine-tuned, even if only the position of the error code returned changed, it would cause a series of hash inconsistencies, resulting in problems such as the inability of the new node to synchronize historical blocks.

[0003] In blockchain data, the genesis block is generally the zeroth block, and new data begins to be generated based on the genesis block. For heterogeneous blockchain upgrades, historical transaction data is not compatible.

[0004] There is currently no effective solution to the problem that when upgrading heterogeneous blockchains in the existing technology, new nodes cannot synchronize historical blocks and are not compatible with historical transaction data. Summary of the invention

[0005] The embodiment of the present invention provides a heterogeneous blockchain upgrade method and system based on data archiving service to solve the problem in the prior art that when a heterogeneous blockchain is upgraded, a new node cannot synchronize historical blocks and cannot be compatible with historical transaction data.

[0006] To achieve the above-mentioned purpose, on the one hand, the present invention provides a heterogeneous blockchain upgrade method based on data archiving service, the method comprising: S1, obtaining the block height n of the last block to be upgraded on the chain to be upgraded, and obtaining the hash information of the block n; S2, archiving the block information on the chain to be upgraded to the archive server; wherein the block information is the block information from the genesis block to the nth block; S3, archiving the contract status information and configuration information that meet the same storage form to the archive server through the archive interface; S4, configuring the information of the new chain, the information of the new chain includes the block height n of the last block on the chain of the node to be upgraded and the hash information of the nth block; S5, starting the new chain and constructing a new genesis block; S6, running the new chain.

[0007] Optionally, if different nodes can share the same archive server, when the old node performs a heterogeneous blockchain upgrade and archives the block information to the archive server, when the new node joins to perform the heterogeneous blockchain upgrade, the archive server of the new node is directly configured as the existing archive server; the parameters of the new node are configured, and the parameters of the new node include the block height n of the last block that has been archived and the hash information of the nth block; the new node is started and a new genesis block is constructed; and the new block data is synchronized to other nodes.

[0008] Optionally, if different nodes do not share the same archive server, after the old node performs a heterogeneous blockchain upgrade and archives the block information to the archive server, when the new node joins to perform a heterogeneous blockchain upgrade, the new node synchronizes the block data from the existing archive server; and generates block and contract status information based on the block data; and repeats S1 to S6 to complete the heterogeneous blockchain upgrade of the new node.

[0009] Optionally, after S6, it also includes: accepting a transaction request sent by a user in the new chain, and querying the contract status information locally. If the contract status information is not found, querying the archive server for relevant information through the contract address and caching it in the new chain according to new rules; if the contract status information is not found in the archive server, creating a new contract according to the logic of the new chain or returning a transaction failure.

[0010] Optionally, the same storage format is a key-value pair storage format.

[0011] On the other hand, the present invention provides a heterogeneous blockchain upgrade system based on data archiving service, the system comprising: an acquisition unit, used to obtain the block height n of the last block to be upgraded on the chain to be upgraded, and obtain the hash information of the block n; a first archiving unit, used to archive the block information on the chain to be upgraded to an archiving server; wherein the block information is the block information from the genesis block to the nth block; a second archiving unit, used to archive the contract status information and configuration information that meet the same storage form to the archiving server through an archiving interface; a configuration unit, used to configure the information of the new chain, the information of the new chain including the block height n of the last block on the chain of the node to be upgraded and the hash information of the nth block; a startup unit, used to start the new chain and construct a new genesis block; and a running unit, used to run the new chain.

[0012] Optionally, if different nodes can share the same archive server, when the old node performs a heterogeneous blockchain upgrade and archives the block information to the archive server, when the new node joins to perform the heterogeneous blockchain upgrade, the archive server of the new node is directly configured as the existing archive server; the parameters of the new node are configured, and the parameters of the new node include the block height n of the last block that has been archived and the hash information of the nth block; the new node is started and a new genesis block is constructed; and the new block data is synchronized to other nodes.

[0013] Optionally, if different nodes do not share the same archive server, after the old node performs a heterogeneous blockchain upgrade and archives the block information to the archive server, when the new node joins to perform the heterogeneous blockchain upgrade, the new node synchronizes the block data from the existing archive server; and generates block and contract status information based on the block data; repeats the acquisition unit, the first archive unit, the second archive unit, the configuration unit, the startup unit, and the operation unit to complete the heterogeneous blockchain upgrade of the new node.

[0014] Optionally, a query unit is used to accept transaction requests sent by users in the new chain and query the contract status information locally. If the contract status information is not found, the archive server is queried through the contract address and the relevant information is cached in the new chain according to new rules; if the contract status information is not found in the archive server, a new contract is created according to the logic of the new chain or a transaction failure is returned.

[0015] Optionally, the same storage format is a key-value pair storage format.

[0016] Beneficial effects of the present invention:

[0017] The present invention provides a heterogeneous blockchain upgrade method and system based on data archiving service, wherein the method stores the contract status information and configuration information of the heterogeneous blockchain system in a single storage format; further, the archiving server is designed to archive the contract status information and configuration information; further, the blockchain is designed to start with any block as the genesis block. The method of the present invention can smoothly upgrade heterogeneous blockchains without causing upgrade failures due to the problem of historical block asynchronization. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 It is a flow chart of a heterogeneous blockchain upgrade method based on data archiving service provided by an embodiment of the present invention;

[0019] Figure 2 It is a structural diagram of a heterogeneous blockchain upgrade system based on data archiving service provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0020] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0021] In order to solve the problem in the prior art that new nodes cannot synchronize historical blocks, the applicant analyzed the characteristics of blockchain and the principles of data synchronization. Since only the historical blocks and contract status data need to be read, this read-only data can be stored in a service that only provides read operations to the outside world. In this way, there is no need to re-execute blocks or modify contract status, and thus there is no problem of different execution results due to inconsistent execution logic.

[0022] Therefore, the present invention proposes to store historical block data in an archive server in the form of archives. Currently, the archive server usually only stores block data and does not store contract status data. Therefore, the present invention makes partial targeted adjustments to the archive server to achieve the conditions for supporting heterogeneous blockchain upgrades. At the same time, heterogeneous chains also need to make some adjustments to support this upgrade method.

[0023] In order to solve the problem in the prior art that heterogeneous blockchain upgrades are incompatible with historical transaction data, the present invention proposes to position the genesis block of the new blockchain system as the last block + 1 before the upgrade, that is, the blockchain needs to meet the characteristic that any block can be used as the genesis block.

[0024] Figure 1 is a flow chart of a heterogeneous blockchain upgrade method based on data archiving service provided by an embodiment of the present invention, such as Figure 1 As shown, the method includes:

[0025] S1. Obtain the block height n of the last block to be upgraded on the chain to be upgraded, and obtain the hash information of the block n;

[0026] Specifically, voting is performed on the heterogeneous blockchain (old chain) to be upgraded, the block height n of the last block to be upgraded is obtained, and the hash information of the block n is obtained; assuming that there are 900 blocks on the heterogeneous blockchain, and the upgrade is performed when the number of blocks reaches 1000, the heterogeneous blockchain (old chain) to be upgraded stops producing blocks when the number of blocks reaches 1000, and the heterogeneous blockchain (old chain) is upgraded.

[0027] S2. Archiving the block information on the chain to be upgraded to the archiving server; wherein the block information is the block information from the genesis block to the nth block;

[0028] Specifically, the archive server is started to archive the block information of the heterogeneous blockchain (old chain) to be upgraded from the genesis block to the nth block.

[0029] S3. Archiving the contract status information and configuration information that meet the same storage form to the archiving server through the archiving interface;

[0030] Specifically, the same storage form is a key-value pair storage form (ie, key-value storage form); the configuration information includes: system configuration information and consensus configuration information.

[0031] The contract status information, configuration information and other key-value storage data are archived to the archive server through the archive interface.

[0032] S4. Configure the information of the new chain, where the information of the new chain includes the block height n of the last block on the chain of the node to be upgraded and the hash information of the nth block;

[0033] Specifically, the information of the new chain includes: block height 1000, hash information of the 1000th block.

[0034] S5. Start a new chain and construct a new genesis block;

[0035] Specifically, a new genesis block will be constructed based on the hash information of the 1000th block and the block height 1000 before the upgrade. That is, the 1001th block will be the new genesis block, and blocks smaller than this block need to access the archive server through the chain.

[0036] S6. Run the new chain.

[0037] Run the new chain to ensure it can process new transactions and block generation.

[0038] After S6, the method further includes:

[0039] The new chain accepts transaction requests sent by users and queries the contract status information locally. If the contract is not found, the contract address is used to query the archive server for relevant information and cache it in the new chain according to the new rules. The contract will no longer need to access the archive server in the future. If the contract is not found in the archive server, a new contract is created according to the logic of the new chain or the transaction failure is returned.

[0040] For the new node joining process:

[0041] (1) If different nodes can share the same archive server:

[0042] When the old node upgrades the heterogeneous blockchain and archives the block information to the archive server, when the new node joins the heterogeneous blockchain upgrade, the archive server of the new node is directly configured as the existing archive server; the archive server of the new node contains the data that needs to be synchronized;

[0043] For example: after node A is upgraded, the block data of blocks 0-1000 are archived to the archive server of node A. If node B is newly added, it can directly use the archive server of node A; that is, directly configure the archive server of node B as the archive server of node A, and configure the parameters of node B, including the block height n (1000) of the last archived block and the hash information of the nth (1000) block;

[0044] Start a new node and construct a new genesis block;

[0045] Specifically, a new genesis block is constructed according to the block height n (1000) of the last archived block and the hash information of the nth (1000) block, and the new genesis block is block 1001.

[0046] Synchronize new block data to other nodes.

[0047] Specifically, synchronize new block data to other nodes on the current new chain.

[0048] (2) If different nodes do not share the same archive server:

[0049] After the old node performs a heterogeneous blockchain upgrade and archives the block information to the archive server, when the new node joins the heterogeneous blockchain upgrade, the new node synchronizes the block data from the existing archive server; and regenerates the block and contract status information based on the block data; that is, obtains the block data of the blockchain from the archive server; rebuilds the blocks one by one, and calculates the hash value of each block to verify the data consistency (that is, by comparing the hash value of the newly generated block with the hash value of the block in the archive server, ensure that the newly generated block is consistent with the block in the archive server); regenerates the global state of the blockchain based on all blocks and the hash value of each block.

[0050] Repeat S1 to S6 to complete the heterogeneous blockchain upgrade of the new node.

[0051] For example: after node A is upgraded, the block data of blocks 0-1000 are archived to the archive server of node A. Node B is newly added, and node B synchronizes the block data from the archive server of node A; and regenerates the blockchain based on the block data; repeat S1 to S6 to complete the heterogeneous blockchain upgrade of node B.

[0052] Figure 2A heterogeneous blockchain upgrade system based on data archiving service is provided in an embodiment of the present invention. Figure 2 As shown, the system includes:

[0053] The acquisition unit 201 is used to obtain the block height n of the last block to be upgraded on the chain to be upgraded, and obtain the hash information of the block n;

[0054] The first archiving unit 202 is used to archive the block information on the chain to be upgraded to the archiving server; wherein the block information is the block information from the genesis block to the nth block;

[0055] The second archiving unit 203 is used to archive the contract status information and configuration information that meet the same storage form to the archiving server through the archiving interface;

[0056] The same storage format is a key-value pair storage format.

[0057] A configuration unit 204 is used to configure information of a new chain, wherein the information of the new chain includes the block height n of the last block on the chain of the node to be upgraded and the hash information of the nth block;

[0058] The startup unit 205 is used to start a new chain and construct a new genesis block;

[0059] The running unit 206 is used to run the new chain.

[0060] A heterogeneous blockchain upgrade system based on data archiving service also includes: a query unit, which is used to accept transaction requests sent by users in a new chain and query contract status information locally. If no contract status information is found, the contract address is used to query the archive server for relevant information and cache it in the new chain according to new rules; if no contract status information is found in the archive server, a new contract is created according to the logic of the new chain or a transaction failure is returned.

[0061] When a new node joins:

[0062] (1) If different nodes can share the same archive server:

[0063] When the old node upgrades the heterogeneous blockchain and archives the block information to the archive server, when the new node joins to upgrade the heterogeneous blockchain, the archive server of the new node is directly configured as the existing archive server;

[0064] Configure the parameters of the new node, wherein the parameters of the new node include the block height n of the last archived block and the hash information of the nth block;

[0065] Start a new node and construct a new genesis block;

[0066] Synchronize new block data to other nodes.

[0067] (2) If different nodes do not share the same archive server:

[0068] When the old node upgrades the heterogeneous blockchain and archives the block information to the archive server, when the new node joins the heterogeneous blockchain upgrade, the new node synchronizes the block data from the existing archive server; and generates block and contract status information based on the block data;

[0069] Repeat the acquisition unit, the first archiving unit, the second archiving unit, the configuration unit, the startup unit, and the operation unit to complete the heterogeneous blockchain upgrade of the new node.

[0070] Beneficial effects of the present invention:

[0071] The present invention provides a heterogeneous blockchain upgrade method and system based on data archiving service, wherein the method stores the contract status information and configuration information of the heterogeneous blockchain system in a single storage format; further, the archiving server is designed to archive the contract status information and configuration information; further, the blockchain is designed to start with any block as the genesis block. The method of the present invention can smoothly upgrade heterogeneous blockchains without causing upgrade failures due to the problem of historical block asynchronization.

[0072] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A heterogeneous blockchain upgrade method based on data archiving service, It is characterized in that include: S1. Obtain the block height n of the last block to be upgraded on the chain to be upgraded, and obtain the hash information of the block n; S2. Archiving the block information on the chain to be upgraded to the archiving server; wherein the block information is the block information from the genesis block to the nth block; S3. Archiving the contract status information and configuration information that meet the same storage form to the archiving server through the archiving interface; S4. Configure the information of the new chain, where the information of the new chain includes the block height n of the last block on the chain of the node to be upgraded and the hash information of the nth block; S5. Start a new chain and construct a new genesis block; S6. Run the new chain.

2. The method according to claim 1, Features: If different nodes can share the same archive server, when the old node performs a heterogeneous blockchain upgrade and archives the block information to the archive server, when a new node joins to perform a heterogeneous blockchain upgrade, the archive server of the new node is directly configured as the existing archive server; Configure the parameters of the new node, wherein the parameters of the new node include the block height n of the last archived block and the hash information of the nth block; Start a new node and construct a new genesis block; Synchronize new block data to other nodes.

3. The method according to claim 1, Features: If different nodes do not share the same archive server, when the old node performs a heterogeneous blockchain upgrade and archives the block information to the archive server, when the new node joins the heterogeneous blockchain upgrade, the new node synchronizes the block data from the existing archive server; And generate block and contract status information based on block data; Repeat S1 to S6 to complete the heterogeneous blockchain upgrade of the new node.

4. The method according to claim 1, It is characterized in that After S6, the method further includes: The transaction request sent by the user is accepted in the new chain, and the contract status information is queried locally. If the contract status information is not found, the relevant information is queried in the archive server through the contract address and cached in the new chain according to the new rules; if the contract is not found in the archive server, a new contract is created according to the logic of the new chain or the transaction failure is returned.

5. The method according to claim 1, Features: The same storage format is a key-value pair storage format.

6. A heterogeneous blockchain upgrade system based on data archiving services, It is characterized in that include: An acquisition unit, used to acquire the block height n of the last block to be upgraded on the chain to be upgraded, and acquire the hash information of the block n; A first archiving unit, used to archive the block information on the chain to be upgraded to an archiving server; wherein the block information is the block information from the genesis block to the nth block; A second archiving unit, used to archive the contract status information and configuration information that meet the same storage form to the archiving server through an archiving interface; A configuration unit, used to configure the information of the new chain, wherein the information of the new chain includes the block height n of the last block on the chain of the node to be upgraded and the hash information of the nth block; The startup unit is used to start a new chain and construct a new genesis block; Run unit, used to run the new chain.

7. The system according to claim 6, Features: If different nodes can share the same archive server, when the old node performs a heterogeneous blockchain upgrade and archives the block information to the archive server, when a new node joins to perform a heterogeneous blockchain upgrade, the archive server of the new node is directly configured as the existing archive server; Configure the parameters of the new node, wherein the parameters of the new node include the block height n of the last archived block and the hash information of the nth block; Start a new node and construct a new genesis block; Synchronize new block data to other nodes.

8. The system according to claim 6, Features: If different nodes do not share the same archive server, when the old node performs a heterogeneous blockchain upgrade and archives the block information to the archive server, when the new node joins the heterogeneous blockchain upgrade, the new node synchronizes the block data from the existing archive server; and generates block and contract status information based on the block data; Repeat the acquisition unit, the first archiving unit, the second archiving unit, the configuration unit, the startup unit, and the operation unit to complete the heterogeneous blockchain upgrade of the new node.

9. The system according to claim 6, It is characterized in that Also includes: The query unit is used to accept transaction requests sent by users in the new chain and query the contract status information locally. If no information is found, the archive server is used to query the relevant information through the contract address and cache it in the new chain according to the new rules; If the query is not found in the archive server, a new contract is created according to the logic of the new chain or the transaction failure is returned.

10. The system according to claim 6, Features: The same storage format is a key-value pair storage format.