CN114265826A - Migration method, device and platform for block chain service and electronic equipment - Google Patents

Migration method, device and platform for block chain service and electronic equipment Download PDF

Info

Publication number
CN114265826A
CN114265826A CN202111527917.3A CN202111527917A CN114265826A CN 114265826 A CN114265826 A CN 114265826A CN 202111527917 A CN202111527917 A CN 202111527917A CN 114265826 A CN114265826 A CN 114265826A
Authority
CN
China
Prior art keywords
block chain
blockchain
block
account
service
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
CN202111527917.3A
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.)
Ant Blockchain Technology Shanghai Co Ltd
Original Assignee
Ant Blockchain Technology Shanghai 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 Ant Blockchain Technology Shanghai Co Ltd filed Critical Ant Blockchain Technology Shanghai Co Ltd
Priority to CN202111527917.3A priority Critical patent/CN114265826A/en
Publication of CN114265826A publication Critical patent/CN114265826A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The embodiment of the specification provides a migration method, a migration device, a migration platform and electronic equipment for a block chain service. The migration method comprises the following steps: and when the life cycle of the first block chain is finished, performing blocking processing on the first block chain, wherein the first block chain provides block chain services after blocking. And taking the last block in the first block chain as a creation block, creating a second block chain, and synchronizing the intelligent contract and the block chain account in the first block chain to the second block chain. And replacing the first block chain to provide block chain service based on the second block chain.

Description

Migration method, device and platform for block chain service and electronic equipment
Technical Field
The present invention relates to the field of information processing technologies, and in particular, to a method, an apparatus, a platform, and an electronic device for migrating a block chain service.
Background
The block chain is essentially a distributed database, and is increasingly widely applied based on the characteristics of ' non-falsification ', ' whole-course trace ', ' traceable ', ' public transparency ', collective maintenance ' and the like. As time goes on and traffic rises, the data that the blockchain needs to maintain becomes increasingly voluminous, inevitably resulting in performance degradation.
Although in practical applications, only a small portion of data or aging data in the blockchain is used, directly archiving the data in the blockchain destroys the "traceable" and "non-tamperable" nature of the blockchain. Therefore, how to solve the problem caused by the accumulation of the blockchain data is a difficult problem which needs to be overcome at present.
Disclosure of Invention
An embodiment of the present disclosure is to provide a method, an apparatus, a platform, and an electronic device for migrating a block chain service, which can migrate a block chain service of an original block chain to a new block chain on the basis of not damaging characteristics of the block chain, so as to solve a series of problems caused by data accumulation of the block chain, such as performance degradation and maintenance cost aggravation.
In a first aspect, a method for migrating a blockchain service is provided, including:
when the life cycle of a first block chain is finished, performing blocking processing on the first block chain, wherein the first block chain provides block chain services after blocking;
creating a second blockchain by taking the last block in the first blockchain as a created block, and synchronizing the intelligent contract and the blockchain account in the first blockchain to the second blockchain;
and replacing the first block chain to provide block chain service based on the second block chain.
In a second aspect, an apparatus for migrating a blockchain service is provided, including:
the first block chain sealing module is used for sealing and stopping a first block chain when the life cycle of the first block chain is finished, wherein the first block chain is stopped after being sealed and provides block chain service;
the first block chain creating module is used for performing sealing processing on a first block chain when the life cycle of the first block chain is finished, wherein the first block chain takes the last block in the first block chain as an appearance creating block, creating a second block chain, and synchronizing an intelligent contract and a block chain account in the first block chain to the second block chain;
and the first block chain service migration module replaces the first block chain to provide block chain services based on the second block chain.
In a third aspect, a block chain service platform is provided, where the block chain service platform is provided with a first block chain to provide a block chain service, and the block chain service platform includes:
the second block chain stopping module is used for stopping the first block chain when the life cycle of the first block chain is finished, wherein the first block chain stops providing block chain services after stopping;
the second block chain creating module is used for performing sealing processing on a first block chain when the life cycle of the first block chain is finished, wherein the first block chain takes the last block in the first block chain as an appearance creating block, creating a second block chain, and synchronizing an intelligent contract and a block chain account in the first block chain to the second block chain;
and the second block chain service migration module replaces the first block chain to provide block chain services based on the second block chain.
In a fourth aspect, an electronic device is provided comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being executed by the processor to:
when the life cycle of a first block chain is finished, performing blocking processing on the first block chain, wherein the first block chain provides block chain services after blocking;
creating a second blockchain by taking the last block in the first blockchain as a created block, and synchronizing the intelligent contract and the blockchain account in the first blockchain to the second blockchain;
and replacing the first block chain to provide block chain service based on the second block chain.
In a fifth aspect, a computer-readable storage medium is provided, having stored thereon a computer program which, when executed by a processor, performs the steps of:
when the life cycle of a first block chain is finished, performing blocking processing on the first block chain, wherein the first block chain provides block chain services after blocking;
creating a second blockchain by taking the last block in the first blockchain as a created block, and synchronizing the intelligent contract and the blockchain account in the first blockchain to the second blockchain;
and replacing the first block chain to provide block chain service based on the second block chain.
According to the scheme of the embodiment of the specification, when the life cycle of the first block chain is finished, the last block in the first block chain is used as a creation block to create a second block chain, and an intelligent contract and a block chain account in the first block chain are synchronized to the second block chain, so that block chain business of the first block chain is continued by creating a new second block chain, and a series of problems caused by block chain data accumulation are effectively solved, such as performance reduction, maintenance cost aggravation and the like. Because the scheme does not transfer and archive the blocks in the block chain, the characteristics of 'traceable' and 'non-tampering' of the block chain and the like cannot be damaged.
Drawings
In order to more clearly illustrate the embodiments of the present specification or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments described in the embodiments of the present specification, and for a person of ordinary skill in the relevant art, other drawings can be obtained according to the drawings without inventive labor.
Fig. 1 is a first flowchart of a migration method based on a blockchain service according to an embodiment of the present disclosure.
Fig. 2 is a second flowchart of a migration method of a blockchain service according to an embodiment of the present disclosure.
Fig. 3 is a third flowchart of a migration method of a blockchain service according to an embodiment of the present disclosure.
Fig. 4 is a schematic structural diagram of a migration apparatus for a blockchain service according to an embodiment of the present disclosure.
Fig. 5 is a schematic structural diagram of a blockchain service platform provided in an embodiment of the present disclosure.
Fig. 6 is a schematic structural diagram of an electronic device provided in an embodiment of this specification.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments of the present specification, and not all of the embodiments. All other embodiments obtained by persons of ordinary skill in the art based on the embodiments in the present specification without any creative efforts shall fall within the protection scope of the present specification.
As described above, as time goes on and traffic increases, the data maintained on the block chain becomes larger and larger, which inevitably causes a series of problems such as performance degradation and maintenance cost increase. Although in practical applications, only a small portion of data or aging data of the blockchain can be used, directly archiving the data in the blockchain destroys the "traceable" and "non-tamperable" properties of the blockchain, which loses the meaning of using the blockchain as a data storage medium.
Under the background, the present document aims to provide a technical solution for continuing the original blockchain service by replacing a new blockchain, which can solve a series of problems caused by blockchain data accumulation, and does not have the defect that the characteristics of the blockchain are damaged.
Fig. 1 is a flow diagram of a block chain based forensics method according to an embodiment of the present disclosure, which may include the following steps, as shown in fig. 1:
and S102, when the life cycle of the first block chain is finished, performing blocking processing on the first block chain, wherein the first block chain provides block chain services after blocking.
It should be understood that the end of the life cycle of the first blockchain described in the embodiment of the present disclosure refers to the blockchain service that needs to be updated to continue the first blockchain, and therefore, the following situations can be considered as follows:
the performance index of the first block chain does not meet the preset performance requirement;
the data storage capacity of the first block chain reaches a preset data storage capacity threshold;
the block number of the first block chain reaches a preset block number threshold.
Here, the mechanism for determining the end of the life cycle of the first block chain is not specifically limited herein.
In addition, the blocking of the first blockchain means that the first blockchain is stopped from receiving the client request, so as to ensure that the first blockchain does not generate a new blockchain any more. In practical applications, the blocking transaction may be initiated to the first blockchain, so as to set the access right of the first blockchain to be not open to the client. As an exemplary introduction, the access right of the first block chain may be set to allow a specified IP address to be accessed (without including a client), or the access right of the first block chain may be set to provide a key to be accessed (the key is not open to the client). And S104, taking the last block in the first block chain as a creation block, creating a second block chain, and synchronizing the intelligent contract and the block chain account in the first block chain to the second block chain.
It should be understood that the intelligent contract is a computer protocol for block chain execution of block chain services, and after the intelligent contract and the block chain account in the first block chain are synchronized to the second block chain, the second block chain can provide the block chain services of the first block chain to the original block chain account of the first block chain through the intelligent contract on the basis of the transaction data in the founding block. In addition, the second blockchain may also expand a new blockchain account on the basis of the created block, and generate a new block to record the blockchain data of the new blockchain account.
Specifically, if the blockchain service of the first blockchain needs to be upgraded, the step may update the intelligent contract in the first blockchain based on the service logic corresponding to the upgraded blockchain service; and then, synchronizing the updated intelligent contract in the first blockchain to the second blockchain.
In addition, considering that most of the inactive data in the blockchain is not generally used, this step may synchronize the blockchain account in which the activity index value in the first blockchain reaches the preset activity index threshold value to the second blockchain.
The content of the block chain account may be determined based on the update frequency of the corresponding block chain data of the block chain account in the first block chain. It should be understood that blockchain accounts typically have blockchain data updates that occur when:
as an active initiator of the block chain service, block chain data change occurs after the block chain service is completed;
and as a passive invited party of the block chain service, the block chain data change occurs after the block chain service is completed.
That is, the liveness of the blockchain account can be effectively reflected by the update frequency of the blockchain data. In addition, the activity index value may also be calculated according to the frequency of the access of the blockchain account in the first blockchain, which is not described in detail in this text.
Furthermore, it should be understood that this step takes the last block of the first blockchain as the created block of the second blockchain, that is, only the transaction data of the last block of the first blockchain is imported into the second blockchain, so that the data to be synchronized is relatively small.
Of course, if there is a special requirement, more transaction data of the first blockchain may be imported into the second blockchain. Assuming that there are N blocks when the first block chain is terminated, the nth-1 block in the first block chain can be used as the created block of the second block chain, and the nth block in the first block chain can be used as the second block of the second block chain; in this way, the N-2 block in the first block chain may be used as the created block of the second block chain, correspondingly, the N-1 block in the first block chain is used as the second block of the second block chain, and the nth block in the first block chain is used as the third block of the second block chain.
In practice, it is found that the use requirements of most of the scenarios can be met only by using the last block of the first blockchain as the creation block of the second blockchain, and therefore, the embodiment of the present specification does not need to synchronize excessive transaction data of the first blockchain to the second blockchain.
And S106, replacing the first block chain to provide block chain service based on the second block chain.
It should be understood that providing blockchain service in place of the first blockchain based on the second blockchain means that the second blockchain is used to process client requests when blockchain service is subsequently requested by a further blockchain client. Specifically, the IP address pointed by the interface of the blockchain service may be set as the IP address of the second blockchain, so that the service interface submits the client request to the second blockchain for processing after receiving the client request of the blockchain service of the first blockchain.
Exemplarily, the flow of providing the blockchain service by the second blockchain is as follows:
responding to a target client request for initiating a block chain service, and inquiring block chain data of a target block chain account required by processing the target client request in a second block chain, wherein the target client request carries an identifier of the target block chain account, and the target block chain account is a block chain account in a first block chain; and if the query is not hit in the second block chain, querying the block chain data corresponding to the target block chain account in the first block chain, and processing the target client request based on the block chain data corresponding to the target block chain account after the query is hit in the first block chain.
The above process involves the step of accessing the first blockchain query blockchain data by the second blockchain, so that the second blockchain needs to have the access right of the first blockchain. If so, in order to stop the first blockchain from receiving the client request, the access authority of the first blockchain is set to allow the specified IP address to access, or provide a key for access. Correspondingly, if the specified IP address is allowed to be accessed, the IP addresses of all nodes of the second block chain need to be dynamically maintained in the access authority of the first block chain; if the key is provided for access, the key may be assigned to each node of the second blockchain.
Further, since the created block of the second blockchain is the last block of the first blockchain, when the data of the blockchain requested by the target client is not queried and hit in the second blockchain, whether the data of the blockchain is in the first blockchain may be determined based on the created block of the second blockchain, and if it is determined that the data of the blockchain exists in the first blockchain, the target client request is submitted to the first blockchain through the second blockchain. And if the block chain data is determined not to exist in the first block chain, directly feeding back a result of query failure to the target client, and not wasting resources to query in the first block chain.
In addition, if the data of the blockchain hitting the target blockchain account is queried in the first blockchain, it indicates that the target blockchain account is not synchronized to the second blockchain in the previous step S104 due to insufficient activity, but the target blockchain account starts to use the blockchain service again at this time.
Of course, in practical applications, it is not necessary to synchronize all of the intelligent contracts of the first blockchain to the second blockchain. For example, for a target blockchain service for which a new customer has no longer been developed, since fewer and fewer customers have less usage requirements, the intelligent contract for the target blockchain service may be selected not to be synchronized to the second blockchain. If the client initiates the transaction of the intelligent contract for calling the target block chain service, inquiring the contract code of the intelligent contract from the first block chain, and then executing the transaction of the client; meanwhile, if there is a need, for example, the intelligent contract of the target block chain service is also called subsequently, the intelligent contract of the target block chain service can be deployed into the second block chain, so that the number of accesses to the first block chain is reduced.
That is, the newly generated second blockchain may continue the blockchain traffic of the first blockchain. Although the first blockchain provides the blockchain service, in a small part of scenes, the first blockchain can be used as a data support medium for providing the blockchain service for the second blockchain, so that the original blockchain service is not influenced.
In addition, in order to ensure that the blockchain service is not affected, in this step, the client request of the blockchain service received after the first blockchain is stopped may be added to the migration transition queue before the first blockchain is replaced to provide the blockchain service based on the second blockchain. And processing the client requests in the migration transition queue based on the second block chain after replacing the first block chain to provide the block chain service based on the second block chain.
Therefore, according to the method in the embodiment of the present specification, when the life cycle of the first blockchain is ended, the last blockchain in the first blockchain is used as a created blockchain to create the second blockchain, and the intelligent contract and the blockchain account in the first blockchain are synchronized to the second blockchain, so that the blockchain service of the first blockchain is continued by creating a new second blockchain, and a series of problems caused by blockchain data accumulation, such as performance degradation, maintenance cost aggravation and the like, are effectively solved. Because the scheme does not transfer and archive the blocks in the block chain, the characteristics of 'traceable' and 'non-tampering' of the block chain and the like cannot be damaged.
In an actual application scenario, as the blockchain service is developed, more and more blockchains are generated by performing blockchain service migration. For example, when the life cycle of the second blockchain is finished, the last blockchain in the second blockchain may be used as an established blockchain, a third blockchain is created, and the intelligent contract and the blockchain account in the second blockchain are synchronized to the third blockchain, so that the blockchain service is provided by replacing the second blockchain based on the third blockchain. For another example, when the life cycle of the third blockchain is ended, the last blockchain in the third blockchain may be used as an created blockchain, a fourth blockchain is created, and the intelligent contract and the blockchain account in the third blockchain are synchronized to the fourth blockchain, so that the third blockchain is replaced to provide the blockchain service … … based on the fourth blockchain.
Based on the above method, the newly generated blockchain can retain relatively new blockchain data of active users. For example, as shown in fig. 2, when the first blockchain provides a blockchain service, there are three blockchain accounts, i.e., Alice, Bob, and Tom, if Tom no longer uses the blockchain service for a long time, the migrated second blockchain synchronizes only the two blockchain accounts, i.e., Alice and Bob, and a new blockchain account Mark may be introduced during the life cycle of the subsequent second blockchain. Of course, if Tom resumes using the blockchain service, the second blockchain first calls the latest blockchain data of Tom from the first blockchain to provide blockchain service for Tom, allocates a blockchain account of Tom in the second blockchain, and after the blockchain service is finished, the second blockchain generates the latest block recording the blockchain data of Tom. Similarly, when the second block chain provides the block chain service, three block chain accounts including Alice, Bob and Mark exist, and if Bob does not use the block chain service any more for a long time, the block chain service is migrated to the third block chain, and the third block chain only synchronizes the two block chain accounts including Alice and Mark.
Further referring to fig. 3, taking a blockchain account Alice of each of the first blockchain, the second blockchain, and the third blockchain as an example, the blockchain accounts Alice are arranged in descending order of time, Alice performs three transactions in the first blockchain lifecycle, and the corresponding transaction data are tx1, tx2, and tx3, and assuming that the latest transaction data tx3 does not belong to the last blockchain of the first blockchain, tx1, tx2, and tx3 are not synchronized to the second blockchain after the first blockchain lifecycle is over. Similarly, Alice performs two transactions in the second blockchain lifecycle, and the corresponding transaction data are tx4 and tx5, where tx5 belongs to the last block of the second blockchain, and only tx5 is synchronized to the third blockchain after the second blockchain lifecycle is over. Obviously. Based on the mechanism, only the transaction data with the aging effect can be synchronized to the latest block along with the migration of the block chain service, so that the utilization rate of the data is ensured, meanwhile, the original transaction data without the aging effect and a small part of transaction data with the aging effect which is not synchronized can still be traced based on the previous block chain, although the previous block chain does not provide the block chain service any more, the previous block chain still has the characteristic of being traceable, and meanwhile, the data support can also be provided for the block chain service processed by the block chain afterwards.
In addition, corresponding to the method shown in fig. 4, an embodiment of the present invention further provides a migration apparatus for a block chain service. Fig. 4 is a schematic structural diagram of a migration apparatus 400 according to an embodiment of the present invention, including:
the first blockchain sealing module 410 seals the first blockchain when the life cycle of the first blockchain is over, wherein the first blockchain provides blockchain services after sealing.
The first blockchain creating module 420 performs a sealing process on a first blockchain when a life cycle of the first blockchain is finished, wherein the first blockchain takes a last block in the first blockchain as an established block, creates a second blockchain, and synchronizes an intelligent contract and a blockchain account in the first blockchain to the second blockchain.
The first blockchain service migration module 430 replaces the first blockchain to provide blockchain services based on the second blockchain.
When the life cycle of the first block chain is finished, the device in the embodiment of the description creates a second block chain by taking the last block in the first block chain as a creation block, and synchronizes an intelligent contract and a block chain account in the first block chain to the second block chain, so that the block chain service of the first block chain is continued by creating a new second block chain, and a series of problems caused by block chain data accumulation, such as performance reduction, maintenance cost aggravation and the like, are effectively solved. Because the scheme does not transfer and archive the blocks in the block chain, the characteristics of 'traceable' and 'non-tampering' of the block chain and the like cannot be damaged.
Optionally, the first blockchain service migration module 430 is specifically configured to: responding to a target client request for initiating the block chain service, and inquiring block chain data of a target block chain account required for processing the target client request in the second block chain, wherein the target client request carries an identifier of the target block chain account, and the target block chain account is a block chain account in the first block chain; and if the query is not hit in the second block chain, querying block chain data corresponding to the target block chain account in the first block chain, and processing the target client request based on the block chain data corresponding to the target block chain account after the query is hit in the first block chain.
Optionally, the first blockchain creating module 420 specifically synchronizes a blockchain account in the first blockchain whose activity index value reaches a preset activity index threshold value to the second blockchain. The active index value of the blockchain account in the first blockchain is determined based on the update frequency of the blockchain account in the corresponding blockchain data of the first blockchain.
In addition, if the data of the block chain corresponding to the target block chain account is not queried and hit in the second block chain and the target block chain account is not synchronized to the second block chain, the first block chain creation module 420 may synchronize the target block chain account to the second block chain when the data of the block chain corresponding to the target block chain account is queried and hit in the first block chain.
Optionally, the first blockchain creating module 420 is specifically configured to: if the block chain service of the first block chain needs to be upgraded, updating the intelligent contract in the first block chain based on the service logic corresponding to the upgraded block chain service; and then synchronizing the updated intelligent contracts in the first blockchain to the second blockchain.
Optionally, the first blockchain service migration module 430 may further add, to the migration transition queue, the client request of the blockchain service received after the first blockchain is stopped before the first blockchain is replaced to provide the blockchain service based on the second blockchain; and processing the client request in the migration transition queue based on the second block chain after replacing the first block chain to provide block chain service based on the second block chain.
Optionally, the first blockchain blocking module 410 specifically sends a blocking transaction to the first blockchain, so as to set the access right of the first blockchain to allow a specified IP address to be accessed or provide a key for access, so that the first blockchain rejects receiving a client request.
Optionally, a part of the intelligent contracts in the first blockchain are synchronized to the second blockchain, the target client requests a transaction for invoking a target intelligent contract, and if the target intelligent contract is not deployed in the second blockchain, the first blockchain service migration module 43 queries the first blockchain for a contract code of the target intelligent contract to process the transaction; and synchronizing the target intelligent contract in the first blockchain into the second blockchain.
Obviously, the migration apparatus of the embodiment of the present specification may serve as the execution subject of the method shown in fig. 1, and thus can implement the steps and functions of the method implemented in fig. 1. Since the principle is the same, the detailed description is omitted here.
In addition, corresponding to the method shown in fig. 1, an embodiment of the present invention further provides a block chain service platform, where the block chain service platform is provided with a first block chain to provide a block chain service. Fig. 5 is a schematic structural diagram of a forensic apparatus 500 according to an embodiment of the present invention, including:
a second block chain blocking module 510, configured to block a first block chain when a life cycle of the first block chain is finished, where the first block chain is stopped to provide a block chain service;
a second blockchain creating module 520, configured to perform a sealing process on a first blockchain when a life cycle of the first blockchain is finished, wherein the first blockchain uses a last block in the first blockchain as an creation block, create a second blockchain, and synchronize an intelligent contract and a blockchain account in the first blockchain to the second blockchain;
a second blockchain service migration module 530, configured to provide blockchain services based on the second blockchain in place of the first blockchain.
When the life cycle of the first block chain is finished, the block chain service platform in the embodiment of the description creates a second block chain by using the last block in the first block chain as a creation block, and synchronizes an intelligent contract and a block chain account in the first block chain to the second block chain, so that the block chain service of the first block chain is continued by creating a new second block chain, and a series of problems caused by block chain data accumulation, such as performance reduction, maintenance cost aggravation and the like, are effectively solved. Because the scheme does not transfer and archive the blocks in the block chain, the characteristics of 'traceable' and 'non-tampering' of the block chain and the like cannot be damaged.
Optionally, the second blockchain service migration module 530 is specifically configured to: responding to a target client request for initiating the block chain service, and inquiring block chain data of a target block chain account required for processing the target client request in the second block chain, wherein the target client request carries an identifier of the target block chain account, and the target block chain account is a block chain account in the first block chain; and if the query is not hit in the second block chain, querying block chain data corresponding to the target block chain account in the first block chain, and processing the target client request based on the block chain data corresponding to the target block chain account after the query is hit in the first block chain.
Optionally, the second blockchain creating module 520 specifically synchronizes a blockchain account in the first blockchain, where an activity index value of the blockchain reaches a preset activity index threshold, to the second blockchain. The active index value of the blockchain account in the first blockchain is determined based on the update frequency of the blockchain account in the corresponding blockchain data of the first blockchain.
In addition, if the data of the block chain corresponding to the target block chain account is not queried and hit in the second block chain and the target block chain account is not synchronized to the second block chain, the second block chain creation module 520 may synchronize the target block chain account to the second block chain when the data of the block chain corresponding to the target block chain account is queried and hit in the first block chain.
Optionally, the second blockchain creating module 520 is specifically configured to: if the block chain service of the first block chain needs to be upgraded, updating the intelligent contract in the first block chain based on the service logic corresponding to the upgraded block chain service; and then synchronizing the updated intelligent contracts in the first blockchain to the second blockchain.
Optionally, the second blockchain service migration module 530 may further add, to the migration transition queue, the client request of the blockchain service received after the first blockchain is stopped before replacing the first blockchain to provide the blockchain service based on the second blockchain; and processing the client request in the migration transition queue based on the second block chain after replacing the first block chain to provide block chain service based on the second block chain.
Obviously, the blockchain service platform of the embodiment of the present specification may serve as an execution subject of the method shown in fig. 1, and thus can implement the steps and functions of the method implemented in fig. 1. Since the principle is the same, the detailed description is omitted here.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present specification. Referring to fig. 6, at a hardware level, the electronic device includes a processor, and optionally further includes an internal bus, a network interface, and a memory. The Memory may include a Memory, such as a Random-Access Memory (RAM), and may further include a non-volatile Memory, such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, the network interface, and the memory may be connected to each other via an internal bus, which may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 6, but that does not indicate only one bus or one type of bus.
And the memory is used for storing programs. In particular, the program may include program code comprising computer operating instructions. The memory may include both memory and non-volatile storage and provides instructions and data to the processor.
The processor reads a corresponding computer program from the nonvolatile memory into the memory and then runs the computer program, and a migration device of the block chain service is formed on a logic level. The processor is used for executing the program stored in the memory and is specifically used for executing the following operations:
and when the life cycle of the first block chain is finished, performing blocking processing on the first block chain, wherein the first block chain provides block chain services after blocking.
And taking the last block in the first block chain as a creation block, creating a second block chain, and synchronizing the intelligent contract and the block chain account in the first block chain to the second block chain.
And replacing the first block chain to provide block chain service based on the second block chain.
When the life cycle of the first block chain is finished, the electronic device in the embodiment of the description creates a second block chain by using the last block in the first block chain as a creation block, and synchronizes an intelligent contract and a block chain account in the first block chain to the second block chain, so that the block chain service of the first block chain is continued by creating a new second block chain, and a series of problems caused by block chain data accumulation, such as performance reduction, maintenance cost aggravation and the like, are effectively solved. Because the scheme does not transfer and archive the blocks in the block chain, the characteristics of 'traceable' and 'non-tampering' of the block chain and the like cannot be damaged.
The forensics method disclosed in the embodiment of fig. 1 in this specification may be implemented in or by a processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present specification may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present specification may be embodied directly in a hardware decoding processor, or in a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
It should be understood that the electronic device of the embodiment of the present specification can implement the functions of the embodiment of the forensics method shown in fig. 1. Since the principle is the same, the detailed description is omitted here.
Of course, besides the software implementation, the electronic device in this specification does not exclude other implementations, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or logic devices.
Furthermore, the present specification embodiments also propose a computer-readable storage medium storing one or more programs, the one or more programs including instructions.
Wherein the instructions, when executed by a portable electronic device comprising a plurality of application programs, enable the portable electronic device to perform the method of the embodiment shown in fig. 1, and are specifically configured to perform the following steps:
and when the life cycle of the first block chain is finished, performing blocking processing on the first block chain, wherein the first block chain provides block chain services after blocking.
And taking the last block in the first block chain as a creation block, creating a second block chain, and synchronizing the intelligent contract and the block chain account in the first block chain to the second block chain.
And replacing the first block chain to provide block chain service based on the second block chain.
As will be appreciated by one of ordinary skill in the art, the embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The above description is only an example of the present specification, and is not intended to limit the present specification. Various modifications and changes may occur to those skilled in the art to which it pertains. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification should be included in the scope of the claims of the present specification. Moreover, all other embodiments obtained by persons of ordinary skill in the art without making any inventive step shall fall within the scope of protection of this document.

Claims (14)

1. A migration method of block chain service comprises the following steps:
when the life cycle of a first block chain is finished, performing blocking processing on the first block chain, wherein the first block chain provides block chain services after blocking;
creating a second blockchain by taking the last block in the first blockchain as a created block, and synchronizing the intelligent contract and the blockchain account in the first blockchain to the second blockchain;
and replacing the first block chain to provide block chain service based on the second block chain.
2. The method of claim 1, wherein the first and second light sources are selected from the group consisting of,
after providing the blockchain service by replacing the first blockchain based on the second blockchain, the method includes:
responding to a target client request for initiating the block chain service, and inquiring block chain data of a target block chain account required for processing the target client request in the second block chain, wherein the target client request carries an identifier of the target block chain account, and the target block chain account is a block chain account in the first block chain;
and if the query is not hit in the second block chain, querying block chain data corresponding to the target block chain account in the first block chain, and processing the target client request based on the block chain data corresponding to the target block chain account after the query is hit in the first block chain.
3. The method of claim 2, wherein the first and second light sources are selected from the group consisting of,
synchronizing a blockchain account in the first blockchain to the second blockchain, including:
and synchronizing the block chain account of which the active index value reaches a preset active index threshold value in the first block chain to the second block chain.
4. The method of claim 3, wherein the first and second light sources are selected from the group consisting of,
the active index value of the blockchain account in the first blockchain is determined based on the update frequency of the blockchain data corresponding to the blockchain account in the first blockchain.
5. The method of claim 4, further comprising:
if the block chain data corresponding to the target block chain account is not inquired and hit in the second block chain and the target block chain account is not synchronized to the second block chain, synchronizing the target block chain account to the second block chain when the block chain data corresponding to the target block chain account is inquired and hit in the first block chain.
6. The method of claim 2, wherein the first and second light sources are selected from the group consisting of,
synchronizing a portion of the smart contracts in the first blockchain to the second blockchain, the target client requesting a transaction that invokes a target smart contract, the method further comprising:
querying contract code of the target intelligent contract in the first blockchain to execute the transaction if the target intelligent contract is not deployed by the second blockchain; and the number of the first and second groups,
synchronizing the target smart contract into the second blockchain.
7. The method of claim 1, wherein the first and second light sources are selected from the group consisting of,
performing a blocking process on the first blockchain, comprising:
and sending a blocking transaction to the first blockchain so as to set the access authority of the first blockchain to allow the access of a specified IP address or provide a key for access, so that the first blockchain refuses to receive a client request.
8. The method of claim 1, further comprising:
synchronizing smart contracts in the first blockchain to the second blockchain, including:
if the block chain service of the first block chain needs to be upgraded, updating the intelligent contract in the first block chain based on the service logic corresponding to the upgraded block chain service;
and synchronizing the updated intelligent contract in the first blockchain to the second blockchain.
9. The method of claim 1, further comprising:
adding a client request of the block chain service received after the first block chain is stopped into a migration transition queue before replacing the first block chain to provide the block chain service based on the second block chain;
and processing the client request in the migration transition queue based on the second block chain after replacing the first block chain to provide block chain service based on the second block chain.
10. The method of claim 1, wherein the first and second light sources are selected from the group consisting of,
the end of the life cycle of the first blockchain refers to at least one of the following conditions:
the performance index of the first block chain does not meet the preset performance requirement;
the data storage capacity of the first block chain reaches a preset data storage capacity threshold;
the block number of the first block chain reaches a preset block number threshold.
11. A migration apparatus of blockchain services, comprising:
the first block chain sealing module is used for sealing and stopping a first block chain when the life cycle of the first block chain is finished, wherein the first block chain is stopped after being sealed and provides block chain service;
the first block chain creating module is used for performing sealing processing on a first block chain when the life cycle of the first block chain is finished, wherein the first block chain takes the last block in the first block chain as an appearance creating block, creating a second block chain, and synchronizing an intelligent contract and a block chain account in the first block chain to the second block chain;
and the first block chain service migration module replaces the first block chain to provide block chain services based on the second block chain.
12. A blockchain service platform provided with a first blockchain to provide blockchain services, the blockchain service platform comprising:
the second block chain stopping module is used for stopping the first block chain when the life cycle of the first block chain is finished, wherein the first block chain stops providing block chain services after stopping;
the second block chain creating module is used for performing sealing processing on a first block chain when the life cycle of the first block chain is finished, wherein the first block chain takes the last block in the first block chain as an appearance creating block, creating a second block chain, and synchronizing an intelligent contract and a block chain account in the first block chain to the second block chain;
and the second block chain service migration module replaces the first block chain to provide block chain services based on the second block chain.
13. An electronic device includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being executed by the processor to:
when the life cycle of a first block chain is finished, performing blocking processing on the first block chain, wherein the first block chain provides block chain services after blocking;
creating a second blockchain by taking the last block in the first blockchain as a created block, and synchronizing the intelligent contract and the blockchain account in the first blockchain to the second blockchain;
and replacing the first block chain to provide block chain service based on the second block chain.
14. A computer-readable storage medium having a computer program stored thereon, which when executed by a processor, performs the steps of:
when the life cycle of a first block chain is finished, performing blocking processing on the first block chain, wherein the first block chain provides block chain services after blocking;
creating a second blockchain by taking the last block in the first blockchain as a created block, and synchronizing the intelligent contract and the blockchain account in the first blockchain to the second blockchain;
and replacing the first block chain to provide block chain service based on the second block chain.
CN202111527917.3A 2021-12-14 2021-12-14 Migration method, device and platform for block chain service and electronic equipment Pending CN114265826A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111527917.3A CN114265826A (en) 2021-12-14 2021-12-14 Migration method, device and platform for block chain service and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111527917.3A CN114265826A (en) 2021-12-14 2021-12-14 Migration method, device and platform for block chain service and electronic equipment

Publications (1)

Publication Number Publication Date
CN114265826A true CN114265826A (en) 2022-04-01

Family

ID=80827074

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111527917.3A Pending CN114265826A (en) 2021-12-14 2021-12-14 Migration method, device and platform for block chain service and electronic equipment

Country Status (1)

Country Link
CN (1) CN114265826A (en)

Similar Documents

Publication Publication Date Title
US11711420B2 (en) Automated management of resource attributes across network-based services
CN109669709B (en) Data migration method and data migration system for block chain upgrading
CN108427684B (en) Data query method and device and computing equipment
CN107622091B (en) Database query method and device
US20200328984A1 (en) Method and apparatus for allocating resource
CN106302074B (en) Migration method and device of virtual network function VNF
CN110661658B (en) Node management method and device of block chain network and computer storage medium
CN107016016B (en) Data processing method and device
WO2021109750A1 (en) Node management method, device and apparatus, storage medium, and system
CN104239156A (en) External service call method and system
CN110210845B (en) Method, apparatus, medium, and computing device for blockchain data migration
EP3951607A1 (en) Data reading method, data writing method, and server
CN110673933A (en) ZooKeeper-based distributed asynchronous queue implementation method, device, equipment and medium
CN111708787A (en) Multi-center service data management system
CN114090179A (en) Migration method and device of stateful service and server
CN113722114A (en) Data service processing method and device, computing equipment and storage medium
WO2023103341A1 (en) Blockchain-based smart contract invocation method, apparatus and device
CN110162395B (en) Memory allocation method and device
CN110798358B (en) Distributed service identification method and device, computer readable medium and electronic equipment
CN110647463B (en) Method and device for restoring test breakpoint and electronic equipment
CN109976896B (en) Service re-ranking processing method and device
CN114265826A (en) Migration method, device and platform for block chain service and electronic equipment
CN115033551A (en) Database migration method and device, electronic equipment and storage medium
WO2023029485A1 (en) Data processing method and apparatus, computer device, and computer-readable storage medium
US10200301B1 (en) Logical control groups for distributed system resources

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