CN113806335A - Data migration method and device applied to block chain - Google Patents

Data migration method and device applied to block chain Download PDF

Info

Publication number
CN113806335A
CN113806335A CN202111145917.7A CN202111145917A CN113806335A CN 113806335 A CN113806335 A CN 113806335A CN 202111145917 A CN202111145917 A CN 202111145917A CN 113806335 A CN113806335 A CN 113806335A
Authority
CN
China
Prior art keywords
block
target
transaction
block chain
original
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.)
Pending
Application number
CN202111145917.7A
Other languages
Chinese (zh)
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.)
Hangzhou Rivtower Technology Co Ltd
Original Assignee
Hangzhou Rivtower Technology 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 Hangzhou Rivtower Technology Co Ltd filed Critical Hangzhou Rivtower Technology Co Ltd
Priority to CN202111145917.7A priority Critical patent/CN113806335A/en
Publication of CN113806335A publication Critical patent/CN113806335A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/214Database migration support
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • 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

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Finance (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Computing Systems (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

A data migration method and device applied to a block chain are provided, wherein the method is applied to a server side which is connected to an original block chain and a target block chain in an interfacing manner, and comprises the following steps: obtaining a corresponding existence certification of an original transaction to be migrated in an original block chain; storing the existence certificate in a preset block of a target block chain; constructing a migration transaction, wherein the migration transaction comprises an original transaction to be migrated and a search mark; the search mark is used for searching a corresponding existence certification of the original transaction to be migrated in an original block chain in the preset block; and issuing the migration transaction in the target block chain to be uplink. By applying the scheme, the transaction data can be guaranteed to be difficult to be tampered or forged in the data migration process, and therefore the reliability of block chain data migration is improved.

Description

Data migration method and device applied to block chain
Technical Field
The present disclosure relates to the field of blockchain technologies, and in particular, to a data migration method and apparatus applied to a blockchain.
Background
The block chain technology, also called distributed ledger technology, is a technology in which several computing devices participate in "accounting" together, and maintain a complete distributed database together. In actual traffic, it may be necessary to migrate data in one blockchain to another blockchain, possibly due to traffic transitions, or technical iterations.
In the related art, the old chain transaction can be directly modified and then re-uplinked to the new chain, which is equivalent to re-uplinking the transaction on the new chain, but in the scheme, the operator has the possibility of counterfeiting and tampering the original transaction data in the migration process, so that the reliability of the scheme is poor.
Disclosure of Invention
In view of the above, the present specification discloses a data migration method and apparatus applied to a block chain.
According to a first aspect of the embodiments of the present specification, a data migration method applied to a block chain is disclosed, which is applied to a server that is docked to an original block chain and a target block chain; the method comprises the following steps:
obtaining a corresponding existence certification of an original transaction to be migrated in an original block chain;
storing the existence certificate in a preset block of a target block chain;
constructing a migration transaction, wherein the migration transaction comprises an original transaction to be migrated and a search mark; the search mark is used for searching a corresponding existence certification of the original transaction to be migrated in an original block chain in the preset block;
and issuing the migration transaction in the target block chain to be uplink.
Optionally, the method further includes:
acquiring a target search mark corresponding to the original block chain transaction to be verified from the issued uplink migration transaction;
searching a corresponding target existence certification in the preset block based on the target search mark;
and checking whether the target existence certification is legal or not.
Optionally, an intelligent contract for searching for a corresponding presence certificate from the preset block based on a search mark is pre-deployed in the target block chain;
the searching for the corresponding target existence certification in the preset block based on the target search mark comprises:
initiating a presence certificate search transaction carrying a target search mark to the target block chain, so that the target block chain responds to the presence certificate search transaction, calling a search logic in the intelligent contract, searching a target presence certificate corresponding to the target search mark from the preset block, and generating a result return event corresponding to the target presence certificate;
and responding to the result return event, and acquiring the target existence certification from a preset block of the block chain.
Optionally, the existence certification includes a block height of a block in the original block chain where the original transaction is located, and at least one of the following information:
block header information of a block where the original transaction is located, cryptographic certification of the block header information, and a transaction hash list.
Optionally, the chunk header information in the target presence certificate includes a chunk hash, a chunk timestamp, a consensus signature, a transaction root, and a parent chunk hash; the verifying whether the target presence certificate is legal includes: performing a combination of any one or more of the following checks:
verifying, based on a consensus signature in the target presence attestation, whether a block hash of the target presence attestation is signed by a consensus participant;
searching a parent block of the corresponding block of the target existence certification, the block height of which is less than 1 of the block height of the target existence certification, and checking whether the parent block hash field of the target existence certification is matched with the block hash field of the parent block;
verifying whether the cryptographic proof of the block header information of the target existence proof is established based on the block hash, the block timestamp, the consensus signature, the transaction root and the parent block hash in the target existence proof;
and checking whether the transaction hash list of the target existence certification is matched with a transaction root.
According to a second aspect of the embodiments of the present specification, a data migration apparatus applied to a block chain is disclosed, and is applied to a server that is docked to an original block chain and a target block chain; the device comprises:
the first acquisition module is used for acquiring a corresponding existence certificate of an original transaction to be migrated in an original block chain;
the evidence storing module is used for storing the existence evidence in a preset block of the target block chain;
the building module is used for building a migration transaction, wherein the migration transaction comprises an original transaction to be migrated and a search mark; the search mark is used for searching a corresponding existence certification of the original transaction to be migrated in an original block chain in the preset block;
and the release module is used for releasing the uplink of the migration transaction in the target block chain.
Optionally, the apparatus further comprises:
the second acquisition module is used for acquiring a target search mark corresponding to the original block chain transaction to be verified from the issued uplink migration transaction;
the searching module searches for a corresponding target existence certification in the preset block based on the target searching mark;
and the checking module is used for checking whether the target existence certification is legal or not.
Optionally, an intelligent contract for searching for a corresponding presence certificate from the preset block based on a search mark is pre-deployed in the target block chain;
the lookup module further:
initiating a presence certificate search transaction carrying a target search mark to the target block chain, so that the target block chain responds to the presence certificate search transaction, calling a search logic in the intelligent contract, searching a target presence certificate corresponding to the target search mark from the preset block, and generating a result return event corresponding to the target presence certificate;
and responding to the result return event, and acquiring the target existence certification from a preset block of the block chain.
Optionally, the existence certification includes a block height of a block in the original block chain where the original transaction is located, and at least one of the following information:
block header information of a block where the original transaction is located, cryptographic certification of the block header information, and a transaction hash list.
Optionally, the chunk header information in the target presence certificate includes a chunk hash, a chunk timestamp, a consensus signature, a transaction root, and a parent chunk hash; the verification module further performs any one or a combination of the following verifications:
verifying, based on a consensus signature in the target presence attestation, whether a block hash of the target presence attestation is signed by a consensus participant;
searching a parent block of the corresponding block of the target existence certification, the block height of which is less than 1 of the block height of the target existence certification, and checking whether the parent block hash field of the target existence certification is matched with the block hash field of the parent block;
verifying whether the cryptographic proof of the block header information of the target existence proof is established based on the block hash, the block timestamp, the consensus signature, the transaction root and the parent block hash in the target existence proof;
and checking whether the transaction hash list of the target existence certification is matched with a transaction root.
According to a third aspect of the embodiments of the present specification, a computer device is disclosed, which at least comprises a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of the above-mentioned aspect embodiments when executing the program.
According to a fourth aspect of embodiments herein, a computer-readable storage medium is disclosed, having stored thereon a computer program which, when executed by a processor, implements the method of any of the above-described embodiments of a tweet.
In the above technical solution, on one hand, since the migration transaction issued to the target block chain includes the original transaction to be migrated, the transaction data in the original block chain is migrated to the target block chain; therefore, the technical scheme can complete transaction data migration between the blockchains.
On the other hand, in the scheme, the corresponding existence certification of the original transaction to be migrated in the original block chain is also stored in the preset block of the target block chain, so that if the server tries to tamper or forge the transaction data in the data migration process, the tampered or forged transaction data cannot be matched with the existence certification; therefore, the technical scheme can ensure that the transaction data is difficult to be tampered or forged in the data migration process, so that the reliability of block chain data migration is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with this specification and together with the description, serve to explain the principles.
FIG. 1 is a diagram illustrating an exemplary scenario of inter-blockchain data migration, as described herein;
FIG. 2 is a flowchart illustrating a method of data migration applied to a blockchain as described herein;
FIG. 3 is an exemplary diagram illustrating deployment and invocation of a smart contract according to the present description;
FIG. 4 is a diagram illustrating an exemplary structure of a data migration apparatus applied to a blockchain;
fig. 5 is a diagram showing an example of a configuration of a computer apparatus for data migration applied to a blockchain in the present specification.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in one or more embodiments of the present disclosure, the technical solutions in one or more embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in one or more embodiments of the present disclosure. It is to be understood that the described embodiments are only a few, and not all embodiments. All other embodiments that can be derived by one of ordinary skill in the art from one or more embodiments of the disclosure without making any creative effort shall fall within the scope of the disclosure.
When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present specification. Rather, they are merely examples of systems and methods consistent with certain aspects of the present description, as detailed in the appended claims.
The terminology used in the description herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the description. As used in this specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, the first information may also be referred to as second information, and similarly, the second information may also be referred to as first information, without departing from the scope of the present specification. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
Referring to fig. 1, fig. 1 is a diagram illustrating an exemplary scenario of data migration between block chains in the present specification;
as shown in fig. 1, the application scenario includes an original block chain, a target block chain, and a server respectively connected to the two block chains. The original blockchain may be a blockchain including an original transaction to be migrated, and may also be referred to as an old chain; the target blockchain may be a blockchain that is about to receive data migrated from the original blockchain, and may also be referred to as a new chain; the server may be a physical server connected to the original blockchain and the target blockchain or a virtual server established in a cloud platform.
When the server is in butt joint with the two block chains, communication connection can be established with the node devices of the two block chains respectively, and the server itself can be directly added into the two block chains as the node devices of the two block chains. Those skilled in the art should understand that the server, the original blockchain, and the target blockchain may run on different physical computers or on the same cloud platform.
It is to be understood that, although only one original blockchain and one target blockchain are disclosed in the above scenario, in practical applications, data migration between blockchains may also occur between blockchains, for example, data in multiple original blockchains are merged into one target blockchain, or data in one original blockchain is split into multiple target blockchains, or data in multiple original blockchains are redistributed into multiple target blockchains. The number of block chains specifically interfaced to by the server is not limited in the present specification.
In the related art, the old chain transaction can be directly modified and then re-linked to the new chain, which is equivalent to re-linking the transaction on the new chain; for example, assuming that the old chain is a blockchain a for storing water meter counts of certified users, wherein the transaction basic format is "household ID-meter reading date-water meter reading-electricity meter reading", and the new chain is a blockchain B for general certification, wherein the transaction basic format is "certification type-certification data", when the transaction data in the blockchain a is migrated to the blockchain B, the service end is required to modify the transactions, which are in the form of "ID 123456-202104-153.3-456.5", which refers to the transaction ID123456 as ID 153.3 and the electricity meter reading as 456.5 in 4 months of 2021, into transactions, which are adapted to the blockchain B, in the form of "water meter counts-ID 123456-202104-153.3-456.5", and then link the modified transactions in the blockchain B.
However, in the scheme, the operator has the possibility of counterfeiting and tampering the original transaction data in the migration process; continuing to take the above-mentioned water meter counting data migration as an example, the industry generally uses a hash check method to determine whether the data is forged or tampered, but since the transaction data in the blockchain a is modified into the transaction format supported by the blockchain B, the change of the hash value of the transaction is usually unavoidable, and thus the change of the hash value cannot be used to determine whether the data is forged or tampered. Therefore, the reliability of the above related art scheme is not good.
Based on this, the present specification proposes a technical solution that not only links the original transaction to be migrated in the target blockchain, but also verifies the corresponding presence certificate of the original transaction in the original blockchain to the target blockchain.
During implementation, the corresponding existence certificate of the original transaction to be migrated in the original block chain may be stored in a preset block of the target block chain, and a migration transaction including the original transaction to be migrated is constructed and issued to the target block chain; the migration transaction may further include a search mark for searching the preset block for a corresponding presence certificate of the original transaction to be migrated in the original block chain.
In the above technical solution, on one hand, since the migration transaction issued to the target block chain includes the original transaction to be migrated, the transaction data in the original block chain is migrated to the target block chain; therefore, the technical scheme can complete transaction data migration between the blockchains.
On the other hand, in the scheme, the corresponding existence certification of the original transaction to be migrated in the original block chain is also stored in the preset block of the target block chain, so that if the server tries to tamper or forge the transaction data in the data migration process, the tampered or forged transaction data cannot be matched with the existence certification; therefore, the technical scheme can ensure that the transaction data is difficult to be tampered or forged in the data migration process, so that the reliability of block chain data migration is improved.
The present specification is described below with reference to specific embodiments and specific application scenarios.
Referring to fig. 2, fig. 2 is a block chain data migration method applied to a server interfacing to an original block chain and a target block chain according to an embodiment of the present disclosure; the method may comprise the steps of:
s201, obtaining a corresponding existence certification of an original transaction to be migrated in an original block chain;
s202, storing the existence certificate in a preset block of a target block chain;
s203, constructing a migration transaction, wherein the migration transaction comprises an original transaction to be migrated and a search mark; the search mark is used for searching a corresponding existence certification of the original transaction to be migrated in an original block chain in the preset block;
s204, the migration transaction is distributed to the uplink in the target block chain.
The original block chain and the target block chain may include any type of block chain; in the art, blockchains are generally divided into three types: public chain (Public Blockchain), Private chain (Private Blockchain) and alliance chain (Consortium Blockchain). Furthermore, there may be a combination of the above types, such as private chain + federation chain, federation chain + public chain, and so on. The most decentralized is the public chain, the private chain can be a weak centralized system, which has strict limitation on nodes and a small number of nodes, and the federation chain is a block chain between the public chain and the private chain, which can implement "partial decentralized". The skilled person can select the specific used block chain type according to the specific service requirement, which is not limited in detail in this specification.
In this specification, the server may first obtain a corresponding presence certificate of an original transaction to be migrated in an original blockchain. Typically, a block header of a block chain contains a hash value generated based on a hash encryption algorithm, and a specific value of the hash value is related to a transaction in the block; since hash encryption algorithms are usually mathematical in terms of collision resistance, it is difficult for an original transaction that has been issued to an original blockchain to be modified while maintaining its corresponding hash value unchanged, so that the hash value can serve as a proof of the existence of the transaction data. It will be appreciated that the hash algorithm used to generate the presence credential may differ for different blockchains, as may the data structure employed by the presence credential itself; accordingly, the specification is not necessarily limited to the specific form of the presence certificate.
In this specification, the server may store the existence certification in a predetermined block of a target block chain. Specifically, the existence certification may be stored in a predetermined block of the target block chain by the server. For example, the predetermined block may be a first block of the target block chain, which is also called a created block, and the server may store the existence certificate corresponding to the original transaction to be migrated in the original block chain in the created block, so as to query the existence certificate from the created block when the existence of the original transaction needs to be confirmed in the future.
It is of course understood that the presence certificate may be stored in other blocks than the above-described created block as the storage location of the presence certificate. For example, if the original blockchain is a smaller private chain, and the target blockchain is a federation chain that has been running for a period of time, and the founder block of the federation chain is not writable, the presence certificate may be stored in the latest block of the target blockchain.
In one embodiment, the presence certificate includes a height of a block in the original block chain where the original transaction is located, and at least one of the following information: block header information of a block where the original transaction is located, cryptographic certification of the block header information, and a transaction hash list. In general, the block height can be used as an identification to quickly distinguish the corresponding presence evidence of different blocks; the block header information may be used to indicate authenticity of transaction data in the block body, while cryptographic proof of the block header information may be used to prove authenticity of the block header information, and the transaction hash list may be used to verify whether a transaction is packed into the current block; therefore, recording the above information in the presence certificate can enhance the reliability of the presence certificate.
For example, the storage structure of the presence certificate in the target block chain may be in the form of a Key-Value pair (Key-Value), where a Key in the Key-Value pair is a block height, and a Value may include block header information, a cryptographic certificate of the block header information, a transaction hash list, and other information; when the existence certification corresponding to a certain original transaction needs to be searched, the key value pair storage structure can be inquired according to the block height of the block where the certain original transaction is located in the original block chain.
In this specification, the server may construct a migration transaction including an original transaction to be migrated and a search tag; the search mark is used for searching the corresponding existence certification of the original transaction to be migrated in the original block chain in the preset block. Specifically, it is generally considered that when the original transaction to be migrated is re-linked in the target blockchain, the original transaction needs to be modified, and in the scheme, a data storage area may be preset in the migration transaction structure adapted to the target blockchain to store the original transaction to be migrated.
For example, an extension field is added in the migration transaction, and the extension field is used for storing the original transaction to be migrated and a search mark. In implementation, in order to further facilitate storage of paired information { < original transaction >, < lookup flag > }, the paired information may be encoded into Bytes format first, and then stored into the extension field of the migration transaction, so as to obtain the migration transaction corresponding to the original transaction to be migrated. Certainly, the storage scheme is only a feasible example, and those skilled in the art may also use data structures such as arrays, linked lists, vectors, and the like and corresponding read-write algorithms to implement other types of storage schemes, and this specification does not need to limit the specific storage schemes for the original transaction to be migrated and the search tag.
For the search mark, the specific content thereof may be a storage address of the presence certificate in the distributed ledger of the target block chain, or may be a keyword that can be used for querying, and the like; for example, if the number of the block where the original transaction is located in the original block chain is block number, and the position number of the original transaction in the block is position, the keyword for querying may be a binary group such as { blcknumber, position }.
It can be understood that, the step of constructing the migration transaction and the step of storing the certificate existence certification do not strictly require the order of execution, that is, the existence certification may be stored in the preset block of the target block chain first, then the migration transaction is constructed, the migration transaction may be constructed first, then the existence certification is stored in the preset block of the target block chain, and the two steps may be executed in parallel. In this specification, the execution order of the two steps is not limited.
In this specification, the migration transaction may be distributed in the target blockchain to the uplink. After the migration transaction is completed, the server can distribute the migration transaction to the uplink in the target block chain. As described above, the server may establish a communication connection with the node device of the target block chain, and may not add the target block chain itself, or may directly add the target block chain as a node device of the target block chain; therefore, when the migration transaction is released to the uplink in the target blockchain, the server may send the transaction to the node device of the target blockchain, so that the node device releases the migration transaction on the target blockchain, or may directly send the migration transaction to the target blockchain as the node device of the target blockchain.
In an embodiment shown in the foregoing, the server may further obtain, from the migration transaction of the released uplink, a target search mark corresponding to the transaction of the original blockchain to be verified; searching a corresponding target existence certification in the preset block based on the target search mark; and finally, checking whether the target existence certification is legal or not. Through the process, when the legality of the original transaction transferred to the target block chain needs to be verified, the corresponding target existence certification is searched in the preset block of the target block chain according to the target search mark which is stored in the transferred transaction together with the original transaction, and if the corresponding target existence certification can be searched and the target existence certification is legal, the original transaction transferred to the target block chain can be indirectly proved to be legal.
In an illustrated embodiment, the process of searching for the corresponding target existence certification in the preset block of the target block chain according to the target search flag stored in the migration transaction together with the original transaction may be implemented by an intelligent contract. In particular, an intelligent contract on a blockchain is a contract on a blockchain that can be executed triggered by a transaction. An intelligent contract may be defined in the form of code. The intelligent contract can be independently executed at each node in the blockchain network in a specified mode, and all execution records and data are stored on the blockchain, so that after the transaction is executed, transaction certificates which cannot be tampered and lost are stored on the blockchain.
Referring to FIG. 3, FIG. 3 is a schematic diagram illustrating the creation of an intelligent contract and invocation of an intelligent contract as described herein; as shown in fig. 3, taking an ethernet as an example, to create an intelligent contract, the intelligent contract may be written, changed into bytecode, and deployed to a block chain; and calling the intelligent contract in the Ethernet workshop, initiating a transaction pointing to the intelligent contract address, respectively executing the transaction by the EVM of each node, and operating the intelligent contract code in a distributed manner in the virtual machine of each node in the Ethernet workshop network.
When the search process of the target existence certification is realized through the intelligent contract, the called intelligent contract can be the intelligent contract which is deployed in the target block chain in advance and used for searching the corresponding existence certification from the preset block based on the search mark; the server may initiate a presence certificate search transaction carrying a target search tag to the target block chain, so that the target block chain responds to the presence certificate search transaction, invokes a search logic in the intelligent contract, searches for a target presence certificate corresponding to the target search tag from the preset block, and generates a result return event corresponding to the target presence certificate; then, the server side can respond to the result return event and obtain the target existence certification from the preset blocks of the block chain. It is understood that the event mechanism is only one possible form of inter-and intra-chain data interaction for the block chain, and besides, those skilled in the art may select other inter-and intra-chain data interaction approaches to deliver the target presence certificate found by the intelligent contract from the preset block to the server.
In this specification, the validity check method for the target presence certificate may be determined according to specific business requirements and contents in the target presence certificate, for example, the reliability of validity check may be improved by checking in multiple aspects; in one embodiment, the chunk header information in the target presence certificate includes a chunk hash, a chunk timestamp, a consensus signature, a transaction root, and a parent chunk hash; the above-mentioned means for verifying whether the target presence credential is legitimate may comprise performing any one or a combination of the following checks:
verifying whether the block hash of the target presence certificate is signed by a consensus participant based on the consensus signature in the target presence certificate; for example, if the consensus signature of the chunk hash in a target presence certificate does not match the signature public key of the consensus participant, it can be proved that the chunk hash in the target presence certificate is not signed by the consensus participant, and thus the target presence certificate is proved to be illegal; otherwise, the target existence proving legitimacy can be proved in the dimension.
Finding a parent block of a corresponding block of the target existence certification, the block height of which is less than 1 from the block height of the target existence certification, and checking whether a parent block hash field (also called parentHash) of the target existence certification is matched with the block hash field of the parent block; in general, if the hash of the parent block of a valid block is stored, the hash of the parent block stored in the target existence certification to be verified is compared with the hash of the parent block of the block corresponding to the target existence certification to be verified, and if the hash of the parent block is matched with the hash of the parent block of the block corresponding to the target existence certification to be verified, the connection relationship between the two blocks can be verified, so that the target existence certification is verified in one dimension.
Verifying whether the cryptographic proof of the block header information of the target existence proof is established or not based on the block hash, the block timestamp, the consensus signature, the transaction root and the father block hash in the target existence proof; for example, the block hash, the block timestamp, the consensus signature, the transaction root, and the total hash of the parent block hash may be stored in the cryptographic proof of the block header information, and if any one of the block hash, the block timestamp, the consensus signature, the transaction root, and the parent block hash is tampered, the regenerated total hash may not match the total hash in the cryptographic proof of the block header information, that is, the cryptographic proof is not true; therefore, if the cryptographic proof of the block header information of the target presence proof is established, it can be verified that the block hash, the block timestamp, the consensus signature, the transaction root, and the parent block hash have not been tampered with, and that the target presence proof is valid.
And checking whether the transaction hash list of the target existence certification is matched with the transaction root. Typically, the transaction root in the chunk header is computed from the transaction hash list; if the transaction hash list of the target existence certification is not matched with the transaction root, the existence of tampered data in the target existence certification and the transaction root can be certified; otherwise, it can be proved that the transaction hash list and the transaction root of the target existence certification are not tampered, so that the target existence certification is proved to be legal.
It is understood that, besides the above-mentioned verification methods, those skilled in the art may also select other validity verification methods according to specific requirements to obtain verification reliability meeting the service requirements.
The foregoing is all embodiments of the present specification directed to the data migration method applied to the blockchain. The present specification further provides embodiments of a corresponding data migration apparatus applied to a blockchain as follows:
the present specification proposes a data migration apparatus applied to a block chain, which is applied to a server side that is docked to an original block chain and a target block chain; an example of the structure of the device can be shown in fig. 4, which includes:
a first obtaining module 401, configured to obtain a corresponding existence certification of an original transaction to be migrated in an original block chain;
a certificate storing module 402, for storing the existence certificate in a preset block of the target block chain;
a building module 403, configured to build a migration transaction, where the migration transaction includes an original transaction to be migrated and a search tag; the search mark is used for searching a corresponding existence certification of the original transaction to be migrated in an original block chain in the preset block;
the issuing module 404 issues the migration transaction on the uplink in the target block chain.
In one embodiment, the presence certificate includes a height of a block in the original block chain where the original transaction is located, and at least one of the following information: block header information of a block where the original transaction is located, cryptographic certification of the block header information, and a transaction hash list. In general, the block height can be used as an identification to quickly distinguish the corresponding presence evidence of different blocks; the block header information may be used to indicate authenticity of transaction data in the block body, while cryptographic proof of the block header information may be used to prove authenticity of the block header information, and the transaction hash list may be used to verify whether a transaction is packed into the current block; therefore, recording the above information in the presence certificate can enhance the reliability of the presence certificate.
In a specific embodiment, the apparatus may further include a second obtaining module, a searching module, and a checking module, where the second obtaining module may obtain, from the migration transaction of the released uplink, a target search mark corresponding to the original blockchain transaction to be checked; the searching module can search the corresponding target existence certification in the preset block based on the target searching mark; the verification module may verify that the target presence attestation is legitimate. Through the process, when the legality of the original transaction transferred to the target block chain needs to be verified, the corresponding target existence certification is searched in the preset block of the target block chain according to the target search mark which is stored in the transferred transaction together with the original transaction, and if the corresponding target existence certification can be searched and the target existence certification is legal, the original transaction transferred to the target block chain can be indirectly proved to be legal.
In an illustrated embodiment, the process of searching for the corresponding target existence certification in the preset block of the target block chain by the search module according to the target search mark stored in the migration transaction together with the original transaction may be implemented by an intelligent contract. The called intelligent contract can be an intelligent contract which is deployed in the target block chain in advance and used for searching the corresponding existence certificate from the preset block based on the search mark; the search module may initiate a presence certificate search transaction carrying a target search tag to the target block chain, so that the target block chain responds to the presence certificate search transaction, invokes a search logic in the intelligent contract, searches for a target presence certificate corresponding to the target search tag from the preset block, and generates a result return event corresponding to the target presence certificate; then, the search module may obtain the target existence certification from a preset block of the block chain in response to the result return event.
In one embodiment, the chunk header information in the target presence certificate includes a chunk hash, a chunk timestamp, a consensus signature, a transaction root, and a parent chunk hash; the above-mentioned means for verifying whether the target presence credential is legitimate may comprise performing any one or a combination of the following checks:
verifying whether the block hash of the target presence certificate is signed by a consensus participant based on the consensus signature in the target presence certificate;
searching a parent block of a corresponding block with the block height being the block height of the target existence certification minus 1, and checking whether the parent block hash field of the target existence certification is matched with the block hash field of the parent block;
verifying whether the cryptographic proof of the block header information of the target existence proof is established or not based on the block hash, the block timestamp, the consensus signature, the transaction root and the father block hash in the target existence proof;
and checking whether the transaction hash list of the target existence certification is matched with the transaction root.
Embodiments of the present specification further provide a computer device, which at least includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the foregoing data migration method applied to the blockchain.
Fig. 5 is a schematic diagram illustrating a more specific hardware structure of a computing device according to an embodiment of the present disclosure, where the computing device may include: a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050. Wherein the processor 1010, memory 1020, input/output interface 1030, and communication interface 1040 are communicatively coupled to each other within the device via bus 1050.
The processor 1010 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits, and is configured to execute related programs to implement the technical solutions provided in the embodiments of the present disclosure.
The Memory 1020 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, or the like. The memory 1020 may store an operating system and other application programs, and when the technical solution provided by the embodiments of the present specification is implemented by software or firmware, the relevant program codes are stored in the memory 1020 and called to be executed by the processor 1010.
The input/output interface 1030 is used for connecting an input/output module to input and output information. The i/o module may be configured as a component in a device (not shown) or may be external to the device to provide a corresponding function. The input devices may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices may include a display, a speaker, a vibrator, an indicator light, etc.
The communication interface 1040 is used for connecting a communication module (not shown in the drawings) to implement communication interaction between the present apparatus and other apparatuses. The communication module can realize communication in a wired mode (such as USB, network cable and the like) and also can realize communication in a wireless mode (such as mobile network, WIFI, Bluetooth and the like).
Bus 1050 includes a path that transfers information between various components of the device, such as processor 1010, memory 1020, input/output interface 1030, and communication interface 1040.
It should be noted that although the above-mentioned device only shows the processor 1010, the memory 1020, the input/output interface 1030, the communication interface 1040 and the bus 1050, in a specific implementation, the device may also include other components necessary for normal operation. In addition, those skilled in the art will appreciate that the above-described apparatus may also include only those components necessary to implement the embodiments of the present description, and not necessarily all of the components shown in the figures.
Embodiments of the present specification also provide a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the aforementioned data migration method applied to a blockchain.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
From the above description of the embodiments, it is clear to those skilled in the art that the embodiments of the present disclosure can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the embodiments of the present specification may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments of the present specification.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus embodiment, since it is substantially similar to the method embodiment, it is relatively simple to describe, and reference may be made to some descriptions of the method embodiment for relevant points. The above-described apparatus embodiments are merely illustrative, and the modules described as separate components may or may not be physically separate, and the functions of the modules may be implemented in one or more software and/or hardware when implementing the embodiments of the present disclosure. And part or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
The foregoing is only a specific embodiment of the embodiments of the present disclosure, and it should be noted that, for those skilled in the art, a plurality of modifications and decorations can be made without departing from the principle of the embodiments of the present disclosure, and these modifications and decorations should also be regarded as the protection scope of the embodiments of the present disclosure.

Claims (12)

1. A data migration method applied to a block chain is applied to a server side which is connected to an original block chain and a target block chain in an abutting mode; the method comprises the following steps:
obtaining a corresponding existence certification of an original transaction to be migrated in an original block chain;
storing the existence certificate in a preset block of a target block chain;
constructing a migration transaction, wherein the migration transaction comprises an original transaction to be migrated and a search mark; the search mark is used for searching a corresponding existence certification of the original transaction to be migrated in an original block chain in the preset block;
and issuing the migration transaction in the target block chain to be uplink.
2. The method of claim 1, further comprising:
acquiring a target search mark corresponding to the original block chain transaction to be verified from the issued uplink migration transaction;
searching a corresponding target existence certification in the preset block based on the target search mark;
and checking whether the target existence certification is legal or not.
3. The method according to claim 2, wherein an intelligent contract for searching the corresponding existence certification from the preset block based on the search mark is pre-deployed in the target block chain;
the searching for the corresponding target existence certification in the preset block based on the target search mark comprises:
initiating a presence certificate search transaction carrying a target search mark to the target block chain, so that the target block chain responds to the presence certificate search transaction, calling a search logic in the intelligent contract, searching a target presence certificate corresponding to the target search mark from the preset block, and generating a result return event corresponding to the target presence certificate;
and responding to the result return event, and acquiring the target existence certification from a preset block of the block chain.
4. The method of claim 2, wherein the existence certification comprises a block height of a block in the original block chain where the original transaction is located, and at least one of the following information:
block header information of a block where the original transaction is located, cryptographic certification of the block header information, and a transaction hash list.
5. The method of claim 4, wherein the chunk header information in the target presence attestation includes a chunk hash, a chunk timestamp, a consensus signature, a transaction root, a parent chunk hash; the verifying whether the target presence certificate is legal includes: performing a combination of any one or more of the following checks:
verifying, based on a consensus signature in the target presence attestation, whether a block hash of the target presence attestation is signed by a consensus participant;
searching a parent block of the corresponding block of the target existence certification, the block height of which is less than 1 of the block height of the target existence certification, and checking whether the parent block hash field of the target existence certification is matched with the block hash field of the parent block;
verifying whether the cryptographic proof of the block header information of the target existence proof is established based on the block hash, the block timestamp, the consensus signature, the transaction root and the parent block hash in the target existence proof;
and checking whether the transaction hash list of the target existence certification is matched with a transaction root.
6. A data migration device applied to a block chain is applied to a server side which is connected to an original block chain and a target block chain in an abutting mode; the device comprises:
the first acquisition module is used for acquiring a corresponding existence certificate of an original transaction to be migrated in an original block chain;
the evidence storing module is used for storing the existence evidence in a preset block of the target block chain;
the building module is used for building a migration transaction, wherein the migration transaction comprises an original transaction to be migrated and a search mark; the search mark is used for searching a corresponding existence certification of the original transaction to be migrated in an original block chain in the preset block;
and the release module is used for releasing the uplink of the migration transaction in the target block chain.
7. The apparatus of claim 6, the apparatus further comprising:
the second acquisition module is used for acquiring a target search mark corresponding to the original block chain transaction to be verified from the issued uplink migration transaction;
the searching module searches for a corresponding target existence certification in the preset block based on the target searching mark;
and the checking module is used for checking whether the target existence certification is legal or not.
8. The apparatus according to claim 7, wherein an intelligent contract for searching the corresponding presence certificate from the preset block based on the search mark is pre-deployed in the target block chain;
the lookup module further:
initiating a presence certificate search transaction carrying a target search mark to the target block chain, so that the target block chain responds to the presence certificate search transaction, calling a search logic in the intelligent contract, searching a target presence certificate corresponding to the target search mark from the preset block, and generating a result return event corresponding to the target presence certificate;
and responding to the result return event, and acquiring the target existence certification from a preset block of the block chain.
9. The apparatus of claim 7, wherein the existence certification comprises a block height of a block in the original block chain where the original transaction is located, and at least one of the following information:
block header information of a block where the original transaction is located, cryptographic certification of the block header information, and a transaction hash list.
10. The apparatus of claim 9, wherein the chunk header information in the target presence attestation includes a chunk hash, a chunk timestamp, a consensus signature, a transaction root, a parent chunk hash; the verification module further performs any one or a combination of the following verifications:
verifying, based on a consensus signature in the target presence attestation, whether a block hash of the target presence attestation is signed by a consensus participant;
searching a parent block of the corresponding block of the target existence certification, the block height of which is less than 1 of the block height of the target existence certification, and checking whether the parent block hash field of the target existence certification is matched with the block hash field of the parent block;
verifying whether the cryptographic proof of the block header information of the target existence proof is established based on the block hash, the block timestamp, the consensus signature, the transaction root and the parent block hash in the target existence proof;
and checking whether the transaction hash list of the target existence certification is matched with a transaction root.
11. A computer device comprising at least a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of claims 1 to 5 when executing the program.
12. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method of any one of claims 1 to 5.
CN202111145917.7A 2021-09-28 2021-09-28 Data migration method and device applied to block chain Pending CN113806335A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111145917.7A CN113806335A (en) 2021-09-28 2021-09-28 Data migration method and device applied to block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111145917.7A CN113806335A (en) 2021-09-28 2021-09-28 Data migration method and device applied to block chain

Publications (1)

Publication Number Publication Date
CN113806335A true CN113806335A (en) 2021-12-17

Family

ID=78938849

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111145917.7A Pending CN113806335A (en) 2021-09-28 2021-09-28 Data migration method and device applied to block chain

Country Status (1)

Country Link
CN (1) CN113806335A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115630046A (en) * 2022-12-22 2023-01-20 国网数字科技控股有限公司 Block chain migration method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107577427A (en) * 2017-08-31 2018-01-12 上海保险交易所股份有限公司 For the data migration method of block catenary system, equipment and storage medium
CN108829350A (en) * 2018-05-31 2018-11-16 阿里巴巴集团控股有限公司 Data migration method and device based on block chain
US20200057565A1 (en) * 2018-08-17 2020-02-20 Bank Of America Corporation Blockchain architecture for selective data restore and migration
US20200175003A1 (en) * 2017-08-29 2020-06-04 Huawei Technologies Co., Ltd. Cross-Chain Transaction Method and Apparatus
CN112052235A (en) * 2020-09-21 2020-12-08 深圳前海微众银行股份有限公司 Method and device for migrating block chain transaction data
WO2021187733A1 (en) * 2020-03-17 2021-09-23 삼성전자주식회사 Electronic device and control method thereof

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200175003A1 (en) * 2017-08-29 2020-06-04 Huawei Technologies Co., Ltd. Cross-Chain Transaction Method and Apparatus
CN107577427A (en) * 2017-08-31 2018-01-12 上海保险交易所股份有限公司 For the data migration method of block catenary system, equipment and storage medium
CN108829350A (en) * 2018-05-31 2018-11-16 阿里巴巴集团控股有限公司 Data migration method and device based on block chain
US20200057565A1 (en) * 2018-08-17 2020-02-20 Bank Of America Corporation Blockchain architecture for selective data restore and migration
WO2021187733A1 (en) * 2020-03-17 2021-09-23 삼성전자주식회사 Electronic device and control method thereof
CN112052235A (en) * 2020-09-21 2020-12-08 深圳前海微众银行股份有限公司 Method and device for migrating block chain transaction data

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115630046A (en) * 2022-12-22 2023-01-20 国网数字科技控股有限公司 Block chain migration method and device

Similar Documents

Publication Publication Date Title
TWI724391B (en) Node management method and device based on blockchain
TWI737944B (en) Block chain-based transaction execution method and device, and electronic equipment
CN108182581B (en) Accounting method and device for block chain
CN110442652B (en) Cross-chain data processing method and device based on block chain
US20190386834A1 (en) Blockchain management apparatus, blockchain management method, and program
CN111898360A (en) Text similarity detection method and device based on block chain and electronic equipment
EP3813296B1 (en) Methods and apparatuses for reading blockchain data
CN111079101B (en) Method and device for obtaining evidence of infringement based on block chain, electronic equipment and storage medium
WO2020258858A1 (en) Authorization method, system, apparatus and device in blockchain-type account book
CN112487492B (en) Data verification method, system and equipment
US10778452B2 (en) Blockchain ledger authentication
CN112200569B (en) Digital seal using method and device based on block chain and electronic equipment
CN111597567B (en) Data processing method, data processing device, node equipment and storage medium
CN111342963A (en) Data uplink method, data storage method and device
CN112287033B (en) Data synchronization method, equipment and computer readable storage medium
WO2022206454A1 (en) Method and apparatus for providing cross-chain messages
CN112287034A (en) Data synchronization method, equipment and computer readable storage medium
US20240078551A1 (en) Blockchain-based user element authorization methods and apparatuses
Jiang et al. A Blockchain‐Based Vehicle Condition Recording System for Second‐Hand Vehicle Market
CN114039733B (en) Certificate storage service transfer method, device and equipment for alliance chains
CN111245897A (en) Data processing method, device, system, storage medium and processor
CN113806335A (en) Data migration method and device applied to block chain
CN113542405A (en) Block chain-based network communication system, method, device and storage medium
CN111899104B (en) Service execution method and device
CN113949632B (en) Dynamic node configuration method and device for block chain

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
CB02 Change of applicant information

Address after: Room 2339, 2nd Floor, No. 92, Huancheng North Road, Gongshu District, Hangzhou City, Zhejiang Province 310005

Applicant after: Hangzhou Xita Technology Co.,Ltd.

Address before: 310007 room 2001 and 2010, 20 / F, tower a, Huaxing Times Square, No. 478, Wensan Road, Xihu District, Hangzhou, Zhejiang

Applicant before: Hangzhou Xita Technology Co.,Ltd.

CB02 Change of applicant information