Method and device for synchronizing block chain node data

By rebuilding the state tree in the new node and using shared storage devices to obtain the value of the leaf node, the problem of large amount of synchronization data and long time in the prior art is solved, and faster new node synchronization and consensus node addition is achieved.

CN120186162APending Publication Date: 2025-06-20ANT BLOCKCHAIN TECHNOLOGY (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510349376.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-21
Publication Date
2025-06-20

AI Technical Summary

Technical Problem

When the existing technology uses new nodes to consensus in blockchain systems, it is necessary to synchronize a large amount of historical transaction data and status information, resulting in large amounts of data and long synchronization time, making it difficult to quickly add new consensus nodes.

Method used

By only transmitting the hash values ​​of the keys and values ​​of the leaf nodes of the state tree in the existing nodes of the blockchain system to the new node, and rebuilding the state tree in the new node, using the shared storage device to obtain the value of the leaf node to achieve synchronization of the new node.

Benefits of technology

This significantly reduces the amount and time of synchronizing data between new nodes and old nodes, and improves the speed of adding new consensus nodes to the blockchain system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120186162A_ABST
    Figure CN120186162A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a method and equipment for synchronizing block chain node data, the method is executed by a target node in a block chain system, and the method comprises the following steps: obtaining a key corresponding to a first leaf node contained in a first tree used for storing a world state in a first node and a hash value of a value corresponding to the first leaf node from the first node; a key of the first leaf node corresponds to an identifier of a target object in the block chain system, and a value corresponding to the first leaf node corresponds to a state value of the target object; constructing a second tree for storing the world state according to the key of the first leaf node; and obtaining a value corresponding to the second leaf node through a shared storage device in the block chain system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this specification belong to the technical field of blockchain, and in particular, relate to a method and device for synchronizing data of blockchain nodes. Background Art

[0002] Blockchain is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithms. In a blockchain system, data blocks are combined into a chained data structure in a sequential connection manner according to the time sequence, and a distributed ledger that is tamper-proof and non-forgeable is guaranteed by cryptographic means. Due to the characteristics of blockchain such as decentralization, information immutability, and autonomy, blockchain has received more and more attention and applications. Summary of the Invention

[0003] The purpose of the present invention is to provide a method and device for synchronizing data of blockchain nodes. Before a new node is used for consensus, only the keys of the leaf nodes of the state tree and the hash values of the values of the leaf nodes in the existing nodes of the blockchain system are transmitted to the new node, and the state tree is reconstructed in the new node according to the keys of the leaf nodes, so that the new node can be used as a consensus node of the blockchain system. And during the process of the new node participating in the consensus mechanism as a consensus node, the values corresponding to the leaf nodes in the state tree of the new node can be obtained through the shared storage device in the blockchain system. Thus, the amount of data synchronized between the new and old nodes for using the new node for consensus and the synchronization time are reduced, and the speed of adding new consensus nodes in the blockchain system is greatly accelerated, solving the deficiencies of the prior art.

[0004] To achieve the above purpose, the first aspect of this specification provides a method for synchronizing data of blockchain nodes. The method is executed by a target node in the blockchain system, and the method includes: obtaining, from a first node, the keys corresponding to the first leaf nodes included in the first tree for storing the world state in the first node, and the hash values of the values corresponding to the first leaf nodes; the keys of the first leaf nodes correspond to the identifiers of the target objects in the blockchain system, and the values corresponding to the first leaf nodes correspond to the state values of the target objects; constructing a second tree for storing the world state according to the keys of the first leaf nodes; and obtaining the values corresponding to the second leaf nodes through the shared storage device in the blockchain system.

[0005] The second aspect of this specification provides a computing device, including: a processor; and a memory, in which a program is stored. When the processor executes the executable code, the method described in the first aspect is implemented.

[0006] In the solution for synchronizing blockchain node data provided in the embodiments of this specification, a target node in the blockchain system can obtain, from a first node, the keys corresponding to the first leaf nodes included in the first tree for storing the world state in the first node, and the hash values of the values corresponding to the first leaf nodes. The keys of the first leaf nodes can correspond to the identifiers of target objects in the blockchain system, and the values corresponding to the first leaf nodes correspond to the state values of the target objects. A second tree for storing the world state can be constructed according to the keys of the first leaf nodes. Furthermore, the values corresponding to the second leaf nodes can be obtained through the shared storage device in the blockchain system. Through this method, the amount of data and the time for synchronizing data between the new node and the old node before using the new node for consensus can be significantly reduced, so that consensus nodes can be added to the blockchain system at a faster speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0007] To more clearly illustrate the technical solutions in the embodiments of this specification, the drawings required for describing the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments recorded in this specification. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0008] Figure 1 Shows the blockchain architecture diagram in an embodiment;

[0009] Figure 2 Is a schematic diagram of a method for synchronizing blockchain node data in an embodiment of this specification;

[0010] Figure 3 Is a flowchart of a method for synchronizing blockchain node data in an embodiment of this specification;

[0011] Figure 4 Is a schematic diagram of obtaining the value of a leaf node from a shared storage device in an embodiment of this specification;

[0012] Figure 5 Is a schematic diagram of synchronizing intermediate nodes of a state tree in an embodiment of this specification;

[0013] Figure 6 Is a schematic diagram of obtaining a leaf node from a shared storage device in an embodiment of this specification. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0014] To enable those skilled in the art to better understand the technical solutions in this specification, the following will clearly and completely describe the technical solutions in the embodiments of this specification in conjunction with the accompanying drawings in the embodiments of this specification. Obviously, the described embodiments are only a part of the embodiments of this specification, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this specification without creative efforts shall fall within the scope of protection of this specification.

[0015] Figure 1 shows a blockchain architecture diagram in an embodiment. In Figure 1 the shown blockchain architecture diagram, the blockchain 100 includes N nodes, Figure 1 and nodes 1 - node 8 are schematically shown. The connections between the nodes schematically represent P2P (Peer to Peer) connections, and such connections can be, for example, TCP connections, etc., for transmitting data between the nodes. A full ledger can be stored on these nodes, that is, the states of all blocks and all accounts are stored. Among them, each node in the blockchain can generate the same state in the blockchain by executing the same transactions, and each node in the blockchain can store the same state database.

[0016] Transactions in the blockchain field can refer to task units that are executed and recorded in the blockchain. A transaction usually includes a sending field (From), a receiving field (To), and a data field (Data). Among them, in the case of a transfer transaction, the From field represents the account address that initiates the transaction (i.e., initiates the transfer task to another account), the To field represents the account address that receives the transaction (i.e., receives the transfer), and the Data field includes the transfer amount.

[0017] One of the decentralized features that distinguish blockchain technology from traditional technologies is that accounting is performed on each node, or distributed accounting, rather than traditional centralized accounting. For a blockchain system to become a decentralized, honest, and trustworthy system that is difficult to break, open, and has immutable data records, it is necessary to achieve the security, clarity, and irreversibility of distributed data records in the shortest possible time. In different types of blockchain networks, in order to keep the ledgers consistent among the nodes that record the ledgers, a consensus algorithm is usually adopted to ensure, that is, the aforementioned consensus mechanism. For example, a consensus mechanism at the block granularity can be achieved among blockchain nodes. For instance, after a block is generated at a node (such as a unique node), if the generated block is recognized by other nodes, the other nodes record the same block. Another example is that a consensus mechanism at the transaction granularity can be achieved among blockchain nodes. For example, after a blockchain transaction is obtained at a node (such as a unique node), if this blockchain transaction is recognized by other nodes, each node that recognizes the blockchain transaction can respectively add the blockchain transaction to the latest block maintained by itself, and ultimately ensure that the same latest block is generated at each node. The consensus mechanism is a mechanism for blockchain nodes to reach a consensus on the block information (or block data) across the network, which can ensure that the latest block is accurately added to the blockchain.

[0018] The world state is the collection of the current states of all accounts (user accounts, smart contract accounts, etc.) in the blockchain system. For example, it can include account balances, contract codes, stored data, etc. The world state is usually saved on the nodes in the blockchain system and can be specifically saved through a tree-like data structure. For example, the world state of Ethereum is saved through the Merkle Patricia Trie (MPT). Usually, during the long operating cycle of the blockchain system, the number of actually available nodes can change. For example, several nodes go down in a production environment. In this case, the availability of the entire blockchain system decreases, and even leads to security issues where the blockchain service cannot continue to be provided. Therefore, it is often desired to quickly add new nodes to the blockchain system.

[0019] An existing solution for adding nodes to a blockchain system mainly involves adding new nodes in the blockchain system that have downloaded all blocks and verified all historical transaction data therein. Such nodes can serve as full nodes and consensus nodes in the blockchain system. However, the problem with this solution is that the storage space occupied by downloading and verifying all historical transaction data is very large, and it requires a large amount of computing resources and computing time, making it difficult to quickly add new nodes to the blockchain system. Another solution for adding nodes to the blockchain system mainly involves adding new nodes in the blockchain system that have synchronized the block headers of some blocks and the latest version of the state data. Such nodes can serve as consensus nodes in the blockchain system. The problem with this solution is that the amount of state information data is still relatively large, and it requires a long synchronization time and a large amount of synchronized data.

[0020] To solve the above problems, an embodiment of this specification provides a method for synchronizing blockchain node data. Through this method, only the keys corresponding to the leaf nodes of the state tree and the hash values of the values corresponding to the leaf nodes in the existing nodes of the blockchain system are transmitted to the new node, and after reconstructing the state tree in the new node based on the keys of the leaf nodes, the new node is added to the blockchain system as a consensus node. Furthermore, during the process of the new node participating in the consensus mechanism as a consensus node, the values corresponding to the leaf nodes in the state tree of the new node can be obtained through the shared storage device in the blockchain system. Figure 2 It is a schematic diagram of a method for synchronizing blockchain node data in an embodiment of this specification. As Figure 2As shown, for example, a blockchain system includes multiple nodes, namely Node 1, Node 2, Node 3, and Node 4. Each of these nodes stores a state tree (MPT tree). The state tree is composed of, for example, three types of nodes: Extension Node, Branch Node, and Leaf Node. Among them, the Extension Node and the Branch Node are intermediate nodes between the Leaf Node and the State Root. The Leaf Node can be used to store the key-value pairs corresponding to the objects (such as user accounts or contract accounts) in the blockchain system. Among them, the Key can be used to store the identifier of the account, and the value is used to store the content in the account, such as account balance, contract code, stored data, etc. For the new node X, for example, it can obtain the hash values (ValueHash) of the keys and the values corresponding to the keys of each leaf node of the state tree T1 of Node 1 from Node 1. And based on the keys of these leaf nodes, reconstruct the state tree T2 on the new node X. Furthermore, the new node X can be used as a consensus node of this blockchain. After that, during the process where the node X participates in the consensus mechanism as a consensus node, the values of the leaf nodes in the state tree T2 can be obtained through the shared storage device in the blockchain system.

[0021] The advantages of this method are as follows: First, since the data volume occupied by the state values in the state tree is usually relatively large, during the process of adding a node by this method, only the hash value of the state value instead of the state value is transmitted to the new node, that is, the new node can be used as a consensus node, and the state value itself can be obtained through the shared storage device in the blockchain system during the process where the new node participates in the consensus mechanism. Since the data volume of the hash value of the state value is usually much smaller than the state value, therefore, compared with the existing solutions for adding nodes in the blockchain, adding a new consensus node in the blockchain by this method can greatly reduce the network data transmission volume between the new node and the old nodes. Second, this method also shortens the time for synchronizing data between the new node and the old nodes before using the new node for consensus, so that available consensus nodes can be added to the blockchain system at a faster speed. Third, in some embodiments, before using the new node as a consensus node, only the intermediate nodes in the state tree can be synchronized from the old node to the new node, and the state tree is reconstructed on the new node based on the intermediate nodes. Since the data volume of the intermediate nodes is usually smaller than that of the leaf nodes, thus, the data volume and the synchronization time for synchronizing data between the new and old nodes for using the new node for consensus can be further reduced.

[0022] Next, a method for synchronizing data of blockchain nodes provided in the embodiments of this specification will be further described. Figure 3It is a flowchart of a method for synchronizing blockchain node data in an embodiment of this specification. The method is executed by a target node in a blockchain system, such as Figure 3 shown, and the method at least includes the following steps:

[0023] Step S301: Obtain the key corresponding to the first leaf node included in the first tree for storing the world state in the first node, and the hash value of the value corresponding to the first leaf node; the key of the first leaf node corresponds to the identifier of the target object in the blockchain system, and the value corresponding to the first leaf node corresponds to the state value of the target object;

[0024] Step S303: Construct a second tree for storing the world state according to the key of the first leaf node;

[0025] Step S305: Obtain the value corresponding to the second leaf node through the shared storage device in the blockchain system.

[0026] First, in step S301, the key corresponding to the first leaf node included in the first tree for storing the world state in the first node, and the hash value of the value corresponding to the leaf node can be obtained from the first node. The key of the first leaf node can correspond to the identifier of the target object in the blockchain system, and the value corresponding to the first leaf node can correspond to the state value of the target object. In different embodiments, the blockchain system can be different specific blockchain systems, and this specification does not limit this. The first node is an existing node in the blockchain system. According to different embodiments, the first node can be, for example, an existing master node, full node, or consensus node in the blockchain system. In different embodiments, the target object in the blockchain system can be, for example, a user account or a contract account in the blockchain system.

[0027] According to one embodiment, the first tree used by the first node to store the world state may be a State Trie. In different specific embodiments, the first leaf node of the state tree on the first node may be used to store the key-value pairs corresponding to user accounts or contract accounts in the blockchain system. The key is used to store the identifier of the account, and the value may be used to store the account balance, contract code, stored data, etc. in the account. According to another embodiment, the first tree used by the first node to store the world state may also be a Storage Trie. As mentioned above, the state tree may record the account states such as the balance and nonce of each account, while the storage tree may record the variable states in smart contracts. In one example, the root hash of the state tree may be included in the block header, and the root hash of the storage tree may be included in a node of the state tree. The storage tree may adopt the same data structure as the state tree, such as the MPT tree. In this specification, the synchronous state tree is mainly used as an example for illustration, and the synchronous storage tree can be synchronized and reconstructed in a similar manner to the state tree.

[0028] Then, in step S303, a second tree for storing the world state can be constructed according to the key of the first leaf node obtained in step S301. According to one embodiment, both the first tree and the second tree are MPTs, and the second tree may also include extension nodes, branch nodes, and leaf nodes. Among them, the extension nodes and branch nodes are intermediate nodes between the leaf nodes and the state root. Furthermore, the leaf node (the first leaf node) obtained in step S301 can be used as the leaf node (the second leaf node) of the second tree. Since the MPT is also a prefix (Trie) tree, the key of the leaf node in the MPT tree contains the indication information of the nodes included in the path from the leaf node to the root node. Therefore, the intermediate nodes from each leaf node to the root node in the second tree can be constructed according to the indication information included in the keys of each leaf node, thereby obtaining the second tree. In different specific embodiments, the specific process of constructing the intermediate nodes from each leaf node to the root node in the second tree according to the indication information included in the keys of each leaf node may be different, and this specification does not limit this.

[0029] After constructing the second tree, an index file and a data file corresponding to the second tree can be generated. The index file stores the mapping from the node hash to the physical location of the node content in the data file, so that the node content in the data file can be directly located through the hash value, avoiding traversing the entire tree and improving the retrieval efficiency. Therefore, according to one embodiment, the index file may also be used to at least store the correspondence between the hash value obtained according to the value corresponding to the second leaf node and the storage location of the value corresponding to the second leaf node.

[0030] As described above, a consensus mechanism at the transaction granularity can be executed between blockchain nodes to ensure that the states of all nodes in the network are consistent after transaction execution. In a blockchain system, transactions can be executed and the states after transactions can be verified. Thus, the nodes that can execute such a consensus mechanism are consensus nodes. According to an implementation, after constructing a second tree for storing the world state, a target node can be used as a consensus node of the blockchain system.

[0031] Furthermore, in step S305, the value corresponding to the second leaf node can be obtained from a shared storage device in the blockchain system. Figure 4 This is a schematic diagram of obtaining the value of a leaf node from a shared storage device in an embodiment of this specification. As Figure 4 shown, for example, the reconstructed state tree on target node X includes intermediate nodes (such as extended nodes and branch nodes) and leaf nodes (such as LN1, LN2...LN5), and the hash values of the values corresponding to the leaf nodes are stored in the leaf nodes. In one example, after using target node X as a consensus node of the blockchain system, the values corresponding to each of the leaf nodes LN1, LN2...LN5 in the state tree T2 of node X can be obtained from the shared storage device. In another example, for instance, when target node X participates in the consensus on transaction C1, transaction C1 is executed locally. And transaction C1, for example, reads the account balance of account A1 (identified as key1). The target node obtains the value valueA of the leaf node corresponding to account A1 in the state tree of existing node 1 in the blockchain system from the shared storage device in the blockchain system, and replaces the value hash VHashX corresponding to account A1 stored in state tree T2 with valueA. In one example, the target node can also calculate the hash value of valueA and determine whether the hash value of valueA is consistent with the hash value (i.e., VHashX) stored in account A1. In the case where the two are consistent, after verifying valueA, the value hash VHashX corresponding to account A1 stored in the second tree is replaced with valueA, that is, replaced with the verified value corresponding to account A1.

[0032] In the above implementation of constructing the index file, the target node can also verify the value corresponding to the second leaf node according to the hash value of the value of the second leaf node; in the case where the verification passes, the value corresponding to the second leaf node is saved to the storage location of the value corresponding to the second leaf node in the index file.

[0033] A shared storage device can be a storage device used by multiple nodes in a blockchain system to access and store shared data. In different embodiments, the specific type of the shared storage device can be different. For example, it can be a logical storage device or system, or a physical storage device or system. In one embodiment, for example, it can be the InterPlanetary File System (IPFS). In another embodiment, for example, it can be the Network File System (NFS). In different embodiments, the process of obtaining the value of a leaf node through the shared storage device can also be different. In one embodiment, the value corresponding to the second leaf node can be obtained from the first disk mounted to the first node through the shared storage device in the blockchain system. Furthermore, the value corresponding to the second leaf node can be saved in the storage location in the second disk mounted to the target node. In another embodiment, the value corresponding to the second leaf node can also be obtained from the backup of the value corresponding to the first node in the first disk in the shared storage device in the blockchain system.

[0034] To further reduce the amount of data and the time for synchronizing data between new and old nodes when using a new node for consensus. According to one embodiment, the blockchain system may further include a second node, and the second node is configured to perform the following process: obtain the intermediate nodes between the root hash and the leaf nodes included in the first tree for storing the world state in the first node, where the key of the leaf node corresponds to the identifier of the target object in the blockchain system, and the value corresponding to the leaf node corresponds to the state value of the target object; construct a third tree for storing the world state according to the intermediate nodes; in response to an access to a third leaf node in the third tree, obtain the fourth leaf node corresponding to the third leaf node in the first tree through the shared storage device in the blockchain system; generate the third leaf node in the third tree according to the fourth leaf node. In a specific embodiment, after constructing the third tree for storing the world state, the second node can be used as a consensus node in the blockchain system.

[0035] Figure 5 It is a schematic diagram of synchronizing intermediate nodes of a state tree in an embodiment of this specification. As Figure 5As shown, for example, the target node X obtains the intermediate nodes of its state tree (such as including extended nodes and branch nodes) from the existing node 1 in the blockchain system. Based on these intermediate nodes, the state tree T3 is reconstructed on the node X. The leaf nodes in the state tree T3 can be empty or not generated, and the target node X is used as a consensus node in the blockchain system to participate in the consensus mechanism. Thereafter, during the process where the node X participates in the consensus mechanism as a consensus node, the leaf nodes in the state tree T2 can be obtained through the shared storage device in the blockchain system, which can include the keys and values corresponding to the leaf nodes.

[0036] Specifically, Figure 6 is a schematic diagram of obtaining leaf nodes from a shared storage device in an embodiment of this specification. As Figure 6 shown in the example, for example, when the target node X participates in the consensus for the transaction C1, the transaction C1 is executed locally, and the transaction C1 reads the account A1 (identified as key1) for example. The target node can obtain the leaf node corresponding to the account A1 in the state tree of the existing node 1 in the blockchain system from the shared storage device of the blockchain system (for example, the key is key1 and the value is ValueA), and generate a leaf node with the key key1 and the value ValueA corresponding to the account A1 in the state tree T2.

[0037] Generally, the change of leaf nodes can lead to the change of the hash of intermediate nodes, and the obtained leaf nodes can also be verified whether they are correct through the hash values of the intermediate nodes in the state tree of the target node. Therefore, in a specific implementation manner, the fourth leaf node can also be verified according to the intermediate nodes in the third tree; in the case of passing the verification, the third leaf node is generated in the third tree. In different specific implementation manners, the specific process of verifying the fourth leaf node according to the intermediate nodes in the third tree can be different, and this specification does not limit this.

[0038] In this implementation manner, the advantage of only synchronizing the intermediate nodes in the state tree from the old node to the new node before using the new node as a consensus node is that: generally, the number of intermediate nodes in the state tree is much less than that of leaf nodes, and the data volume of intermediate nodes is also much smaller than that of leaf nodes. Therefore, only synchronizing the intermediate nodes from the old node to the new node can further reduce the data volume and synchronization time of synchronizing data between the new and old nodes for using the new node for consensus. Thus, it further improves the speed of adding available consensus nodes in the blockchain system.

[0039] Another aspect of this specification provides a computing device, including: a processor; and a memory, where a program is stored, and when the processor executes the program, the above-mentioned method in any one of the above is implemented.

[0040] In another aspect of this specification, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed on a computer, the computer is made to execute any one of the above methods.

[0041] In another aspect of this specification, a computer program product is provided, including a computer program / instructions. When the computer program / instructions are executed by a processor, any one of the above methods is implemented.

[0042] In the 1990s, it was obvious to distinguish whether an improvement in a technology was a hardware improvement (e.g., improvement in circuit structures such as diodes, transistors, switches, etc.) or a software improvement (improvement in method processes). However, with the development of technology, many improvements in method processes today can be regarded as direct improvements in hardware circuit structures. Almost all designers obtain the corresponding hardware circuit structure by programming the improved method process into the hardware circuit. Therefore, it cannot be said that an improvement in a method process cannot be implemented with a hardware entity module. For example, a Programmable Logic Device (PLD) (e.g., a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logical function is determined by the user programming the device. Designers can program by themselves to "integrate" a digital system on a piece of PLD without asking a chip manufacturer to design and fabricate a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly implemented using "logic compiler" software, which is similar to the software compiler used in program development and writing. The original code before compilation also has to be written in a specific programming language, which is called a Hardware Description Language (HDL). There is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones currently are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also be clear that as long as the method process is slightly logically programmed with the above-mentioned several hardware description languages and programmed into the integrated circuit, it is easy to obtain the hardware circuit that implements the logical method process.

[0043] The controller can be implemented in any suitable manner. For example, the controller can take the form of, for example, a microprocessor or a processor and a computer-readable medium storing computer-readable program code (such as software or firmware) executable by the (micro)processor, logic gates, switches, an application specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of the controller include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in the form of pure computer-readable program code, it is entirely possible to make the controller implement the same function in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be regarded as the structures within the hardware component. Or even, the devices for implementing various functions can be regarded as either software modules for implementing the method or the structures within the hardware component.

[0044] The systems, devices, modules, or units illustrated in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a server system. Of course, this application does not exclude that with the development of future computer technologies, the computers for implementing the functions of the above embodiments can be, for example, personal computers, laptop computers, in-vehicle human-machine interaction devices, cellular phones, camera phones, smart phones, personal digital assistants, media players, navigation devices, email devices, game consoles, tablet computers, wearable devices, or any combination of these devices.

[0045] Although one or more embodiments of this specification provide method operation steps as described in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way among many execution orders of the steps and does not represent the only execution order. When the actual device or terminal product is executed, it may be executed in the order of the method shown in the embodiments or the drawings or executed in parallel (for example, in an environment of parallel processors or multi-threaded processing, or even in a distributed data processing environment). The terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, product or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or also includes elements inherent to such process, method, product or device. Without further limitation, there is no exclusion of additional identical or equivalent elements in the process, method, product or device comprising the said elements. For example, if terms such as first and second are used to denote names, they do not denote any particular order.

[0046] For the convenience of description, the above device is described by dividing it into various modules according to functions. Of course, when implementing one or more of this specification, the functions of each module can be implemented in the same or multiple software and / or hardware, or the modules implementing the same function can be realized by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces, and the indirect coupling or communication connection of the device or unit can be in electrical, mechanical or other forms.

[0047] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate a device for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0048] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means that implement the function specified in one or more of the procedures Figure 1 one or more of the procedures and / or boxes Figure 1 specified in one or more of the boxes or boxes.

[0049] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, such that a series of operational steps are performed on the computer or other programmable apparatus to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable apparatus provide steps for implementing the function specified in one or more of the procedures Figure 1 one or more of the procedures and / or boxes Figure 1 specified in one or more of the boxes or boxes.

[0050] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.

[0051] The memory may include non-permanent memory in the computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of, for example, read-only memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.

[0052] Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology for storing information. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage, graphene storage or other magnetic storage devices, or any other non-transitory media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media such as modulated data signals and carrier waves.

[0053] Those skilled in the art should understand that one or more embodiments of this specification can be provided as a method, a system, or a computer program product. Therefore, one or more embodiments of this specification can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, one or more embodiments of this specification can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0054] One or more embodiments of this specification can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of this specification can also be practiced in a distributed computing environment where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0055] Each embodiment in this specification is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and reference can be made to the relevant parts of the method embodiments for the related content. In the description of this specification, the description of reference terms such as "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. In addition, without contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.

[0056] The above description is only for the embodiments of one or more embodiments of this specification and is not intended to limit one or more embodiments of this specification. For those skilled in the art, one or more embodiments of this specification can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification shall be included within the scope of the claims.

Claims

1. A method for synchronizing blockchain node data, the method being executed by a target node in a blockchain system, the method comprising: Obtain from the first node a hash value of a key corresponding to a first leaf node contained in a first tree for storing a world state in the first node and a value corresponding to the first leaf node; The key of the first leaf node corresponds to the identifier of the target object in the blockchain system, and the value corresponding to the first leaf node corresponds to the state value of the target object; Constructing a second tree for saving the world state according to the key of the first leaf node; Obtain a value corresponding to the second leaf node in the second tree from a shared storage device in the blockchain system.

2. The method according to claim 1, further comprising: Construct an index file corresponding to the second tree, wherein the index file is used to store at least a correspondence between a hash value obtained according to a value corresponding to the second leaf node and a storage location of the value corresponding to the second leaf node.

3. The method according to claim 2, wherein: Obtaining, through a shared storage device in the blockchain system, a value corresponding to the second leaf node, including: Obtaining, through a shared storage device in the blockchain system, a value corresponding to the second leaf node from a first disk mounted to the first node; The method further comprises: The value corresponding to the second leaf node is saved in the storage location in the second disk mounted to the target node.

4. The method according to claim 3, wherein: Saving the value corresponding to the second leaf node in the storage location in the second disk mounted to the target node includes: According to the hash value of the value of the second leaf node, the obtained value corresponding to the second leaf node is verified; if the verification passes, the value corresponding to the second leaf node is saved in the storage location.

5. The method according to claim 3, wherein: Obtaining, through a shared storage device in the blockchain system, a value corresponding to the second leaf node from a first disk mounted to the first node, including: Obtain a value corresponding to the second leaf node from a backup of the value corresponding to the first node in the first disk in a shared storage device in the blockchain system.

6. The method according to claim 1, wherein: After constructing the second tree for saving the world state, the target node is used as a consensus node of the blockchain system.

7. The method according to claim 1, wherein: The blockchain system also includes a second node, which is used to perform the following process: Obtaining from the first node an intermediate node between a root hash and a leaf node included in a first tree for storing a world state in the first node, wherein a key of the leaf node corresponds to an identifier of a target object in the blockchain system, and a value corresponding to the leaf node corresponds to a state value of the target object; Constructing a third tree for saving the world state according to the intermediate nodes; In response to accessing the third leaf node in the third tree, obtaining, through a shared storage device in the blockchain system, a fourth leaf node corresponding to the third leaf node in the first tree; According to the fourth leaf node, the third leaf node is generated in the third tree.

8. The method according to claim 7, wherein: Generating the third leaf node in the third tree according to the fourth leaf node includes: The fourth leaf node is verified according to the intermediate node in the third tree; if the verification passes, the third leaf node is generated in the third tree.

9. The method according to claim 7, wherein: After constructing a third tree for saving the world state, the second node is used as a consensus node of the blockchain system.

10. A computer device comprising: processor; and a memory, wherein the memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 9 is implemented.