CN107145521B - A kind of data migration method towards block chain multistage intelligent contract - Google Patents
A kind of data migration method towards block chain multistage intelligent contract Download PDFInfo
- Publication number
- CN107145521B CN107145521B CN201710230002.3A CN201710230002A CN107145521B CN 107145521 B CN107145521 B CN 107145521B CN 201710230002 A CN201710230002 A CN 201710230002A CN 107145521 B CN107145521 B CN 107145521B
- Authority
- CN
- China
- Prior art keywords
- contract
- data
- node
- address
- block chain
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/21—Design, administration or maintenance of databases
- G06F16/214—Database migration support
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/382—Payment protocols; Details thereof insuring higher security of transaction
- G06Q20/3825—Use of electronic signatures
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Business, Economics & Management (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Accounting & Taxation (AREA)
- General Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Data Mining & Analysis (AREA)
- Finance (AREA)
- Strategic Management (AREA)
- General Business, Economics & Management (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a kind of data migration methods towards block chain multistage intelligent contract.Include the following steps: 1) to construct contract tree shaped model for the contract system for there are multiple contracts mutually to call;2) data of the migration top layer contract in addition to child node contract address;3) judge whether node where current contract is leaf node;4) it disposes the new contract of leaf node and migrates the data of the contract, the contract address of store leaf node;5) Data Migration of all child node contracts finishes, and disposes new contract migration contract data and stores the new address of all child node contracts;6) repeat step 3) to step 5), migrate the contract address parameter of all sub- contracts of top layer contract.When the present invention solves on block chain complicated intelligence contract data migration contract address as parameter can not replacement problem, realize the Data Migration towards block chain multistage intelligent contract.
Description
Technical field
The present invention relates to block chain technology, intelligent contract, caching and multithreadings more particularly to a kind of multistage intelligent to close
Data migration method when about upgrading.
Background technique
Block chain technology, block chain are a kind of novel decentralization agreements, can safely store digital cash transaction or its
His data, information can not be forged and be distorted, and the trade confirmation on block chain is completed jointly by all nodes on block chain, by altogether
Know algorithm and guarantee its consistency, safeguards a public account book, all users in memory block chain network on block chain
Remaining sum, public account book are located at any node in memory block as it can be seen that guarantee that it can not forge and distort.
Intelligent contract, the intelligent contract on block chain refer to write and compiled by solidity and run on block chain
A string of binary codes, we can realize data storage, read-write and some logics on block chain by intelligent contract
Operation, therefore some applications based on block chain are completed using intelligent contract.
Caching and multithreading, caching refer to when program needs to read data, the data read will be needed to set in advance
In caching, process priority reads data from caching.Since the speed of service of caching is more many than memory block, so caching can pole
Big faster procedure reads data speed.Multithreading refers to program when carrying out the operation of some calculating ratio comparatively denses, and use is multi-thread
Journey is handled, and makes full use of CPU core calculation, improves CPU efficiency.
Summary of the invention
The purpose of the present invention is being directed to the deficiency of existing block chain technology, one kind is provided towards block chain multistage intelligent contract
Data migration method.
Due to the characteristic of block chain itself, generally using the block chain of intelligent contract using after online, if to apply
Version requirement need to update, it is meant that contract must be redeployed, and generate new contract address.System will use new later
Contract just need to move to old contract data in new contract at this time since old data cannot be abandoned.
The purpose of the present invention is be achieved through the following technical solutions: in the case where not changing block chain contract data,
Ensure safely and efficiently to move to old contract data in new contract, more particularly to has the multistage contract number of call relation
According to migration situation, include the following steps:
1) for the intelligent contract system for there are multiple contracts mutually to call, contract data is migrated step by step using tree shaped model,
Father node contract calls child node contract in tree shaped model;
2) contract for disposing top mode migrates data of the top layer contract in addition to child node contract address;
3) judge whether node where current contract is leaf node, if present node is not leaf node, reading is worked as
The contract address of the child node of front nodal point repeats the judgement to sub- contract;If present node is leaf node, enter step
4);
4) it disposes the new contract of leaf node and migrates the data of the contract, the contract address of store leaf node;
5) all contract nodes are traversed, if the Data Migration of all child nodes of node finishes where contract, start to dispose
New current contract migrates contract data and stores the new address of all child node contracts;Otherwise, it reads and is moved without completing data
The sub- contract address moved carries out step 3);
6) repeat step 3) to step 5), until node where current contract is top mode, migrate top layer contract
All sub- contracts contract address parameter.
Further, structure is answered first for there are the multiple contracts mutually called to construct tree shaped model in the step 1)
The call relation between the clear contract of tree shaped model is made, wherein has in father node contract and calls child node contract method, one of them
Contract can call multiple sub- contracts, and a sub- contract can be called by multiple contracts.
Further, in the step 2), contract can dispose new contract when migrating, each contract has uniquely
Contract address.Old contract address should be removed when migrating top layer contract data, only all child node contract datas are all moved
After shifting, father node contract just starts Data Migration, and the migration of contract address should be based on newly deployed contract.
Further, it needs to cache private key before calling contract method migration contract data, based on block chain itself
Characteristic requires private key when calling intelligence contract method every time and signs, and private key is generally encrypted as a private key file
In the presence of.Therefore, private key file can be decrypted to storage in advance in the buffer, the efficient reading speed based on cache file is called
It is more efficient when contract method.
Further, when migrating contract data, due to can constantly execute the read-write operation of contract when contract data migration,
The core number of CPU can be made full use of using the method for multithreading.Contract data moving method can support block chain in this way
On the big order of magnitude Data Migration, and ensure in new contract system effectively to use the related data of old contract.
The beneficial effects of the present invention are: the present invention constructs contract in the Data Migration towards block chain multistage intelligent contract
It calls tree shaped model to carry out safety transfer contract data, and is realized in migrating data using the technology of caching and multithreading
The Data Migration of complicated intelligence contract.For the Data Migration of the intelligent contract of general not call relation, way is direct
Data Migration can be completed in the Set method of the Get method and new contract of calling old contract, but for there is the multiple of call relation
The Data Migration of contract, Direct Transfer data can destroy original contract call relation.To guarantee contract data and its calling to patrol
The newly deployed contract system that completely moves to is collected, the present invention is adjusted in the migration of multistage intelligent contract data using tree shaped model
The selection of sequence and transferring content when contract migrates, and technology is read and write into one using private key caching and multithreading intelligence contract
Step improves contract data transport efficiency, accordingly even when being that complicated intelligent contract system can also completely move to new contract system
System is without worrying that its calling logic is destroyed.Present invention efficiently solves the Data Migrations towards multistage intelligent contract to ask
Topic.
Detailed description of the invention
Fig. 1 is the step flow chart of multistage intelligent contract data moving method of the present invention;
Fig. 2 is the tree shaped model figure of the multistage intelligent contract of the embodiment of the present invention;
Fig. 3 is that the contract data of the embodiment of the present invention migrates specific procedure chart.
Specific embodiment
Below according to the drawings and specific embodiments the present invention is described in detail, the objects and effects of the present invention will become brighter
It is aobvious.
As shown in Figure 1, the method for the present invention, includes the following steps:
1) for the intelligent contract system for thering are multiple contracts mutually to call, as shown in Fig. 2, being migrated step by step using tree shaped model
Contract data, father node contract calls child node contract in tree shaped model;
2) contract for disposing top mode migrates data of the top layer contract in addition to child node contract address;
3) judge whether node where current contract is leaf node, if present node is not leaf node, reading is worked as
The contract address of the child node of front nodal point repeats the judgement to sub- contract;If present node is leaf node, enter step
4);
4) it disposes the new contract of leaf node and migrates the data of the contract, the contract address of store leaf node;
5) all contract nodes are traversed, if the Data Migration of all child nodes of node finishes where contract, start to dispose
New current contract migrates contract data and stores the new address of all child node contracts;Otherwise, it reads and is moved without completing data
The sub- contract address moved carries out step 3);
6) repeat step 3) to step 5), until node where current contract is top mode, migrate top layer contract
All sub- contracts contract address parameter.
Further, structure is answered first for there are the multiple contracts mutually called to construct tree shaped model in the step 1)
The call relation between the clear contract of tree shaped model is made, wherein has in father node contract and calls child node contract method, one of them
Contract can call multiple sub- contracts, and a sub- contract can be called by multiple contracts.
Further, in the step 2), contract can dispose new contract when migrating, each contract has uniquely
Contract address.Therefore, old contract address, and only all child node contract numbers should be removed when migrating top layer contract data
After according to all migrations, father node contract just starts Data Migration, and the migration of contract address should be with newly deployed contract
It is main.
Further, as shown in figure 3, needing to cache private key before calling contract method, the spy based on block chain itself
Property, requiring private key when calling intelligence contract method every time signs, and private key is generally encrypted and deposits for a private key file
?.Therefore, private key file can be decrypted to storage in advance in the buffer, the efficient reading speed based on cache file is called and closed
About method when it is more efficient;
Further, as shown in figure 3, executing contract method using the method for multithreading when migrating contract data, due to
Contract data can constantly execute the read-write operation of contract when migrating, the core of CPU can be made full use of using the method for multithreading
Calculation.Contract data moving method can support the Data Migration of the big order of magnitude on block chain in this way, and ensure in new conjunction
The related data of old contract is effectively used about in system.
Illustrate specific embodiment with a specific intelligent contract migration example below:
A Data Migration towards multistage block chain intelligence contract is simulated, as shown in Fig. 2, and there are two variables in about 1
Contract1Addrs [] and contract2Addrs [] stores all and about 2 addresses and all and about 3 ground respectively
Location.Also there are two variable contract3Addrs [] and contract4Addrs [] to store all and about 4 respectively in about 2
Address and all and about 5 addresses.Also variable contract5Addrs [] stores all and about 5 addresses in about 3.
Firstly, we judge that the intelligence contract system is one and has mutual call relation before formally migration contract data
Multistage intelligent contract system.By the tree shaped model (shown in Fig. 2) of contract call relation, it is known that and about 1 calling and about 2
With with about 3, and about 2 call and about 4 and and about 5, and about 3 call and about 5.According to step 2), step 3), step 4) and step
5), first deployment it is new and about 4 and and about 5, and migrate contract data, store the address of new contract.At this point, and about 2 and and about 3
All child node contracts migrated and finished, dispose it is new and about 2 and and about 3, migrate all data in addition to contract address,
Finally storage it is new and about 4 and and about 5 address.Final step, and about 1 all child node contracts all complete by migration, portion
Administration it is new and about 1, migrate all data in addition to contract address, store it is new and about 2 and and about 3 address.This is arrived, the multistage
The Data Migration of intelligent contract system finishes.
Claims (5)
1. a kind of data migration method towards block chain multistage intelligent contract, which comprises the steps of:
1) for the intelligent contract system for there are multiple contracts mutually to call, contract data is migrated step by step using tree shaped model, it is tree-shaped
Father node contract calls child node contract in model;
2) contract for disposing top mode migrates data of the top layer contract in addition to child node contract address;
3) judge whether node where current contract is leaf node, if present node is not leaf node, prosthomere is worked as in reading
The contract address of the child node of point, repeats the judgement to sub- contract;If present node is leaf node, enter step 4);
4) it disposes the new contract of leaf node and migrates the data of the contract, the contract address of store leaf node;
5) all contract nodes are traversed, if the Data Migration of all child nodes of node finishes where contract, start to dispose newly
Current contract migrates contract data and stores the new address of all child node contracts;Otherwise, it reads without completing Data Migration
Sub- contract address carries out step 3);
6) repeat step 3) to step 5), until node where current contract is top mode, migrate the institute of top layer contract
There is the contract address parameter of sub- contract.
2. a kind of data migration method towards block chain multistage intelligent contract as described in claim 1, which is characterized in that step
It is rapid 1) in for have the multiple contracts mutually called construct tree shaped model, wherein father node is stored with child node in tree shaped model
Simultaneously there is call relation in contract address to child node contract, and a contract calls multiple sub- contracts or called by multiple father's contracts.
3. a kind of data migration method towards block chain multistage intelligent contract as described in claim 1, which is characterized in that step
It is rapid 2) in, contract migrate when can dispose new contract, each contract has unique contract address;Migrate top layer contract data
When should remove old contract address, only all after migration, father node contract just starts for all child node contract datas
The migration of Data Migration, contract address should be based on newly deployed contract.
4. a kind of data migration method towards block chain multistage intelligent contract as described in claim 1, which is characterized in that
Before calling contract method migration contract data, all private key files are decrypted to form plaintext private key with its corresponding password,
Plaintext private key is stored in the buffer using caching mechanism.
5. a kind of data migration method towards block chain multistage intelligent contract as described in claim 1, which is characterized in that
When migrating contract data, old contract data is obtained using multithreading and new contract is written into old contract data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710230002.3A CN107145521B (en) | 2017-04-10 | 2017-04-10 | A kind of data migration method towards block chain multistage intelligent contract |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710230002.3A CN107145521B (en) | 2017-04-10 | 2017-04-10 | A kind of data migration method towards block chain multistage intelligent contract |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107145521A CN107145521A (en) | 2017-09-08 |
CN107145521B true CN107145521B (en) | 2019-05-21 |
Family
ID=59773695
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710230002.3A Active CN107145521B (en) | 2017-04-10 | 2017-04-10 | A kind of data migration method towards block chain multistage intelligent contract |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107145521B (en) |
Families Citing this family (23)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108170740B (en) * | 2017-12-18 | 2022-04-26 | 深圳前海微众银行股份有限公司 | 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 |
CN109978477B (en) * | 2017-12-27 | 2022-12-23 | 现代财富控股有限公司 | Intelligent contract version control and management system and method based on block chain |
CN108510389B (en) * | 2018-03-30 | 2020-12-18 | 深圳前海微众银行股份有限公司 | Intelligent contract calling method and device based on block chain and readable storage medium |
WO2019227052A1 (en) | 2018-05-24 | 2019-11-28 | Walmart Apollo, Llc | System and methods for multi-variant tracking |
US20190363890A1 (en) | 2018-05-24 | 2019-11-28 | Walmart Apollo, Llc | Nested Blockchain System |
CN108876605A (en) * | 2018-05-27 | 2018-11-23 | 北京轻松筹信息技术有限公司 | Digital asset method of commerce and device |
CN108829350B (en) * | 2018-05-31 | 2020-02-21 | 阿里巴巴集团控股有限公司 | Data migration method and device based on block chain |
CN111897498A (en) * | 2018-07-27 | 2020-11-06 | 创新先进技术有限公司 | Multi-level storage method and device for block chain data |
KR20210050527A (en) * | 2018-08-10 | 2021-05-07 | 티제로그룹, 인코포레이티드 | Self-regulated security token that implements smart contract-based compliance rules consulting an investor's smart contract-based global registry |
CN109410057A (en) * | 2018-10-10 | 2019-03-01 | 吕晋磊 | A kind of tree-shaped multicore block chain ecosystem method for building up of family and process |
CN110443658B (en) * | 2018-12-07 | 2023-01-24 | 深圳市智税链科技有限公司 | Tax management method, apparatus, medium and electronic device based on block chain system |
CN109766722B (en) * | 2019-01-22 | 2020-11-10 | 苏州同济区块链研究院有限公司 | Method for constructing intelligent contract in block chain |
CN109951467B (en) * | 2019-03-11 | 2021-09-28 | 苏州缓流科技有限公司 | Data interaction system, method and equipment based on block chain |
CN110058968A (en) * | 2019-04-17 | 2019-07-26 | 深圳市先河系统技术有限公司 | Control method, system and the relevant device of decentralization storage |
CN110175844A (en) * | 2019-05-07 | 2019-08-27 | 深圳前海微众银行股份有限公司 | The dissemination method and device of intelligent contract in a kind of block chain |
CN111104144B (en) * | 2019-12-27 | 2023-10-20 | 珠海金山数字网络科技有限公司 | Anchor point updating method and device |
CN111680317B (en) * | 2020-04-27 | 2021-05-25 | 华东师范大学 | Block chain-oriented optimistic concurrency order-preserving coding method |
CN111679902B (en) * | 2020-08-14 | 2020-11-10 | 支付宝(杭州)信息技术有限公司 | Intelligent contract calling method and device based on block chain and electronic equipment |
CN111949297B (en) * | 2020-08-20 | 2023-04-07 | 杭州溪塔科技有限公司 | Block chain intelligent contract upgrading method and device and electronic equipment |
CN112400182A (en) * | 2020-10-12 | 2021-02-23 | 北京和联共识科技有限公司 | Method and device for executing intelligent contracts in block chain and electronic equipment |
CN112527781B (en) * | 2020-12-23 | 2022-07-15 | 上海万向区块链股份公司 | Intelligent contract data migration method and system |
CN112866025B (en) * | 2021-01-14 | 2022-10-11 | 公安部第三研究所 | Intelligent contract fragmentation processing method |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102004769A (en) * | 2010-11-12 | 2011-04-06 | 成都市华为赛门铁克科技有限公司 | File management method, equipment and memory system |
CN102196049A (en) * | 2011-05-31 | 2011-09-21 | 北京大学 | Method suitable for secure migration of data in storage cloud |
CN102968498A (en) * | 2012-12-05 | 2013-03-13 | 华为技术有限公司 | Method and device for processing data |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160321435A1 (en) * | 2015-05-01 | 2016-11-03 | Monegraph, Inc. | Managing digital content via block chain registers |
US10380702B2 (en) * | 2015-05-01 | 2019-08-13 | Monegraph, Inc. | Rights transfers using block chain transactions |
CN105893042A (en) * | 2016-03-31 | 2016-08-24 | 北京航空航天大学 | Intelligent contract implementation method based on block chain |
CN106407430B (en) * | 2016-09-27 | 2019-09-03 | 北京天德科技有限公司 | A kind of intelligent contract state synchronization method of complexity based on stage bucket |
CN106559211B (en) * | 2016-11-22 | 2019-12-13 | 中国电子科技集团公司第三十研究所 | Privacy protection intelligent contract method in block chain |
-
2017
- 2017-04-10 CN CN201710230002.3A patent/CN107145521B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102004769A (en) * | 2010-11-12 | 2011-04-06 | 成都市华为赛门铁克科技有限公司 | File management method, equipment and memory system |
CN102196049A (en) * | 2011-05-31 | 2011-09-21 | 北京大学 | Method suitable for secure migration of data in storage cloud |
CN102968498A (en) * | 2012-12-05 | 2013-03-13 | 华为技术有限公司 | Method and device for processing data |
Non-Patent Citations (1)
Title |
---|
基于DPB+-Tree的数据迁移策略研究;黄克军等;《电子科技大学学报》;20040430;第33卷(第2期);正文第181-183页 |
Also Published As
Publication number | Publication date |
---|---|
CN107145521A (en) | 2017-09-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107145521B (en) | A kind of data migration method towards block chain multistage intelligent contract | |
CN110933953B (en) | Systems and methods for extending blockchain utility through use of related sub-blockchains | |
CN106681739B (en) | Automatic intelligent contract generation method | |
CN110457123B (en) | Control method and device for block processing task | |
CN106407430B (en) | A kind of intelligent contract state synchronization method of complexity based on stage bucket | |
CN112015517B (en) | Block chain node dynamic migration method and system based on k8s cluster | |
CN102103497B (en) | Finite state machine actuating device and method, and method for establishing and using finite state machine | |
CN110096891A (en) | Object signature in library of object | |
CN112418438A (en) | Container-based machine learning procedural training task execution method and system | |
CN109559229A (en) | The method of the intelligent contract group of update based on block chain | |
CN108053239A (en) | Sensor network sharing method based on block chain | |
CN112527781B (en) | Intelligent contract data migration method and system | |
CN111221568B (en) | Fabric chain code life cycle management system based on physical machine deployment | |
CN109510852A (en) | The method and device of gray scale publication | |
CN110134646B (en) | Knowledge platform service data storage and integration method and system | |
CN109681165B (en) | Water injection strategy optimization method and device for oil extraction in oil field | |
CN106569872A (en) | Method for shortening virtual machine snapshot chain | |
CN110597821B (en) | Method and device for changing database table structure | |
CN106682021A (en) | Database migration method and device | |
CN106384292A (en) | System and method for collecting relation among social network users | |
CN110515833A (en) | A kind of method of software test, equipment and readable medium | |
CN103559574B (en) | Method and system for operating workflow | |
CN105677579A (en) | Data access method and system in cache system | |
CN106161056B (en) | The distributed caching O&M method and device of preiodic type data | |
CN108241671B (en) | Service processing method and system and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |