CN110210845B - Method, apparatus, medium, and computing device for blockchain data migration - Google Patents

Method, apparatus, medium, and computing device for blockchain data migration Download PDF

Info

Publication number
CN110210845B
CN110210845B CN201910503915.7A CN201910503915A CN110210845B CN 110210845 B CN110210845 B CN 110210845B CN 201910503915 A CN201910503915 A CN 201910503915A CN 110210845 B CN110210845 B CN 110210845B
Authority
CN
China
Prior art keywords
blockchain system
transaction
intelligent contract
user state
transaction information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910503915.7A
Other languages
Chinese (zh)
Other versions
CN110210845A (en
Inventor
王挺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN201910503915.7A priority Critical patent/CN110210845B/en
Publication of CN110210845A publication Critical patent/CN110210845A/en
Application granted granted Critical
Publication of CN110210845B publication Critical patent/CN110210845B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/04Payment circuits
    • G06Q20/06Private payment circuits, e.g. involving electronic currency used among participants of a common payment scheme
    • G06Q20/065Private payment circuits, e.g. involving electronic currency used among participants of a common payment scheme using e-cash
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • Theoretical Computer Science (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Technology Law (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a method for block chain data migration, which comprises the following steps: terminating a transaction corresponding to at least one intelligent contract in the first blockchain system based on first transaction information, and deriving user state data corresponding to the at least one intelligent contract in the first blockchain system; deploying the at least one intelligent contract in the second blockchain system based on second transaction information and importing the user state data to the second blockchain system; and starting a transaction corresponding to the at least one intelligent contract in the second blockchain system based on third transaction information. Wherein the user status data is user status information corresponding to the at least one intelligent contract in the first blockchain system when the transaction corresponding to the at least one intelligent contract in the first blockchain system is terminated. The embodiment of the invention also provides a device, a medium and a computing device for block chain data migration.

Description

Method, apparatus, medium, and computing device for blockchain data migration
Technical Field
The embodiment of the invention relates to the technical field of Internet, in particular to a method, a device, a medium and a computing device for block chain data migration.
Background
This section is intended to provide a background or context to the embodiments of the invention that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
In the existing blockchain technology, whether a public chain or a alliance chain, all transactions fall on each blockchain node. The block link points are usually stored in an mpt (media Patricia tree) data structure. The MPT data structure is used to store all transactions, all account data, and all receipts in the blockchain system. In the MPT data structure, data access of one storage node requires multiple disk read and write operations, and each change of each storage node causes one storage node of the MPT data structure to be split into multiple storage nodes. Therefore, as the transaction amount of the blockchain system increases (for example, after the transaction amount reaches billions), the data storage amount of the MPT data structure of each blockchain node increases, and the storage nodes of the MPT data structure also increase greatly, which leads to that the data read/write operation required for executing each transaction becomes complicated, so that the execution speed of the blockchain system decreases greatly, and the error rate of the transactions in the blockchain system occurs at a high frequency.
Disclosure of Invention
In this context, embodiments of the present invention provide a method, an apparatus, a medium, and a system for blockchain data migration, which solve the problems of a blockchain system performance being sharply decreased and an error rate being continuously increased after a transaction amount in the blockchain system is increased, to a certain extent, by performing data migration between two blockchain systems.
In a first aspect of embodiments of the present invention, a method for migrating block chain data is provided, which is applied to a management platform. The method comprises the following steps: sending first transaction information to a first blockchain system to terminate a transaction corresponding to at least one intelligent contract in the first blockchain system; exporting user state data corresponding to the at least one intelligent contract in the first blockchain system to a database, wherein the user state data is user state information corresponding to the at least one intelligent contract in the first blockchain system when a transaction corresponding to the at least one intelligent contract in the first blockchain system is terminated; sending second transaction information to a second blockchain system to deploy the at least one intelligent contract in the second blockchain system; importing the user state data from the database to the second blockchain system; and sending third transaction information to the second blockchain system so that the second blockchain system starts a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user state data.
In an embodiment of the present invention, the sending the first transaction information to the first blockchain system to terminate the transaction corresponding to the at least one intelligent contract in the first blockchain system includes invoking a transaction stopping method corresponding to each intelligent contract in the at least one intelligent contract according to the first transaction information, so as to terminate the transaction corresponding to the intelligent contract corresponding to the transaction stopping method by using the transaction stopping method. In one embodiment of the invention, before the sending the first transaction information to the first blockchain system, the method further comprises setting the stop transaction method in each of the at least one intelligent contract.
In one embodiment of the invention, the first blockchain system and the second blockchain system are independent of each other; or, the first blockchain system is a main chain, and the second blockchain system is a side chain corresponding to the main chain.
In an embodiment of the present invention, when the first blockchain system is a main chain and the second blockchain system is a side chain corresponding to the main chain, after the sending third transaction information to the second blockchain system to make the second blockchain system open a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user status data, the method further includes: sending the first transaction information to the second blockchain system to terminate the transaction corresponding to the at least one intelligent contract in the second blockchain system; exporting second user state data corresponding to the at least one intelligent contract in the second blockchain system to the database, wherein the second user state data is user state information corresponding to the at least one intelligent contract in the second blockchain system when the transaction corresponding to the at least one intelligent contract in the second blockchain system is terminated; importing the second user state data from the database into the first blockchain system to update the user state data in the first blockchain system through the second user state data; and sending the third transaction information to the first blockchain system so that the first blockchain system starts a transaction corresponding to the at least one intelligent contract in the first blockchain system based on the second user state data.
In one embodiment of the invention, the sending the first transaction information to the first blockchain system comprises sending the first transaction information to the first blockchain system through a predetermined blockchain address.
In an embodiment of the present invention, after the sending of the second transaction information to the second blockchain system to deploy the at least one intelligent contract in the second blockchain system, the method further includes setting a starting transaction method for starting a transaction corresponding to the at least one intelligent contract for the second blockchain system.
In an embodiment of the present invention, the sending third transaction information to the second blockchain system to enable the second blockchain system to open a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user state data includes invoking the open transaction method according to the third transaction information to open a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user state data.
In one embodiment of the invention, before said sending the second transaction information to the second blockchain system, the method further comprises checking whether the user status data derived to the database is correct, resulting in a first check result. And sending the second transaction information to the second blockchain system under the condition that the first check result is correct.
In an embodiment of the present invention, before the sending of the third transaction information to the second blockchain system, the method further includes checking whether the user status data imported into the second blockchain system is correct, and obtaining a second checking result. And sending the third transaction information to the second blockchain system under the condition that the second check result is correct.
In a second aspect of the embodiments of the present invention, a method for migrating block chain data is provided, which is applied to a first block chain system. The method comprises the following steps: receiving first transaction information to terminate a transaction corresponding to the at least one intelligent contract; exporting user state data corresponding to the at least one intelligent contract to a database, wherein the user state data is user state information corresponding to the at least one intelligent contract in the first blockchain system when the transaction corresponding to the at least one intelligent contract in the first blockchain system is terminated; wherein the at least one intelligent contract is further deployed in a second blockchain system according to second transaction information; the user state data is also imported into the second blockchain system, so that the second blockchain system starts a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user state data when third transaction information is received. Wherein the first blockchain system is different from the second blockchain system.
In one embodiment of the invention, the receiving first transaction information to terminate the transaction corresponding to the at least one intelligent contract comprises calling a transaction stopping method corresponding to each intelligent contract in the at least one intelligent contract according to the first transaction information; and terminating the transaction corresponding to the intelligent contract corresponding to the transaction stopping method according to the transaction stopping method.
In one embodiment of the invention, prior to the receiving the first transaction information, the method further comprises setting the stop transaction method in each of the at least one intelligent contract.
In an embodiment of the present invention, the first blockchain system is a main chain, the second blockchain system is a side chain corresponding to the main chain, and after the user status data corresponding to the at least one intelligent contract is exported to a database, the method further includes importing second user status data corresponding to the at least one intelligent contract to update the user status data through the second user status data, where the second user status data is user status information corresponding to the at least one intelligent contract in the second blockchain system when the transaction corresponding to the at least one intelligent contract in the second blockchain system is terminated; and receiving third transaction information to open a transaction corresponding to the at least one intelligent contract in the first blockchain system based on the second user state data.
In a third aspect of the embodiments of the present invention, a method for block chain data migration is provided, which is applied to a second block chain system. The method comprises the following steps: receiving second transaction information to deploy the at least one intelligent contract in the second blockchain system, wherein the at least one intelligent contract is also deployed in the first blockchain system; importing user state data corresponding to the at least one intelligent contract from a database, wherein the user state data is user state information corresponding to the at least one intelligent contract in a first blockchain system when the first blockchain system terminates a transaction corresponding to the at least one intelligent contract in the first blockchain system based on first transaction information; the database is also used for importing the user state data from the first blockchain system; wherein the first blockchain system is different from the second blockchain system; and receiving third transaction information to open a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user state data.
In one embodiment of the present invention, after the receiving second transaction information to deploy the at least one intelligent contract in the second blockchain system, the method further includes setting a starting transaction method for starting a transaction corresponding to the at least one intelligent contract for the second blockchain system.
In an embodiment of the present invention, the receiving third transaction information to open a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user state data includes invoking the open transaction method according to the third transaction information, and opening a transaction corresponding to the at least one intelligent contract according to the open transaction method.
In one embodiment of the invention, the first blockchain system and the second blockchain system are independent from each other; or, the first blockchain system is a main chain, and the second blockchain system is a side chain corresponding to the first blockchain system.
In one embodiment of the present invention, when the first blockchain system is a main chain and the second blockchain system is a corresponding side chain of the first blockchain system, after the receiving third transaction information to open a transaction corresponding to the at least one smart contract in the second blockchain system based on the user state data, the method further includes receiving first transaction information to terminate a transaction corresponding to the at least one smart contract in the second blockchain system, and exporting second user state data corresponding to the at least one intelligent contract in the second blockchain system to a database, wherein the second user status data is user status information corresponding to the at least one intelligent contract in the second blockchain system when the transaction corresponding to the at least one intelligent contract in the second blockchain system is terminated. Wherein the second user state data is used to update the user state data in the first blockchain system.
In a fourth aspect of the embodiments of the present invention, an apparatus for migrating block chain data is provided, where the apparatus is disposed on a management platform. The device comprises a first sending module, a first data migration module, a second sending module, a second data migration module and a third sending module. The first sending module is used for sending first transaction information to a first blockchain system so as to terminate a transaction corresponding to at least one intelligent contract in the first blockchain system. The first data migration module is configured to export user status data corresponding to the at least one intelligent contract in the first blockchain system to a database, where the user status data is user status information corresponding to the at least one intelligent contract in the first blockchain system when a transaction corresponding to the at least one intelligent contract in the first blockchain system is terminated. The second sending module is configured to send second transaction information to a second blockchain system, so as to deploy the at least one intelligent contract in the second blockchain system. The second data migration module is configured to import the user state data from the database to the second blockchain system. The third sending module is configured to send third transaction information to the second blockchain system, so that the second blockchain system starts a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user state data.
In an embodiment of the present invention, the first sending module is specifically configured to invoke a trade stopping method corresponding to each intelligent contract in the at least one intelligent contract according to the first trade information, so as to terminate the trade corresponding to the intelligent contract corresponding to the trade stopping method by using the trade stopping method.
In one embodiment of the invention, the apparatus further comprises a stop transaction method setting module. The trade stop method setting module is used for setting the trade stop method in each intelligent contract in the at least one intelligent contract before the first trade information is sent to the first blockchain system.
In one embodiment of the invention, the first blockchain system and the second blockchain system are independent of each other; or, the first blockchain system is a main chain, and the second blockchain system is a side chain corresponding to the main chain.
In an embodiment of the present invention, the first sending module is further configured to, when the first blockchain system is a main chain and the second blockchain system is a side chain corresponding to the main chain, send third transaction information to the second blockchain system after the second blockchain system starts a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user status data, send the first transaction information to the second blockchain system to terminate the transaction corresponding to the at least one intelligent contract in the second blockchain system. The first data migration module is further configured to export second user status data corresponding to the at least one intelligent contract in the second blockchain system to the database, where the second user status data is user status information corresponding to the at least one intelligent contract in the second blockchain system when the transaction corresponding to the at least one intelligent contract in the second blockchain system is terminated. The second data migration module is further configured to import the second user status data from the database into the first blockchain system, so as to update the user status data in the first blockchain system through the second user status data. The third sending module is further configured to send the third transaction information to the first blockchain system, so that the first blockchain system opens a transaction corresponding to the at least one intelligent contract in the first blockchain system based on the second user state data.
In one embodiment of the invention, the sending the first transaction information to the first blockchain system comprises sending the first transaction information to the first blockchain system through a predetermined blockchain address.
In one embodiment of the invention, the device further comprises a start transaction method setting module. The open transaction method setting module is configured to set, after the second transaction information is sent to the second blockchain system to deploy the at least one intelligent contract in the second blockchain system, an open transaction method for opening a transaction corresponding to the at least one intelligent contract for the second blockchain system.
In an embodiment of the present invention, the third sending module is specifically configured to invoke the transaction opening method according to the third transaction information, so as to open a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user state data.
In one embodiment of the invention, the apparatus further comprises a first reconciliation module. The first checking module is used for checking whether the user state data derived from the database is correct or not before the second transaction information is sent to the second blockchain system, so as to obtain a first checking result; the second sending module is specifically configured to send the second transaction information to the second blockchain system when the first check result is correct.
In one embodiment of the invention, the apparatus further comprises a second verification module. The second checking module is configured to check whether the user status data imported into the second blockchain system is correct before the third transaction information is sent to the second blockchain system, so as to obtain a second checking result. The third sending module is specifically configured to send the third transaction information to the second blockchain system when the second check result is correct.
In a fifth aspect of the embodiments of the present invention, an apparatus for blockchain data migration is provided in a first blockchain system. The apparatus includes a first receiving module, and a first data derivation module. The first receiving module is used for receiving first transaction information so as to terminate the transaction corresponding to the at least one intelligent contract. The first data export module is configured to export user status data corresponding to the at least one intelligent contract to a database, where the user status data is user status information corresponding to the at least one intelligent contract in the first blockchain system when a transaction corresponding to the at least one intelligent contract in the first blockchain system is terminated; wherein the at least one intelligent contract is further deployed in a second blockchain system according to second transaction information; the user status data is also imported from the database into the second blockchain system, such that the second blockchain system opens a transaction corresponding to the at least one smart contract in the second blockchain system based on the user status data upon receiving third transaction information. Wherein the first blockchain system is different from the second blockchain system.
In an embodiment of the present invention, the first receiving module is specifically configured to invoke a trade stop method corresponding to each intelligent contract in the at least one intelligent contract according to the first trade information, and terminate a trade corresponding to the intelligent contract corresponding to the trade stop method according to the trade stop method.
In one embodiment of the invention, the apparatus further comprises a stop transaction method setting module. The stop trading method setting module is used for setting the stop trading method in each intelligent contract in the at least one intelligent contract before the first trading information is received.
In one embodiment of the present invention, the apparatus further comprises a first data import module. The first data importing module is configured to import, when the first blockchain system is a main chain and the second blockchain system is a side chain corresponding to the main chain, second user state data corresponding to the at least one intelligent contract after exporting the user state data corresponding to the at least one intelligent contract to a database, so as to update the user state data by using the second user state data, where the second user state data is user state information corresponding to the at least one intelligent contract in the second blockchain system when a transaction corresponding to the at least one intelligent contract in the second blockchain system is terminated. The first receiving module is further configured to receive third transaction information, so as to open a transaction corresponding to the at least one intelligent contract in the first blockchain system based on the second user state data.
In a sixth aspect of the embodiments of the present invention, an apparatus for migrating blockchain data is provided in a second blockchain system. The device comprises a second receiving module and a second data importing module. The second receiving module is configured to receive second transaction information to deploy the at least one intelligent contract in the second blockchain system, wherein the at least one intelligent contract is also deployed in the first blockchain system. The second data import module is configured to import, from the database, user state data corresponding to the at least one intelligent contract, where the user state data is user state information corresponding to the at least one intelligent contract in the first blockchain system when the first blockchain system terminates a transaction corresponding to the at least one intelligent contract in the first blockchain system based on first transaction information; the database is also used for importing the user state data from the first blockchain system; wherein the first blockchain system is different from the second blockchain system. The second receiving module is further configured to receive third transaction information to open a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user state data.
In one embodiment of the invention, the device further comprises a start transaction method setting module. The transaction starting method setting module is configured to set, after the second transaction information is received and the at least one intelligent contract is deployed in the second blockchain system, a transaction starting method for starting a transaction corresponding to the at least one intelligent contract for the second blockchain system.
In an embodiment of the present invention, the receiving third transaction information to open the transaction corresponding to the at least one intelligent contract in the second blockchain system includes invoking the open transaction method according to the third transaction information, and opening the transaction corresponding to the at least one intelligent contract according to the open transaction method.
In one embodiment of the invention, the first blockchain system and the second blockchain system are independent from each other; or, the first blockchain system is a main chain, and the second blockchain system is a side chain corresponding to the first blockchain system.
In one embodiment of the invention, the apparatus further comprises a second data derivation module. The second receiving module is further configured to receive the first transaction information after receiving the third transaction information to start a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user state data when the first blockchain system is a main chain and the second blockchain system is a side chain corresponding to the first blockchain system, so as to terminate the transaction corresponding to the at least one intelligent contract in the second blockchain system. The second data export module is configured to export second user status data corresponding to the at least one intelligent contract in the second blockchain system to a database, where the second user status data is user status information corresponding to the at least one intelligent contract in the second blockchain system when a transaction corresponding to the at least one intelligent contract in the second blockchain system is terminated; wherein the second user state data is used to update the user state data in the first blockchain system.
In a seventh aspect of embodiments of the present invention, there is provided a computer-readable storage medium having stored thereon executable instructions, which when executed by a processor, cause the processor to perform a method for blockchain data migration as provided in the first, second or third aspects of embodiments of the present invention.
In a seventh aspect of embodiments of the present invention, a computing device is provided. The computing device includes one or more memories, and one or more processors. The one or more memories store executable instructions. The one or more processors execute the executable instructions to implement the method for blockchain data migration provided according to the first, second or third aspect of the embodiments of the present invention.
According to the method, the device, the system and the medium for migrating the blockchain data, when data migration is performed between two blockchain systems, only user state data corresponding to at least one intelligent contract in a first blockchain system can be migrated into a second blockchain system, wherein the user state data is user state information corresponding to the at least one intelligent contract in the first blockchain system when a transaction corresponding to the at least one intelligent contract in the first blockchain system is terminated, so that all transaction data of the first blockchain system does not need to be migrated. Therefore, on one hand, the second blockchain system can continuously start new transactions based on the user state data, so that the second blockchain system does not bear the burden of historical transaction records any more, the transaction speed can be greatly improved, and the negative effects on the transactions caused by the rapid performance reduction and the continuous increase of the error rate of the first blockchain system after the transaction amount is increased are avoided to a certain extent. On the other hand, when historical transaction data needs to be inquired, inquiry can be carried out in the first block chain system, the integrity of the transaction data is saved, and the characteristics of fairness and transparency of the block chain are not lost.
According to some embodiments of the present invention, the method, apparatus, medium, and computing device for blockchain data migration may be applied between a main chain and a side chain of a blockchain system. Wherein the corresponding user state information when at least one intelligent contract in the main chain stops trading can be migrated to the side chain. And then the side chain continues to execute the transaction, stops the transaction of the at least one intelligent contract in the side chain at a certain moment when the at least one intelligent contract of the side chain is no longer used as the intelligent contract of the hotspot, and migrates the user state information corresponding to the at least one intelligent contract in the side chain when the transaction is stopped to the main chain so as to update the user state information corresponding to the at least one intelligent contract in the main chain, and enables the main chain to continue to execute the transaction after the migration is completed. In this way, the problem of increased computational pressure of the blockchain system during peak traffic is solved, and the total amount of transactions for a single chain (main chain or side chain) is also reduced to avoid a too fast decrease in computational performance of the single chain.
Drawings
The above and other objects, features and advantages of exemplary embodiments of the present invention will become readily apparent from the following detailed description read in conjunction with the accompanying drawings. Several embodiments of the invention are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which:
FIG. 1 schematically illustrates an application scenario of a method, apparatus, medium, and computing device for blockchain data migration according to embodiments of the present invention;
FIG. 2 schematically illustrates a flow diagram of a method for blockchain data migration applied to a management platform, in accordance with an embodiment of the present invention;
FIG. 3 schematically illustrates a flow diagram of a method for blockchain data migration applied to a first blockchain system, in accordance with an embodiment of the present invention;
FIG. 4 schematically illustrates a flow chart of a method for blockchain data migration applied to a second blockchain system, in accordance with an embodiment of the present invention;
FIG. 5 schematically illustrates a conceptual illustration for blockchain system data migration according to an embodiment of the present invention;
FIG. 6 schematically illustrates a flow diagram of a method for blockchain data migration applied to a management platform in accordance with another embodiment of the present invention;
FIG. 7 schematically illustrates a conceptual illustration for data migration between a main chain and a side chain according to an embodiment of the invention;
FIG. 8 is a block diagram that schematically illustrates an apparatus for blockchain data migration that is deployed to a management platform, in accordance with an embodiment of the present invention;
FIG. 9 schematically illustrates a block diagram of an apparatus for blockchain data migration that is disposed at a first blockchain system, in accordance with an embodiment of the present invention;
FIG. 10 schematically illustrates a block diagram of an apparatus for blockchain data migration that is disposed at a second blockchain system, in accordance with an embodiment of the present invention;
FIG. 11 schematically illustrates a program product suitable for implementing a method for blockchain data migration in accordance with an embodiment of the present invention; and
FIG. 12 schematically illustrates a schematic diagram of a computing device suitable for implementing a method for blockchain data migration according to an embodiment of the present invention.
In the drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
Detailed Description
The principles and spirit of the present invention will be described with reference to a number of exemplary embodiments. It is understood that these embodiments are given solely for the purpose of enabling those skilled in the art to better understand and to practice the invention, and are not intended to limit the scope of the invention in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
As will be appreciated by one skilled in the art, embodiments of the present invention may be embodied as a system, apparatus, device, method, or computer program product. Accordingly, the present disclosure may be embodied in the form of: entirely hardware, entirely software (including firmware, resident software, micro-code, etc.), or a combination of hardware and software.
According to an embodiment of the invention, a method, a device, a medium and a computing device for block chain data migration are provided.
In this document, it is to be understood that any number of elements in the specification and drawings is to be considered exemplary rather than limiting, and that any nomenclature is used for distinction only and not in any limiting sense.
The principles and spirit of the present invention are explained in detail below with reference to several representative embodiments of the invention.
Summary of The Invention
The inventor finds that if the original blockchain system comprises the functions of stopping transaction and data export, and the new blockchain system comprises the functions of data import and transaction start, the transaction in the original blockchain system can be terminated, then the user state information at the transaction termination time in the original blockchain system can be exported, then the user state information is imported into the new blockchain system, and finally the transaction of the new blockchain system is started. Therefore, a new blockchain system can drop burden of historical transactions, and the problems that the performance of the blockchain system is sharply reduced and the error rate is continuously increased after the transaction amount in the blockchain system is increased are solved to a certain extent. And the original blockchain system can be used for querying historical transactions by users without losing the characteristics of fairness and transparency of the blockchain system.
Having described the general principles of the invention, various non-limiting embodiments of the invention are described in detail below.
Application scene overview
Reference is first made to fig. 1.
Fig. 1 schematically illustrates an application scenario of a method, an apparatus, a medium, and a computing device for block chain data migration according to embodiments of the present invention.
As shown in fig. 1, the application scenario includes a management platform 10, a first blockchain system 11, and a second blockchain system 12. The management platform 10 may communicate with a first blockchain system 11 and a second blockchain 12.
According to an embodiment of the present invention, the tasks of the management platform 10 include closing the transaction of the original blockchain system (e.g., the first blockchain system 11), exporting the user state data, migrating the user state data, and opening the transaction of the new blockchain system (e.g., the second blockchain system 12).
According to an embodiment of the present invention, the first blockchain system 11 can be used as an original blockchain system. The main tasks of the first blockchain system 11 include stopping transactions and deriving user status data.
According to one embodiment of the present invention, the second blockchain system 12 can be used as a new blockchain system corresponding to the original blockchain system. The tasks of the second blockchain system 12 may include deploying intelligent contracts, importing user state data from the first blockchain system 11, and closing and opening transactions, among other tasks.
The first and second blockchain systems 11 and 12 may each include a plurality of nodes. The plurality of nodes may communicate with each other. Each node may correspond to at least one database (e.g., a LevelDB database). The plurality of nodes may form a database storage system that may be distributed around the world and may be capable of cooperating. The plurality of nodes may be deployed in servers around the world, respectively, each node may be a server or a server cluster, and the server/server cluster may be a server/server cluster providing various services.
According to some embodiments of the present invention, the first blockchain system 11 may be a main chain and the second blockchain system 12 may also be a side chain corresponding to the main chain. According to an embodiment of the present invention, after the data of the main chain is migrated to the side chain, the data of the side chain may also be migrated back to the main chain.
It should be understood that fig. 1 is merely illustrative, and the management platform, the number of nodes in the blockchain system, etc. are merely illustrative.
Exemplary method
A method for blockchain data migration according to an exemplary embodiment of the present invention is described below with reference to fig. 2 to 7 in conjunction with the application scenario of fig. 1.
FIG. 2 schematically illustrates a flow diagram of a method for blockchain data migration as applied to the management platform 10, in accordance with an embodiment of the present invention;
as shown in fig. 2, the method for blockchain data migration applied to the management platform 10 may include operations S201 to S205.
In operation S201, first transaction information is sent to the first blockchain system 11 to terminate a transaction corresponding to at least one intelligent contract in the first blockchain system 11. For example, the first transaction information may be sent to the first blockchain system 11 through a predetermined blockchain address (e.g., a designated blockchain account number). A plurality of intelligent contracts may be deployed on the first blockchain system 11. Wherein the intelligent contract is a transaction rule.
According to one embodiment of the invention, the first transaction information may be a stop transaction type transaction. When the first blockchain system 11 receives the first transaction information sent by the management platform 10, the first blockchain system 11 verifies the first transaction information, and executes the first transaction information after the verification is passed, so that the first blockchain system stops receiving any transaction, and discards all transactions in the transaction pool, thereby stopping all transactions. According to one embodiment of the present invention, verifying the first transaction information includes verifying whether the account from which the first transaction information originated is a blockchain address pre-specified by the management platform 10; if the verification determines that the account initiating the first transaction information is not the blockchain address pre-designated by the management platform 10, the first transaction information is not verified, and at this time, the first blockchain system 11 may feed back to the management platform 10 that the account initiating the first transaction information is not the blockchain address pre-designated by the management platform 10, so as to help the management platform 10 perform management analysis; if the account initiating the first transaction message is determined to be the blockchain address pre-designated by the management platform 10 after verification, then the other verification is continued if the first transaction message needs to be verified, or if no other verification exists, the first transaction message is determined to be verified. In this case, after the first transaction information is verified, in operation S201, the transactions corresponding to all the smart contracts in the first blockchain system 11 may be terminated through the first transaction information.
In the embodiment of the present invention, the management platform 10 may first obtain the performance data of the first blockchain system 11 before sending the first transaction information to the first blockchain system 11, and determine whether the performance data exceeds a preset threshold. The management platform 10 may send the first transaction information to the first blockchain system 11 when determining that the performance data exceeds the preset threshold (operation S201). Of course, according to another embodiment of the present disclosure, the performance data of the first blockchain system 11 may be obtained and the performance data may be determined manually by the operation and maintenance personnel, so that the management platform 10 may not obtain and determine the performance data of the first blockchain system 11 before sending the first transaction information.
According to another embodiment of the invention, each intelligent contract of the at least one intelligent contract is provided with a corresponding stop trading method. In operation S201, a trade stop method corresponding to each smart contract in the at least one smart contract may be called according to the first trade information, so as to terminate the trade corresponding to the smart contract corresponding to the trade stop method by the trade stop method. In this case, in operation S201, the transaction corresponding to the respective smart contract may be specifically terminated by the first transaction information according to the transaction of the smart contract to be terminated.
In operation S202, user status data corresponding to the at least one intelligent contract in the first blockchain system 11 is exported to a database, where the user status data is user status information corresponding to the at least one intelligent contract in the first blockchain system 11 when a transaction corresponding to the at least one intelligent contract in the first blockchain system 11 is terminated.
The exporting of the user state data to the database may be that the management platform invokes an export method of the user state data corresponding to at least one intelligent contract of the first blockchain system 11, and holds the exported user state data to the database. Table 1 schematically shows the structure of user state data corresponding to a certain intelligent contract in the database, including the number of tokens of the user at the time of termination of a transaction of the intelligent contract, the token state, and the field of whether the token has been transferred. Where token is a digital currency circulating in the blockchain or a blockchain digital item such as an ethernet currency, ERC20 token.
TABLE 1
Figure GDA0003044477560000161
In operation S203, second transaction information is sent to the second blockchain system 12 to deploy the at least one intelligent contract in the second blockchain system 12. For example, the management platform 10 sends the second transaction information to the second blockchain system 12 through a predetermined blockchain address. After the second blockchain system 12 receives and executes the second transaction information, the at least one intelligent contract is deployed in the second blockchain system 12.
According to an embodiment of the present invention, before operation S203, it may be checked whether the user status data exported to the database is correct, so as to obtain a first check result. If the first check result is correct, operation S203 is performed again. For example, after all the user status data corresponding to the at least one intelligent contract is derived, the management platform 10 may invoke a data query checking method provided by each intelligent contract in the at least one intelligent contract in the first blockchain system 11 to check the derived data, where after all the derived data are successfully checked, it is determined that the first checking result is correct.
In operation S204, the user state data is imported from the database to the second blockchain system 12. After the second blockchain system 12 has deployed the at least one intelligent contract, the management platform 10 may begin migrating the user state data in the database to the second blockchain system 12. For example, the management platform 10 calls an import method of the user status data corresponding to the at least one intelligent contract in the second blockchain system 12 to import the user status data to the second blockchain system. When receiving feedback information that a certain data returned by the second blockchain system 12 is successfully imported, the management platform 10 may mark that the data is successfully transferred.
In operation S205, third transaction information is sent to the second blockchain system 12, so that the second blockchain system 12 starts a transaction corresponding to the at least one intelligent contract in the second blockchain system 12 based on the user status data.
According to some embodiments of the present invention, after operation S204, the management platform 10 may further set a starting transaction method for starting a transaction corresponding to the at least one smart contract to the second blockchain system 12. In this case, according to some embodiments of the present invention, in operation S205, the open transaction method may be invoked according to the third transaction information to open a transaction corresponding to the at least one intelligent contract in the second blockchain system 12 based on the user status data.
According to some embodiments of the present invention, the management platform 10 may check whether the user status data imported into the second blockchain system 12 is correct to obtain a second check result before operation S205. Wherein, in case that the second checking result is correct, operation S205 is performed. For example, the management platform 10 may check the consistency of the user status data imported into the second blockchain system 12 and the user status data in the database by calling the status query interface of the second blockchain system 12. And after all the verification is successful, determining that the second verification result is correct.
According to the method for migrating blockchain data in the embodiment of the present invention, only the user state data corresponding to at least one intelligent contract in the first blockchain system 11 may be migrated to the second blockchain system 12, where the user state data is the user state information corresponding to the at least one intelligent contract in the first blockchain system 11 when the transaction corresponding to the at least one intelligent contract in the first blockchain system 11 is terminated, so that all transaction data of the first blockchain system 11 may not be migrated. In this way, on the one hand, the second blockchain system 12 can continue to start new transactions based on the user status data, so that the second blockchain system 12 does not bear the burden of historical transaction records any more, and the transaction speed can be greatly improved. On the other hand, when historical transaction data needs to be queried, the historical transaction data can be queried in the first blockchain system 11, so that the integrity of the transaction data is saved, and the characteristics of fairness and transparency of the blockchain are not lost.
According to some embodiments of the invention, the first blockchain system 11 and the second blockchain system 12 are independent of each other.
According to other embodiments of the present invention, the first blockchain system 11 is a main chain and the second blockchain system 12 is a side chain corresponding to the main chain. That is, the method for block chain data migration according to the embodiment of the present invention may be applied to data migration between a main chain and a side chain, and for this more detailed embodiment, reference may be made to the following description with respect to fig. 6 and 7.
Fig. 3 schematically shows a flowchart of a method for blockchain data migration applied to the first blockchain system 11 according to an embodiment of the present invention.
As shown in fig. 3, the method for blockchain data migration applied to the first blockchain system 11 according to the embodiment of the present invention includes operations S301 and S302
In operation S301, first transaction information is received to terminate a transaction corresponding to the at least one smart contract.
According to some embodiments of the invention, the first transaction information may be a stop transaction type transaction. After receiving the first transaction information, the first blockchain system 11 verifies the first transaction information and allows the first transaction information to enter a transaction pool for transaction execution after the first transaction information passes the verification. After the first transaction message is executed, the transaction pool stops receiving any transactions, and discards all transactions in the transaction pool, thereby stopping all transactions. The code for the transaction pool to stop all transactions can be referred to as illustrated in table 2 below:
TABLE 2
Figure GDA0003044477560000181
Figure GDA0003044477560000191
According to further embodiments of the present invention, the stop transaction method may be set in each of the at least one intelligent contract in the first blockchain system 11 before operation S301. Then, in operation S301, a trade stopping method corresponding to each smart contract in the at least one smart contract may be called according to the first trade information, and a trade corresponding to the smart contract corresponding to the trade stopping method may be terminated according to the trade stopping method. In this way, the transaction stopping method corresponding to the intelligent contract to be stopped can be invoked in a targeted manner, so that the transaction corresponding to the corresponding intelligent contract is stopped in a targeted manner.
For example, a corresponding stop transaction method may be set for each intelligent contract in the first blockchain system 11. And after each transaction stopping method is converted from false to true through the marking bit stopAll, terminating the transaction corresponding to the corresponding intelligent contract. The specific code implementation of the stop transaction method can refer to the example as shown in table 3 below.
TABLE 3
Figure GDA0003044477560000192
Exporting, in operation S302, user status data corresponding to the at least one intelligent contract to a database, where the user status data is user status information corresponding to the at least one intelligent contract in the first blockchain system 11 when the transaction corresponding to the at least one intelligent contract in the first blockchain system 11 is terminated; wherein the at least one intelligent contract is also deployed in the second blockchain system 12 according to the second transaction information; the user status data is also imported into the second blockchain system 12, so that the second blockchain system 12 opens a transaction corresponding to the at least one intelligent contract in the second blockchain system 12 based on the user status data when third transaction information is received; wherein the first blockchain system 11 is different from the second blockchain system 12.
Fig. 4 schematically shows a flowchart of a method for blockchain data migration applied to the second blockchain system 12 according to an embodiment of the present invention.
As shown in fig. 4, the method for blockchain data migration applied to the second blockchain system 12 includes operations S401 to S403.
In operation S401, second transaction information is received to deploy the at least one intelligent contract in the second blockchain system 12, wherein the at least one intelligent contract is also deployed in the first blockchain system 11.
All of the at least one intelligent contracts that need to be migrated are deployed in the second blockchain system 12. For each intelligent contract in the at least one intelligent contract, issuing a number of tokens consistent with the total amount of the intelligent contract in the first blockchain system 11, and setting an interface for importing user state data and an interface for inquiring the user state data.
First, a token is issued for each of the at least one intelligent contract. Each of the at least one intelligent contract in the second blockchain system 12 issues a number of tokens that is equal to the number of tokens and a state equal token as the first blockchain system 11. The equivalent number means that for the same intelligent contract, the number of tokens in the second blockchain system 12 and the first blockchain system 11 are kept consistent, and the tokens in the equivalent state means that for the same intelligent contract, the number of tokens in the states of mining, locking and the like in the second blockchain system 12 and the first blockchain system 11 are respectively kept consistent.
Then, an interface for importing user state data is set for each intelligent contract in the at least one intelligent contract. In this embodiment, the caller of the interface for importing the user status data is a predetermined blockchain address (e.g., a designated blockchain account) in the management platform 10 to prevent data migration from being abused by other accounts. The implementation code of the interface for importing user status data may refer to the example of table 4.
TABLE 4
Figure GDA0003044477560000211
In operation S402, importing, from a database, user status data corresponding to the at least one intelligent contract, where the user status data is user status information corresponding to the at least one intelligent contract in the first blockchain system 11 when the first blockchain system 11 terminates a transaction corresponding to the at least one intelligent contract in the first blockchain system 11 based on first transaction information; the database is also used for importing the user state data from the first blockchain system 11; wherein the first blockchain system 11 is different from the second blockchain system 12.
In operation S403, third transaction information is received to open a transaction corresponding to the at least one intelligent contract in the second blockchain system 12 based on the user status data.
According to an embodiment of the present invention, after operation S402, a transaction opening method for opening a transaction corresponding to the at least one smart contract may be further set for the second blockchain system 12. Thus, according to the embodiment of the present invention, in operation S403, the transaction opening method may be invoked according to the third transaction information, and a transaction corresponding to the at least one smart contract may be opened according to the transaction opening method. The implementation code of the open transaction method may refer to the example of table 5 below.
TABLE 5
Figure GDA0003044477560000212
FIG. 5 schematically shows a conceptual illustration for blockchain system data migration according to an embodiment of the present invention.
As shown in fig. 5, the overall migration process of the method for data migration of the blockchain system described in fig. 2 to 4 according to the embodiment of the present invention is roughly as follows:
1) the management platform 10 sends the first transaction information to the first blockchain system 11 through the predetermined blockchain address, so that the first blockchain system 11 terminates the transaction corresponding to the at least one intelligent contract.
2) The management platform 10 calls a user state data export interface of the first blockchain system 11, and exports the user state data corresponding to the at least one intelligent contract to the database through the user state data export interface. And finishing the export after the export is finished and the export is checked to be correct.
3) A second blockchain system 12 is created. After the creation of the second blockchain system is completed, the management platform 10 sends second transaction information to the second blockchain system to deploy the at least one intelligent contract in the second blockchain system 12. Each of the at least one intelligent contract deployed in the second blockchain system 12 may include a user state data import interface, a close/open transaction method.
4) The management platform 10 migrates the user state data in the database to the second blockchain system 12. For example, the management platform 10 may invoke a user state data import interface corresponding to each smart contract through a predetermined blockchain address to import data. And entering the user state data in the database into the second block chain system 12, checking the user state data without errors, and ending the importing.
5) The management platform 10 sends third transaction information to the second blockchain system 12 through a predetermined blockchain address to call a starting transaction method corresponding to each intelligent contract in the at least one intelligent contract in the second blockchain system 12. After the third transaction information is uplink executed, the second blockchain system 12 starts receiving new transactions from the user. Thereafter, the user may perform a new transaction and query the corresponding transaction record in the second blockchain system, and may query the historical transaction record in the first blockchain system 11.
Fig. 6 schematically shows a flowchart of a method for blockchain data migration applied to the management platform 10 according to another embodiment of the present invention.
As described above, the method for block chain data migration according to the embodiment of the present invention may be applied to data migration between a main chain and a side chain. The first blockchain system 11 is a main chain, and the second blockchain system 12 is a side chain corresponding to the main chain. According to the embodiment of the present invention, the method for migrating block chain data, which is applied to the management platform 10, may further include operations S606 to S609 shown in fig. 6 after operations S201 to S205 shown in fig. 2.
In operation S606, the first transaction information is sent to the second blockchain system 12 to terminate the transaction corresponding to the at least one intelligent contract in the second blockchain system 12.
In operation S607, second user status data corresponding to the at least one intelligent contract in the second blockchain system 12 is exported to the database, where the second user status data is user status information corresponding to the at least one intelligent contract in the second blockchain system 12 when the transaction corresponding to the at least one intelligent contract in the second blockchain system 12 is terminated.
In operation S608, the second user status data is imported from the database into the first blockchain system to update the user status data in the first blockchain system 11 with the second user status data.
In operation S609, the third transaction information is sent to the first blockchain system 11, so that the first blockchain system 11 opens a transaction corresponding to the at least one intelligent contract in the first blockchain system 11 based on the second user status data.
According to the embodiment of the invention, when the transaction amount of the main chain of a blockchain system is greatly increased in some peak periods, partial transactions on the main chain can be migrated to the side chain for processing according to the embodiment of the invention, the transaction result processed on the side chain is migrated back to the main chain after the business pressure of the main chain is reduced, and the main chain continues to execute subsequent transactions on the basis of the transaction result. That is, after the user state information corresponding to the at least one intelligent contract in the main chain is migrated to the side chain when the transaction is terminated and a new transaction is continuously executed in the side chain, the at least one intelligent contract transaction in the side chain may be stopped at a certain moment after the service pressure of the main chain is reduced, and the user state information corresponding to the at least one intelligent contract in the side chain when the transaction is stopped is migrated to the main chain to update the user state information corresponding to the at least one intelligent contract in the main chain, and the main chain is made to continuously execute the transaction after the migration is completed.
According to an embodiment of the present invention, in a case where the first blockchain system 11 is a main chain and the second blockchain system 12 is a side chain corresponding to the first blockchain system 11, the second blockchain system 12 may receive first transaction information when data is migrated back from the side chain to the main chain, so as to terminate a transaction corresponding to the at least one intelligent contract in the second blockchain system 12, and export second user status data corresponding to the at least one intelligent contract in the second blockchain system 12 to the database, where the second user status data is user status information corresponding to the at least one intelligent contract in the second blockchain system 12 when the transaction corresponding to the at least one intelligent contract in the second blockchain system 12 is terminated; wherein the second user status data is used to update the user status data in the first blockchain system 11.
According to an embodiment of the present invention, when the first blockchain system 11 is a main chain and the second blockchain system 12 is a side chain corresponding to the main chain, the first blockchain system 11 may import second user status data corresponding to the at least one intelligent contract when data is migrated back from the side chain to the main chain, so as to update the user status data by the second user status data, where the second user status data is user status information corresponding to the at least one intelligent contract in the second blockchain system 12 when a transaction corresponding to the at least one intelligent contract in the second blockchain system 12 is terminated, and receive third transaction information to open a transaction corresponding to the at least one intelligent contract in the first blockchain system 11 based on the second user status data.
According to the embodiment of the invention, the user state data corresponding to at least one intelligent contract in the main chain can be migrated to the side chain. And then the side chain continuously executes the transaction, and stops the transaction of the at least one intelligent contract in the side chain when the at least one intelligent contract of the side chain is no longer used as the intelligent contract of the hotspot at a certain moment, and migrates the second user state data corresponding to the at least one intelligent contract in the side chain to the main chain so as to update the user state data corresponding to the at least one intelligent contract in the main chain, and enables the main chain to continuously execute the transaction after the migration is completed. In this way, frequent transactions of different services can be met, the transaction total amount of a single blockchain system is reduced, and the performance of the single blockchain system is improved.
FIG. 7 schematically shows a conceptual illustration for data migration between a main chain and a side chain according to an embodiment of the invention.
A process for data migration between a main chain and a side chain according to an embodiment of the present invention is generally described below in conjunction with fig. 7. Wherein, a main chain can correspond to a plurality of side chains, and each side chain is provided with at least one intelligent contract in the main chain. For example, in fig. 7, a certain stage of the transaction corresponding to the intelligent contract a in the main chain may be transferred to the side chain 1 for execution, and after the side chain 1 finishes executing the transaction at this stage, the transaction corresponding to the intelligent contract a may be transferred back to the main chain for further execution.
1) The management platform 10 calls a transaction stopping method of at least one intelligent contract in the main chain through a preset blockchain address. After the transaction stopping method is executed, the transaction corresponding to the at least one intelligent contract in the main chain is terminated.
2) And the management platform 10 calls a user state data export interface of the main chain to export the user state data corresponding to the at least one intelligent contract. And after the data export is finished and the export is checked to be correct, the data export is finished.
3) Deploying the at least one smart contract at the side chain. The same number of tokens and tokens in the same state as the at least one intelligent contract in the main chain are set in the at least one intelligent contract.
4) The management platform 10 migrates the user state data in the database to the side chain. The management platform 10 calls a user state data import interface corresponding to each intelligent contract through a predetermined blockchain address. And after the user state data is imported into the side chain and the state data is checked to be correct, the import is finished.
5) And the management platform 10 calls a transaction starting method corresponding to the at least one intelligent contract of the side chain through a preset block chain address so as to start the transaction of the side chain.
6) And at a certain moment, after determining that the side chain data needs to be migrated back to the main chain, the management platform 10 sends first transaction information to the side chain so as to terminate the transaction of at least one intelligent contract in the side chain through the first transaction information.
7) And the management platform 10 derives second user state data corresponding to the at least one intelligent contract in the side chain to the database and checks the second user state data.
8) Closing the corresponding transaction of the at least one intelligent contract in the main chain and ensuring that the total number of tokens and the total state in the at least one intelligent contract in the main chain and the side chain are consistent.
9) And the management platform 10 migrates the second user status data in the database to the main chain and checks the second user status data.
10) And updating the user state data in the main chain with the second user state data. The main chain then restarts the transaction, restarting the receiving user's new transaction.
The transaction records of all users corresponding to the at least one intelligent contract of the main chain and the side chain exist so far, and can be inquired by the users. Meanwhile, the back-and-forth switching transaction of the main chain and the side chain solves the problem that the calculation pressure of the block chain system is increased in the peak period of the business, and reduces the total transaction amount of the single chain (the main chain or the side chain) so as to avoid the over-quick reduction of the calculation performance of the single chain.
Exemplary devices
Having described the method of the exemplary embodiment of the present invention, next, a method for block chain data migration of the exemplary embodiment of the present invention will be described with reference to fig. 8, 9, and 10.
Fig. 8 is a block diagram schematically illustrating an apparatus for blockchain data migration provided to the management platform 10 according to an embodiment of the present invention.
As shown in fig. 8, the apparatus 800 may include a first transmitting module 810, a first data migration module 820, a second transmitting module 830, a second data migration module 840, and a third transmitting module 850. The first sending module 810 is configured to send first transaction information to the first blockchain system 11, so as to terminate a transaction corresponding to at least one intelligent contract in the first blockchain system 11. The first data migration module 820 is configured to export, to a database, user status data corresponding to the at least one intelligent contract in the first blockchain system 11, where the user status data is user status information corresponding to the at least one intelligent contract in the first blockchain system 11 when a transaction corresponding to the at least one intelligent contract in the first blockchain system 11 is terminated. The second sending module 830 is configured to send second transaction information to the second blockchain system 12 to deploy the at least one intelligent contract in the second blockchain system 12. The second data migration module 840 is configured to import the user state data from the database to the second blockchain system 12. The third sending module 850 is configured to send third transaction information to the second blockchain system 12, so that the second blockchain system 12 starts a transaction corresponding to the at least one intelligent contract in the second blockchain system 12 based on the user status data.
In an embodiment of the present invention, the first sending module 810 is specifically configured to invoke a trade stop method corresponding to each intelligent contract in the at least one intelligent contract according to the first trade information, so as to terminate the trade corresponding to the intelligent contract corresponding to the trade stop method by using the trade stop method.
In one embodiment of the invention, the device 800 further includes a stop transaction method setting module 860. The stop transaction method setting module 860 is configured to set the stop transaction method in each of the at least one smart contract before the sending of the first transaction information to the first blockchain system 11.
In one embodiment of the present invention, the first blockchain system 11 and the second blockchain system 12 are independent from each other; alternatively, the first blockchain system 11 is a main chain, and the second blockchain system 12 is a side chain corresponding to the main chain.
In an embodiment of the present invention, the first sending module 810 is further configured to, when the first blockchain system 11 is a main chain and the second blockchain system 12 is a side chain corresponding to the main chain, send the first transaction information to the second blockchain system 12 after the third transaction information is sent to the second blockchain system 12, so that the second blockchain system 12 starts a transaction corresponding to the at least one intelligent contract in the second blockchain system 12 based on the user status data, so as to terminate the transaction corresponding to the at least one intelligent contract in the second blockchain system 12. The first data migration module 820 is further configured to export second user status data corresponding to the at least one intelligent contract in the second blockchain system 12 to the database, where the second user status data is user status information corresponding to the at least one intelligent contract in the second blockchain system 12 when the transaction corresponding to the at least one intelligent contract in the second blockchain system 12 is terminated. The second data migration module 840 is further configured to import the second user status data from the database into the first blockchain system 11, so as to update the user status data in the first blockchain system 11 by using the second user status data. The third sending module 850 is further configured to send the third transaction information to the first blockchain system 11, so that the first blockchain system 11 opens a transaction corresponding to the at least one intelligent contract in the first blockchain system 11 based on the second user status data.
In one embodiment of the present invention, the sending the first transaction information to the first blockchain system 11 includes sending the first transaction information to the first blockchain system 11 through a predetermined blockchain address.
In one embodiment of the invention, the device 800 further comprises a start transaction method setting module 870. The open transaction method setting module 870 is configured to set an open transaction method for opening a transaction corresponding to the at least one intelligent contract for the second blockchain system 12 after the sending of the second transaction information to the second blockchain system 12 to deploy the at least one intelligent contract in the second blockchain system 12.
In an embodiment of the present invention, the third sending module 850 is specifically configured to invoke the open transaction method according to the third transaction information, so as to open a transaction corresponding to the at least one intelligent contract in the second blockchain system 12 based on the user state data.
In one embodiment of the present invention, the apparatus 800 further comprises a first reconciliation module 880. The first checking module is configured to check whether the user status data derived from the database is correct before the second transaction information is sent to the second blockchain system 12, so as to obtain a first checking result; the second sending module is specifically configured to send the second transaction information to the second blockchain system 12 when the first check result is correct.
In one embodiment of the present invention, the apparatus 800 further includes a second verification module 890. The second checking module is configured to check whether the user status data imported into the second blockchain system 12 is correct before the third transaction information is sent to the second blockchain system 12, so as to obtain a second checking result. The third sending module is specifically configured to send the third transaction information to the second blockchain system 12 when the second check result is correct.
According to an embodiment of the present invention, the apparatus 800 may be used to perform the method for blockchain data migration described with reference to fig. 2 and/or fig. 6.
Fig. 9 schematically shows a block diagram of an apparatus 900 for blockchain data migration provided to the first blockchain system 11 according to an embodiment of the present invention.
As shown in fig. 9, the apparatus 900 includes a first receiving module 910, and a first data deriving module 920. The first receiving module 910 is configured to receive first transaction information to terminate a transaction corresponding to the at least one intelligent contract. The first data export module 920 is configured to export user status data corresponding to the at least one intelligent contract to a database, where the user status data is user status information corresponding to the at least one intelligent contract in the first blockchain system 11 when a transaction corresponding to the at least one intelligent contract in the first blockchain system 11 is terminated; wherein the at least one intelligent contract is also deployed in the second blockchain system 12 according to the second transaction information; the user status data is also imported from the database into the second blockchain system 12 such that the second blockchain system 12 opens a transaction corresponding to the at least one intelligent contract in the second blockchain system 12 based on the user status data upon receiving third transaction information. Wherein the first blockchain system 11 is different from the second blockchain system 12.
In an embodiment of the present invention, the first receiving module 910 is specifically configured to invoke a transaction stopping method corresponding to each intelligent contract in the at least one intelligent contract according to the first transaction information, and terminate a transaction corresponding to the intelligent contract corresponding to the transaction stopping method according to the transaction stopping method.
In one embodiment of the invention, the apparatus 900 further comprises a stop transaction method setup module 930. The stop trading method setting module 930 is configured to set the stop trading method in each smart contract in the at least one smart contract before the receiving the first trading information.
In one embodiment of the present invention, the apparatus 900 further includes a first data import module 940. The first data importing module 940 is configured to, when the first blockchain system 11 is a main chain and the second blockchain system 12 is a side chain corresponding to the main chain, import second user state data corresponding to the at least one intelligent contract after exporting the user state data corresponding to the at least one intelligent contract to a database, so as to update the user state data by using the second user state data, where the second user state data is user state information corresponding to the at least one intelligent contract in the second blockchain system 12 when terminating a transaction corresponding to the at least one intelligent contract in the second blockchain system 12. The first receiving module 910 is further configured to receive third transaction information, so as to open a transaction corresponding to the at least one intelligent contract in the first blockchain system 11 based on the second user status data.
According to an embodiment of the present invention, the apparatus 900 may be used to perform the method for blockchain data migration described with reference to fig. 3.
Fig. 10 schematically shows a block diagram of an apparatus for blockchain data migration provided to the second blockchain system 12 according to an embodiment of the present invention.
As shown in fig. 10, the apparatus 1000 includes a second receiving module 1010 and a second data importing module 1020. The second receiving module 1010 is configured to receive second transaction information to deploy the at least one intelligent contract in the second blockchain system 12, wherein the at least one intelligent contract is also deployed in the first blockchain system 11. The second data import module 1020 is configured to import, from the database, user status data corresponding to the at least one intelligent contract, where the user status data is user status information corresponding to the at least one intelligent contract in the first blockchain system 11 when the first blockchain system 11 terminates a transaction corresponding to the at least one intelligent contract in the first blockchain system 11 based on the first transaction information; the database is also used for importing the user state data from the first blockchain system 11; wherein the first blockchain system 11 is different from the second blockchain system 12. The second receiving module 1020 is further configured to receive third transaction information to open a transaction corresponding to the at least one intelligent contract in the second blockchain system 12 based on the user status data.
In one embodiment of the invention, the device 1000 further comprises a start transaction method setting module 1030. The open transaction method setting module 1030 is configured to set, after the receiving of the second transaction information to deploy the at least one intelligent contract in the second blockchain system 12, an open transaction method for opening a transaction corresponding to the at least one intelligent contract for the second blockchain system 12. In an embodiment of the present invention, the receiving third transaction information to open the transaction corresponding to the at least one intelligent contract in the second blockchain system 12 includes invoking the open transaction method according to the third transaction information, and opening the transaction corresponding to the at least one intelligent contract according to the open transaction method.
In one embodiment of the present invention, the first blockchain system 11 and the second blockchain system 12 are independent from each other; alternatively, the first blockchain system 11 is a main chain, and the second blockchain system 12 is a side chain corresponding to the first blockchain system 11.
In one embodiment of the present invention, the apparatus 1000 further comprises a second data derivation module 1040. The second receiving module 1010 is further configured to receive the first transaction information after receiving the third transaction information to start the transaction corresponding to the at least one intelligent contract in the second blockchain system 12 based on the user status data when the first blockchain system 11 is a main chain and the second blockchain system 12 is a side chain corresponding to the first blockchain system 11, so as to terminate the transaction corresponding to the at least one intelligent contract in the second blockchain system 12. The second data export module 1040 is configured to export, to the database, second user status data corresponding to the at least one intelligent contract in the second blockchain system 12, where the second user status data is user status information corresponding to the at least one intelligent contract in the second blockchain system 12 when the transaction corresponding to the at least one intelligent contract in the second blockchain system 12 is terminated; wherein the second user status data is used to update the user status data in the first blockchain system 11.
Exemplary Medium
Having described the method and apparatus of exemplary embodiments of the present invention, a program product suitable for implementing the method for blockchain data migration in accordance with an embodiment of the present invention is described next with reference to fig. 11.
Embodiments of the present invention provide a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform a method for blockchain data migration according to an embodiment of the present invention.
In some possible embodiments, aspects of the present invention may also be implemented in the form of a program product including program code for causing a computing device to perform operations for use in a blockchain data migration method according to various exemplary embodiments of the present invention described in the above section "exemplary methods" of this specification when the program product is run on the computing device.
For example, the computing device may execute operation S201 shown in fig. 2, and send first transaction information to the first blockchain system 11 to terminate a transaction corresponding to at least one intelligent contract in the first blockchain system 11; operation S202, exporting, to a database, user status data corresponding to the at least one intelligent contract in the first blockchain system 11, where the user status data is user status information corresponding to the at least one intelligent contract in the first blockchain system 11 when a transaction corresponding to the at least one intelligent contract in the first blockchain system 11 is terminated; operation S203, sending second transaction information to a second blockchain system 12 to deploy the at least one intelligent contract in the second blockchain system 12; operation S204, importing the user state data from the database to the second blockchain system 12; and operation S205, sending third transaction information to the second blockchain system 12, so that the second blockchain system 12 starts a transaction corresponding to the at least one intelligent contract in the second blockchain system 12 based on the user status data.
Or for example, the computing device may execute operation S301 shown in fig. 3, and receive first transaction information to terminate a transaction corresponding to the at least one smart contract; and operation S302, exporting user status data corresponding to the at least one intelligent contract to a database, where the user status data is user status information corresponding to the at least one intelligent contract in the first blockchain system 11 when the transaction corresponding to the at least one intelligent contract in the first blockchain system 11 is terminated; wherein the at least one intelligent contract is also deployed in the second blockchain system 12 according to the second transaction information; the user status data is also imported into the second blockchain system 12, so that the second blockchain system 12 opens a transaction corresponding to the at least one intelligent contract in the second blockchain system 12 based on the user status data when third transaction information is received; wherein the first blockchain system 11 is different from the second blockchain system 12.
Or for example, the computing device may perform operation S401 shown in fig. 4, receiving second transaction information to deploy the at least one intelligent contract in the second blockchain system 12, wherein the at least one intelligent contract is also deployed in the first blockchain system 11; operation S402, importing, from a database, user state data corresponding to the at least one intelligent contract, where the user state data is user state information corresponding to the at least one intelligent contract in the first blockchain system 11 when the first blockchain system 11 terminates a transaction corresponding to the at least one intelligent contract in the first blockchain system 11 based on first transaction information; the database is also used for importing the user state data from the first blockchain system 11; wherein the first blockchain system 11 is different from the second blockchain system 12; in operation S403, third transaction information is received, so as to open a transaction corresponding to the at least one intelligent contract in the second blockchain system 12 based on the user status data.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
As shown in fig. 11, a program product 1100 for blockchain data migration according to an embodiment of the present invention is depicted, which may employ a portable compact disk read only memory (CD-ROM) and include program code, and may be run on a computing device, such as a personal computer. However, the program product of the present invention is not limited in this regard and, in the present document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
Exemplary computing device
Having described the methods, apparatus and media of the exemplary embodiments of the invention, a computing device suitable for implementing a method for blockchain data migration in accordance with an embodiment of the invention is now described with reference to fig. 12.
The embodiment of the invention also provides the computing equipment. As will be appreciated by one skilled in the art, aspects of the present invention may be embodied as a system, method or program product. Thus, various aspects of the invention may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
In some possible embodiments, a computing device according to the present invention may include at least one processing unit, and at least one memory unit. Wherein the storage unit stores program code that, when executed by the processing unit, causes the processing unit to perform operations in a method for blockchain data migration according to various exemplary embodiments of the present invention described in the above section "exemplary methods" of the present specification.
For example, the processing unit may execute operation S201 shown in fig. 2, and send first transaction information to the first blockchain system 11 to terminate a transaction corresponding to at least one intelligent contract in the first blockchain system 11; operation S202, exporting, to a database, user status data corresponding to the at least one intelligent contract in the first blockchain system 11, where the user status data is user status information corresponding to the at least one intelligent contract in the first blockchain system 11 when a transaction corresponding to the at least one intelligent contract in the first blockchain system 11 is terminated; operation S203, sending second transaction information to a second blockchain system 12 to deploy the at least one intelligent contract in the second blockchain system 12; operation S204, importing the user state data from the database to the second blockchain system 12; and operation S205, sending third transaction information to the second blockchain system 12, so that the second blockchain system 12 starts a transaction corresponding to the at least one intelligent contract in the second blockchain system 12 based on the user status data.
Or for example, the processing unit may execute operation S301 shown in fig. 3, and receive first transaction information to terminate a transaction corresponding to the at least one smart contract; and operation S302, exporting user status data corresponding to the at least one intelligent contract to a database, where the user status data is user status information corresponding to the at least one intelligent contract in the first blockchain system 11 when the transaction corresponding to the at least one intelligent contract in the first blockchain system 11 is terminated; wherein the at least one intelligent contract is also deployed in the second blockchain system 12 according to the second transaction information; the user status data is also imported into the second blockchain system 12, so that the second blockchain system 12 opens a transaction corresponding to the at least one intelligent contract in the second blockchain system 12 based on the user status data when third transaction information is received; wherein the first blockchain system 11 is different from the second blockchain system 12.
Or for example, the processing unit may execute operation S401 shown in fig. 4, receive second transaction information to deploy the at least one intelligent contract in the second blockchain system 12, where the at least one intelligent contract is also deployed in the first blockchain system 11; operation S402, importing, from a database, user state data corresponding to the at least one intelligent contract, where the user state data is user state information corresponding to the at least one intelligent contract in the first blockchain system 11 when the first blockchain system 11 terminates a transaction corresponding to the at least one intelligent contract in the first blockchain system 11 based on first transaction information; the database is also used for importing the user state data from the first blockchain system 11; wherein the first blockchain system 11 is different from the second blockchain system 12; in operation S403, third transaction information is received, so as to open a transaction corresponding to the at least one intelligent contract in the second blockchain system 12 based on the user status data.
A computing device 1200 suitable for implementing a method for blockchain data migration in accordance with an embodiment of the present invention is described below with reference to fig. 12. The computing device 1200 shown in FIG. 12 is only one example and should not be taken to limit the scope of use and functionality of embodiments of the present invention.
As shown in fig. 12, computing device 1200 is embodied in the form of a general purpose computing device. Components of computing device 1200 may include, but are not limited to: the at least one processor 1210, the at least one memory unit 1220, and the bus 1230 connecting the various system components including the memory unit 1220 and the processor 1210.
The bus 1230 includes a data bus, a control bus, and an address bus.
The storage unit 1220 may include readable media in the form of volatile memory, such as Random Access Memory (RAM)1221 and/or cache memory 1222, and may further include Read Only Memory (ROM) 1223.
Storage unit 1220 may also include a program/utility 1225 having a set (at least one) of program modules 1224, such program modules 1224 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Computing device 1200 can also communicate with one or more external devices 1240 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with computing device 1200, and/or with any devices (e.g., router, modem, etc.) that enable computing device 1200 to communicate with one or more other computing devices. Such communication may occur via an input/output (I/0) interface 1250. Moreover, computing device 1200 may also communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via network adapter 1260. As shown, the network adapter 1260 communicates with the other modules of the computing device 1200 via the bus 1230. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the computing device 1200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
It should be noted that although in the above detailed description several units/modules or sub-units/modules of the apparatus are mentioned, such a division is merely exemplary and not mandatory. Indeed, the features and functionality of two or more of the units/modules described above may be embodied in one unit/module according to embodiments of the invention. Conversely, the features and functions of one unit/module described above may be further divided into embodiments by a plurality of units/modules.
Moreover, while the operations of the method of the invention are depicted in the drawings in a particular order, this does not require or imply that the operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
While the spirit and principles of the invention have been described with reference to several particular embodiments, it is to be understood that the invention is not limited to the disclosed embodiments, nor is the division of aspects, which is for convenience only as the features in such aspects may not be combined to benefit. The invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims (40)

1. A method for block chain data migration, applied to a management platform, the method comprising:
sending first transaction information to a first blockchain system to terminate a transaction corresponding to at least one intelligent contract in the first blockchain system;
exporting user state data corresponding to the at least one intelligent contract in the first blockchain system to a database, wherein the user state data is user state information corresponding to the at least one intelligent contract in the first blockchain system when a transaction corresponding to the at least one intelligent contract in the first blockchain system is terminated;
sending second transaction information to a second blockchain system to deploy the at least one intelligent contract in the second blockchain system;
importing the user state data from the database to the second blockchain system; and
and sending third transaction information to the second blockchain system so that the second blockchain system starts a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user state data.
2. The method of claim 1, wherein the sending first transaction information to a first blockchain system to terminate a transaction corresponding to at least one smart contract in the first blockchain system comprises:
and calling a transaction stopping method corresponding to each intelligent contract in the at least one intelligent contract according to the first transaction information so as to terminate the transaction corresponding to the intelligent contract corresponding to the transaction stopping method through the transaction stopping method.
3. The method of claim 2, wherein prior to said sending the first transaction information to the first blockchain system, the method further comprises:
the stop transaction method is set in each of the at least one intelligent contract.
4. The method of claim 1, wherein the first and second blockchain systems are independent of each other; or, the first blockchain system is a main chain, and the second blockchain system is a side chain corresponding to the main chain.
5. The method of claim 4, wherein when the first blockchain system is a main chain and the second blockchain system is a side chain corresponding to the main chain, after the sending third transaction information to the second blockchain system to cause the second blockchain system to open a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user status data, the method further comprises:
sending the first transaction information to the second blockchain system to terminate the transaction corresponding to the at least one intelligent contract in the second blockchain system;
exporting second user state data corresponding to the at least one intelligent contract in the second blockchain system to the database, wherein the second user state data is user state information corresponding to the at least one intelligent contract in the second blockchain system when the transaction corresponding to the at least one intelligent contract in the second blockchain system is terminated;
importing the second user state data from the database into the first blockchain system to update the user state data in the first blockchain system through the second user state data; and
and sending the third transaction information to the first blockchain system so that the first blockchain system starts a transaction corresponding to the at least one intelligent contract in the first blockchain system based on the second user state data.
6. The method of claim 1, wherein said sending first transaction information to a first blockchain system comprises:
and sending the first transaction information to the first blockchain system through a preset blockchain address.
7. The method of claim 1, wherein after said sending second transaction information to a second blockchain system to deploy the at least one intelligent contract in the second blockchain system, the method further comprises:
and setting a transaction starting method for starting the transaction corresponding to the at least one intelligent contract for the second blockchain system.
8. The method of claim 7, wherein the sending third transaction information to the second blockchain system to cause the second blockchain system to open a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user status data comprises:
and calling the transaction starting method according to the third transaction information so as to start the transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user state data.
9. The method of claim 1, wherein prior to said sending second transaction information to the second blockchain system, the method further comprises:
checking whether the user state data derived from the database is correct or not to obtain a first checking result;
and sending the second transaction information to the second blockchain system under the condition that the first check result is correct.
10. The method of claim 1, wherein prior to said sending third transaction information to the second blockchain system, the method further comprises:
checking whether the user state data imported into the second blockchain system is correct or not to obtain a second checking result;
and sending the third transaction information to the second blockchain system under the condition that the second check result is correct.
11. A method for blockchain data migration, applied to a first blockchain system, the method comprising:
receiving first transaction information to terminate a transaction corresponding to at least one intelligent contract in the first blockchain system; and
exporting user state data corresponding to the at least one intelligent contract to a database, wherein the user state data is user state information corresponding to the at least one intelligent contract in the first blockchain system when a transaction corresponding to the at least one intelligent contract in the first blockchain system is terminated; wherein the at least one intelligent contract is further deployed in a second blockchain system according to second transaction information; the user state data is also imported into the second blockchain system, so that the second blockchain system starts a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user state data when third transaction information is received;
wherein the first blockchain system is different from the second blockchain system.
12. The method of claim 11, wherein the receiving first transaction information to terminate a transaction corresponding to the at least one smart contract comprises:
calling a transaction stopping method corresponding to each intelligent contract in the at least one intelligent contract according to the first transaction information; and
and terminating the transaction corresponding to the intelligent contract corresponding to the transaction stopping method according to the transaction stopping method.
13. The method of claim 12, wherein prior to said receiving first transaction information, the method further comprises:
the stop transaction method is set in each of the at least one intelligent contract.
14. The method of claim 11, wherein the first blockchain system is a main chain and the second blockchain system is a side chain corresponding to the main chain, and after the exporting of the user status data corresponding to the at least one intelligent contract to a database, the method further comprises:
importing second user state data corresponding to the at least one intelligent contract to update the user state data through the second user state data, wherein the second user state data is user state information corresponding to the at least one intelligent contract in the second blockchain system when the transaction corresponding to the at least one intelligent contract in the second blockchain system is terminated; and
and receiving third transaction information to open a transaction corresponding to the at least one intelligent contract in the first blockchain system based on the second user state data.
15. A method for blockchain data migration, applied to a second blockchain system, the method comprising:
receiving second transaction information to deploy at least one intelligent contract in the second blockchain system, wherein the at least one intelligent contract is also deployed in the first blockchain system;
importing user state data corresponding to the at least one intelligent contract from a database, wherein the user state data is user state information corresponding to the at least one intelligent contract in a first blockchain system when the first blockchain system terminates a transaction corresponding to the at least one intelligent contract in the first blockchain system based on first transaction information; the database is also used for importing the user state data from the first blockchain system; wherein the first blockchain system is different from the second blockchain system; and
and receiving third transaction information to start a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user state data.
16. The method of claim 15, wherein after the receiving second transaction information to deploy the at least one smart contract in the second blockchain system, the method further comprises:
and setting a transaction starting method for starting the transaction corresponding to the at least one intelligent contract for the second blockchain system.
17. The method of claim 16, wherein the receiving third transaction information to open a transaction corresponding to the at least one smart contract in the second blockchain system based on the user state data comprises:
calling the transaction starting method according to the third transaction information; and
and starting the transaction corresponding to the at least one intelligent contract according to the transaction starting method.
18. The method of claim 15, wherein the first blockchain system and the second blockchain system are independent of each other; or, the first blockchain system is a main chain, and the second blockchain system is a side chain corresponding to the first blockchain system.
19. The method of claim 18, wherein when the first blockchain system is a main chain and the second blockchain system is a corresponding side chain of the first blockchain system, after the receiving third transaction information to open a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user status data, the method further comprises:
receiving first transaction information to terminate a transaction corresponding to the at least one intelligent contract in the second blockchain system; and
exporting second user state data corresponding to the at least one intelligent contract in the second blockchain system to a database, wherein the second user state data is user state information corresponding to the at least one intelligent contract in the second blockchain system when the transaction corresponding to the at least one intelligent contract in the second blockchain system is terminated; wherein the second user state data is used to update the user state data in the first blockchain system.
20. An apparatus for blockchain data migration, disposed on a management platform, the apparatus comprising:
the system comprises a first sending module, a second sending module and a third sending module, wherein the first sending module is used for sending first transaction information to a first blockchain system so as to terminate the transaction corresponding to at least one intelligent contract in the first blockchain system;
a first data migration module, configured to export user status data corresponding to the at least one intelligent contract in the first blockchain system to a database, where the user status data is user status information corresponding to the at least one intelligent contract in the first blockchain system when a transaction corresponding to the at least one intelligent contract in the first blockchain system is terminated;
a second sending module, configured to send second transaction information to a second blockchain system to deploy the at least one intelligent contract in the second blockchain system;
a second data migration module, configured to import the user state data from the database to the second blockchain system; and
a third sending module, configured to send third transaction information to the second blockchain system, so that the second blockchain system starts a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user state data.
21. The apparatus of claim 20, wherein the first transmitting module is specifically configured to:
and calling a transaction stopping method corresponding to each intelligent contract in the at least one intelligent contract according to the first transaction information so as to terminate the transaction corresponding to the intelligent contract corresponding to the transaction stopping method through the transaction stopping method.
22. The apparatus of claim 21, wherein the apparatus further comprises:
a stop transaction method setting module for setting the stop transaction method in each of the at least one intelligent contract before the sending of the first transaction information to the first blockchain system.
23. The apparatus of claim 20, wherein the first and second blockchain systems are independent of each other; or, the first blockchain system is a main chain, and the second blockchain system is a side chain corresponding to the main chain.
24. The apparatus of claim 23, wherein:
the first sending module is further configured to send, when the first blockchain system is a main chain and the second blockchain system is a side chain corresponding to the main chain, third transaction information to the second blockchain system after the third transaction information is sent to the second blockchain system so that the second blockchain system starts a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user state data, send the first transaction information to the second blockchain system to terminate the transaction corresponding to the at least one intelligent contract in the second blockchain system;
the first data migration module is further configured to export second user status data corresponding to the at least one intelligent contract in the second blockchain system to the database, where the second user status data is user status information corresponding to the at least one intelligent contract in the second blockchain system when the transaction corresponding to the at least one intelligent contract in the second blockchain system is terminated;
the second data migration module is further configured to import the second user status data from the database into the first blockchain system, so as to update the user status data in the first blockchain system by using the second user status data; and
the third sending module is further configured to send the third transaction information to the first blockchain system, so that the first blockchain system opens a transaction corresponding to the at least one intelligent contract in the first blockchain system based on the second user state data.
25. The apparatus of claim 20, wherein the sending the first transaction information to the first blockchain system comprises:
and sending the first transaction information to the first blockchain system through a preset blockchain address.
26. The apparatus of claim 20, wherein the apparatus further comprises:
and the starting transaction method setting module is used for setting a starting transaction method for starting a transaction corresponding to the at least one intelligent contract for the second blockchain system after the second transaction information is sent to the second blockchain system so as to deploy the at least one intelligent contract in the second blockchain system.
27. The apparatus of claim 26, wherein the third sending module is specifically configured to:
and calling the transaction starting method according to the third transaction information so as to start the transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user state data.
28. The apparatus of claim 20, wherein the apparatus further comprises:
a first checking module, configured to check whether the user status data derived from the database is correct before sending the second transaction information to the second blockchain system, to obtain a first checking result; the second sending module is specifically configured to send the second transaction information to the second blockchain system when the first check result is correct.
29. The apparatus of claim 20, wherein the apparatus further comprises:
the second checking module is used for checking whether the user state data imported into the second blockchain system is correct or not before the third transaction information is sent to the second blockchain system, so that a second checking result is obtained;
the third sending module is specifically configured to send the third transaction information to the second blockchain system when the second check result is correct.
30. An apparatus for blockchain data migration, disposed in a first blockchain system, the apparatus comprising:
the first receiving module is used for receiving first transaction information so as to terminate the transaction corresponding to at least one intelligent contract in the first blockchain system; and
a first data export module, configured to export user status data corresponding to the at least one intelligent contract to a database, where the user status data is user status information corresponding to the at least one intelligent contract in the first blockchain system when a transaction corresponding to the at least one intelligent contract in the first blockchain system is terminated; wherein the at least one intelligent contract is further deployed in a second blockchain system according to second transaction information; the user status data is also imported from the database into the second blockchain system, so that the second blockchain system starts a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user status data when third transaction information is received;
wherein the first blockchain system is different from the second blockchain system.
31. The apparatus of claim 30, wherein the first receiving means is specifically configured to:
calling a transaction stopping method corresponding to each intelligent contract in the at least one intelligent contract according to the first transaction information; and
and terminating the transaction corresponding to the intelligent contract corresponding to the transaction stopping method according to the transaction stopping method.
32. The apparatus of claim 31, wherein the apparatus further comprises:
a stop trading method setting module for setting the stop trading method in each of the at least one intelligent contract before the receiving the first trading information.
33. The apparatus of claim 30, wherein the apparatus further comprises:
a first data importing module, configured to import, when the first blockchain system is a main chain and the second blockchain system is a side chain corresponding to the main chain, second user state data corresponding to the at least one intelligent contract after exporting the user state data corresponding to the at least one intelligent contract to a database, so as to update the user state data by using the second user state data, where the second user state data is user state information corresponding to the at least one intelligent contract in the second blockchain system when terminating a transaction corresponding to the at least one intelligent contract in the second blockchain system; and
the first receiving module is further configured to receive third transaction information, so as to open a transaction corresponding to the at least one intelligent contract in the first blockchain system based on the second user state data.
34. An apparatus for blockchain data migration, disposed in a second blockchain system, the apparatus comprising:
a second receiving module, configured to receive second transaction information to deploy at least one intelligent contract in the second blockchain system, where the at least one intelligent contract is also deployed in the first blockchain system;
a second data importing module, configured to import, from a database, user state data corresponding to the at least one intelligent contract, where the user state data is user state information corresponding to the at least one intelligent contract in a first blockchain system when the first blockchain system terminates a transaction corresponding to the at least one intelligent contract in the first blockchain system based on first transaction information; the database is also used for importing the user state data from the first blockchain system; wherein the first blockchain system is different from the second blockchain system; and
the second receiving module is further configured to receive third transaction information to open a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user state data.
35. The apparatus of claim 34, wherein the apparatus further comprises:
and the transaction starting method setting module is used for setting a transaction starting method for starting the transaction corresponding to the at least one intelligent contract for the second blockchain system after the second transaction information is received and the at least one intelligent contract is deployed in the second blockchain system.
36. The apparatus of claim 35, wherein the receiving third transaction information to open a transaction corresponding to the at least one smart contract in the second blockchain system comprises:
calling the transaction starting method according to the third transaction information; and
and starting the transaction corresponding to the at least one intelligent contract according to the transaction starting method.
37. The apparatus of claim 34, wherein the first blockchain system and the second blockchain system are independent of each other; or, the first blockchain system is a main chain, and the second blockchain system is a side chain corresponding to the first blockchain system.
38. The apparatus of claim 37, wherein the apparatus further comprises a second data derivation module, wherein:
the second receiving module is further configured to receive, when the first blockchain system is a main chain and the second blockchain system is a side chain corresponding to the first blockchain system, the first transaction information after receiving the third transaction information to start a transaction corresponding to the at least one intelligent contract in the second blockchain system based on the user state data to terminate the transaction corresponding to the at least one intelligent contract in the second blockchain system;
the second data export module is configured to export second user status data corresponding to the at least one intelligent contract in the second blockchain system to a database, where the second user status data is user status information corresponding to the at least one intelligent contract in the second blockchain system when a transaction corresponding to the at least one intelligent contract in the second blockchain system is terminated; wherein the second user state data is used to update the user state data in the first blockchain system.
39. A computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform:
a process according to any one of claims 1 to 10; or
A process according to any one of claims 11 to 14; or
A method according to any one of claims 15 to 19.
40. A computing device, comprising:
one or more memories storing executable instructions;
one or more processors executing the executable instructions to implement:
a process according to any one of claims 1 to 10; or
A process according to any one of claims 11 to 14; or
A method according to any one of claims 15 to 19.
CN201910503915.7A 2019-06-11 2019-06-11 Method, apparatus, medium, and computing device for blockchain data migration Active CN110210845B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910503915.7A CN110210845B (en) 2019-06-11 2019-06-11 Method, apparatus, medium, and computing device for blockchain data migration

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910503915.7A CN110210845B (en) 2019-06-11 2019-06-11 Method, apparatus, medium, and computing device for blockchain data migration

Publications (2)

Publication Number Publication Date
CN110210845A CN110210845A (en) 2019-09-06
CN110210845B true CN110210845B (en) 2021-06-18

Family

ID=67792059

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910503915.7A Active CN110210845B (en) 2019-06-11 2019-06-11 Method, apparatus, medium, and computing device for blockchain data migration

Country Status (1)

Country Link
CN (1) CN110210845B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112017052B (en) * 2020-10-28 2021-05-18 支付宝(杭州)信息技术有限公司 Method and apparatus for deploying and invoking contracts in blockchain
CN112650733A (en) * 2020-12-28 2021-04-13 杭州趣链科技有限公司 Intelligent contract state data processing method, system and device
CN112738280B (en) * 2021-03-30 2021-07-23 支付宝(杭州)信息技术有限公司 Method and device for communication between block chain and equipment under block chain
CN113342776B (en) * 2021-05-18 2022-11-15 网易(杭州)网络有限公司 Transaction information migration method, device, equipment and medium based on intelligent contract

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101701131B1 (en) * 2016-04-28 2017-02-13 주식회사 라피 Data recording and validation methods and systems using the connecting of blockchain between different type
CN108492183A (en) * 2018-03-29 2018-09-04 深圳前海微众银行股份有限公司 Account trading method, system and the computer readable storage medium of block chain
CN109471744A (en) * 2018-11-21 2019-03-15 北京蓝石环球区块链科技有限公司 The more subchain system architectures of main chain adduction row based on block chain
CN109669940A (en) * 2018-11-12 2019-04-23 深圳市步云科技有限公司 A kind of main side chain distributed storage mode based on block chain
CN109829718A (en) * 2019-01-30 2019-05-31 缀初网络技术(上海)有限公司 A kind of block chain multi-layer framework and its operation method based on storage application scenarios
CN109857580A (en) * 2019-03-12 2019-06-07 深圳市网心科技有限公司 Across the chain contract call method of block chain, device and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10498541B2 (en) * 2017-02-06 2019-12-03 ShocCard, Inc. Electronic identification verification methods and systems
US10958418B2 (en) * 2017-10-10 2021-03-23 Chromata Corporation System and method for a blockchain network with heterogeneous privacy
CN109522362B (en) * 2018-10-17 2020-09-15 北京瑞卓喜投科技发展有限公司 Incomplete data synchronization method, system and equipment based on block chain data

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101701131B1 (en) * 2016-04-28 2017-02-13 주식회사 라피 Data recording and validation methods and systems using the connecting of blockchain between different type
CN108492183A (en) * 2018-03-29 2018-09-04 深圳前海微众银行股份有限公司 Account trading method, system and the computer readable storage medium of block chain
CN109669940A (en) * 2018-11-12 2019-04-23 深圳市步云科技有限公司 A kind of main side chain distributed storage mode based on block chain
CN109471744A (en) * 2018-11-21 2019-03-15 北京蓝石环球区块链科技有限公司 The more subchain system architectures of main chain adduction row based on block chain
CN109829718A (en) * 2019-01-30 2019-05-31 缀初网络技术(上海)有限公司 A kind of block chain multi-layer framework and its operation method based on storage application scenarios
CN109857580A (en) * 2019-03-12 2019-06-07 深圳市网心科技有限公司 Across the chain contract call method of block chain, device and storage medium

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
Research on Cross-Chain Technology Based on Sidechain and Hash-Locking;Liping Deng等;《International Conference on Edge Computing》;20180616;第144-151页 *
Sidechains: Decoupled Consensus Between Chains;Alberto Garoffolo等;《https://arxiv.org/abs/1812.05441》;20181017;第1-20页 *
以太坊上的侧链技术Loom(一);赵小峰的思想迭代器;《https://www.jianshu.com/p/35039dc96bbb?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation》;20180513;全文 *
发布区块链标准应用模型及应用部署技术研究;白杰等;《信息技术与网络安全》;20180914;第13-18页 *

Also Published As

Publication number Publication date
CN110210845A (en) 2019-09-06

Similar Documents

Publication Publication Date Title
CN110210845B (en) Method, apparatus, medium, and computing device for blockchain data migration
CN108595157B (en) Block chain data processing method, device, equipment and storage medium
CN112650576B (en) Resource scheduling method, device, equipment, storage medium and computer program product
CN105988862B (en) Distributed transaction processing method and device
CN109995523B (en) Activation code management method and device and activation code generation method and device
CN111277639A (en) Method and device for maintaining data consistency
CN112306645B (en) Transaction processing method, device, equipment and medium for Ether house virtual machine
US20220100777A1 (en) Transaction request construction method and apparatus, transaction request processing method and apparatus, device and storage medium
CN109951546A (en) Transactions requests processing method, device, equipment and medium based on intelligent contract
WO2022095518A1 (en) Automatic interface test method and apparatus, and computer device and storage medium
WO2020224100A1 (en) Blockchain configuration file processing apparatus, system, and method, and storage medium
CN114327803A (en) Method, apparatus, device and medium for accessing machine learning model by block chain
CN111598575A (en) Business process control method and device, electronic equipment and readable storage medium
CN114328132A (en) Method, device, equipment and medium for monitoring state of external data source
CN114138549A (en) Data backup and recovery method based on kubernets system
CN111813418A (en) Distributed link tracking method, device, computer equipment and storage medium
CN110737425B (en) Method and device for establishing application program of charging platform system
CN113191889A (en) Wind control configuration method, configuration system, electronic device and readable storage medium
KR102637173B1 (en) System of Blockchain Framework for 5G Mobile Edge Computing, Device and Management Method thereof
CN113360172B (en) Application deployment method, device, computer equipment and storage medium
CN115827265A (en) Transaction processing method, device, equipment and storage medium
JP7273241B2 (en) Intelligent contract execution method and apparatus
CN112988738B (en) Data slicing method and device for block chain
CN114416357A (en) Method and device for creating container group, electronic equipment and medium
CN113791792A (en) Application calling information acquisition method and device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant