CN112527781A - Intelligent contract data migration method and system - Google Patents

Intelligent contract data migration method and system Download PDF

Info

Publication number
CN112527781A
CN112527781A CN202011539896.2A CN202011539896A CN112527781A CN 112527781 A CN112527781 A CN 112527781A CN 202011539896 A CN202011539896 A CN 202011539896A CN 112527781 A CN112527781 A CN 112527781A
Authority
CN
China
Prior art keywords
intelligent contract
data
transaction
new version
version
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.)
Granted
Application number
CN202011539896.2A
Other languages
Chinese (zh)
Other versions
CN112527781B (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.)
Shanghai Wanxiang Blockchain Inc
Original Assignee
Shanghai Wanxiang Blockchain Inc
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 Shanghai Wanxiang Blockchain Inc filed Critical Shanghai Wanxiang Blockchain Inc
Priority to CN202011539896.2A priority Critical patent/CN112527781B/en
Publication of CN112527781A publication Critical patent/CN112527781A/en
Application granted granted Critical
Publication of CN112527781B publication Critical patent/CN112527781B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention provides an intelligent contract data migration method and system, comprising the following steps: step M1: verifying intelligent contract operation input by a user through an intelligent contract command management module, generating corresponding intelligent contract management transaction according to operation content, and sending the intelligent contract management transaction to a block network for transaction consensus; step M2: and the intelligent contract data migration module migrates the data in the old version intelligent contract to the new version intelligent contract according to the transaction content after receiving the intelligent contract management transaction. The invention can reduce the long-chain calling caused by upgrading the intelligent contract, does not need to hard code the address pointing to the old version intelligent contract in the new version intelligent contract, and simplifies the development logic of the intelligent contract.

Description

Intelligent contract data migration method and system
Technical Field
The invention relates to the technical field of block chains, in particular to an intelligent contract data migration method and system, and more particularly to an efficient intelligent contract data migration scheme.
Background
The block chain technology is a novel decentralized protocol, digital currency transactions or other data can be safely stored, information cannot be forged and tampered, transaction confirmation on the block chain is completed by all nodes on the block chain together, consistency of the transaction confirmation is guaranteed by a consensus algorithm, a public account book is maintained on the block chain and used for storing balance of all users on a block chain network, and any node of the public account book on a storage block is visible, so that counterfeiting and tampering of the public account book are guaranteed.
The intelligent contract on the blockchain refers to a string of binary codes written and compiled by the security and run on the blockchain, and data storage, reading and writing and some logic operations on the blockchain can be realized through the intelligent contract, so that some applications based on the blockchain are completed by using the intelligent contract.
The existing intelligent contract upgrading usually uses a hard coding migration method, a contract address pointing to an old version of data contract is stored in a new version of data contract, and incremental data content is stored in the new version of data contract. However, continuous version upgrading can result in a long chain logic relationship, and maintenance cost is high.
Patent document CN107145521B (application number: 201710230002.3) discloses a data migration method for a blockchain multi-level intelligent contract. The method comprises the following steps: 1) constructing a contract tree model for a contract system with a plurality of contracts mutually invoked; 2) migrating data of the top-level contract except the contract address of the child node; 3) judging whether the node where the current contract is located is a leaf node; 4) deploying a new contract of the leaf node, migrating the data of the contract, and storing the contract address of the leaf node; 5) after the data migration of all the sub-node contracts is finished, deploying new contract migration contract data and storing new addresses of all the sub-node contracts; 6) repeating the steps 3) to 5), and migrating the contract address parameters of all the sub-contracts of the top-level contract.
Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide an intelligent contract data migration method and system.
The invention provides an intelligent contract data migration method, which comprises the following steps:
step M1: verifying intelligent contract operation input by a user through an intelligent contract command management module, generating corresponding intelligent contract management transaction according to operation content, and sending the intelligent contract management transaction to a block network for transaction consensus;
step M2: and the intelligent contract data migration module migrates the data in the old version intelligent contract to the new version intelligent contract according to the transaction content after receiving the intelligent contract management transaction.
Preferably, the step M1 includes: the intelligent contract command management module carries out authority and feasibility verification on the intelligent contract operation according to the intelligent contract operation input by a user, generates intelligent contract management transaction corresponding to the operation, and sends the intelligent contract management transaction to a block network for transaction consensus.
Preferably, the intelligent contract management transaction includes migration operation specific content including an initiator of the migration operation, an old version intelligent contract address, a new version intelligent contract address and transaction signature information.
Preferably, the step M2 includes: the intelligent contract data migration module receives the block after the transaction consensus, retrieves whether the transaction in the current block contains the intelligent contract management transaction, and migrates the data in the old version of the intelligent contract into the new version of the intelligent contract according to the content in the intelligent contract management transaction when the intelligent contract management transaction is retrieved; when no intelligent contract management transactions are retrieved, the current migration operation is skipped.
Preferably, the new version intelligent contract comprises a mode that the new version intelligent contract storage structure inherits the old version intelligent contract storage structure, so that the new data attribute can be added into the new version intelligent contract while the old version intelligent contract data attribute is used in the new version intelligent contract.
Preferably, the migration of data in the old version intelligent contract to the new version intelligent contract in the step M2 includes utilizing the storage tree principle of the intelligent contract on the blockchain, and deriving the storage tree of the new version intelligent contract directly from the storage tree of the old version contract by means of implementing the normalized data migration through the underlying coding.
Preferably, the migration of the data in the old version intelligent contract to the new version intelligent contract in the step M2 includes:
when the data migration operation is triggered to be executed, the account information corresponding to the old version of the intelligent contract is found through the address of the old version of the intelligent contract, and obtains the data tree stored in the old version of intelligent contract according to the root hash in the account information, the intelligent contract data migration module traverses each node in the data tree, obtains the key of the node and the value of the node, intercepts the key value when the data is stored in the node key content, and combines the key value with the contract address of the new version of intelligent contract to generate a new key, reconstructing the storage tree of the new version intelligent contract according to the new key, adding the node data into the storage tree of the new version intelligent contract, after the data traversal of the old version intelligent contract is completed, the storage tree of the new version intelligent contract contains all the data of the old version intelligent contract, and finally the root hash of the new version intelligent contract points to the tree root of the storage tree of the new version intelligent contract to complete the data migration.
The invention provides an intelligent contract data migration system, which comprises:
module M1: verifying intelligent contract operation input by a user through an intelligent contract command management module, generating corresponding intelligent contract management transaction according to operation content, and sending the intelligent contract management transaction to a block network for transaction consensus;
module M2: and the intelligent contract data migration module migrates the data in the old version intelligent contract to the new version intelligent contract according to the transaction content after receiving the intelligent contract management transaction.
Preferably, said module M1 comprises: the intelligent contract command management module carries out authority and feasibility verification on the intelligent contract operation according to the intelligent contract operation input by a user, generates intelligent contract management transaction corresponding to the operation, and sends the intelligent contract management transaction to a block network for transaction consensus;
the intelligent contract management transaction comprises the specific content of the migration operation, including an initiator of the migration operation, an old version intelligent contract address, a new version intelligent contract address and transaction signature information.
Preferably, said module M2 comprises: the intelligent contract data migration module receives the block after the transaction consensus, retrieves whether the transaction in the current block contains the intelligent contract management transaction, and migrates the data in the old version of the intelligent contract into the new version of the intelligent contract according to the content in the intelligent contract management transaction when the intelligent contract management transaction is retrieved; skipping the current migration operation when the intelligent contract management transaction is not retrieved;
the new version intelligent contract comprises a mode that the new version intelligent contract storage structure inherits the old version intelligent contract storage structure, so that the new data attribute can be added into the new version intelligent contract while the old version intelligent contract data attribute is used in the new version intelligent contract;
the data migration of the old version intelligent contract to the new version intelligent contract in the module M2 comprises the steps of utilizing the storage tree principle of the intelligent contract on a block chain, and realizing the standardized data migration mode through bottom layer coding to lead the storage tree of the new version intelligent contract to be directly derived from the storage tree of the old version contract;
the migration of the data in the old version intelligent contract to the new version intelligent contract in the module M2 comprises the following steps:
when the data migration operation is triggered to be executed, the account information corresponding to the old version of the intelligent contract is found through the address of the old version of the intelligent contract, and obtains the data tree stored in the old version of intelligent contract according to the root hash in the account information, the intelligent contract data migration module traverses each node in the data tree, obtains the key of the node and the value of the node, intercepts the key value when the data is stored in the node key content, and combines the key value with the contract address of the new version of intelligent contract to generate a new key, reconstructing the storage tree of the new version intelligent contract according to the new key, adding the node data into the storage tree of the new version intelligent contract, after the data traversal of the old version intelligent contract is completed, the storage tree of the new version intelligent contract contains all the data of the old version intelligent contract, and finally the root hash of the new version intelligent contract points to the tree root of the storage tree of the new version intelligent contract to complete the data migration.
Compared with the prior art, the invention has the following beneficial effects:
1. the invention can reduce the long-chain calling caused by upgrading the intelligent contract, does not need to hard code the address pointing to the old version intelligent contract in the new version intelligent contract, and simplifies the development logic of the intelligent contract;
2. the invention can simplify the operation of data migration through the intelligent contract data migration module, and does not need to carry out additional hard coding on the premise of ensuring the atomicity of the operation.
3. The method and the device can improve the accuracy and atomicity of data migration and improve the efficiency of data migration.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments with reference to the following drawings:
FIG. 1 is a schematic diagram of an intelligent contract data migration system.
Detailed Description
The present invention will be described in detail with reference to specific examples. The following examples will assist those skilled in the art in further understanding the invention, but are not intended to limit the invention in any way. It should be noted that it would be obvious to those skilled in the art that various changes and modifications can be made without departing from the spirit of the invention. All falling within the scope of the present invention.
Example 1
The invention provides an intelligent contract data migration system, which comprises:
step M1: verifying intelligent contract operation input by a user through an intelligent contract command management module, generating corresponding intelligent contract management transaction according to operation content, and sending the intelligent contract management transaction to a block network for transaction consensus;
step M2: and the intelligent contract data migration module migrates the data in the old version intelligent contract to the new version intelligent contract according to the transaction content after receiving the intelligent contract management transaction.
Specifically, the step M1 includes: the intelligent contract command management module carries out authority and feasibility verification on the intelligent contract operation according to the intelligent contract operation input by a user, generates intelligent contract management transaction corresponding to the operation, and sends the intelligent contract management transaction to a block network for transaction consensus.
Specifically, the intelligent contract management transaction includes migration operation specific content including an initiator of the migration operation, an old version intelligent contract address, a new version intelligent contract address, and transaction signature information.
Specifically, the step M2 includes: the intelligent contract data migration module receives the block after the transaction consensus, retrieves whether the transaction in the current block contains the intelligent contract management transaction, and migrates the data in the old version of the intelligent contract into the new version of the intelligent contract according to the content in the intelligent contract management transaction when the intelligent contract management transaction is retrieved; when no intelligent contract management transactions are retrieved, the current migration operation is skipped.
Specifically, the new version intelligent contract comprises a mode that the new version intelligent contract storage structure inherits the old version intelligent contract storage structure, so that the new data attribute can be added into the new version intelligent contract while the old version intelligent contract data attribute is used in the new version intelligent contract.
Specifically, the migration of data in the old version intelligent contract to the new version intelligent contract in step M2 includes utilizing the storage tree principle of the intelligent contract on the block chain, and implementing the normalized data migration through the bottom layer coding, so that the storage tree of the new version intelligent contract is directly derived from the storage tree of the old version contract.
Specifically, the migration of the data in the old version intelligent contract to the new version intelligent contract in the step M2 includes:
when the data migration operation is triggered to be executed, the account information corresponding to the old version of the intelligent contract is found through the address of the old version of the intelligent contract, and obtains the data tree stored in the old version of intelligent contract according to the root hash in the account information, the intelligent contract data migration module traverses each node in the data tree, obtains the key of the node and the value of the node, intercepts the key value when the data is stored in the node key content, and combines the key value with the contract address of the new version of intelligent contract to generate a new key, reconstructing the storage tree of the new version intelligent contract according to the new key, adding the node data into the storage tree of the new version intelligent contract, after the data traversal of the old version intelligent contract is completed, the storage tree of the new version intelligent contract contains all the data of the old version intelligent contract, and finally the root hash of the new version intelligent contract points to the tree root of the storage tree of the new version intelligent contract to complete the data migration.
An intelligent contract data migration system provided by the present invention, as shown in fig. 1, includes:
module M1: verifying intelligent contract operation input by a user through an intelligent contract command management module, generating corresponding intelligent contract management transaction according to operation content, and sending the intelligent contract management transaction to a block network for transaction consensus;
module M2: and the intelligent contract data migration module migrates the data in the old version intelligent contract to the new version intelligent contract according to the transaction content after receiving the intelligent contract management transaction.
Specifically, the module M1 includes: the intelligent contract command management module carries out authority and feasibility verification on the intelligent contract operation according to the intelligent contract operation input by a user, generates intelligent contract management transaction corresponding to the operation, and sends the intelligent contract management transaction to a block network for transaction consensus;
the intelligent contract management transaction comprises the specific content of the migration operation, including an initiator of the migration operation, an old version intelligent contract address, a new version intelligent contract address and transaction signature information.
Specifically, the module M2 includes: the intelligent contract data migration module receives the block after the transaction consensus, retrieves whether the transaction in the current block contains the intelligent contract management transaction, and migrates the data in the old version of the intelligent contract into the new version of the intelligent contract according to the content in the intelligent contract management transaction when the intelligent contract management transaction is retrieved; skipping the current migration operation when the intelligent contract management transaction is not retrieved;
the new version intelligent contract comprises a mode that the new version intelligent contract storage structure inherits the old version intelligent contract storage structure, so that the new data attribute can be added into the new version intelligent contract while the old version intelligent contract data attribute is used in the new version intelligent contract;
the data migration of the old version intelligent contract to the new version intelligent contract in the module M2 comprises the steps of utilizing the storage tree principle of the intelligent contract on a block chain, and realizing the standardized data migration mode through bottom layer coding to lead the storage tree of the new version intelligent contract to be directly derived from the storage tree of the old version contract;
the migration of the data in the old version intelligent contract to the new version intelligent contract in the module M2 comprises the following steps:
when the data migration operation is triggered to be executed, the account information corresponding to the old version of the intelligent contract is found through the address of the old version of the intelligent contract, and obtains the data tree stored in the old version of intelligent contract according to the root hash in the account information, the intelligent contract data migration module traverses each node in the data tree, obtains the key of the node and the value of the node, intercepts the key value when the data is stored in the node key content, and combines the key value with the contract address of the new version of intelligent contract to generate a new key, reconstructing the storage tree of the new version intelligent contract according to the new key, adding the node data into the storage tree of the new version intelligent contract, after the data traversal of the old version intelligent contract is completed, the storage tree of the new version intelligent contract contains all the data of the old version intelligent contract, and finally the root hash of the new version intelligent contract points to the tree root of the storage tree of the new version intelligent contract to complete the data migration.
After the intelligent contract is upgraded, the data of the old version intelligent contract is not required to be explicitly migrated to the new version intelligent contract, and the data of the old version intelligent contract can be accessed by calling the new version intelligent contract.
Example 2
Example 2 is a modification of example 1
In an original intelligent contract data migration scene, a contract address pointing to an old version of an intelligent contract is usually stored in a new version of the intelligent contract in a hard coding mode of the intelligent contract, and data of the old version of the intelligent contract is accessed through chained calling. Continuous upgrading can result in longer-run call links, increasing maintenance costs.
An efficient intelligent contract data migration scheme, comprising: intelligent contract command management module, intelligent contract data migration module.
The intelligent contract command management module comprises a management function for contract operation commands;
the intelligent contract data migration module comprises functions of contract deployment, contract upgrading, contract data migration and the like;
1.2, based on each module in the system framework structure, describing the work flow of the whole system, and embodying the coordination relationship among the modules:
the intelligent contract command management module receives the intelligent contract operation content input by the user, and the intelligent contract operation content is integrated and constructed by the intelligent contract command management module.
The intelligent contract data migration module
Firstly, the feasibility of the migration operation is verified, a manager of an old version intelligent contract and a manager of a new version intelligent contract are obtained, and permission judgment is carried out with an initiator of the migration operation to judge whether the initiator has the permission to execute the migration operation.
The module adopts the inheritance characteristic of language facing to the object, and ensures that a user can use the data attribute of the old version contract in the new version contract and simultaneously can add new data attribute in the new version contract by the mode that the storage structure of the new version contract is inherited to the storage structure of the old version contract.
The module utilizes the storage tree principle of the intelligent contract on the block chain, and realizes the standard data migration mode through bottom layer coding, so that the storage tree of the new version contract is directly derived from the storage tree of the old version contract.
Each contract Account corresponds to a state object, each state object has a member variable of an Account type, the Account object also comprises a Root hash (Root) of a storage tree, and all stored data in the intelligent contract Account can be indexed according to the Root hash. In the module, when a data migration operation is triggered to be executed, a system finds account information corresponding to an old version of intelligent contract through an address of the old version of intelligent contract, and obtains a data tree stored in the old version of intelligent contract according to root hash in the account information, wherein the data tree uniquely locates the address of data through a key (keyrie) mode and a value (data) mode, and the content of the key (keyrie) in the data tree is formed by combining the contract address (address) of the intelligent contract and a key value (key) during data storage. The migration module iterates through each node in the data tree, obtains a key (keyrie) of the node and a value (data) of the node, intercepts a key value (key) of the node in the key (keyrie) content during data storage, combines the key value (key) with a contract address (address) of the new version intelligent contract to generate a new key (keyrie), and adds the node data into the storage tree of the new version intelligent contract. After the data traversal of the old version intelligent contract is completed, the storage tree of the new version intelligent contract contains all the data of the old version intelligent contract, and finally the root hash of the new version intelligent contract points to the tree root of the storage tree of the new version intelligent contract to complete the data migration.
The data structure of the "account" is as follows:
Figure BDA0002854260870000071
Figure BDA0002854260870000081
the intelligent contract data migration module can be integrated with the contract deployment module to complete the operation from deployment to data migration atomization; and adding contract deployment transaction information in the specific intelligent contract upgrading transaction, and combining the two transactions into one transaction. When the intelligent contract data migration module processes the transaction, a new version of the intelligent contract is deployed first, and then the data stored by the old version of the intelligent contract is migrated to the intelligent contract deployed in the previous step.
Those skilled in the art will appreciate that, in addition to implementing the systems, apparatus, and various modules thereof provided by the present invention in purely computer readable program code, the same procedures can be implemented entirely by logically programming method steps such that the systems, apparatus, and various modules thereof are provided in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Therefore, the system, the device and the modules thereof provided by the present invention can be considered as a hardware component, and the modules included in the system, the device and the modules thereof for implementing various programs can also be considered as structures in the hardware component; modules for performing various functions may also be considered to be both software programs for performing the methods and structures within hardware components.
The foregoing description of specific embodiments of the present invention has been presented. It is to be understood that the present invention is not limited to the specific embodiments described above, and that various changes or modifications may be made by one skilled in the art within the scope of the appended claims without departing from the spirit of the invention. The embodiments and features of the embodiments of the present application may be combined with each other arbitrarily without conflict.

Claims (10)

1. An intelligent contract data migration method, comprising:
step M1: verifying intelligent contract operation input by a user through an intelligent contract command management module, generating corresponding intelligent contract management transaction according to operation content, and sending the intelligent contract management transaction to a block network for transaction consensus;
step M2: and the intelligent contract data migration module migrates the data in the old version intelligent contract to the new version intelligent contract according to the transaction content after receiving the intelligent contract management transaction.
2. The intelligent contract data migration method according to claim 1, wherein said step M1 includes: the intelligent contract command management module carries out authority and feasibility verification on the intelligent contract operation according to the intelligent contract operation input by a user, generates intelligent contract management transaction corresponding to the operation, and sends the intelligent contract management transaction to a block network for transaction consensus.
3. The intelligent contract data migration method of claim 2, wherein the intelligent contract management transactions include migration operation specific content including an originator of a migration operation, an old version intelligent contract address, a new version intelligent contract address, and transaction signature information.
4. The intelligent contract data migration method according to claim 1, wherein said step M2 includes: the intelligent contract data migration module receives the block after the transaction consensus, retrieves whether the transaction in the current block contains the intelligent contract management transaction, and migrates the data in the old version of the intelligent contract into the new version of the intelligent contract according to the content in the intelligent contract management transaction when the intelligent contract management transaction is retrieved; when no intelligent contract management transactions are retrieved, the current migration operation is skipped.
5. The intelligent contract data migration method of claim 1, wherein the new version intelligent contract comprises a manner in which the new version intelligent contract storage structure inherits from the old version intelligent contract storage structure, so that new data attributes can be added to the new version intelligent contract while the old version intelligent contract data attributes are used in the new version intelligent contract.
6. The intelligent contract data migration method according to claim 1, wherein the step M2 of migrating the data in the old version intelligent contract to the new version intelligent contract comprises utilizing the storage tree principle of the intelligent contract on the block chain to directly derive the storage tree of the new version intelligent contract from the storage tree of the old version contract by means of implementing the canonical data migration through the bottom layer coding.
7. The intelligent contract data migration method according to claim 1, wherein the step M2 of migrating the data in the old version intelligent contract to the new version intelligent contract comprises:
when the data migration operation is triggered to be executed, the account information corresponding to the old version of the intelligent contract is found through the address of the old version of the intelligent contract, and obtains the data tree stored in the old version of intelligent contract according to the root hash in the account information, the intelligent contract data migration module traverses each node in the data tree, obtains the key of the node and the value of the node, intercepts the key value when the data is stored in the node key content, and combines the key value with the contract address of the new version of intelligent contract to generate a new key, reconstructing the storage tree of the new version intelligent contract according to the new key, adding the node data into the storage tree of the new version intelligent contract, after the data traversal of the old version intelligent contract is completed, the storage tree of the new version intelligent contract contains all the data of the old version intelligent contract, and finally the root hash of the new version intelligent contract points to the tree root of the storage tree of the new version intelligent contract to complete the data migration.
8. An intelligent contract data migration system, comprising:
module M1: verifying intelligent contract operation input by a user through an intelligent contract command management module, generating corresponding intelligent contract management transaction according to operation content, and sending the intelligent contract management transaction to a block network for transaction consensus;
module M2: and the intelligent contract data migration module migrates the data in the old version intelligent contract to the new version intelligent contract according to the transaction content after receiving the intelligent contract management transaction.
9. The intelligent contract data migration system of claim 8, wherein said module M1 includes: the intelligent contract command management module carries out authority and feasibility verification on the intelligent contract operation according to the intelligent contract operation input by a user, generates intelligent contract management transaction corresponding to the operation, and sends the intelligent contract management transaction to a block network for transaction consensus;
the intelligent contract management transaction comprises the specific content of the migration operation, including an initiator of the migration operation, an old version intelligent contract address, a new version intelligent contract address and transaction signature information.
10. The intelligent contract data migration system of claim 8, wherein said module M2 includes: the intelligent contract data migration module receives the block after the transaction consensus, retrieves whether the transaction in the current block contains the intelligent contract management transaction, and migrates the data in the old version of the intelligent contract into the new version of the intelligent contract according to the content in the intelligent contract management transaction when the intelligent contract management transaction is retrieved; skipping the current migration operation when the intelligent contract management transaction is not retrieved;
the new version intelligent contract comprises a mode that the new version intelligent contract storage structure inherits the old version intelligent contract storage structure, so that the new data attribute can be added into the new version intelligent contract while the old version intelligent contract data attribute is used in the new version intelligent contract;
the data migration of the old version intelligent contract to the new version intelligent contract in the module M2 comprises the steps of utilizing the storage tree principle of the intelligent contract on a block chain, and realizing the standardized data migration mode through bottom layer coding to lead the storage tree of the new version intelligent contract to be directly derived from the storage tree of the old version contract;
the migration of the data in the old version intelligent contract to the new version intelligent contract in the module M2 comprises the following steps:
when the data migration operation is triggered to be executed, the account information corresponding to the old version of the intelligent contract is found through the address of the old version of the intelligent contract, and obtains the data tree stored in the old version of intelligent contract according to the root hash in the account information, the intelligent contract data migration module traverses each node in the data tree, obtains the key of the node and the value of the node, intercepts the key value when the data is stored in the node key content, and combines the key value with the contract address of the new version of intelligent contract to generate a new key, reconstructing the storage tree of the new version intelligent contract according to the new key, adding the node data into the storage tree of the new version intelligent contract, after the data traversal of the old version intelligent contract is completed, the storage tree of the new version intelligent contract contains all the data of the old version intelligent contract, and finally the root hash of the new version intelligent contract points to the tree root of the storage tree of the new version intelligent contract to complete the data migration.
CN202011539896.2A 2020-12-23 2020-12-23 Intelligent contract data migration method and system Active CN112527781B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011539896.2A CN112527781B (en) 2020-12-23 2020-12-23 Intelligent contract data migration method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011539896.2A CN112527781B (en) 2020-12-23 2020-12-23 Intelligent contract data migration method and system

Publications (2)

Publication Number Publication Date
CN112527781A true CN112527781A (en) 2021-03-19
CN112527781B CN112527781B (en) 2022-07-15

Family

ID=74975895

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011539896.2A Active CN112527781B (en) 2020-12-23 2020-12-23 Intelligent contract data migration method and system

Country Status (1)

Country Link
CN (1) CN112527781B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113065867A (en) * 2021-03-30 2021-07-02 上海万向区块链股份公司 System, method and medium for data playback-based incompatible blockchain upgrade
CN113760353A (en) * 2021-08-27 2021-12-07 浙商银行股份有限公司 Block chain intelligent contract version control method and block chain system
CN116702157A (en) * 2023-06-21 2023-09-05 烟台大学 Intelligent contract vulnerability detection method based on neural network

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106709704A (en) * 2016-11-23 2017-05-24 杭州秘猿科技有限公司 Intelligent contract upgrading method based on permission chain
CN107145521A (en) * 2017-04-10 2017-09-08 杭州趣链科技有限公司 A kind of data migration method towards block chain multistage intelligent contract
CN107464148A (en) * 2017-08-23 2017-12-12 众安信息技术服务有限公司 A kind of intelligent contract upgrade method and system based on alliance's chain
CN108170740A (en) * 2017-12-18 2018-06-15 深圳前海微众银行股份有限公司 Data migration method, system and computer readable storage medium
CN108196872A (en) * 2017-12-27 2018-06-22 邵美 The upgrade method of intelligent contract in a kind of block catenary system
CN109978477A (en) * 2017-12-27 2019-07-05 现代财富控股有限公司 Intelligent contract version keyholed back plate system and method based on block chain
CN110018840A (en) * 2019-04-11 2019-07-16 深圳市网心科技有限公司 A kind of intelligence contract upgrade method, device, block chain node device and medium
CN110413304A (en) * 2019-07-31 2019-11-05 中国工商银行股份有限公司 The hot upgrade method of intelligent contract and device based on block chain network
CN111932260A (en) * 2020-09-18 2020-11-13 杭州趣链科技有限公司 Intelligent contract version management method, equipment and readable storage medium
CN111949297A (en) * 2020-08-20 2020-11-17 杭州溪塔科技有限公司 Block chain intelligent contract upgrading method and device and electronic equipment
CN112118133A (en) * 2020-09-11 2020-12-22 北京易安睿龙科技有限公司 Method for facilitating quick upgrading of Ether intelligent contracts based on custom structure data

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106709704A (en) * 2016-11-23 2017-05-24 杭州秘猿科技有限公司 Intelligent contract upgrading method based on permission chain
CN107145521A (en) * 2017-04-10 2017-09-08 杭州趣链科技有限公司 A kind of data migration method towards block chain multistage intelligent contract
CN107464148A (en) * 2017-08-23 2017-12-12 众安信息技术服务有限公司 A kind of intelligent contract upgrade method and system based on alliance's chain
CN108170740A (en) * 2017-12-18 2018-06-15 深圳前海微众银行股份有限公司 Data migration method, system and computer readable storage medium
CN108196872A (en) * 2017-12-27 2018-06-22 邵美 The upgrade method of intelligent contract in a kind of block catenary system
CN109978477A (en) * 2017-12-27 2019-07-05 现代财富控股有限公司 Intelligent contract version keyholed back plate system and method based on block chain
CN110018840A (en) * 2019-04-11 2019-07-16 深圳市网心科技有限公司 A kind of intelligence contract upgrade method, device, block chain node device and medium
CN110413304A (en) * 2019-07-31 2019-11-05 中国工商银行股份有限公司 The hot upgrade method of intelligent contract and device based on block chain network
CN111949297A (en) * 2020-08-20 2020-11-17 杭州溪塔科技有限公司 Block chain intelligent contract upgrading method and device and electronic equipment
CN112118133A (en) * 2020-09-11 2020-12-22 北京易安睿龙科技有限公司 Method for facilitating quick upgrading of Ether intelligent contracts based on custom structure data
CN111932260A (en) * 2020-09-18 2020-11-13 杭州趣链科技有限公司 Intelligent contract version management method, equipment and readable storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113065867A (en) * 2021-03-30 2021-07-02 上海万向区块链股份公司 System, method and medium for data playback-based incompatible blockchain upgrade
CN113760353A (en) * 2021-08-27 2021-12-07 浙商银行股份有限公司 Block chain intelligent contract version control method and block chain system
CN113760353B (en) * 2021-08-27 2024-01-02 浙商银行股份有限公司 Block chain intelligent contract version control method and block chain system
CN116702157A (en) * 2023-06-21 2023-09-05 烟台大学 Intelligent contract vulnerability detection method based on neural network
CN116702157B (en) * 2023-06-21 2023-12-26 烟台大学 Intelligent contract vulnerability detection method based on neural network

Also Published As

Publication number Publication date
CN112527781B (en) 2022-07-15

Similar Documents

Publication Publication Date Title
CN112527781B (en) Intelligent contract data migration method and system
CN112686671B (en) Intelligent contract deployment method, device, equipment and medium based on block chain
CN106681739B (en) Automatic intelligent contract generation method
AU2019329945A1 (en) System and method for improved blockchain-implemented smart contract
CN109829296A (en) The sandbox implementation method of intelligent contract based on alliance's chain
CN112862490B (en) Output consensus method under asynchronous network
CN109597822A (en) A kind of storage of user data and querying method and user data processing unit
CN104408584A (en) Analysis method and system for transaction relevance
CN110297721B (en) Cross-contract calling method of intelligent contract based on JAVA
CN102314358A (en) Method for deploying conventional applications on cloud platform in SOA (service oriented architecture) way
CN107092491A (en) A kind of configuring load application method and system
CN112035090A (en) Intelligent contract management system and method based on containerization technology
CN114417413A (en) File processing method, device, equipment and medium of block chain file system
CN107168704A (en) A kind of multi-page resource file method for implanting and device
CN111339193B (en) Category encoding method and device
CN111813836A (en) Method for improving Ethereum block chain system expansibility
CN106990974A (en) A kind of APP applications update method, device and electronic equipment
CN111125996B (en) Method for realizing instruction set based on bidirectional constraint tree of pseudo-random excitation generator
CN110544092B (en) Dynamic newly-added multi-type database data operation chaining method for block chain
CN111949634A (en) Method for synchronously migrating block chain data
CN112287032B (en) Block chain data storage method and device and block chain link points
CN113076086B (en) Metadata management system and method for modeling model object using the same
CN111062060B (en) Voting proposal life cycle management method based on intelligent contract
CN113741868B (en) Service computing task processing method, device, computer equipment and storage medium
CN104331538A (en) Information flow process modeling method and system based on mode assignment

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