CN115174599B - Business archiving node creation and data processing method, device, equipment and medium - Google Patents
Business archiving node creation and data processing method, device, equipment and medium Download PDFInfo
- Publication number
- CN115174599B CN115174599B CN202210523933.3A CN202210523933A CN115174599B CN 115174599 B CN115174599 B CN 115174599B CN 202210523933 A CN202210523933 A CN 202210523933A CN 115174599 B CN115174599 B CN 115174599B
- Authority
- CN
- China
- Prior art keywords
- account
- blockchain
- block height
- node
- state information
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1097—Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/104—Peer-to-peer [P2P] networks
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Theoretical Computer Science (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本申请实施例提供一种业务归档节点创建及数据处理方法、装置、设备及介质。在本申请实施例中,能够在区块链网络中创建一种新型的业务归档节点,既能满足一些业务场景对各个区块链账户的账户状态数据的查询需求,又由于业务归档节点是一种轻量级的归档节点,还能够极大地降低因使用归档节点带来的存储资源的消耗,减少存储成本。
The embodiment of the present application provides a method, device, equipment and medium for creating and processing business archiving nodes. In the embodiment of the present application, a new type of business archiving node can be created in the blockchain network, which can not only meet the query requirements of some business scenarios for the account status data of each blockchain account, but also greatly reduce the consumption of storage resources caused by the use of archiving nodes and reduce storage costs because the business archiving node is a lightweight archiving node.
Description
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a method, an apparatus, a device, and a medium for creating and processing data of a service archiving node.
Background
The blockchain network introduces nodes of different types such as Full Node light nodes (LIGHTWEIGHT NODE) and Archive nodes (Archive nodes) so as to meet different service requirements. Specifically, the full node has the function of storing complete blockchain data, and has the capability of independent verification to confirm the validity of a transaction. The light node has the function of storing block header data. The archiving node has the function of storing all data maintained in the full node while also additionally storing account status data for each blockchain account at each blockheight. Account status data includes, for example, but is not limited to, statement of account, balance, random number nounce, code hash, storage root, and so forth.
In practical application, a plurality of archiving nodes are generally added in the blockchain network to meet the requirement of inquiring account status data of each blockchain account in some business scenes. However, the larger the data storage amount of the filing node, the more the filing node is added, the more storage resources are consumed, and the storage cost is high. Therefore, how to reduce the consumption of storage resources on the premise of meeting the query requirement of account status data is a technical problem to be solved.
Disclosure of Invention
Aspects of the application provide a method, a device, equipment and a medium for creating and processing business archiving nodes, which are used for reducing consumption of storage resources on the premise of meeting the query requirement of account state data.
The embodiment of the application provides a service archiving node creation method, which comprises the steps of determining at least one first blockchain account with relevance to service requirements from all blockchain accounts on a blockchain network, controlling any blockchain node in the blockchain network to repeatedly execute the following steps, enabling a blockchain link point to be created as the service archiving node, responding to the current blockheight of a blockchain, acquiring account state information of each of the at least one first blockchain account at the current blockheight, and storing the account state information of each of the at least one first blockchain account at the current blockheight into a database.
The embodiment of the application also provides a data processing method, which comprises the steps of responding to the current block height of the blockchain, acquiring account state information of each of at least one first blockchain account under the current block height, wherein the first blockchain account is a blockchain account which has relevance with service requirements on a blockchain network, and storing the account state information of each of the at least one first blockchain account under the current block height into a database.
The embodiment of the application also provides a service archiving node creation device which comprises a determination module and a control module, wherein the determination module is used for determining at least one first blockchain account which has relevance to service requirements from all blockchain accounts on a blockchain network, the control module is used for controlling any blockchain node in the blockchain network to repeatedly execute the following steps so that the blockchain node is created as the service archiving node, the account state information of each of the at least one first blockchain account under the current blockheight is acquired in response to the current blockheight of the blockchain, and the account state information of each of the at least one first blockchain account under the current blockheight is saved in a database.
The embodiment of the application also provides a data processing device which comprises an acquisition module and a storage module, wherein the acquisition module is used for responding to the current block height of the blockchain and acquiring account state information of at least one first blockchain account under the current block height, the first blockchain account is a blockchain account with relevance to service requirements on a blockchain network, and the storage module is used for storing the account state information of the at least one first blockchain account under the current block height into a database.
The embodiment of the application also provides computer equipment, which comprises a memory and a processor, wherein the memory is used for storing a computer program, and the processor is coupled to the memory and used for executing the computer program to execute the steps in the business archiving node creation method or the data processing method.
The embodiments of the present application also provide a computer storage medium storing a computer program which, when executed by a processor, causes the processor to implement steps in a service archiving node creation method or a data processing method.
In the embodiment of the application, a novel service archiving node can be created in the blockchain network, so that the inquiring requirement of some service scenes on account state data of each blockchain account can be met, and the consumption of storage resources caused by using the archiving node can be greatly reduced because the service archiving node is a lightweight archiving node, and the storage cost is reduced.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
FIG. 1 is a block chain network architecture diagram provided by the present application;
Fig. 2 is a flowchart of a method for creating a service archiving node according to an embodiment of the present application;
FIG. 3 is an exemplary block-corresponding state tree;
FIG. 4 is a flowchart of a data processing method according to an embodiment of the present application;
Fig. 5 is a schematic structural diagram of a service archiving node creation apparatus according to an embodiment of the present application;
FIG. 6 is a schematic diagram of a data processing apparatus according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be clearly and completely described below with reference to specific embodiments of the present application and corresponding drawings. It will be apparent that the described embodiments are only some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
On the premise of meeting the query requirement of account state data, how to reduce the consumption of storage resources becomes a technical problem to be solved. To this end, the embodiment of the application provides a method, a device, equipment and a medium for creating and processing service archiving nodes. In the embodiment of the application, a novel service archiving node can be created in the blockchain network, so that the inquiring requirement of some service scenes on account state data of each blockchain account can be met, and the consumption of storage resources caused by using the archiving node can be greatly reduced because the service archiving node is a lightweight archiving node, and the storage cost is reduced.
First, some terms related to the embodiments of the present application will be described:
Blockchain account-uniquely identifying the identity of a user in a blockchain network. Taking the ethernet as an example, blockchain accounts can be divided into external accounts (externally owned accounts) and contract accounts (contract accounts). The account status information of the external account includes, for example, but is not limited to, account identification (also known as account address), balance, and random number (nounce). The account status information for the contract account includes, for example, but is not limited to, account identification, balance, random number (nounce), code, and storage root for the smart contract.
Service archiving node refers to a blockchain node with data storage capacity larger than the full node but smaller than the archiving node. In the embodiment of the application, compared with the whole node, the business archiving node additionally stores account state information of the blockchain account related to the business requirement under each block height according to the business requirement. Compared with the archiving node, the business archiving node is a lightweight archiving node, and on the premise of meeting the query requirement of account state data required by business requirements, the consumption of storage resources is reduced, and the storage cost is reduced.
The block height, which refers to the sequence number of a block added to the blockchain, can be used as a unique identifier for the block, indicating the position of the block in the blockchain, for example, starting from 0. The current block height refers to the sequence number of a new block currently added to the blockchain, and the historical block height refers to the sequence number of an existing block of the new block which is added earlier in time than the blockchain, namely the appearance time of the historical block height is earlier than the current block height.
Status tree: for the state tree, each node basically contains a key-value map, where the key is the blockchain account and the value is account state information including declarations of the account, balance, random number nounce, code, and storage root: account balances and random number nonces for accounts are often changed, and more importantly, new accounts are frequently inserted, and stored keys are also frequently inserted and deleted.
P2P (Peer-to-Peer) networks, also known as Peer-to-Peer networks, or point-to-point networks, where participants of the network share some of their own hardware resources (such as processing power, storage power, network connectivity, printers, etc.), which provide services and content through the network that can be accessed directly by other Peer nodes (peers) without going through intermediate entities.
Smart contract (Smart contract) is a computer protocol that aims to propagate, verify, or execute contracts in an informative manner. Smart contracts allow trusted transactions to be made without third parties, which transactions are traceable and irreversible. Essentially, the operating principles of these autocontracts are similar to if-then statements of other computer programs. The smart contracts merely interact with real world assets in this manner. When a pre-programmed condition is triggered, the smart contract performs the corresponding contract term.
The following describes in detail the technical solutions provided by the embodiments of the present application with reference to the accompanying drawings.
FIG. 1 is a block chain network architecture diagram according to the present application. As shown in fig. 1, the blockchain network may include a plurality of blockchain nodes, each of which collectively form a blockchain network, the blockchain network being a P2P network. The blockchain nodes can be terminal equipment or servers, the positions of the blockchain nodes in the blockchain network are equal, and the blockchain nodes commonly maintain one blockchain.
In embodiments of the present application, the type of blockchain network is not limited, and may be, for example, public blockchains (Public Block Chains), private blockchains (Private Block Chains), federated blockchains, licensed blockchains, and the like. The public blockchain has the characteristic of public deployment, any person can participate at will, the private blockchain has the characteristic of private deployment and is limited to be used in a certain organization, and the alliance blockchain and the permission blockchain have the characteristic of private deployment and are commonly used by multiple organizations and have access and authority management mechanisms.
In an embodiment of the present application, the blockchain network includes, for example, but is not limited to, an Ethernet network.
The terminal device may be hardware or software. When the terminal device is hardware, the terminal device is, for example, a mobile phone, a tablet computer, a desktop computer, a wearable intelligent device, an intelligent home device, or the like. When the terminal device is software, it may be installed in the above-listed hardware device, and in this case, the terminal device is, for example, a plurality of software modules or a single software module, etc., the embodiment of the present application is not limited. The server may be hardware or software. When the server is hardware, the server is a single server or a distributed server cluster composed of a plurality of servers. When the server is software, it may be a plurality of software modules or a single software module, and the embodiment of the present application is not limited.
It should be understood that the blockchain nodes in fig. 1 are merely illustrative. In practical application, any number of blockchain nodes are deployed according to practical requirements.
Fig. 2 is a flowchart of a method for creating a service archiving node according to an embodiment of the present application. The method may be performed by a service archiving node creation means, which may be implemented in software and/or hardware and may be generally integrated in a blockchain node. As shown in fig. 2, the method may include the steps of:
201. determining at least one first blockchain account associated with the service requirement from all blockchain accounts on the blockchain network, and controlling any blockchain node in the blockchain network to repeatedly execute 202 to 203 so that the blockchain node is created as a service archiving node.
202. In response to a current block height of the blockchain, account status information of each of the at least one first blockchain account at the current block height is obtained.
203. And saving account state information of at least one first blockchain account under the current block height respectively into a database.
In the embodiment of the application, different blockchain accounts are needed for participation by different business requirements, so that at least one blockchain account with the relevance to the business requirements is determined from all blockchain accounts on a blockchain network, and the at least one blockchain account with the relevance to the business requirements is determined as at least one first blockchain account. Wherein the number of first blockchain accounts may be one or more.
In this embodiment, any one of the blockchain nodes may be selected from the blockchain network for functional expansion, so that the blockchain node becomes a service archiving node. In practical application, a block chain node can be randomly selected from each block chain link point to perform function expansion. And according to the resource use condition, the load state or the communication quality of each block chain node, one block chain node with good resource use condition, good load state or good communication quality can be selected from each block chain node for functional expansion.
In specific implementation, aiming at the blockchain node selected for function expansion, each time the blockchain block height is updated, namely a new block is added to the blockchain, account state information of each first blockchain account under the current block height is obtained, and the account state information of at least one first blockchain account under the current block height is stored in a database so as to meet the query requirement of the account state data of the blockchain account related to business requirements.
According to the technical scheme provided by the embodiment of the application, a novel service archiving node can be created in the blockchain network, so that the inquiring requirement of some service scenes on account state data of each blockchain account can be met, and the service archiving node is a lightweight archiving node, so that the consumption of storage resources caused by using the archiving node can be greatly reduced, and the storage cost is reduced.
In practical applications, in the case that the blockchain is at the current blockheight, if only account status information of the blockchain account associated with the service requirement at the current blockheight is kept in the database, some service failures may be caused. Thus, further optionally, in order to ensure availability and reliability of services provided by the blockchain network, the business archiving node may further obtain account status information for each of the at least one second blockchain account at the current blockheight in response to the current blockchain height, the second blockchain account having no correlation with business requirements, and save the account status information for each of the at least one second blockchain account at the current blockheight to the database.
It is noted that in the case where the blockchain is at the current blockheight, although account status information for all blockchain accounts at the current blockheight is simultaneously maintained in the database, blockchain accounts that are not relevant to the business requirements are only temporarily maintained in the database at the current blockheight and subsequently deleted from the database as appropriate.
Thus, further optionally, the service archiving node may further select a target historical block height satisfying a preset archiving threshold condition with the current block height from among the historical block heights appearing earlier than the current block height on the blockchain in response to the current block height of the blockchain, and delete account status information of at least one second blockchain account stored in the database under the target historical block height, respectively.
In this embodiment, the preset archiving threshold condition is determined according to the actual situation, for example, the number of 5 blocks or the number of 8 blocks. For example, if the preset archiving threshold condition is the number of M blocks, M is a positive integer. When the current block height on the block chain is N+M, deleting the account state information of at least one second block chain account which is stored in the database and is respectively under the block height N on the block chain, wherein N is a positive integer.
Notably, the deletion time of the account state information of the second blockchain account in the database under the target historical block height is constrained by using a preset archiving threshold condition, so that the stability of blockchain generation can be ensured.
In practice, although the second blockchain account is determined according to whether the second blockchain account is related to the service requirement, account status information of the second blockchain account may be required in the block generation process due to complexity of the blockchain network. Thus, further optionally, the account status information of the second blockchain account in the database is accurately identified in conjunction with the status tree to further ensure availability and reliability of services provided by the blockchain network. The method comprises the steps of judging whether nodes corresponding to second blockchain accounts in a state tree corresponding to the target historical block height are referenced by a state tree corresponding to the current block height or not according to any second blockchain account, deleting the account state information of the second blockchain accounts stored in the database under the target historical block height if the nodes corresponding to the second blockchain accounts are referenced by the state tree corresponding to the current block height, and reserving the account state information of the second blockchain accounts stored in the database under the target historical block height if the nodes corresponding to the second blockchain accounts are referenced by the state tree corresponding to the current block height.
Specifically, each chunk corresponds to a state tree, and the leaf nodes of the state tree of each chunk represent a blockchain account. By analyzing the node information of the state tree corresponding to each block, whether the reference relationship exists among the nodes of different state trees can be determined.
Referring to FIG. 3, account a is a first blockchain account and account b is a second blockchain account. Taking M as 1 as an example, when the currently added block on the blockchain is the block N, the account state information of the account b under the block N-1 in the database needs to be deleted originally, but because the node in the state tree of the block N references the node corresponding to the account b in the state tree of the block N-1 (the corresponding node in fig. 3 has a connection line to represent that there is a reference relationship), the account state information of the account b under the block N-1 in the database does not need to be deleted.
In some embodiments, the service archiving node may further receive an account status information restoration instruction, where the account status information restoration instruction is configured to instruct to restore the account status information of the deleted second blockchain account at each of the historic block heights in the database, sequentially execute transactions related to the deleted second blockchain account in each of the blockchains in response to the account status information restoration instruction, to obtain the account status information of the deleted second blockchain account at each of the historic block heights, and restore the obtained account status information of the deleted second blockchain account at each of the historic block heights to the database.
In this embodiment, the service archiving node further has a re-archiving capability, so that the account status information of the blockchain account deleted in the database is restored to the database again, so as to meet flexible and changeable service requirements, and further ensure availability and reliability of services provided by the blockchain network.
For example, in the case where the currently joining block on the blockchain is block N, account status information for account b under blocks 1 through N-1 has been deleted from the database. If there is a demand for recovering the account state information of the account b under the blocks 1 to N-1 in the database, the transaction data recorded in each block 1 to N-1 can be obtained, and the corresponding transaction data is re-executed, so as to re-obtain the account state information of the account b under the blocks 1 to N-1, and store the re-obtained account state information of the account b under the blocks 1 to N-1 in the database, thereby realizing re-archiving of the account state information of the account b under the blocks 1 to N-1 in the database.
Fig. 4 is a flowchart of a data processing method according to an embodiment of the present application. The method may be performed by a data processing apparatus, which may be implemented in software and/or hardware, and which may be generally integrated in a blockchain node. As shown in fig. 4, the method may include the steps of:
401. in response to a current block height of the blockchain, account state information of each of at least one first blockchain account under the current block height is obtained, wherein the first blockchain account is a blockchain account with relevance to a business requirement on a blockchain network.
402. And saving account state information of at least one first blockchain account under the current block height respectively into a database.
Further optionally, the method may further include obtaining account status information of each of the at least one second blockchain account at the current blockheight in response to the current blockheight of the blockchain, the second blockchain account having no association with the business requirement, and saving the account status information of each of the at least one second blockchain account at the current blockheight to the database.
Further optionally, the method may further include selecting a target historical block height satisfying a preset archiving threshold condition with the current block height from among the historical block heights appearing earlier than the current block height on the blockchain in response to the current block height of the blockchain, and deleting account status information of at least one second blockchain account stored in the database at the target historical block height, respectively.
Further optionally, deleting the account state information of each of the at least one second blockchain account stored in the database at the target historical block height includes, for any second blockchain account, determining whether a node corresponding to the second blockchain account in the state tree corresponding to the target historical block height is referenced by the state tree corresponding to the current block height, if not, deleting the account state information of the second blockchain account stored in the database at the target historical block height, and if so, retaining the account state information of the second blockchain account stored in the database at the target historical block height.
Further optionally, the method further comprises the steps of receiving an account state information recovery instruction, wherein the account state information recovery instruction is used for indicating to recover the account state information of the deleted second blockchain account at the heights of the historical blocks in the database, responding to the account state information recovery instruction, sequentially executing transactions related to the deleted second blockchain account in each block on the blockchain to obtain the account state information of the deleted second blockchain account at the heights of the historical blocks, and saving the obtained account state information of the deleted second blockchain account at the heights of the historical blocks in the database again.
According to the technical scheme provided by the embodiment of the application, a novel service archiving node can be created in the blockchain network, so that the inquiring requirement of some service scenes on account state data of each blockchain account can be met, and the service archiving node is a lightweight archiving node, so that the consumption of storage resources caused by using the archiving node can be greatly reduced, and the storage cost is reduced.
Fig. 5 is a schematic structural diagram of a service archiving node creation apparatus according to an embodiment of the present application. Referring to fig. 5, the apparatus may include:
A determining module 51, configured to determine at least one first blockchain account that has a correlation with a service requirement from all blockchain accounts on the blockchain network;
The control module 52 is configured to control any blockchain node in the blockchain network to repeatedly perform the steps of obtaining account status information of each of the at least one first blockchain account at the current blockheight in response to the current blockheight of the blockchain and saving the account status information of each of the at least one first blockchain account at the current blockheight to the database.
Further optionally, the control module 52 is further configured to control any blockchain node in the blockchain network to obtain account status information of each of the at least one second blockchain account at the current blockheight in response to the current blockheight of the blockchain, wherein the second blockchain account has no correlation with the business requirement, and store the account status information of each of the at least one second blockchain account at the current blockheight in the database.
Further optionally, the control module 52 is further configured to control any blockchain node in the blockchain network to select a target historical block height that meets a preset archiving threshold condition with a current block height from among the historical block heights that occur earlier than the current block height on the blockchain in response to the current block height of the blockchain, and to delete account status information for each of the at least one second blockchain account that has been stored in the database at the target historical block height.
Further optionally, deleting the account state information of each of the at least one second blockchain account stored in the database at the target historical block height includes, for any second blockchain account, determining whether a node corresponding to the second blockchain account in the state tree corresponding to the target historical block height is referenced by the state tree corresponding to the current block height, if not, deleting the account state information of the second blockchain account stored in the database at the target historical block height, and if so, retaining the account state information of the second blockchain account stored in the database at the target historical block height.
Further optionally, the control module 52 is further configured to control any blockchain node in the blockchain network to receive an account status information restoration instruction, where the account status information restoration instruction is configured to instruct the database to restore the account status information of the deleted second blockchain account at the respective historic block heights, sequentially execute transactions related to the deleted second blockchain account in the respective blocks on the blockchain in response to the account status information restoration instruction to obtain the account status information of the deleted second blockchain account at the respective historic block heights, and restore the obtained account status information of the deleted second blockchain account at the respective historic block heights to the database.
The particular manner in which the various modules, units, and operations of the service archiving node creation apparatus shown in fig. 5 are performed has been described in detail in connection with an embodiment of a service archiving node creation method and will not be described in detail herein.
Fig. 6 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present application. Referring to fig. 6, the apparatus may include:
an obtaining module 61, configured to obtain account status information of each of at least one first blockchain account under the current blockheight in response to the current blockheight of the blockchain, where the first blockchain account is a blockchain account on the blockchain network that has an association with a service requirement;
A saving module 62, configured to save account status information of at least one first blockchain account at the current blockheight to a database.
Further optionally, the obtaining module 61 is further configured to obtain, in response to the current block height of the blockchain, account status information of each of the at least one second blockchain account at the current block height, where the second blockchain account has no association with the service requirement, and save the account status information of each of the at least one second blockchain account at the current block height to the database.
Further optionally, the device further comprises a deleting module, which is used for responding to the current block height of the blockchain, selecting a target historical block height which meets the preset archiving threshold condition with the current block height from the historical block heights which occur earlier than the current block height on the blockchain, and deleting account state information of at least one second blockchain account which is stored in the database and is under the target historical block height.
The deleting module is further optionally configured to, when deleting account status information of at least one second blockchain account stored in the database at the target historical block height, determine, for any second blockchain account, whether a node corresponding to the second blockchain account in the status tree corresponding to the target historical block height is referenced by the status tree corresponding to the current block height, if not, delete account status information of the second blockchain account stored in the database at the target historical block height, and if so, retain account status information of the second blockchain account stored in the database at the target historical block height.
The device further comprises a restoring module, wherein the restoring module is used for receiving an account state information restoring instruction, the account state information restoring instruction is used for indicating to restore the account state information of the deleted second blockchain account under the heights of the historical blocks in the database, responding to the account state information restoring instruction, sequentially executing transactions related to the deleted second blockchain account in each block on the blockchain to acquire the account state information of the deleted second blockchain account under the heights of the historical blocks, and restoring the acquired account state information of the deleted second blockchain account under the heights of the historical blocks to the database.
The particular manner in which the various modules, units, and operations of the data processing apparatus illustrated in fig. 6 are performed has been described in detail in connection with an embodiment of a service archiving node creation method, and will not be described in detail herein.
It should be noted that, the execution subjects of each step of the method provided in the above embodiment may be the same device, or the method may also be executed by different devices. For example, the execution subject of steps 301 to 302 may be device a, for example, the execution subject of step 301 may be device a, the execution subject of step 302 may be device B, and so on.
In addition, in some of the flows described in the above embodiments and the drawings, a plurality of operations appearing in a specific order are included, but it should be clearly understood that the operations may be performed out of the order in which they appear herein or performed in parallel, the sequence numbers of the operations such as 301, 302, etc. are merely used to distinguish between the various operations, and the sequence numbers themselves do not represent any order of execution. In addition, the flows may include more or fewer operations, and the operations may be performed sequentially or in parallel. It should be noted that, the descriptions of "first" and "second" herein are used to distinguish different messages, devices, modules, etc., and do not represent a sequence, and are not limited to the "first" and the "second" being different types.
Fig. 7 is a schematic structural diagram of a computer device according to an embodiment of the present application. As shown in fig. 7, the computer device includes a memory 71 and a processor 72;
Memory 71 for storing a computer program and may be configured to store other various data to support operations on the computing platform. Examples of such data include instructions for any application or method operating on a computing platform, contact data, phonebook data, messages, pictures, videos, and the like.
The memory 71 may be implemented by any type of volatile or non-volatile memory device or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
A processor 72 coupled to the memory 71 for executing a computer program in the memory 71 for determining at least one first blockchain account associated with a business requirement from among all blockchain accounts on the blockchain network, controlling any blockchain node in the blockchain network to repeatedly perform the steps of causing the blockchain point to be created as a business archiving node by acquiring account status information of each of the at least one first blockchain account at a current blockheight in response to the current blockheight of the blockchain, saving the account status information of each of the at least one first blockchain account at the current blockheight to a database, or
A processor 72 coupled to the memory 71 for executing a computer program in the memory 71 for acquiring account status information of each of the at least one first blockchain account at the current blockheight in response to the current blockheight of the blockchain, the first blockchain account being a blockchain account on the blockchain network that has an association with a business requirement, and saving the account status information of each of the at least one first blockchain account at the current blockheight to a database.
Further, as shown in FIG. 7, the computer device also includes a communication component 73, a display 74, a power supply component 75, an audio component 76, and other components. Only some of the components are schematically shown in fig. 7, which does not mean that the computer device only comprises the components shown in fig. 7. In addition, the components within the dashed box in FIG. 7 are optional components, and not necessarily optional components, depending on the product form of the computer device. The computer device in this embodiment may be implemented as a terminal device such as a desktop computer, a notebook computer, a smart phone, or an IOT device, or may be a server device such as a conventional server, a cloud server, or a server array. If the computer device of the embodiment is implemented as a terminal device such as a desktop computer, a notebook computer, or a smart phone, the components in the dashed box in fig. 7 may be included, and if the computer device of the embodiment is implemented as a server device such as a conventional server, a cloud server, or a server array, the components in the dashed box in fig. 7 may not be included.
The detailed implementation process of each action performed by the processor may refer to the related description of the foregoing method embodiment, and will not be repeated herein.
Accordingly, embodiments of the present application also provide a computer-readable storage medium storing a computer program, where the computer program is executed to implement the steps executable by a computer device in the above-described method embodiments.
Accordingly, embodiments of the present application also provide a computer program product comprising a computer program/instructions which, when executed by a processor, cause the processor to carry out the steps of the above-described method embodiments that are executable by a computer device.
The communication component is configured to facilitate wired or wireless communication between the device in which the communication component is located and other devices. The device where the communication component is located can access a wireless network based on a communication standard, such as a mobile communication network of WiFi,2G, 3G, 4G/LTE, 5G, etc., or a combination thereof. In one exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication component further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
The display includes a screen, which may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or sliding action, but also the duration and pressure associated with the touch or sliding operation.
The power supply component provides power for various components of equipment where the power supply component is located. The power components may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the devices in which the power components are located.
The audio component described above may be configured to output and/or input an audio signal. For example, the audio component includes a Microphone (MIC) configured to receive external audio signals when the device in which the audio component is located is in an operational mode, such as a call mode, a recording mode, and a speech recognition mode. The received audio signal may be further stored in a memory or transmitted via a communication component. In some embodiments, the audio assembly further comprises a speaker for outputting audio signals.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application 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 present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the application are to be included in the scope of the claims of the present application.
Claims (7)
1. A method for creating a service archiving node, comprising:
Determining at least one first blockchain account with relevance to the business requirement from all blockchain accounts on a blockchain network;
Controlling any blockchain node in the blockchain network to repeatedly execute the following steps to enable the blockchain node to be created as a service archiving node, wherein the service archiving node is a lightweight archiving node, the service archiving node stores all data reserved in all nodes, and the all nodes store complete blockchain data:
acquiring account state information of each at least one first blockchain account under the current blockheight in response to the current blockheight of the blockchain, wherein the account state information comprises at least one of declarations, balances, random numbers, code hashes and storage roots;
storing account state information of at least one first blockchain account under the current block height respectively into a database;
Responding to the current block height of the block chain, acquiring account state information of each second block chain account under the current block height, wherein the second block chain accounts have no relevance to the service requirement, and storing the account state information of each second block chain account under the current block height into a database;
selecting a target historical block height satisfying a preset archiving threshold condition with a current block height from among historical block heights appearing earlier than the current block height on the blockchain in response to the current block height of the blockchain; deleting account status information of each of the at least one second blockchain account stored in the database at the target historical block height;
Wherein deleting account status information of each of the at least one second blockchain account stored in the database at the target historical block height comprises:
For any second blockchain account, judging whether a node corresponding to the second blockchain account in the state tree corresponding to the target historical block height is referenced by the state tree corresponding to the current block height;
if not, deleting the account state information of the second blockchain account stored in the database under the target historical block height;
if yes, the account state information of the second blockchain account stored in the database under the target historical block height is reserved.
2. The method as recited in claim 1, further comprising:
receiving an account state information recovery instruction, wherein the account state information recovery instruction is used for indicating that the deleted account state information of the second blockchain account under each historical block height is recovered again in the database;
responding to the account state information recovery instruction, and sequentially executing transactions related to the deleted second blockchain account in each block on the blockchain to acquire account state information of the deleted second blockchain account under each historical block height;
And saving the acquired account state information of the deleted second blockchain account under each historical block height in the database.
3. A data processing method, characterized by being applied to a service archiving node, the service archiving node being a lightweight archiving node, the service archiving node storing all data retained in a full node, the full node storing complete blockchain data, the method comprising:
Acquiring account state information of at least one first blockchain account under the current blockheight respectively in response to the current blockheight of the blockchain, wherein the first blockchain account is a blockchain account with relevance to service requirements on a blockchain network;
storing account state information of at least one first blockchain account under the current block height respectively into a database;
Responding to the current block height of the block chain, acquiring account state information of each second block chain account under the current block height, wherein the second block chain accounts have no relevance to the service requirement, and storing the account state information of each second block chain account under the current block height into a database;
selecting a target historical block height satisfying a preset archiving threshold condition with a current block height from among historical block heights appearing earlier than the current block height on the blockchain in response to the current block height of the blockchain; deleting account status information of each of the at least one second blockchain account stored in the database at the target historical block height;
Wherein deleting account status information of each of the at least one second blockchain account stored in the database at the target historical block height comprises:
For any second blockchain account, judging whether a node corresponding to the second blockchain account in the state tree corresponding to the target historical block height is referenced by the state tree corresponding to the current block height;
if not, deleting the account state information of the second blockchain account stored in the database under the target historical block height;
if yes, the account state information of the second blockchain account stored in the database under the target historical block height is reserved.
4. A service archiving node creation apparatus, characterized by being applied to a service archiving node, the service archiving node being a lightweight archiving node, the service archiving node storing all data remaining in a full node, the full node storing complete blockchain data, the apparatus comprising:
The system comprises a determining module, a storage module and a processing module, wherein the determining module is used for determining at least one first blockchain account with relevance to the business requirement from all blockchain accounts on a blockchain network, and the account state information comprises at least one of declaration, balance, random number, code hash and storage root;
the control module is used for controlling any blockchain node in the blockchain network to repeatedly execute the following steps, so that the blockchain node is created as a service archiving node, wherein the account state information of at least one first blockchain account under the current blockheight is obtained in response to the current blockheight of the blockchain; storing account state information of at least one first blockchain account under the current block height respectively into a database; responding to the current block height of the block chain, acquiring account state information of each second block chain account under the current block height, wherein the second block chain accounts have no relevance to the service requirement, and storing the account state information of each second block chain account under the current block height into a database; selecting a target historical block height satisfying a preset archiving threshold condition with a current block height from among historical block heights appearing earlier than the current block height on the blockchain in response to the current block height of the blockchain;
Wherein deleting account status information of each of the at least one second blockchain account stored in the database at the target historical block height comprises:
For any second blockchain account, judging whether a node corresponding to the second blockchain account in the state tree corresponding to the target historical block height is referenced by the state tree corresponding to the current block height;
if not, deleting the account state information of the second blockchain account stored in the database under the target historical block height;
if yes, the account state information of the second blockchain account stored in the database under the target historical block height is reserved.
5. A data processing apparatus for use with a service archiving node, the service archiving node being a lightweight archiving node, the service archiving node storing all data retained in a full node, the full node storing complete blockchain data, the apparatus comprising:
The system comprises an acquisition module, a storage module and a storage module, wherein the acquisition module is used for responding to the current block height of a blockchain and acquiring account state information of at least one first blockchain account under the current block height, wherein the first blockchain account is a blockchain account with relevance to service requirements on a blockchain network;
the storage module is used for storing account state information of at least one first blockchain account under the current block height into a database; responding to the current block height of the block chain, acquiring account state information of each second block chain account under the current block height, wherein the second block chain accounts have no relevance to the service requirement, and storing the account state information of each second block chain account under the current block height into a database;
A deletion module, configured to select, in response to a current block height of the blockchain, a target historical block height that satisfies a preset archive threshold condition with the current block height from among the historical block heights that occur earlier than the current block height on the blockchain;
Wherein deleting account status information of each of the at least one second blockchain account stored in the database at the target historical block height comprises:
For any second blockchain account, judging whether a node corresponding to the second blockchain account in the state tree corresponding to the target historical block height is referenced by the state tree corresponding to the current block height;
if not, deleting the account state information of the second blockchain account stored in the database under the target historical block height;
if yes, the account state information of the second blockchain account stored in the database under the target historical block height is reserved.
6. A computer device comprising a memory and a processor, the memory for storing a computer program, the processor being coupled to the memory for executing the computer program for performing the steps in the method of any of claims 1-3.
7. A computer storage medium storing a computer program, which, when executed by a processor, causes the processor to carry out the steps of the method according to any one of claims 1-3.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210523933.3A CN115174599B (en) | 2022-05-13 | 2022-05-13 | Business archiving node creation and data processing method, device, equipment and medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210523933.3A CN115174599B (en) | 2022-05-13 | 2022-05-13 | Business archiving node creation and data processing method, device, equipment and medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN115174599A CN115174599A (en) | 2022-10-11 |
| CN115174599B true CN115174599B (en) | 2025-06-13 |
Family
ID=83483863
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202210523933.3A Active CN115174599B (en) | 2022-05-13 | 2022-05-13 | Business archiving node creation and data processing method, device, equipment and medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN115174599B (en) |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110264217A (en) * | 2018-10-11 | 2019-09-20 | 腾讯科技(深圳)有限公司 | A kind of information processing method, equipment and storage medium |
| CN112291376A (en) * | 2020-12-31 | 2021-01-29 | 腾讯科技(深圳)有限公司 | Data processing method and related equipment in block chain system |
Family Cites Families (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109656873B (en) * | 2018-11-02 | 2023-04-14 | 平安科技(深圳)有限公司 | Block chain-based data archiving method and device and terminal equipment |
| US20200364817A1 (en) * | 2019-05-17 | 2020-11-19 | UCOT Holdings Pty Ltd | Machine type communication system or device for recording supply chain information on a distributed ledger in a peer to peer network |
| CN110471795B (en) * | 2019-07-31 | 2020-10-02 | 阿里巴巴集团控股有限公司 | Block chain state data recovery method and device and electronic equipment |
| US10761948B1 (en) * | 2019-07-13 | 2020-09-01 | Alibaba Group Holding Limited | Method, apparatus, and electronic device for restoring state data of blockchain |
| CN111444185B (en) * | 2020-03-26 | 2024-08-23 | 平安壹钱包电子商务有限公司 | Block information updating method, device, computer equipment and storage medium |
-
2022
- 2022-05-13 CN CN202210523933.3A patent/CN115174599B/en active Active
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110264217A (en) * | 2018-10-11 | 2019-09-20 | 腾讯科技(深圳)有限公司 | A kind of information processing method, equipment and storage medium |
| CN112291376A (en) * | 2020-12-31 | 2021-01-29 | 腾讯科技(深圳)有限公司 | Data processing method and related equipment in block chain system |
Also Published As
| Publication number | Publication date |
|---|---|
| CN115174599A (en) | 2022-10-11 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2018219178A1 (en) | Data synchronization method and apparatus, server, and storage medium | |
| US20170031948A1 (en) | File synchronization method, server, and terminal | |
| WO2019028992A1 (en) | Multi-module version dependency relationship construction method, device, server and storage medium | |
| EP3084631A1 (en) | Data synchonization in a storage network | |
| US20190181901A1 (en) | Local profile assistant and application programming interface | |
| US20140237024A1 (en) | Network communication devices and file tracking methods thereof | |
| CN113301558B (en) | Message transmission method, device, system and storage medium | |
| CN113392158A (en) | Service data processing method and device and data center | |
| CN105302920A (en) | Optimal management method and system for cloud storage data | |
| US9628567B2 (en) | Methods and systems for efficient discovery of devices in a peer-to-peer network | |
| CN113138717B (en) | Node deployment method, device and storage medium | |
| CN109672752A (en) | The synchronous method of data and node | |
| CN114844788B (en) | Network data analysis method, system, equipment and storage medium | |
| CN112579877B (en) | Control method, device, storage medium and equipment of information source system | |
| CN112114804A (en) | Application program generation method, device and system | |
| US10853892B2 (en) | Social networking relationships processing method, system, and storage medium | |
| CN114880717A (en) | Data archiving method and device | |
| CN115174599B (en) | Business archiving node creation and data processing method, device, equipment and medium | |
| CN104063377A (en) | Information processing method and electronic equipment using same | |
| CN116126968A (en) | Method and system for providing data storage service based on blockchain as-a-service BaaS platform | |
| CN115658357A (en) | Method and apparatus for replaying blockchain transactions | |
| CN115022053A (en) | Method, apparatus and system for accessing a blockchain network | |
| CN117014420A (en) | File synchronization method, device, equipment and medium | |
| Ganchev et al. | A cloud-based service recommendation system for use in UCWW | |
| CN109962931B (en) | Information pushing method, device and system |
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 |