Blockchain data synchronization method and device, electronic equipment and readable storage medium

By sending target synchronization interest packets between blockchain nodes and utilizing the SVS protocol of the NDN network to achieve blockchain data synchronization, the problem of low synchronization efficiency in the NDN network architecture is solved, and efficient and reliable blockchain data synchronization is achieved.

CN116028578BActive Publication Date: 2026-03-03PENG CHENG LAB
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310127660.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-17
Publication Date
2026-03-03
Estimated Expiration
2043-02-17

AI Technical Summary

Technical Problem

Existing technologies based on NDN network architecture have poor data synchronization performance, especially when the data polling and sending cycle is limited, the synchronization time is uncontrollable, and the NDN data distribution mechanism is incompatible with the blockchain data communication mechanism, resulting in low synchronization efficiency.

Method used

By detecting data synchronization tasks in the data synchronization state, the interest packets to be synchronized are determined, target synchronization data is generated, and target synchronization interest packets are sent to adjacent blockchain nodes to achieve data synchronization between blockchain nodes. The SVS protocol of the NDN network is used for efficient data transmission.

Benefits of technology

Without increasing the data transmission structure, it improves the efficiency and reliability of blockchain data synchronization, solves the problems of uncontrollable synchronization time and compatibility, and ensures data consistency among blockchain nodes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116028578B_ABST
    Figure CN116028578B_ABST
Patent Text Reader

Abstract

The application discloses a blockchain data synchronization method and device, electronic equipment and a readable storage medium, which are applied to a target blockchain node. The blockchain data synchronization method comprises the following steps: if a data synchronization task in a data synchronization state is detected, a to-be-synchronized interest package corresponding to the data synchronization task is determined, wherein the data synchronization task is triggered by a data synchronization event or a data synchronization period; to-be-synchronized data carried by the to-be-synchronized interest package is synchronized to obtain target synchronization data; a target synchronization interest package corresponding to the target synchronization data is sent to a neighboring blockchain node of the target blockchain node, so that the blockchain data between the target blockchain node and the neighboring blockchain node is synchronized. The application solves the technical problem of poor synchronization effect of the blockchain data based on the NDN network architecture.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of blockchain technology, and in particular to a blockchain data synchronization method, apparatus, electronic device, and readable storage medium. Background Technology

[0002] With its decentralized, immutable, and traceable characteristics, blockchain technology has been gradually applied to many fields such as finance, the Internet of Things, and public services. At the same time, as the amount of data on the blockchain grows larger and larger, how to establish a secure and efficient blockchain data transmission system has become an urgent problem to be solved in the field of blockchain technology.

[0003] Currently, blockchains are generally deployed in NDN (Named Data Networking) network architectures, leveraging NDN's inherent multicast advantages and in-network caching mechanisms to effectively address blockchain data transmission efficiency issues. Furthermore, to make blockchain data transparent, data polling and sending cycles are typically set in the NDN network, or data transmission structures are added for broadcasting. However, the former is limited by the data polling and sending cycle, leading to uncontrollable blockchain data synchronization time, while the latter suffers from compatibility issues between the NDN data distribution mechanism and the blockchain's data communication mechanism. Therefore, the synchronization effect of blockchain data based on the current NDN network architecture is poor. Summary of the Invention

[0004] The main purpose of this application is to provide a blockchain data synchronization method, device, electronic device and readable storage medium, which aims to solve the technical problem of poor synchronization effect of blockchain data based on NDN network architecture in the prior art.

[0005] To achieve the above objectives, this application provides a blockchain data synchronization method applied to a target blockchain node, the blockchain data synchronization method comprising:

[0006] If a data synchronization task is detected in a data synchronization state, the interest packet to be synchronized corresponding to the data synchronization task is determined, wherein the data synchronization task is triggered by a data synchronization event or a data synchronization cycle.

[0007] The data to be synchronized carried by the interest packet to be synchronized is synchronized to obtain the target synchronized data;

[0008] Send a target synchronization interest packet corresponding to the target synchronization data to the neighboring blockchain nodes of the target blockchain node to synchronize the blockchain data between the target blockchain node and the neighboring blockchain nodes.

[0009] Optionally, the data synchronization task includes a first data synchronization task and a second data synchronization task, and the step of determining the interest package to be synchronized corresponding to the data synchronization task includes:

[0010] If the data synchronization task is the first data synchronization task, then the corresponding data to be synchronized is obtained from the blockchain data pool; based on the data to be synchronized, the interest package to be synchronized is generated; or,

[0011] If the data synchronization task is the second data synchronization task, then the interest packet to be synchronized sent by the blockchain synchronization node is received.

[0012] Optionally, the data to be synchronized includes block data to be synchronized and transaction data to be synchronized, and the step of generating the interest package to be synchronized based on the data to be synchronized includes:

[0013] The transaction data to be synchronized is encapsulated into the interest package to be synchronized; or...

[0014] Obtain the block information of the block data to be synchronized; generate the interest packet to be synchronized based on the block information.

[0015] Optionally, the step of synchronizing the data to be synchronized carried by the interest packet to obtain the target synchronization data includes:

[0016] Extract the node information of the target blockchain node from the interest packet to be synchronized;

[0017] If the node information update is detected to be successful, the data to be synchronized will be used as the target synchronization data.

[0018] Optionally, the step of synchronizing the data to be synchronized carried by the interest packet to obtain the target synchronization data includes:

[0019] Obtain the reception state vector carried by the interest packet to be synchronized;

[0020] Based on the correspondence between the received state vector and the local state vector of the target blockchain node, determine whether to update the data to be synchronized;

[0021] If so, the data to be synchronized is updated according to the receive sequence number of the receive state vector to obtain the target synchronization data;

[0022] If not, then the data to be synchronized will be used as the target synchronization data.

[0023] Optionally, the step of updating the data to be synchronized based on the received sequence number of the received state vector to obtain the target synchronization data includes:

[0024] Detect whether the received sequence number exists in the local state vector;

[0025] If so, then based on the size relationship between the received sequence number and the local sequence number of the local state vector, the data to be synchronized is updated to obtain the target synchronization data;

[0026] If not, the received sequence number is added to the local state vector, and the data to be synchronized is replaced with the pulled blockchain data in the blockchain data pool to obtain the target synchronization data.

[0027] Optionally, the step of updating the data to be synchronized based on the relationship between the received sequence number and the local sequence number of the local state vector to obtain the target synchronization data includes:

[0028] If the received sequence number is greater than the local sequence number, then the following steps are performed: replace the data to be synchronized with the pulled blockchain data in the blockchain data pool to obtain the target synchronization data;

[0029] If the received sequence number is less than the local sequence number, the data to be synchronized is updated based on the interest packet reception status within a preset time period to obtain the target synchronization data.

[0030] To achieve the above objectives, this application also provides a blockchain data synchronization device, applied to a target blockchain node, the blockchain data synchronization device comprising:

[0031] The determination module is used to determine the interest packet to be synchronized corresponding to the data synchronization task if a data synchronization task in a data synchronization state is detected, wherein the data synchronization task is triggered by a data synchronization event or a data synchronization cycle.

[0032] The synchronization module is used to synchronize the data to be synchronized carried by the interest packet to obtain the target synchronized data;

[0033] The sending module is used to send the target synchronization interest packet corresponding to the target synchronization data to the neighboring blockchain nodes of the target blockchain node, so as to synchronize the blockchain data between the target blockchain node and the neighboring blockchain nodes.

[0034] Optionally, the data synchronization task includes a first data synchronization task and a second data synchronization task, and the determining module is further configured to:

[0035] If the data synchronization task is the first data synchronization task, then the corresponding data to be synchronized is obtained from the blockchain data pool; based on the data to be synchronized, the interest package to be synchronized is generated; or,

[0036] If the data synchronization task is the second data synchronization task, then the interest packet to be synchronized sent by the blockchain synchronization node is received.

[0037] Optionally, the data to be synchronized includes block data to be synchronized and transaction data to be synchronized, and the determining module is further configured to:

[0038] The transaction data to be synchronized is encapsulated into the interest package to be synchronized; or...

[0039] Obtain the block information of the block data to be synchronized; generate the interest packet to be synchronized based on the block information.

[0040] Optionally, the synchronization module is further configured to:

[0041] Extract the node information of the target blockchain node from the interest packet to be synchronized;

[0042] If the node information update is detected to be successful, the data to be synchronized will be used as the target synchronization data.

[0043] Optionally, the synchronization module is further configured to:

[0044] Obtain the reception state vector carried by the interest packet to be synchronized;

[0045] Based on the correspondence between the received state vector and the local state vector of the target blockchain node, determine whether to update the data to be synchronized;

[0046] If so, the data to be synchronized is updated according to the receive sequence number of the receive state vector to obtain the target synchronization data;

[0047] If not, then the data to be synchronized will be used as the target synchronization data.

[0048] Optionally, the synchronization module is further configured to:

[0049] Detect whether the received sequence number exists in the local state vector;

[0050] If so, then based on the size relationship between the received sequence number and the local sequence number of the local state vector, the data to be synchronized is updated to obtain the target synchronization data;

[0051] If not, the received sequence number is added to the local state vector, and the data to be synchronized is replaced with the pulled blockchain data in the blockchain data pool to obtain the target synchronization data.

[0052] Optionally, the synchronization module is further configured to:

[0053] If the received sequence number is greater than the local sequence number, then the following steps are performed: replace the data to be synchronized with the pulled blockchain data in the blockchain data pool to obtain the target synchronization data;

[0054] If the received sequence number is less than the local sequence number, the data to be synchronized is updated based on the interest packet reception status within a preset time period to obtain the target synchronization data.

[0055] This application also provides an electronic device, the electronic device comprising: a memory, a processor, and a program of the blockchain data synchronization method stored in the memory and executable on the processor, wherein when the program of the blockchain data synchronization method is executed by the processor, it can implement the steps of the blockchain data synchronization method as described above.

[0056] This application also provides a computer-readable storage medium storing a program for implementing a blockchain data synchronization method, wherein when the program for the blockchain data synchronization method is executed by a processor, it implements the steps of the blockchain data synchronization method as described above.

[0057] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the blockchain data synchronization method described above.

[0058] This application provides a blockchain data synchronization method, apparatus, electronic device, and readable storage medium, applied to a target blockchain node. Specifically, if a data synchronization task is detected in a data synchronization state, a packet of interest (interest) corresponding to the data synchronization task is determined. The data synchronization task is triggered by a data synchronization event or a data synchronization cycle. The data to be synchronized carried in the packet of interest is synchronized to obtain target synchronized data. The target synchronized interest packet corresponding to the target synchronized data is sent to adjacent blockchain nodes of the target blockchain node to synchronize the blockchain data between the target blockchain node and the adjacent blockchain nodes. Since the target blockchain node determines the packet of interest to be synchronized after detecting a data synchronization event or a data synchronization task triggered by a data synchronization cycle, and then obtains the target synchronized interest packet by synchronizing the blockchain data in the packet of interest, and finally sends the target synchronized interest packet to the adjacent blockchain nodes, the purpose of blockchain data synchronization between the target blockchain node and its adjacent blockchain nodes can be achieved. Furthermore, when each node on the blockchain can achieve blockchain data synchronization with its adjacent nodes, data communication between different nodes on the blockchain can be achieved in the form of interest packets without increasing the data transmission structure. Instead of relying solely on broadcasting or setting a data polling cycle to synchronize blockchain data in an NDN-based blockchain data transmission system, this approach overcomes the technical limitations of uncontrollable synchronization time due to the restricted data polling cycle and poor compatibility between the NDN data distribution mechanism and the blockchain's data communication mechanism. Therefore, it improves the synchronization efficiency of blockchain data based on the NDN network architecture. Attached Figure Description

[0059] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0060] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0061] Figure 1 A schematic diagram of multi-link communication for the blockchain data synchronization method provided in Embodiment 1 of this application;

[0062] Figure 2 A schematic diagram of the synchronization network architecture provided in Embodiment 1 of this application;

[0063] Figure 3A schematic diagram illustrating the process of creating, querying, importing, or exporting accounts for the blockchain data synchronization method provided in Embodiment 1 of this application;

[0064] Figure 4 A schematic diagram illustrating the client deployment and contract acquisition process of the blockchain data synchronization method provided in Embodiment 1 of this application;

[0065] Figure 5 A schematic flowchart of the blockchain data synchronization method provided in Embodiment 2 of this application;

[0066] Figure 6 This is a schematic diagram of the structure of the blockchain data synchronization device provided in Embodiment 3 of this application;

[0067] Figure 7 This is a schematic diagram of the structure of the electronic device provided in Embodiment 4 of this application.

[0068] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0069] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0070] In the first embodiment of this application, it should first be understood that, with the increasing maturity of the NDN network architecture, deploying blockchain on NDN networks has become a common practice in the industry. This allows NDN networks to effectively alleviate network load and improve blockchain data transmission efficiency by leveraging their support for content distribution, multicast, and network caching. However, NDN's efficient data distribution mechanism and blockchain's data communication mechanism are incompatible. NDN uses a pull-based data distribution method, while blockchain uses a push-based communication method. For example, when a blockchain node needs to broadcast blockchain data in real time, other blockchain nodes cannot predict the generation time of the aforementioned blockchain data or know when to initiate a request for interest packets to request the corresponding block. Currently, blockchain data synchronization is typically achieved by setting a data polling period or adding a data transmission structure for broadcasting within the NDN network. For example, the patent "Blockchain Synchronization Method and Device Based on NDN" relies on setting a polling period. However, setting a short polling period wastes network resources, while setting an excessively long polling period can lead to untimely blockchain data synchronization or even severe blockchain forks. Another example is the patent "A Blockchain Data Transmission Method Based on NDN," which achieves reliable data transmission by establishing a data transmission structure between one or more blockchain nodes. However, due to the complexity of the data transmission structure, the workload of establishing and maintaining it between blockchain nodes is large. Furthermore, this method has already modified the NDN network daemon forwarding daemon (NDF), making the implementation logic very complex. Therefore, there is an urgent need for a method to improve the synchronization effect of blockchain data based on multiple NDN network architectures.

[0071] This application provides a blockchain data synchronization method applied to a target blockchain node. In the first embodiment of the blockchain data synchronization method of this application, refer to... Figure 2 The blockchain data synchronization method includes:

[0072] Step S10: If a data synchronization task is detected in the data synchronization state, then determine the interest packet to be synchronized corresponding to the data synchronization task, wherein the data synchronization task is triggered by a data synchronization event or a data synchronization cycle.

[0073] Step S20: Synchronize the data to be synchronized carried by the interest packet to be synchronized to obtain the target synchronization data;

[0074] Step S30: Send the target synchronization interest packet corresponding to the target synchronization data to the neighboring blockchain nodes of the target blockchain node to synchronize the blockchain data between the target blockchain node and the neighboring blockchain nodes.

[0075] In this embodiment, it should be noted that the target blockchain node is used to represent any blockchain node executing the blockchain data synchronization method, specifically a mobile phone or a server. The blockchain is specifically a consortium blockchain. For any blockchain node, it is one of the participating nodes of the blockchain data synchronization group. The data synchronization task is used to represent the synchronization task of blockchain data on the blockchain, specifically triggered by a data synchronization event or a data synchronization cycle. The data synchronization event is used to represent the event that triggers the data synchronization task. Specifically, it can be that a participating node of the synchronization group has a new blockchain data state set change or has received a synchronization interest packet with an outdated dataset state and needs to send a synchronization interest packet to notify other participating nodes. The data synchronization cycle is that the participating nodes of the synchronization group need to periodically send synchronization interest packets to ensure blockchain data synchronization among the participating nodes of the synchronization group. The blockchain data state set can be fed back through the node state of the blockchain node.

[0076] Additionally, it should be noted that each participating node in the synchronization group has a synchronization network architecture deployed, including application layer, consensus layer, and communication layer, as shown in the reference. Figure 2 , Figure 2To illustrate the synchronous network architecture, the application layer's main functions include web services, account management, database management, contract management, and block pool management. Account management includes creating and querying transaction accounts. Database management persists user states and blockchain data, primarily involving a user state database and a transaction information database. The user state database stores contract content and corresponding user state data, while the transaction information database stores blockchain blocks and their transaction information. Contract management includes contract deployment, contract reading, and contract execution. In this synchronous network architecture's blockchain data synchronization system, contracts are a special type of transaction, called contract-type transactions. Other transactions are called ordinary transactions. Block pool management includes blockchain data, the blockchain data pool, and block threads. Blockchain data specifically includes transactions and blocks. The blockchain data pool specifically includes a block pool and a transaction pool. The block pool stores different blocks, and the transaction pool stores different transactions. Transactions include transaction structure definition, transaction hash, transaction signature creation and verification, and transaction serialization. Blocks include block structure definition. The system includes block hashing, block signature creation and verification, block serialization generation, and Merkle tree generation. The transaction pool can perform operations such as "adding transactions to the transaction pool" and "retrieving transactions from the transaction pool". The block pool can perform operations such as "adding blocks", "removing blocks", and "retrieving blocks". The block pool needs to maintain a list of blocks in the pending state and a list of blocks in the confirmed state. The main operations of the block thread are "packaging transactions into blocks in the pending state and putting them into the block pool" and "retrieving blocks in the confirmed state from the block pool, executing the blocks and adding them to the blockchain".

[0077] Additionally, it should be noted that the consensus layer is responsible for controlling the consensus process, mainly involving the leader election, block creation, verification, and on-chaining in the blockchain system. Specifically, the consensus control can be achieved through blockchain consensus algorithms, including Proof-of-Work, Proof-of-Stake, Delegated Proof-of-Stake, and Practical Byzantine Fault Tolerance (PBT). Different blockchain consensus algorithms can be selected based on the specific business scenario when facing different practical application requirements. Considering the need for compatibility with multiple consensus algorithms in practical scenarios, this application embodiment extracts and separates the consensus algorithm into a separate network layer structure at the beginning of the architecture design. This layer is connected to the application layer and communication layer and is responsible for the control and transmission of blockchain data. Based on the blockchain data synchronization task, it enables switching between different consensus algorithms to reduce coupling and improve the scalability and maintainability of the blockchain synchronization system.

[0078] Additionally, it should be noted that the communication layer is used to synchronize blockchain data between various nodes in the blockchain. The architecture layers of the synchronization network interact with each other through the communication layer, which relies on the NDN network's SVS (State Vector Synchronization) protocol for nodes to broadcast or receive blockchain data. In the SVS protocol, participating nodes must use a common group name prefix, allowing access to all participants in the synchronization group. Each participating node uses a unique publishing prefix to identify its data items. The SVS protocol uses a synchronization interest message (synchronization interest packet) for data synchronization. Synchronization group members send synchronization interest packets to participating nodes triggered by data synchronization events or data synchronization cycles. The former is used to transmit the latest dataset state with minimal network latency, while the latter ensures consistency of the dataset state within the synchronization group even in the event of packet loss or momentary network outage. This embodiment of the application, by using the SVS protocol as the underlying communication protocol of the blockchain system, responsible for blockchain system transaction and block data synchronization, can solve the incompatibility problem between the NDN data distribution mechanism and the blockchain data communication mechanism, thus enabling efficient and stable transmission of blockchain data.

[0079] Additionally, it should be noted that in the application layer, referencing Figure 3 , Figure 3 To illustrate the process of creating, querying, importing, or exporting accounts on a client side, the specific steps for creating an account are as follows: The user initiates a request to the web service to create an account through the client's browser; the web service calls the account management module to create the account; the account management module returns the account information to the web service; and the web service returns the account information to the client. The specific steps for querying an account on a client side are as follows: The user initiates a request to the web service to retrieve the account through the client's browser; the web service calls the account management module to retrieve the account information; the account management module returns the account information to the web service; and the web service returns the account information to the client. The specific steps for importing or exporting an account on a client side are as follows: The user initiates a request to the web service to import or export an account through the client's browser; the web service calls the account management module to import or export the account; the account management module returns the execution result or account information to the web service; and the web service returns the execution result or account information to the client.

[0080] Additionally, it should be noted that in the blockchain synchronization system, the source address of a contract-type transaction is the contract address, and the transaction content is the contract content. Ordinary transactions, in addition to the source and destination addresses, also carry the contract address. When a transaction is packaged, uploaded to the blockchain, and executed, the block thread accesses the user state database based on the contract address to retrieve the contract content, then executes the contract content. The generated user state data is also saved to the user state database after execution. (Refer to...) Figure 4 , Figure 4 To illustrate the client-side contract deployment and retrieval process, the specific steps for client-side contract deployment are as follows: The user initiates a contract deployment request to the web service through the client's browser; the contract is encapsulated as a contract-type transaction; the web service requests that the contract-type transaction be added to the transaction pool; the transaction pool sets the transaction status to pending and returns the execution result; the web service notifies the client of the contract deployment result. The specific steps for client-side contract retrieval are as follows: The user initiates a contract retrieval request to the web service through the client's browser; the web service accesses the user's state database to retrieve the contract content; the contract content is found in the user's state database and returned to the web service; the web service returns the contract content to the client.

[0081] Additionally, it's important to note that in application-layer block pool management, the block thread is the core of the entire management process and can be implemented using a defined finite state machine. Without receiving a request to initiate block encapsulation, the block thread periodically queries whether block encapsulation needs to be started. When a client initiates a request to start block encapsulation via the Web API, the Web API service calls the block thread's block encapsulation program to perform the encapsulation. After successful encapsulation, a certain amount of time must be waited before the next encapsulation attempt. If there are no transactions waiting to be processed in the current transaction pool, the thread rests for a period before resuming block encapsulation. This process repeats until a client requests termination of block encapsulation, at which point it enters a terminated state. The specific steps for a client to start or stop the block thread are as follows: the user initiates a request to start or stop the block thread through their client browser to the Web service; the Web service calls the block thread's start or stop method; the block thread returns the execution result to the Web service; and the Web service returns the execution result to the client. In the block encapsulation process of the block thread in this embodiment, the consensus module determines whether the current participant node has block encapsulation authority. If it has block encapsulation authority, it is set to the block encapsulation state; otherwise, it is set to the synchronization state. If a participant node on the blockchain is in the block encapsulation state, the specific steps of its block encapsulation process are as follows: the block thread obtains the transactions to be processed from the transaction pool and packages them into blocks; the block thread sets the block status to the pending state and puts it into the block pool; the consensus module requests the blocks in the pending state from the block pool; the block pool returns the blocks in the pending state to the consensus module; the consensus module sets the blocks in the pending state to the confirmed state and puts them into the block pool. If the participating nodes on the blockchain are in a synchronized state, the specific steps of the block encapsulation process are as follows: The consensus module will put the blocks in the pending state obtained from neighboring nodes into the block pool; the consensus module will receive a message, set the specified pending state blocks to the confirmed state, and put them into the block pool; the block thread will obtain the confirmed state blocks from the block pool; the transactions in the block will be executed, and if it is a contract type transaction, the contract content will be saved in the user state database; the transactions in the block will be executed, and if it is a normal type transaction, the contract content will be executed and the latest state will be saved in the user state database; the confirmed state blocks will be saved to the transaction information database.

[0082] Additionally, it should be noted that the consensus layer in this embodiment focuses on controlling and transmitting blockchain data with the application layer and communication layer. When a user initiates a block encapsulation request through the Web service of the application layer of the target blockchain node, the Web service will call the block thread startup program to encapsulate the block. At this time, the node state of the target blockchain node is set to the synchronization state. The consensus layer will periodically determine whether the target blockchain node can encapsulate the block. If it can, it will migrate to the block encapsulation state; otherwise, it will migrate to the synchronization state. In the block encapsulation state, the consensus layer is responsible for receiving transactions sent by the neighboring blockchain nodes of the target blockchain node through the communication interface of the communication layer and adding transactions to the transaction pool, or requesting to obtain blocks in the pending state from the block pool, broadcasting blocks in the pending state to the neighboring blockchain nodes of the target blockchain node, receiving response messages broadcast by the neighboring blockchain nodes of the target blockchain node, and when the number of received responses exceeds half of the total number of neighboring nodes, the consensus layer notifies the block pool to set the state of the block to the confirmed state, and uses the communication layer to broadcast a block state adjustment message (from pending state to confirmed state) to the neighboring nodes of the target blockchain node.

[0083] Additionally, it should be noted that when the target blockchain node is in a data synchronization state, the target blockchain node executes the blockchain data synchronization method. Taking transaction data as an example, the consensus layer sends a request to the transaction pool to retrieve pending transactions. After the pending transactions are returned to the consensus layer, the consensus layer broadcasts the pending transactions to other nodes of the target blockchain node through the communication layer. Taking block data as an example, the consensus layer receives broadcast messages of pending blocks from neighboring nodes through the communication layer; the consensus layer adds the pending blocks to the block pool; if the addition fails, it waits for the next loop; if the addition is successful, the block pool returns a success message to the consensus layer; the consensus layer broadcasts the acceptance confirmation message of the pending blocks to other nodes through the communication layer; the consensus layer receives broadcast messages of a state change (i.e., from pending to confirmed) for the pending blocks through the communication layer; the consensus layer requests the block pool to set the pending blocks to the confirmed state.

[0084] Additionally, it should be noted that the "interest packet to be synchronized" is used to represent the synchronization interest packets of adjacent (neighboring) blockchain nodes waiting to be synchronized and sent to the target blockchain node. When blockchain nodes transmit data through the communication layer of the data synchronization network architecture, the synchronization interest packets have the same naming format, such as / <grp-prefix> / <state-vector> / <signature>In this structure, `grp-prefix` is the group name prefix, shared by all member nodes within a synchronization group. `state-vector` is the state vector; each element of the list structure represents a key-value pair consisting of a member node's prefix and sequence number, specifically `[participant-prefix1:seq-no1,participant-prefix2:seq-no2,......]`. `signature` is the interest signature; since the name carries the state vector, an interest signature is added for authentication to prevent unauthorized tampering. The data carried in the synchronization interest packet also follows the same naming format, for example, ` / `. <publishing-prefix> / <grp-prefix> / <seq-no>In this context, `publishing-prefix` is the publisher prefix, which supports forwarding interests to data producers; `grp-prefix` is the group prefix, which allows interests to be assigned to the corresponding application on the processing host; `seq-no` is the sequence number; the target synchronization data is used to characterize the latest blockchain data on the blockchain where the target blockchain node is located; and the target interest packet is used to characterize the latest synchronization interest packet on the blockchain where the target blockchain node is located, specifically encapsulated from the target synchronization data.

[0085] As an example, steps S10 to S30 include: if a data synchronization task triggered by a data synchronization event or a data synchronization cycle is detected, then when the target blockchain node is detected to be in a data synchronization state, a packet of interest to be synchronized corresponding to the data synchronization task is determined, wherein the packet of interest to be synchronized may be generated by the target blockchain node or broadcast to the target blockchain node by its neighboring blockchain nodes; the data to be synchronized carried by the packet of interest to be synchronized is synchronized to obtain target synchronization data; based on the target synchronization data, a target synchronization packet of interest is encapsulated, and the target synchronization packet of interest is sent to the neighboring blockchain nodes of the target blockchain node to synchronize the blockchain data between the target blockchain node and the neighboring blockchain nodes.

[0086] The data synchronization task includes a first data synchronization task and a second data synchronization task, and the step of determining the interest package to be synchronized corresponding to the data synchronization task includes:

[0087] Step A10: If the data synchronization task is the first data synchronization task, then obtain the corresponding data to be synchronized from the blockchain data pool; generate the interest package to be synchronized based on the data to be synchronized; or,

[0088] Step A20: If the data synchronization task is the second data synchronization task, then receive the interest packet to be synchronized sent by the blockchain synchronization node.

[0089] In this embodiment, it should be noted that the first data synchronization task and the second data synchronization task are different data synchronization tasks triggered by data synchronization events. Specifically, the first data synchronization task is a data synchronization task triggered by a new state set change of the target blockchain node, such as when the target blockchain node needs to publish transaction data or block data. The second data synchronization task is a data synchronization task triggered by receiving a synchronization interest packet sent by a neighboring blockchain node of the target blockchain node, such as when receiving a synchronization interest packet with an outdated dataset state sent by a neighboring blockchain node and needing to send a synchronization interest packet to notify other participating nodes in the blockchain. The blockchain synchronization node is used to represent the blockchain node that triggers the data synchronization task of the target blockchain node, and can specifically be a neighboring blockchain node of the target blockchain node.

[0090] As an example, steps A10 to A20 include: if the data synchronization task is the first data synchronization task, then obtaining the corresponding block data to be synchronized from the block pool; generating the interest packet to be synchronized based on the block data to be synchronized; or

[0091] If the data synchronization task is the second data synchronization task, then the target blockchain node receives interest packets to be synchronized sent by its neighboring blockchain nodes.

[0092] As an example, steps A10 to A20 include: if the data synchronization task is the first data synchronization task, then obtaining the corresponding transaction data to be synchronized from the block pool; generating the interest package to be synchronized based on the transaction data to be synchronized; or

[0093] If the data synchronization task is the second data synchronization task, then the target blockchain node receives interest packets to be synchronized sent by its neighboring blockchain nodes.

[0094] The data to be synchronized includes blockchain data to be synchronized and transaction data to be synchronized. The step of generating the interest package to be synchronized based on the data to be synchronized includes:

[0095] Step B10: Encapsulate the transaction data to be synchronized into the interest package to be synchronized; or,

[0096] Step B20: Obtain the block information of the block data to be synchronized; generate the interest packet to be synchronized based on the block information.

[0097] In this embodiment, it should be noted that since a block is a collection of numerous transactions, the amount of data is usually large. In order to ensure the efficiency of data synchronization and transmission and reduce the resource consumption of the data synchronization system when synchronizing blockchain data, different encapsulation methods are adopted for different types of blockchain data to encapsulate them into synchronization interest packets.

[0098] As an example, steps B10 to B20 include: retrieving the transaction data to be synchronized from the transaction pool, and encapsulating the transaction data to be synchronized into the interest package to be synchronized; or,

[0099] Extract the block data to be synchronized from the block pool, and extract the block information of the block data to be synchronized, wherein the block information may specifically be a block number; encapsulate the block information into the interest packet to be synchronized.

[0100] The step of synchronizing the data to be synchronized carried by the interest packet to obtain the target synchronization data includes:

[0101] Step C10: Extract the node information of the target blockchain node from the interest packet to be synchronized;

[0102] Step C20: If the node information update is detected to be successful, then the data to be synchronized is used as the target synchronization data.

[0103] In this embodiment, it should be noted that the data to be synchronized carried by the interest packet to be synchronized is extracted from the transaction pool or block pool by the consensus layer of the synchronization network architecture, and the node information is used to characterize the blockchain data synchronization status of the target blockchain node, specifically the node sequence number of the target blockchain node.

[0104] As an example, steps C10 to C20 include: extracting the node sequence number of the target blockchain node from the interest packet to be synchronized; updating the node sequence number according to a preset update method, and detecting whether the node sequence number has been successfully updated. If the node sequence number is successfully updated, the data to be synchronized is used as the target synchronization data. The preset update method can be an update method that adds a fixed identifier to the node sequence number. For example, assuming the node sequence number of the target blockchain node is "seqno", the sequence number obtained after updating the node sequence number is "seqno+1".

[0105] The step of synchronizing the data to be synchronized carried by the interest packet to obtain the target synchronization data includes:

[0106] Step D10: Obtain the reception state vector carried by the interest packet to be synchronized;

[0107] Step D20: Based on the correspondence between the received state vector and the local state vector of the target blockchain node, determine whether to update the data to be synchronized;

[0108] Step D30: If yes, then update the data to be synchronized according to the receive sequence number of the receive state vector to obtain the target synchronization data;

[0109] Step D40: If not, then the data to be synchronized is taken as the target synchronization data.

[0110] In this embodiment, it should be noted that if the interest packet to be synchronized is sent by a neighboring blockchain node of the target blockchain node, when synchronizing the data to be synchronized in the interest packet, the specific blockchain data synchronization method can be determined by comparing the local state vector and the receiving state vector carried in the interest packet. The local state vector can be read from the state vector table of the target blockchain node. For any node on the blockchain, a state vector table is set up. The state vector table is used to store the state vectors of the participating nodes of the synchronization group. After the data to be synchronized is updated, the synchronization interest timer needs to be reset.

[0111] As an example, steps D10 to D40 include: obtaining the receive state vector carried by the interest packet to be synchronized; if the dataset state between the receive state vector and the local state vector is the same, then it is determined not to update the data to be synchronized; if the dataset state between the receive state vector and the local state vector is different, then the data to be synchronized is updated; if the data to be synchronized is to be updated, then the data to be synchronized is updated according to the receive sequence number of the receive state vector to obtain the target synchronization data; if it is determined not to update the data to be synchronized, then the data to be synchronized is used as the target synchronization data. When the received state vector and the local state vector are the same, it indicates that the data to be synchronized carried in the synchronization interest packet received by the target blockchain node is the latest blockchain data. In this case, the data to be synchronized is directly used as the target synchronization data. When the received state vector and the local state vector are different, it indicates that the data to be synchronized carried in the synchronization interest packet received by the blockchain node is not the latest blockchain data. Then, the blockchain data is updated through the communication layer of the synchronization network architecture to obtain the target synchronization data. That is, it is always ensured that the blockchain data carried in the target synchronization interest packet is the latest blockchain data on the current blockchain. Therefore, it lays the foundation for improving the synchronization effect of blockchain data based on the NDN network architecture.

[0112] As an example, the specific steps of updating the data to be synchronized according to the sequence number of the received state vector to obtain the target synchronized data can be as follows: encapsulate the request interest packet according to the sequence number of the received state vector, send the request interest packet to the application layer through the consensus layer of the synchronization network architecture to pull the latest blockchain data of the current blockchain, and replace the data to be synchronized in the interest packet with the latest blockchain data to obtain the target interest packet.

[0113] This application provides a blockchain data synchronization method applied to a target blockchain node. Specifically, if a data synchronization task is detected in a data synchronization state, a target interest packet (ROP) corresponding to the data synchronization task is determined. The data synchronization task is triggered by a data synchronization event or a data synchronization cycle. The data to be synchronized carried in the ROP is synchronized to obtain target synchronized data. The target synchronized ROP corresponding to the target synchronized data is sent to adjacent blockchain nodes of the target blockchain node to synchronize the blockchain data between the target blockchain node and the adjacent blockchain nodes. Since the target blockchain node determines the ROP to be synchronized after detecting a data synchronization event or a data synchronization task triggered by a data synchronization cycle, and then obtains the target synchronized ROP by synchronizing the blockchain data in the ROP, and finally sends the target synchronized ROP to the adjacent blockchain nodes, the purpose of blockchain data synchronization between the target blockchain node and its adjacent blockchain nodes can be achieved. Furthermore, when each node on the blockchain can achieve blockchain data synchronization with its adjacent nodes, data communication between different nodes on the blockchain can be provided in the form of ROPs without increasing the data transmission structure. Instead of relying solely on broadcasting or setting a data polling cycle to synchronize blockchain data in an NDN-based blockchain data transmission system, this approach overcomes the technical limitations of uncontrollable synchronization time due to the restricted data polling cycle and poor compatibility between the NDN data distribution mechanism and the blockchain's data communication mechanism. Therefore, it improves the synchronization efficiency of blockchain data based on the NDN network architecture.

[0114] Furthermore, referring to Figure 5 In Embodiment 2 of this application, the content that is the same as or similar to that in Embodiment 1 above can be referred to the above description and will not be repeated hereafter. Based on this, the step of updating the data to be synchronized according to the received sequence number of the received state vector to obtain the target synchronization data includes:

[0115] Step E10: Detect whether the received sequence number exists in the local state vector;

[0116] Step E20: If yes, then update the data to be synchronized according to the size relationship between the received sequence number and the local sequence number of the local state vector to obtain the target synchronization data;

[0117] Step E30: If not, add the received sequence number to the local state vector and replace the data to be synchronized with the pulled blockchain data in the blockchain data pool to obtain the target synchronization data.

[0118] In this embodiment, it should be noted that since the blockchain synchronization node that sends the synchronization interest packet to the target blockchain node may be a newly joined participating node, or the blockchain synchronization node and the target blockchain node may not be interacting with each other based on the synchronization network architecture, it is necessary to further compare the correspondence between the local state vector and the received state vector in order to enable different types of blockchain synchronization nodes and the target blockchain node to perform blockchain data synchronization interaction under the synchronization network architecture.

[0119] As an example, steps E10 to E30 include: detecting whether the received sequence number exists in the local state vector; if the received sequence number is detected in the local state vector, updating the data to be synchronized according to the size relationship between the received sequence number and the local sequence number of the local state vector to obtain the target synchronization data; if the received sequence number is detected not in the local state vector, adding the received sequence number to the local state vector, and pulling blockchain data from the blockchain data pool by requesting interest packets, and replacing the data to be synchronized with the pulled blockchain data to obtain the target synchronization data.

[0120] In one feasible approach, when the periodic synchronization interest timer expires, the target blockchain node triggers the sending of a synchronization interest packet and resets the periodic synchronization timer.

[0121] The step of updating the data to be synchronized based on the relationship between the received sequence number and the local sequence number of the local state vector to obtain the target synchronization data includes:

[0122] Step F10: If the received sequence number is greater than the local sequence number, then perform the following step: replace the data to be synchronized with the pulled blockchain data in the blockchain data pool to obtain the target synchronization data;

[0123] Step F20: If the received sequence number is less than the local sequence number, then the data to be synchronized is updated based on the interest packet reception status within a preset time period to obtain the target synchronization data.

[0124] As an example, steps F10 to F20 include: if the received sequence number of one or more synchronization group members in the received state vector is greater than the local sequence number recorded locally by the target blockchain node, then the following steps are performed: pull blockchain data from the blockchain data pool by requesting interest packets, and replace the data to be synchronized with the pulled blockchain data to obtain the target synchronization data; if the received sequence number of one or more synchronization group members in the received state vector is less than the local sequence number recorded locally by the target blockchain node, then update the data to be synchronized based on the interest packet reception status within a preset time period to obtain the target synchronization data, wherein if the received sequence number is less than the local sequence number, it indicates that the synchronization interest packet currently received by the target blockchain node is an outdated message on the blockchain.

[0125] In one feasible approach, the specific steps for updating the data to be synchronized based on the reception of interest packets within a preset time period to obtain the target synchronization data can be as follows: Detect whether the target blockchain node receives a synchronization interest packet carrying the same or updated dataset status within the preset time period. If it receives one, the transmission is canceled, and the blockchain data of the latest received synchronization interest packet is used as the target blockchain data. If it does not receive one, the data to be synchronized is updated to obtain the target synchronization data, thus laying the foundation for the target blockchain node to broadcast the latest blockchain data to its neighboring nodes.

[0126] This application provides a method for updating data to be synchronized. Specifically, it detects whether the received sequence number exists in the local state vector; if so, it updates the data to be synchronized according to the relationship between the received sequence number and the local sequence number in the local state vector, obtaining the target synchronized data; if not, it adds the received sequence number to the local state vector and replaces the data to be synchronized with the retrieved blockchain data in the blockchain data pool, obtaining the target synchronized data. Compared to the method of directly generating request interest packets using the received sequence number of the received state vector and requesting the latest blockchain data from the blockchain data pool to update the data to be synchronized, this application uses the correspondence between the local state vector and the received sequence number to update the data to be synchronized using different update methods. This avoids the need to generate a large number of request interest packets to request the latest blockchain data when the data to be synchronized carried by the request interest packet is already the latest blockchain data, thus improving the targeted nature of updating the data to be synchronized.

[0127] Embodiment 3 of this application also provides a blockchain data synchronization device, applied to a target blockchain node, as described above. Figure 6 The blockchain data synchronization device includes:

[0128] The determination module 101 is used to determine the interest packet to be synchronized corresponding to the data synchronization task if a data synchronization task in a data synchronization state is detected, wherein the data synchronization task is triggered by a data synchronization event or a data synchronization cycle.

[0129] Synchronization module 102 is used to synchronize the data to be synchronized carried by the interest packet to be synchronized, so as to obtain the target synchronization data;

[0130] The sending module 103 is used to send the target synchronization interest packet corresponding to the target synchronization data to the neighboring blockchain nodes of the target blockchain node, so as to synchronize the blockchain data between the target blockchain node and the neighboring blockchain nodes.

[0131] Optionally, the data synchronization task includes a first data synchronization task and a second data synchronization task, and the determining module 101 is further configured to:

[0132] If the data synchronization task is the first data synchronization task, then the corresponding data to be synchronized is obtained from the blockchain data pool; based on the data to be synchronized, the interest package to be synchronized is generated; or,

[0133] If the data synchronization task is the second data synchronization task, then the interest packet to be synchronized sent by the blockchain synchronization node is received.

[0134] Optionally, the data to be synchronized includes block data to be synchronized and transaction data to be synchronized, and the determining module 101 is further configured to:

[0135] The transaction data to be synchronized is encapsulated into the interest package to be synchronized; or...

[0136] Obtain the block information of the block data to be synchronized; generate the interest packet to be synchronized based on the block information.

[0137] Optionally, the synchronization module 102 is further configured to:

[0138] Extract the node information of the target blockchain node from the interest packet to be synchronized;

[0139] If the node information update is detected to be successful, the data to be synchronized will be used as the target synchronization data.

[0140] Optionally, the synchronization module 102 is further configured to:

[0141] Obtain the reception state vector carried by the interest packet to be synchronized;

[0142] Based on the correspondence between the received state vector and the local state vector of the target blockchain node, determine whether to update the data to be synchronized;

[0143] If so, the data to be synchronized is updated according to the receive sequence number of the receive state vector to obtain the target synchronization data;

[0144] If not, then the data to be synchronized will be used as the target synchronization data.

[0145] Optionally, the synchronization module 102 is further configured to:

[0146] Detect whether the received sequence number exists in the local state vector;

[0147] If so, then based on the size relationship between the received sequence number and the local sequence number of the local state vector, the data to be synchronized is updated to obtain the target synchronization data;

[0148] If not, the received sequence number is added to the local state vector, and the data to be synchronized is replaced with the pulled blockchain data in the blockchain data pool to obtain the target synchronization data.

[0149] Optionally, the synchronization module 102 is further configured to:

[0150] If the received sequence number is greater than the local sequence number, then the following steps are performed: replace the data to be synchronized with the pulled blockchain data in the blockchain data pool to obtain the target synchronization data;

[0151] If the received sequence number is less than the local sequence number, the data to be synchronized is updated based on the interest packet reception status within a preset time period to obtain the target synchronization data.

[0152] The blockchain data synchronization device provided by this invention, employing the blockchain data synchronization method in the above embodiments, solves the technical problem of poor synchronization effect of blockchain data based on NDN network architecture. Compared with the prior art, the beneficial effects of the blockchain data synchronization device provided by this invention are the same as those of the blockchain data synchronization method provided in the above embodiments, and other technical features in this blockchain data synchronization device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.

[0153] Embodiment 4 of the present invention provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the blockchain data synchronization method in Embodiment 1 above.

[0154] The following is for reference. Figure 7 The diagram illustrates a structural schematic of an electronic device suitable for implementing embodiments of the present disclosure. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 7 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0155] like Figure 7 As shown, the electronic device may include a processing unit 1001 (e.g., a central processing unit, a graphics processor, etc.) that can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the electronic device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus.

[0156] Typically, the following systems can be connected to I / O interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. The communication devices allow electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although electronic devices with various systems are shown in the figures, it should be understood that it is not required to implement or possess all the systems shown. More or fewer systems may be implemented alternatively.

[0157] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 1009, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of embodiments of this disclosure.

[0158] The electronic device provided by this invention employs the blockchain data synchronization method described in the above embodiments, solving the technical problem of poor synchronization performance of blockchain data based on the NDN network architecture. Compared with the prior art, the beneficial effects of the electronic device provided by this invention are the same as those of the blockchain data synchronization method provided in the above embodiments, and other technical features of this electronic device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.

[0159] It should be understood that various parts of this disclosure can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics may be combined in any suitable manner in one or more embodiments or examples.

[0160] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

[0161] This fifth embodiment provides a computer-readable storage medium having computer-readable program instructions stored thereon, which are used to execute the blockchain data synchronization method in the above embodiments.

[0162] The computer-readable storage medium provided in this embodiment of the invention may be, for example, a USB flash drive, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.

[0163] The aforementioned computer-readable storage medium may be included in an electronic device or may exist independently without being assembled into an electronic device.

[0164] The aforementioned computer-readable storage medium carries one or more programs that, when executed by an electronic device, cause the electronic device to: if a data synchronization task is detected in a data synchronization state, determine the interest packet to be synchronized corresponding to the data synchronization task, wherein the data synchronization task is triggered by a data synchronization event or a data synchronization cycle; synchronize the data to be synchronized carried by the interest packet to obtain target synchronization data; and send the target synchronization interest packet corresponding to the target synchronization data to neighboring blockchain nodes of the target blockchain node to synchronize the blockchain data between the target blockchain node and the neighboring blockchain nodes.

[0165] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0166] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0167] The modules described in the embodiments of this disclosure can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0168] The computer-readable storage medium provided by this invention stores computer-readable program instructions for executing the above-described blockchain data synchronization method, thus solving the technical problem of poor synchronization performance of blockchain data based on NDN network architecture. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this invention are the same as those of the blockchain data synchronization method provided in the above-described embodiments, and will not be repeated here.

[0169] Embodiment Six of this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the blockchain data synchronization method described above.

[0170] The computer program product provided in this application solves the technical problem of poor synchronization effect of blockchain data based on NDN network architecture. Compared with the prior art, the beneficial effects of the computer program product provided in the embodiments of this invention are the same as the beneficial effects of the blockchain data synchronization method provided in the above embodiments, and will not be repeated here.

[0171] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent scope of this application. < / grp-prefix> < / publishing-prefix> < / signature> < / state-vector> < / grp-prefix>

Claims

1. A blockchain data synchronization method, characterized in that, Applied to the target blockchain node, the blockchain data synchronization method includes: If a data synchronization task is detected in a data synchronization state, the interest packet to be synchronized corresponding to the data synchronization task is determined, wherein the data synchronization task is triggered by a data synchronization event or a data synchronization cycle. The data to be synchronized carried by the interest packet to be synchronized is synchronized to obtain the target synchronized data; The step of synchronizing the data to be synchronized carried by the interest packet to obtain the target synchronization data includes: Obtain the reception state vector carried by the interest packet to be synchronized; Based on the correspondence between the received state vector and the local state vector of the target blockchain node, it is determined whether to update the data to be synchronized, wherein the communication layer of the target blockchain node depends on the SVS protocol of the NDN network. If so, the data to be synchronized is updated according to the receiving sequence number of the receiving state vector to obtain the target synchronization data; If not, then the data to be synchronized will be used as the target synchronization data; Send a target synchronization interest packet corresponding to the target synchronization data to the neighboring blockchain nodes of the target blockchain node to synchronize the blockchain data between the target blockchain node and the neighboring blockchain nodes.

2. The blockchain data synchronization method as described in claim 1, characterized in that, The data synchronization task includes a first data synchronization task and a second data synchronization task. The step of determining the interest package to be synchronized corresponding to the data synchronization task includes: If the data synchronization task is the first data synchronization task, then the corresponding data to be synchronized is obtained from the blockchain data pool; based on the data to be synchronized, the interest package to be synchronized is generated; or, If the data synchronization task is the second data synchronization task, then the interest packet to be synchronized sent by the blockchain synchronization node is received.

3. The blockchain data synchronization method as described in claim 2, characterized in that, The data to be synchronized includes block data and transaction data to be synchronized. The step of generating the interest package to be synchronized based on the data to be synchronized includes: The transaction data to be synchronized is encapsulated into the interest package to be synchronized; or... Obtain the block information of the block data to be synchronized; generate the interest packet to be synchronized based on the block information.

4. The blockchain data synchronization method as described in claim 1, characterized in that, The step of synchronizing the data to be synchronized carried by the interest packet to obtain the target synchronization data includes: Extract the node information of the target blockchain node from the interest packet to be synchronized; If the node information update is detected to be successful, the data to be synchronized will be used as the target synchronization data.

5. The blockchain data synchronization method as described in claim 1, characterized in that, The step of updating the data to be synchronized based on the received sequence number of the received state vector to obtain the target synchronization data includes: Detect whether the received sequence number exists in the local state vector; If so, the data to be synchronized is updated according to the size relationship between the received sequence number and the local sequence number of the local state vector to obtain the target synchronization data; If not, the received sequence number is added to the local state vector, and the data to be synchronized is replaced with the pulled blockchain data in the blockchain data pool to obtain the target synchronization data.

6. The blockchain data synchronization method as described in claim 5, characterized in that, The step of updating the data to be synchronized based on the relationship between the received sequence number and the local sequence number of the local state vector to obtain the target synchronization data includes: If the received sequence number is greater than the local sequence number, then the following steps are performed: replace the data to be synchronized with the pulled blockchain data in the blockchain data pool to obtain the target synchronization data; If the received sequence number is less than the local sequence number, the data to be synchronized is updated based on the interest packet reception status within a preset time period to obtain the target synchronization data.

7. A blockchain data synchronization device, characterized in that, The blockchain data synchronization device, applied to a target blockchain node, includes: The determination module is used to determine the interest packet to be synchronized corresponding to the data synchronization task if a data synchronization task in a data synchronization state is detected, wherein the data synchronization task is triggered by a data synchronization event or a data synchronization cycle. A synchronization module is used to synchronize the data to be synchronized carried by the interest packet to obtain target synchronized data. Specifically, the synchronization module is used to obtain the reception state vector carried by the interest packet to be synchronized; determine whether to update the data to be synchronized based on the correspondence between the reception state vector and the local state vector of the target blockchain node, wherein the communication layer of the target blockchain node depends on the SVS protocol of the NDN network; if yes, then update the data to be synchronized according to the reception sequence number of the reception state vector to obtain the target synchronized data; if no, then use the data to be synchronized as the target synchronized data. The sending module is used to send the target synchronization interest packet corresponding to the target synchronization data to the neighboring blockchain nodes of the target blockchain node, so as to synchronize the blockchain data between the target blockchain node and the neighboring blockchain nodes.

8. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the steps of the blockchain data synchronization method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program for implementing a blockchain data synchronization method, which is executed by a processor to implement the steps of the blockchain data synchronization method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • NDN network communication method supporting block chain service

    CN108494812A