CN111294390A - Block data rapid synchronization method, device, equipment and storage medium - Google Patents

Block data rapid synchronization method, device, equipment and storage medium Download PDF

Info

Publication number
CN111294390A
CN111294390A CN202010054255.1A CN202010054255A CN111294390A CN 111294390 A CN111294390 A CN 111294390A CN 202010054255 A CN202010054255 A CN 202010054255A CN 111294390 A CN111294390 A CN 111294390A
Authority
CN
China
Prior art keywords
block
node
data
block chain
blockchain
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010054255.1A
Other languages
Chinese (zh)
Other versions
CN111294390B (en
Inventor
黄焕坤
王宗友
刘攀
张劲松
朱耿良
时一防
廖志勇
周开班
刘区城
杨常青
蓝虎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010054255.1A priority Critical patent/CN111294390B/en
Publication of CN111294390A publication Critical patent/CN111294390A/en
Application granted granted Critical
Publication of CN111294390B publication Critical patent/CN111294390B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1074Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
    • H04L67/1078Resource delivery mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Abstract

The embodiment of the application discloses a block data rapid synchronization method, a device, equipment and a storage medium, wherein the method comprises the following steps: the first block chain link point obtains data interaction records between the first block chain link point and each second block chain node in the block chain system, and determines the data interaction times and the data interaction success times between the first block chain link point and each second block chain node according to the data interaction records. And determining the node score of each second block chain node according to the data interaction times and the data interaction success times, and determining the target block chain node according to the plurality of node scores. Sending a first block data synchronization request to a target block chain node, receiving first to-be-synchronized block data returned by the target block chain node according to the first block data synchronization request, and updating block data in the first block chain node according to the first to-be-synchronized block data. By adopting the embodiment of the application, the time consumption for synchronizing the block data can be shortened, and the synchronization efficiency of the block data is improved.

Description

Block data rapid synchronization method, device, equipment and storage medium
Technical Field
The present application relates to the field of block chaining technologies, and in particular, to a method, an apparatus, a device, and a storage medium for fast synchronizing block data.
Background
The block chain is a chain data structure formed by combining block data in a sequential connection mode according to a time sequence, and is a distributed account book which is guaranteed in a cryptographic mode and is not falsifiable, counterfeitable, completely traceable and decentralized. With the rapid development of distributed applications based on intelligent contracts, new nodes are continuously added into a block chain system.
In the prior art, when a new node is added into a blockchain system or a node which is added into the blockchain system and has a network restoration process after network breaking, the new node or the node which has recovered after network breaking can start various service functions such as broadcasting, mining and the like after all blocks in the blockchain system are synchronized. However, as the number of blocks increases with the increase of transactions and data in the blockchain system, and a new node or a node recovered from a broken network needs to consume more time when synchronizing all blocks in the blockchain system, how to solve the problem that in the prior art, the data consumption time of all blocks in the blockchain system is long when the new node or the node recovered from the broken network synchronizes with the data becomes a problem to be solved at present.
Disclosure of Invention
The embodiment of the application provides a block data rapid synchronization method, a block data rapid synchronization device and a block data rapid synchronization storage medium, which can shorten the time consumption of a new node or a node for recovering from a broken network during block data synchronization and improve the block data synchronization efficiency.
In one aspect, an embodiment of the present application provides a method for quickly synchronizing block data, where the method includes:
the method comprises the steps that a first block chain link point obtains data interaction records between the first block chain link point and each second block chain node in a block chain system, and the data interaction times and the data interaction success times between the first block chain link point and each second block chain node are determined according to the data interaction records;
the first block link point determines a node score of each second block link node according to the data interaction times and the data interaction success times, and determines a target block link node from a plurality of second block link nodes corresponding to the plurality of node scores;
the first block link point sends a first block data synchronization request to the target block link node, receives first to-be-synchronized block data returned by the target block link point according to the first block data synchronization request, and updates block data in the first block link node according to the first to-be-synchronized block data, wherein the first block data synchronization request is used for requesting block data in a first block height interval.
On the other hand, an embodiment of the present application provides a block data fast synchronization apparatus, including:
the interaction record acquisition module is used for acquiring data interaction records between the first block chain link point and each second block chain node in the block chain system, and determining the data interaction times and the data interaction success times between the first block chain link point and each second block chain node according to the data interaction records;
the target node determining module is used for determining a node score of each second block chain node according to the data interaction times and the data interaction success times, and determining a target block chain node from a plurality of second block chain nodes corresponding to the plurality of node scores;
the block data processing module is configured to send a first block data synchronization request to the target block chain node, receive first to-be-synchronized block data returned by the target block chain node according to the first block data synchronization request, and update block data in the first block chain node according to the first to-be-synchronized block data, where the first block data synchronization request is used to request block data in a first block height interval.
In one possible implementation, the apparatus further includes a first processing module, and the first processing module includes:
a broadcasting unit, configured to broadcast a second block data synchronization request to the blockchain system, where the second block data synchronization request is used to request block data of a second block height interval;
a first processing unit, configured to receive and verify second block data to be synchronized, which is returned by each second block link point in the block chain system according to the second block data synchronization request, and if a verification result of the second block data to be synchronized, which is returned by any second block chain node, is a verification pass, it is determined that data interaction between the first block link point and any second block chain node is successful;
and a record generating unit, configured to determine, as a data interaction record between the first block link point and each second block link node in the block link system, a second to-be-synchronized block data returned by the second block link points according to the second block data synchronization request, and a verification result of the second to-be-synchronized block data returned by the first block link point for each second block link point.
In a possible implementation manner, the target node determining module is specifically configured to:
and sequencing the node scores, and determining k second block chain link points corresponding to the top k node scores which are sequenced to be the maximum as target block chain nodes, wherein k is an integer larger than 0.
In a possible implementation manner, the apparatus further includes a block chain height information obtaining module, where the block chain height information obtaining module is configured to:
receiving the height information of the block chain sent by each second block chain node in the block chain system, wherein the height information of the block chain sent by any second block chain node comprises the height of the block chain of any second block chain node;
the block data processing module comprises a transceiver unit and a block data synchronization unit, wherein the transceiver unit is used for:
acquiring the block chain height included in the block chain height information sent by each target block chain node in k target block chain nodes to obtain k block chain heights;
acquiring the maximum block chain height in the k block chain heights, and forming a first block height interval with the block chain height included in the first block chain link point;
dividing the first block height interval into k block chain height subintervals, and sending first block data synchronization requests to the k target block chain nodes respectively, wherein one target block chain node corresponds to one first block data synchronization request, and one first block data synchronization request is used for requesting block data of one block chain height subinterval.
In a possible implementation manner, the first to-be-synchronized block data includes a block header and a block body; the block data synchronization unit is specifically configured to:
generating a first Merck tree root from transaction data included in the zone block;
acquiring a second Mercker tree root included in the block header, and determining a verification result of the first to-be-synchronized block data according to the first Mercker tree root and the second Mercker tree root;
and if the verification result is that the verification is passed, adding the first to-be-synchronized block data to the block data of the first block chain node.
In a possible implementation manner, the apparatus further includes a node scoring module, where the node scoring module includes a first node scoring determination unit, and the first node scoring determination unit is specifically configured to:
and updating the node score of the target block chain node according to the verification result.
In a possible implementation manner, the node scoring module further includes a second node scoring determination unit, where the second node scoring determination unit is specifically configured to:
acquiring a time interval between sending the first block data synchronization request and receiving the first block data to be synchronized returned by the target block link point according to the first block data synchronization request;
and updating the node score of the target block chain node according to the time interval.
In another aspect, an embodiment of the present application provides a terminal device, where the terminal device includes a processor and a memory, and the processor and the memory are connected to each other. The memory is used for storing a computer program supporting the terminal device to execute the block data fast synchronization method, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the block data fast synchronization method.
In another aspect, an embodiment of the present application provides a computer-readable storage medium, where a computer program is stored, where the computer program includes program instructions, and the program instructions, when executed by a processor, cause the processor to execute the above block data fast synchronization method.
In the embodiment of the application, the first block link point can determine the data interaction times and the data interaction success times between the first block link point and each second block link node according to the data interaction record by acquiring the data interaction record between the first block link point and each second block link node in the block link system. And determining the node score of each second block chain node according to the data interaction times and the data interaction success times, and determining a target block chain node according to the plurality of node scores. Sending a first block data synchronization request to a target block chain node, receiving first to-be-synchronized block data returned by the target block chain node according to the first block data synchronization request, and updating block data in the first block chain node according to the first to-be-synchronized block data. By adopting the embodiment of the application, the time consumption of the new node or the node recovered by the broken network during the block data synchronization can be shortened, and the block data synchronization efficiency can be improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a blockchain system according to an embodiment of the present disclosure;
FIG. 2 is a flowchart illustrating a block data fast synchronization method according to an embodiment of the present disclosure;
fig. 2a is a schematic structural diagram of block data provided in an embodiment of the present application;
FIG. 3 is another flowchart illustrating a block data fast synchronization method according to an embodiment of the present disclosure;
FIG. 4 is a schematic structural diagram of a block data fast synchronization apparatus according to an embodiment of the present disclosure;
FIG. 5 is a schematic diagram of another block data fast synchronization apparatus according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a block chain system according to an embodiment of the present disclosure. As shown in fig. 1, the blockchain system 100 refers to a system for sharing data between blockchain nodes, and the blockchain system 100 may include a plurality of blockchain nodes, and the blockchain nodes are connected to each other, and as shown in fig. 1, the blockchain system 100 includes a blockchain node 10a, a blockchain node 10b, a blockchain node 10c, a blockchain node 10d, and a blockchain node 10e, where each blockchain node has a connection relationship with other blockchain nodes. It is to be understood that any one of the blockchain nodes in the blockchain system may be any type of computing device, such as a server, a terminal, etc., without limitation. Each blockchain node may receive input information during normal operation and maintain shared data in the blockchain system based on the received input information, for example, the input information may be a transaction request, and the like, which is not limited herein. In order to ensure information intercommunication in the blockchain system, information connection can exist between each blockchain node in the blockchain system, and information transmission can be carried out between the blockchain nodes through the information connection. For example, when any blockchain node in the blockchain system receives input information, other blockchain nodes in the blockchain system acquire the input information according to a consensus algorithm, and store the input information as data in shared data, so that the data stored in all blockchain nodes in the blockchain system are consistent.
Each block chain node in the block chain system has a corresponding block chain link point identifier, and each block chain link point in the block chain system can store block chain link point identifiers of other block chain nodes in the block chain system, so that the generated block is broadcast to other block chain nodes in the block chain system according to the block chain link point identifiers of other block chain nodes. Each block chain node can maintain a block chain link point identification list as shown in the following table, and the block chain node name and the block chain link point identification are correspondingly stored in the block chain link point identification list. The block link node identifier may be an IP (Internet Protocol) address and any other information that can be used to identify the block link node, and table 1 only illustrates the IP address as an example.
Block chain node name Block chain link point identification
Block chain node 1 117.114.151.174
Block chain node 2 117.116.189.145
Block chain node N 119.123.789.258
TABLE 1
The block data rapid synchronization method provided by the embodiment of the application can be widely applied to new nodes or nodes for network failure recovery in a block chain system. In the method in the embodiment of the application, the first block link point can determine the data interaction times and the data interaction success times between the first block link point and each second block link node according to the data interaction record by acquiring the data interaction record between the first block link point and each second block link node in the block link system. And determining the node score of each second block chain node according to the data interaction times and the data interaction success times, and determining a target block chain node according to the plurality of node scores. Sending a first block data synchronization request to a target block chain node, receiving first to-be-synchronized block data returned by the target block chain node according to the first block data synchronization request, and updating block data in the first block chain node according to the first to-be-synchronized block data. It should be understood that the first blockchain link point may be a node newly added to the blockchain system (hereinafter referred to as a new node for convenience of description), or may also be a node that has already been added to the blockchain system but has undergone network outage restoration (hereinafter referred to as a network outage restoration node for convenience of description), and the like, and is not limited herein. Generally, the new node usually only contains the created blocks, and the nodes recovered from the broken network include blocks with a certain block height, but since new blocks are generated continuously in the offline time, the block height of the new blocks is behind other block chain nodes in the block chain system. And the second blockchain node is other blockchain nodes except the new node and the node for recovering from the broken network in the blockchain system. By adopting the embodiment of the application, the time consumption of the new node or the node recovered by the broken network during the block data synchronization can be shortened, and the block data synchronization efficiency can be improved.
The method and the related apparatus provided by the embodiments of the present application will be described in detail with reference to fig. 2 to 6, respectively. The method provided by the embodiment of the application can comprise data processing stages, wherein the data processing stages are used for acquiring data interaction records, determining node scores of all block chain nodes according to the data interaction records, determining target block chain nodes according to the node scores, sending a first block data synchronization request to the target block chain nodes, updating block data based on first block data to be synchronized returned by the target block chain nodes, and the like. The implementation of each data processing stage can be referred to the following implementation shown in fig. 2 to 3.
Referring to fig. 2, fig. 2 is a flow chart illustrating a block data fast synchronization method according to an embodiment of the present disclosure. The method provided by the embodiment of the application can comprise the following steps:
s101, acquiring data interaction records between the first block chain link point and each second block chain node in the block chain system, and determining the data interaction times and the data interaction success times between the first block chain link point and each second block chain node according to the data interaction records.
In some possible embodiments, the first block link point may determine, by obtaining a data interaction record between the first block link point and each second block link node in the block link system, a data interaction number and a data interaction success number between the first block link point and each second block link node according to the data interaction record. It should be understood that the data interaction record may be stored in the first blockchain node, and is an interaction record generated according to a blockchain synchronization request sent by the first blockchain node, which is not limited herein. Generally, a data interaction record includes data interaction between a first blockchain node and a second blockchain node in the blockchain system. Therefore, by obtaining the data interaction record stored in the first block chain node, the data interaction times and the data interaction success times between the first block chain node and each second block chain node can be determined according to the data interaction record. Here, the number of data interaction may be the number of data interaction records, and the number of data interaction success times may be the number of data interaction success times in the data interaction records. It should be understood that the data interaction process between the first blockchain node and the second blockchain node can be determined to be successful if and only if a certain second blockchain node returns correct blockchain data according to the blockchain data synchronization request within a preset time.
And S102, determining the node score of each second block chain node according to the data interaction times and the data interaction success times, and determining a target block chain node from a plurality of second block chain nodes corresponding to the plurality of node scores.
In some possible embodiments, the first block link point may determine a node score for each second block link node according to the number of data interactions and the number of successful data interactions, and then may determine a target block link node from a plurality of second block link nodes corresponding to the plurality of node scores. Specifically, the first block link point may obtain a data interaction success rate of data interaction between each second block link point and the first block link point by calculating a ratio of a data interaction success frequency between the first block link point and each second block link point to the data interaction frequency, and may determine the data interaction success rate as a node score of each second block link node. Or, scores corresponding to preset different data interaction success rate intervals can be obtained, and then the score corresponding to the data interaction success rate interval is determined as the node score by determining which data interaction success rate interval the calculated data interaction success rate falls into. It should be understood that the target blockchain node may be one, or may also be multiple, for example, 2, 3, or 4, and the like, without limitation. When the number of the target blockchain nodes is one, a second blockchain node corresponding to the maximum node score can be determined from the multiple node scores and used as the target blockchain node. When the number of target block chain nodes is multiple, at least one block chain link point which is not smaller than the score threshold value in the scores of the multiple nodes can be determined as the target block chain node by acquiring a preset score threshold value. Or the node scores may be sorted, and k second block link points corresponding to the top k sorted node scores are determined as target block chain nodes, where k is an integer greater than 0. For example, the node scores may be sorted in a descending order, and k second blockchain nodes corresponding to the first k node scores after the descending order may be obtained as target blockchain nodes. Or, the calculated multiple node scores are sorted in an ascending order, and then k second blockchain nodes corresponding to the last k node scores after the ascending order are obtained to serve as target blockchain nodes, where k is an integer greater than 0, for example, k is 10, which is not limited herein.
For example, it is assumed that the blockchain system includes 5 blockchain nodes, i.e., blockchain node 1, blockchain node 2, blockchain node 3, blockchain node 4, and blockchain node 5, and each blockchain node has a connection relationship with other blockchain nodes. Assume that the first blockchain node is blockchain link point 1 in the blockchain system, and the second blockchain node is blockchain link point 2, blockchain link point 3, blockchain link point 4, and blockchain link point 5 in the blockchain system, respectively. Suppose that the blockchain node 1 includes 100 data interaction records, where one data interaction record includes a data interaction situation between the blockchain node 1 and a second blockchain node in the blockchain system. Specifically, it is assumed that 100 data interaction records include 30 data interaction records between the blockchain node 1 and the blockchain link point 2, 20 data interaction records between the blockchain node 1 and the blockchain link point 3, 25 data interaction records between the blockchain node 1 and the blockchain link point 4, and 25 data interaction records between the blockchain node 1 and the blockchain link point 5. The method comprises the following steps that 20 data interaction records between a block chain node 1 and a block chain link point 2 consist of 15 records with successful interaction and 5 records with failed interaction, 30 data interaction records between the block chain link point 1 and a block chain link point 3 consist of 10 records with successful interaction and 20 records with failed interaction, 25 data interaction records between the block chain link point 1 and a block chain link point 4 consist of 15 records with successful interaction and 10 records with failed interaction, and 25 data interaction records between the block chain link point 1 and the block chain link point 5 consist of 10 records with successful interaction and 15 records with failed interaction. Therefore, the success rate of data interaction between the block chain node 1 and the block link point 2 is 15/20 ═ 0.75, the success rate of data interaction between the block chain node 1 and the block link point 3 is 10/30 ═ 0.33, the success rate of data interaction between the block chain node 1 and the block link point 4 is 15/20 ═ 0.75, and the success rate of data interaction between the block chain node 1 and the block link point 5 is 10/20 ═ 0.5. The success rate of data interaction may be further determined as a node score of each second block link node, that is, the node score of the block link point 2 is 0.75 point, the node score of the block link point 3 is 0.33 point, the node score of the block link point 4 is 0.75 point, and the node score of the block link point 5 is 0.5 point. Or, scores corresponding to preset different data interaction success rate intervals can be obtained, and then the score corresponding to the data interaction success rate interval is determined as the node score by determining which data interaction success rate interval the calculated data interaction success rate falls into. That is, assuming that the score corresponding to the data interaction success rate interval is 0.25 point, [0, 0.25) the score corresponding to the data interaction success rate interval is 0.5 point, [0.5, 0.75) the score corresponding to the data interaction success rate interval is 0.75 point, and the score corresponding to the data interaction success rate interval is 0.75 point, [0.75, 1) the score corresponding to the data interaction success rate interval is 1 point, it is determined that the node score for the block link node 2 is 1 point, the node score for the block link node 3 is 0.5 point, the node score for the block link node 4 is 1 point, and the node score for the block link node 5 is 0.75 point. Assuming that the target block chain node is 2 second block chain nodes corresponding to the first 2 node scores after the plurality of node scores are subjected to descending order arrangement, the target block chain node can be determined to be a block chain link point 2 and a block chain link point 4.
S103, sending a first block data synchronization request to the target block chain node, receiving first to-be-synchronized block data returned by the target block chain node according to the first block data synchronization request, and updating block data in the first block chain node according to the first to-be-synchronized block data.
In some possible embodiments, the blockchain node, when running, will broadcast its highest block height to other blockchain nodes at regular intervals. When a certain block link node receives the block height broadcasted by other block link nodes, the block height is compared with the block height of the certain block link node, and if the block height of the certain block link node is behind the block height, a block data downloading flow is started. Generally speaking, the downloading of the block data can be completed in a "request/response" manner, wherein a block chain node entering the downloading process can send a downloading request carrying a block height interval to be downloaded to other block chain nodes, and when receiving the downloading request, other block chain nodes respond to the corresponding block data according to the block height block included in the downloading request. The block height is referred to as a blockchain height, or may be referred to as a block number, and for convenience of understanding, the following embodiments of the present application are all described with reference to the blockchain height.
It is to be understood that, when the target blockchain node is determined, the first blockchain node may send a first blockchain request to the target blockchain node. By receiving the first to-be-synchronized block data returned by the target block chain node according to the first block data synchronization request, the block data in the first block chain node can be updated according to the first to-be-synchronized block data. Specifically, when the target blockchain node is one, that is, when k is equal to 1, the first blockchain link point may compare the obtained blockchain height in the target blockchain with the blockchain height owned by the first blockchain link point by obtaining that the blockchain height information sent by the target blockchain node includes the blockchain height, and may further determine that the first blockchain link point is missing from the target blockchain node. Specifically, the first blockchain node may send a first blockdata synchronization request carrying a first blockheight interval to the target blockchain node, and after the target blockchain receives the first blockdata synchronization request, first block data to be synchronized corresponding to the first blockheight interval included in the first blockdata synchronization request may be acquired from the target blockchain and returned to the first blockchain node. When the first block chain node receives the first to-be-synchronized block data, the first block chain node updates the block data in the first block chain node according to the first to-be-synchronized block data, so that the block data in the first block chain node can be consistent with the target block chain node. That is, after successfully updating the block data in the first blockchain node based on all the returned first to-be-synchronized block data, the block height in the first blockchain node will level up the target blockchain node.
It should be understood that, when there are multiple target blockchain nodes, that is, when k ≧ 2 and k are integers, the first blockchain link point may obtain k blockchain heights by obtaining the blockchain height included in the blockchain height information sent by each target blockchain node among the k target blockchain nodes. By obtaining the maximum blockchain height of the k blockchain heights, a first blockchain height interval can be formed with the blockchain height included in the first blockchain link point. And finally, the first block chain node can respectively send first block data synchronization requests to k target block chain link points, wherein one target block chain link point corresponds to one first block data synchronization request, and one first block data synchronization request is used for requesting block data of one block chain height subinterval. It should be understood that, by uniformly dividing the first block height interval into a plurality of block height sub-intervals and sending first block data synchronization requests for requesting block data of different block height sub-intervals to a plurality of target block chain nodes respectively, the download load can be dispersed to different nodes, thereby avoiding the problem that a single requested node (i.e. a single target block chain node) affects the operation performance of the requested node due to carrying a large number of data accesses, and being beneficial to shortening the time of block data synchronization and improving the synchronization efficiency and stability of the block data. It should be understood that, the dividing manner for dividing the first block height interval into the plurality of block height sub-intervals may be uniform division or non-uniform division, which is determined according to an actual application scenario and is not limited herein. For convenience of description, the following examples of the present application are illustrated by uniformly dividing the examples.
For example, assuming that k is 2, that is, the number of target blockchain nodes is 2, by obtaining the blockchain height information sent by each target blockchain node, the blockchain height included in each piece of blockchain height information can be obtained. Assume that the blockchain system includes 5 blockchain nodes in total, namely, blockchain node 1, blockchain node 2, blockchain node 3, blockchain node 4 and blockchain node 5, and each blockchain node has a connection relationship with other blockchain nodes. Assume that the first blockchain node is blockchain link point 1 in the blockchain system and the target blockchain node is blockchain link point 2 and blockchain link point 4 in the blockchain system. Therefore, by acquiring the block height information sent by the block chain node 2 and the block height information sent by the block chain node 4, the block chain height in the block chain node 2 and the block chain height in the block chain node 4 can be obtained, where it is assumed that the block chain height of the block data in the block chain node 2 is 99 and the block chain height of the block data in the block chain node 4 is 100. Assuming that the blockchain node 1 has its own blockchain height of 50, a first blockchain interval of (50, 100) is obtained, i.e., the missing block data in the blockchain node 1, is block data from block height 51 to block height 100, by uniformly dividing the first block height interval (50, 100) into 2 blockchain height sub-intervals, it is possible to obtain a block height sub-interval 1 of (50, 75) and a block height sub-interval 2 of (75, 100), so that the block chain node 1 can send a first block data synchronization request carrying the block height sub-interval 1 to the block chain node 2, for requesting block data with a block height between 51 and 75 from block link point 2, and block link point 1 may send a first block data synchronization request carrying block height sub-interval 2 to block link point 4, for requesting block data with a block height between 76 th and 100 th from block link point 4.
It should be understood that the first chunk data synchronization request is for requesting chunk data corresponding to the first chunk height interval, and therefore, for convenience of description, the chunk data requested by the first chunk data synchronization request may be referred to as first to-be-synchronized chunk data. Each first block data to be synchronized consists of a block head and a block body.
For example, please refer to fig. 2a, and fig. 2a is a schematic structural diagram of block data provided in an embodiment of the present application. As shown in fig. 2a, the chunk data includes data in a chunk header and data in a chunk body, wherein a chunk version number, a hash value of a previous chunk, a timestamp, a difficulty value, a random number, a mercker tree root, and the like are packaged in the chunk header, and complete transaction data is included in the chunk body, for example, transaction data 1, transaction data 2, …, transaction data m, and the like may be included in the chunk body, and these transaction data may be organized together in the form of a mercker tree. It should be understood that the process of building the mercker tree is a process of recursively computing hash values. Taking the transaction data 1, the transaction data 2, the transaction data 3, and the transaction data 4 in fig. 2a as an example, based on the SHA256 algorithm, the Hash value 1 (i.e., Hash1) corresponding to the transaction data 1, the Hash value 2 (i.e., Hash2) corresponding to the transaction data 2, the Hash value 3 (i.e., Hash3) corresponding to the transaction data 3, and the Hash value 4 (i.e., Hash4) corresponding to the transaction data 4 can be respectively calculated. Further, the Hash1 and the Hash2 are connected in series and further subjected to Hash transformation to obtain the Hash value 12 (i.e., Hash12) shown in fig. 2a, and by analogy, the Hash3 and the Hash4 are connected in series and subjected to Hash transformation to obtain the Hash value 34 (i.e., Hash34) shown in fig. 2a, so that the Hash12 and the Hash34 can be further connected in series and subjected to Hash transformation to obtain the Hash value 1234 (i.e., Hash 1234). And the hash value of all the transaction data obtained finally can be used as the root of the Merck tree in the block data. It can be seen that the mercker tree is very scalable, and no matter how much transaction data is, a mercker tree and a mercker tree root with fixed length can be finally generated.
After the first block link node receives the first to-be-synchronized block data returned by each target block link node according to the first block data synchronization request, each received first to-be-synchronized block data can be sorted according to the block height, and then the first block link node can sequentially verify each sorted first to-be-synchronized block data. It is understood that a certain first to-be-synchronized block data is added to the block data of the first block chain node if and only if the first to-be-synchronized block data is verified. That is, for any received first to-be-synchronized block data, assuming that the first to-be-synchronized block data is the first to-be-synchronized block data 1, the first block link node acquires all transaction data included in the block of the first to-be-synchronized block data 1, and generates a mercker tree and a mercker tree root, i.e., the first mercker tree root, according to the transaction data. By further acquiring the merck tree root included in the block header of the first to-be-synchronized block data 1, that is, the second merck tree root, the verification result of the first to-be-synchronized block data 1 can be determined by comparing the first merck tree root and the second merck tree root. Here, when the first and second merkel roots are the same, it is determined that the verification result is verified, and thus the first blockchain node may add the first to-be-synchronized block data 1 to the block data of the first blockchain node. Accordingly, if the first and second roots are not the same, it indicates that the data in the first block data 1 to be synchronized has been tampered with maliciously, and therefore it can be determined that the verification result is verification failure. It should be understood that the first to-be-synchronized block data that fails to be verified will be discarded, i.e., not added to the block data of the first blockchain node.
In the embodiment of the application, the first block link point may determine, according to the data interaction record, the number of data interactions and the number of data interaction success times between the first block link point and each second block link node by obtaining the data interaction record between the first block link point and each second block link node in the block link system. And determining the node score of each second block chain node according to the data interaction times and the data interaction success times, and determining a target block chain node according to the plurality of node scores. Sending a first block data synchronization request to a target block chain node, receiving first to-be-synchronized block data returned by the target block chain node according to the first block data synchronization request, and updating block data in the first block chain node according to the first to-be-synchronized block data. By adopting the embodiment of the application, the time consumption of the new node or the node recovered by the broken network during the block data synchronization can be shortened, and the block data synchronization efficiency can be improved.
Referring to fig. 3, fig. 3 is another flow chart illustrating a block data fast synchronization method according to an embodiment of the present disclosure. The method provided by the embodiment of the present application can be explained by the following implementation manners provided in steps S201 to S205:
s201, broadcasting a second block data synchronization request to the block chain system, receiving and verifying second to-be-synchronized block data returned by each second block link point in the block chain system, and determining the second block data synchronization request, the second to-be-synchronized block data returned by each second block link point, and the verification result of the second to-be-synchronized block data returned by each second block link point by the first block link point as data interaction records between the first block link point and each second block chain node in the block chain system.
In some possible embodiments, when the first blockchain node is a node newly added to the blockchain system, that is, when the first blockchain node is a new node, the first blockchain node may broadcast the second blockchain node to the blockchain system since only the created block (that is, the data of the block with the block height of 0) is included in the new node and no data interaction is performed with other blockchain nodes in the blockchain system. The second block data synchronization request is used for requesting block data of a second block height interval. The second block height interval is a predetermined block height interval, i.e. a predetermined block height range, and is not overlapped with the first block height interval. It should be understood that, when other blockchain nodes in the blockchain system, i.e., each second blockchain node in the blockchain system, receive the second blockchain synchronization request sent by the first blockchain node, each second blockchain node may respectively respond to the first blockchain node with the blockchain data corresponding to the second blockchain height interval included in the second blockchain synchronization request, i.e., the second block data to be synchronized. And the first blockchain node can verify the received second block data to be synchronized returned by each second blockchain node. If the verification result of the second block data to be synchronized returned by any second block chain node by the first block chain link point passes the verification, the successful data interaction between the first block chain link point and any second block chain node can be determined. Correspondingly, if the verification result of the second block data to be synchronized returned by any second block chain node by the first block chain link point is verification failure, the data interaction failure between the first block chain link point and the second block chain node can be determined. It should be understood that the verification process of receiving each first to-be-verified block data by the first block link point pair may refer to the implementation manner described in step S103 in fig. 1, which is not limited herein. Here, the first block chain node may determine, as the data interaction record between the first block chain node and each second block chain node in the block chain system, the second block data to be synchronized returned by the second block chain node in the block chain system according to the second block data synchronization request, and the verification result of the second block data to be synchronized returned by the first block chain node to each second block chain node.
S202, acquiring data interaction records between the first block chain link point and each second block chain node in the block chain system, and determining the data interaction times and the data interaction success times between the first block chain link point and each second block chain node according to the data interaction records.
S203, determining the node score of each second block chain node according to the data interaction times and the data interaction success times, and determining a target block chain node from a plurality of second block chain nodes corresponding to the plurality of node scores.
S204, sending a first block data synchronization request to the target block chain node, receiving first to-be-synchronized block data returned by the target block chain node according to the first block data synchronization request, and updating block data in the first block chain node according to the first to-be-synchronized block data.
The specific implementation manner of steps S202 to S204 may refer to the description of steps S101 to S103 in the embodiment corresponding to fig. 2, and is not described herein again.
S205, acquiring a time interval between sending the first block data synchronization request and receiving the target block data link point and returning the first to-be-synchronized block data according to the first block data synchronization request, and updating the node score of the target block chain node according to the time interval.
In some possible embodiments, the first block link point may further obtain a time interval from when the node sends the first block data synchronization request to when the receiving target block link node returns the first block data to be synchronized according to the first block data synchronization request. Further, the first blockchain node may update the node score of the target blockchain node according to the acquired time interval. It should be understood that the shorter the time interval between sending the first block data synchronization request and receiving the first block data to be synchronized, the more fluid the network of the target block chain node returning the first block data to be synchronized is, or the better the operation performance of the target block chain node can be said to be, so that the node score of the target block chain node can be increased. On the contrary, the longer the time interval between the sending of the first block data synchronization request and the receiving of the first to-be-synchronized block data is, the more the network of the target block chain node returning the first to-be-synchronized block data is blocked, or the worse the operation performance of the target block chain node is, the node score of the target block chain node can be reduced.
Optionally, the first block link point may also update the node score of the target block link node according to the verification result of the first to-be-synchronized block data. That is, when the first block link node verifies the received first to-be-synchronized block data successfully, it indicates that the block data sent by the target block link node sending the first to-be-synchronized block data is correct and has not been tampered with. Correspondingly, when the first block link node fails to verify the received first to-be-synchronized block data, it indicates that the block data sent by the target block link node sending the first to-be-synchronized block data is tampered data. Therefore, the first blockchain node can send the first blockchain data synchronization request to the target blockchain node again, and verify the received first block data to be synchronized returned by the target blockchain node again. If the verification result of the first to-be-synchronized block data returned by the target blockchain node based on the data synchronization request sent by the first blockchain node for the second time still fails, or the verification results of the first to-be-synchronized block data returned by the data synchronization request sent for the nth time subsequently fail based on the third time, the fourth time, …, or the accumulated failure times reach a preset failure time threshold, the target blockchain node can be determined to be a rogue node in the blockchain system. Therefore, the node score of the target block chain node can be reduced, or the target block chain node can be eliminated, wherein n is a positive integer.
In an embodiment of the present application, the first blockchain node may broadcast a second blockchain data synchronization request to the blockchain system. By receiving and verifying the second block data to be synchronized returned by each second block link point in the block chain system, the second block data synchronization request, the second block data to be synchronized returned by each second block link point, and the verification result of the second block data to be synchronized returned by each second block link point by the first block link point can be determined as the data interaction record between the first block link point and each second block chain node in the block chain system. Then, the first block link point can determine the data interaction times and the data interaction success times between the first block link point and each second block link node according to the data interaction records by acquiring the data interaction records between the first block link point and each second block link node in the block link system. And determining the node score of each second block chain node according to the data interaction times and the data interaction success times, and determining a target block chain node according to the plurality of node scores. Sending a first block data synchronization request to a target block chain node, receiving first to-be-synchronized block data returned by the target block chain node according to the first block data synchronization request, and updating block data in the first block chain node according to the first to-be-synchronized block data. Further, the first block link point may further obtain a time interval between sending the first block data synchronization request and receiving the target block data synchronization request and returning the first to-be-synchronized block data according to the first block data synchronization request, and update the node score of the target block link node according to the time interval. By adopting the embodiment of the application, the time consumption of the new node or the node recovered by the broken network during the block data synchronization can be further shortened, and the block data synchronization efficiency can be improved.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a block data fast synchronization apparatus according to an embodiment of the present disclosure. The block data fast synchronization device provided by the embodiment of the application comprises:
an interaction record obtaining module 41, configured to obtain a data interaction record between a first block link node and each second block link node in the block link system, and determine, according to the data interaction record, a number of data interactions and a number of data interaction success times between the first block link node and each second block link node;
a target node determining module 42, configured to determine a node score for each second blockchain node according to the data interaction times and the data interaction success times, and determine a target blockchain node from a plurality of second blockchain nodes corresponding to the plurality of node scores;
the block data processing module 43 is configured to send a first block data synchronization request to the target block link node, receive first to-be-synchronized block data returned by the target block link node according to the first block data synchronization request, and update block data in the first block link node according to the first to-be-synchronized block data, where the first block data synchronization request is used to request block data in a first block height interval.
Referring to fig. 5, fig. 5 is another schematic structural diagram of a block data fast synchronization apparatus according to an embodiment of the present disclosure. Wherein:
in some possible embodiments, the apparatus further includes a first processing module 44, and the first processing module 44 includes:
a broadcasting unit 441, configured to broadcast a second chunk data synchronization request to the blockchain system, where the second chunk data synchronization request is used to request chunk data of a second chunk height interval;
a first processing unit 442, configured to receive and verify second to-be-synchronized block data returned by each second block link node according to the second block data synchronization request in the block chain system, and if a verification result of the second to-be-synchronized block data returned by any second block chain node is a verification pass, determine that data interaction between the first block link node and any second block chain node is successful;
a record generating unit 443, configured to determine, as data interaction records between the first block link point and each second block link node in the block link system, a second block data to be synchronized, which is returned by the second block link point according to the second block data synchronization request, and a verification result of the second block data to be synchronized, which is returned by the first block link point for each second block link point.
In some possible embodiments, the target node determining module 42 is specifically configured to:
and sequencing the node scores, and determining k second block chain link points corresponding to the top k node scores which are sequenced to be the maximum as target block chain nodes, wherein k is an integer larger than 0.
In some possible embodiments, the apparatus further includes a block chain height information obtaining module 45, where the block chain height information obtaining module 45 is configured to:
receiving the height information of the block chain sent by each second block chain node in the block chain system, wherein the height information of the block chain sent by any second block chain node comprises the height of the block chain of any second block chain node;
the block data processing module 43 includes a transceiver 431 and a block data synchronization unit 432, where the transceiver 431 is configured to:
acquiring the block chain height included in the block chain height information sent by each target block chain node in k target block chain nodes to obtain k block chain heights;
acquiring the maximum block chain height in the k block chain heights, and forming a first block height interval with the block chain height included in the first block chain link point;
dividing the first block height interval into k block chain height subintervals, and sending first block data synchronization requests to the k target block chain nodes respectively, wherein one target block chain node corresponds to one first block data synchronization request, and one first block data synchronization request is used for requesting block data of one block chain height subinterval.
In some possible embodiments, the first to-be-synchronized block data includes a block header and a block body; the block data synchronization unit 432 is specifically configured to:
generating a first Merck tree root from transaction data included in the zone block;
acquiring a second Mercker tree root included in the block header, and determining a verification result of the first to-be-synchronized block data according to the first Mercker tree root and the second Mercker tree root;
and if the verification result is that the verification is passed, adding the first to-be-synchronized block data to the block data of the first block chain node.
In some possible embodiments, the apparatus further includes a node scoring module 46, where the node scoring module includes a first node score determining unit 461, and the first node score determining unit 461 is specifically configured to:
and updating the node score of the target block chain node according to the verification result.
In some possible embodiments, the node scoring module 46 further includes a second node scoring determination unit 462, where the second node scoring determination unit 462 is specifically configured to:
acquiring a time interval between sending the first block data synchronization request and receiving the first block data to be synchronized returned by the target block link point according to the first block data synchronization request;
and updating the node score of the target block chain node according to the time interval.
In a specific implementation, the block data fast synchronization apparatus can execute the implementation manners provided by the steps in fig. 2 to fig. 3 through the built-in functional modules. For example, the interaction record obtaining module 41 may be configured to obtain the data interaction record in each step, and determine the number of data interactions and the number of successful data interactions according to the data interaction record, which may specifically refer to the implementation manners provided in each step, and will not be described herein again. The target node determining module 42 may be configured to execute the implementation manners described in the relevant steps of determining a node score based on the number of data interactions and the number of successful data interactions in each step, and determining a target block link point according to the node score, which may specifically refer to the implementation manners provided in each step, and are not described herein again. The block data processing module 43 may be configured to execute the implementation manners of sending the first block data synchronization request to the target block chain node, receiving the first block data to be synchronized returned by the target block chain node, and updating the block data in the first block chain node according to the first block data to be synchronized in the above steps, which may be specifically referred to the implementation manners provided in the above steps, and is not described herein again.
In the embodiment of the application, the first block link point may determine, according to the data interaction record, the number of data interactions and the number of data interaction success times between the first block link point and each second block link node by obtaining the data interaction record between the first block link point and each second block link node in the block link system. And determining the node score of each second block chain node according to the data interaction times and the data interaction success times, and determining a target block chain node according to the plurality of node scores. Sending a first block data synchronization request to a target block chain node, receiving first to-be-synchronized block data returned by the target block chain node according to the first block data synchronization request, and updating block data in the first block chain node according to the first to-be-synchronized block data. By adopting the embodiment of the application, the time consumption of the new node or the node recovered by the broken network during the block data synchronization can be shortened, the block data synchronization efficiency is improved, and the application range is wide.
Referring to fig. 6, fig. 6 is a schematic structural diagram of a terminal device provided in an embodiment of the present application. As shown in fig. 6, the terminal device in this embodiment may include: one or more processors 501, memory 502, and a transceiver 503. The processor 501, the memory 502, and the transceiver 503 may be connected by a bus 504. In particular, the transceiver 503 may be a communication module, a transceiver circuit. In the embodiment of the present application, the transceiver 503 is configured to perform the operations of sending the first block data synchronization request, receiving the first to-be-synchronized block data, and the like in the above embodiments. The memory 502 is used to store a computer program comprising program instructions and the processor 501 is used to execute the program instructions stored in the memory 502.
It should be understood that in some possible embodiments, the processor 501 may be a Central Processing Unit (CPU), and the processor may be other general processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The memory 502 may include both read-only memory and random access memory, and provides instructions and data to the processor 501. A portion of the memory 502 may also include non-volatile random access memory. For example, the memory 502 may also store device type information.
In a specific implementation, the terminal device may execute the implementation manners provided in the steps in fig. 2 to fig. 3 through the built-in functional modules, which may specifically refer to the implementation manners provided in the steps, and are not described herein again.
In the embodiment of the application, the first block link point may determine, according to the data interaction record, the number of data interactions and the number of data interaction success times between the first block link point and each second block link node by obtaining the data interaction record between the first block link point and each second block link node in the block link system. And determining the node score of each second block chain node according to the data interaction times and the data interaction success times, and determining a target block chain node according to the plurality of node scores. Sending a first block data synchronization request to a target block chain node, receiving first to-be-synchronized block data returned by the target block chain node according to the first block data synchronization request, and updating block data in the first block chain node according to the first to-be-synchronized block data. By adopting the embodiment of the application, the time consumption of the new node or the node recovered by the broken network during the block data synchronization can be shortened, the block data synchronization efficiency is improved, and the application range is wide.
An embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, where the computer program includes program instructions, and when the program instructions are executed by a processor, the block data fast synchronization method provided in each step in fig. 2 to 3 is implemented.
The computer-readable storage medium may be the block data fast synchronization apparatus provided in any of the foregoing embodiments or an internal storage unit of the terminal device, such as a hard disk or a memory of an electronic device. The computer readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a Smart Memory Card (SMC), a Secure Digital (SD) card, a flash card (flash card), and the like, which are provided on the electronic device. Further, the computer readable storage medium may also include both an internal storage unit and an external storage device of the electronic device. The computer-readable storage medium is used for storing the computer program and other programs and data required by the electronic device. The computer readable storage medium may also be used to temporarily store data that has been output or is to be output.
The terms "first", "second", "third", "fourth", and the like in the claims and in the description and drawings of the present application are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments. The term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items. Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The method and the related apparatus provided by the embodiments of the present application are described with reference to the flowchart and/or the structural diagram of the method provided by the embodiments of the present application, and each flow and/or block of the flowchart and/or the structural diagram of the method, and the combination of the flow and/or block in the flowchart and/or the block diagram can be specifically implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block or blocks of the block diagram. These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block or blocks of the block diagram. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block or blocks.

Claims (10)

1. A method for fast synchronization of block data, the method comprising:
the method comprises the steps that a first block chain link point obtains data interaction records between the first block chain link point and each second block chain node in a block chain system, and the data interaction times and the data interaction success times between the first block chain link point and each second block chain node are determined according to the data interaction records;
the first block link point determines a node score of each second block link node according to the data interaction times and the data interaction success times, and determines a target block link node from a plurality of second block link nodes corresponding to the plurality of node scores;
the first block chain node sends a first block data synchronization request to the target block chain node, receives first to-be-synchronized block data returned by the target block chain node according to the first block data synchronization request, and updates block data in the first block chain node according to the first to-be-synchronized block data, wherein the first block data synchronization request is used for requesting block data in a first block height interval.
2. The method of claim 1, wherein before the first blockchain node obtains the data interaction record between the first blockchain node and each second blockchain node in the blockchain system, the method further comprises:
the first blockchain node broadcasts a second blockdata synchronization request to the blockchain system, wherein the second blockdata synchronization request is used for requesting blockdata of a second blockheight interval;
the first block chain node receives and verifies second block data to be synchronized returned by each second block chain node in the block chain system according to the second block data synchronization request, and if the verification result of the second block data to be synchronized returned by any second block chain node is verification passing, the successful data interaction between the first block chain node and any second block chain node is determined;
and the first block link point determines the data interaction record between the first block link point and each second block link node in the block link system according to the second to-be-synchronized block data returned by the second block data synchronization request and the verification result of the second to-be-synchronized block data returned by each second block link point by the first block link point.
3. The method of claim 1, wherein determining the target blockchain node from a plurality of second blockchain nodes corresponding to the plurality of node scores comprises:
the first block link point sorts the plurality of node scores, and determines k second block link points corresponding to the top k sorted node scores as target block link nodes, wherein k is an integer greater than 0.
4. The method of claim 3, wherein before the first blockchain node sends a first blockchain request to the target blockchain node, the method further comprises:
the first block chain link point receives block chain height information sent by each second block chain node in a block chain system, wherein the block chain height information sent by any second block chain node comprises the block chain height of any second block chain node;
the first blockchain node sending a first blockchain data synchronization request to the target blockchain node, including:
the first block chain link point acquires block chain heights included in block chain height information sent by each target block chain node in k target block chain nodes so as to acquire k block chain heights;
the first block link point obtains the maximum block chain height in the k block chain heights, and the maximum block chain height and the block chain height included in the first block link point form a first block height interval;
the first block link point divides the first block height interval into k block chain height sub-intervals;
and the first block chain node respectively sends first block data synchronization requests to the k target block chain nodes, wherein one target block chain node corresponds to one first block data synchronization request, and one first block data synchronization request is used for requesting block data of one block chain height subinterval.
5. The method according to any of claims 1-4, wherein the first to-be-synchronized block data comprises a block header and a block body; the updating the block data in the first block chain node according to the first block data to be synchronized includes:
the first block chain link point generates a first Merck tree root according to transaction data included in the block body;
the first block link point acquires a second Mercker tree root included in the block head, and determines a verification result of the first block data to be synchronized according to the first Mercker tree root and the second Mercker tree root;
and if the verification result is that the verification is passed, adding the first to-be-synchronized block data to the block data of the first block chain node.
6. The method of claim 5, further comprising:
and the first block chain link point updates the node score of the target block chain node according to the verification result.
7. The method according to any one of claims 1-4, further comprising:
the first block link point acquires a time interval between sending the first block data synchronization request and receiving the first block data to be synchronized returned by the target block link point according to the first block data synchronization request;
the first block link point updates a node score for the target block link node according to the time interval.
8. An apparatus for fast synchronization of block data, the apparatus comprising:
the interaction record acquisition module is used for acquiring data interaction records between the first block chain link point and each second block chain node in the block chain system, and determining the data interaction times and the data interaction success times between the first block chain link point and each second block chain node according to the data interaction records;
the target node determining module is used for determining a node score of each second block chain node according to the data interaction times and the data interaction success times, and determining a target block chain node from a plurality of second block chain nodes corresponding to the plurality of node scores;
and the block data processing module is used for sending a first block data synchronization request to the target block chain node, receiving first to-be-synchronized block data returned by the target block chain node according to the first block data synchronization request, and updating block data in the first block chain node according to the first to-be-synchronized block data, wherein the first block data synchronization request is used for requesting block data in a first block height interval.
9. A terminal device, comprising a processor and a memory, the processor and the memory being interconnected;
the memory for storing a computer program comprising program instructions, the processor being configured to invoke the program instructions to perform the method of any of claims 1-7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to carry out the method according to any one of claims 1-7.
CN202010054255.1A 2020-01-17 2020-01-17 Block data rapid synchronization method, device, equipment and storage medium Active CN111294390B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010054255.1A CN111294390B (en) 2020-01-17 2020-01-17 Block data rapid synchronization method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010054255.1A CN111294390B (en) 2020-01-17 2020-01-17 Block data rapid synchronization method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111294390A true CN111294390A (en) 2020-06-16
CN111294390B CN111294390B (en) 2021-11-23

Family

ID=71028377

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010054255.1A Active CN111294390B (en) 2020-01-17 2020-01-17 Block data rapid synchronization method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111294390B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111818181A (en) * 2020-08-31 2020-10-23 腾讯科技(深圳)有限公司 Data processing method and device based on block chain and computer readable storage medium
CN112417052A (en) * 2020-12-03 2021-02-26 腾讯科技(深圳)有限公司 Data synchronization method, device, equipment and storage medium in block chain network
CN113065867A (en) * 2021-03-30 2021-07-02 上海万向区块链股份公司 System, method and medium for data playback-based incompatible blockchain upgrade
CN113098970A (en) * 2021-04-12 2021-07-09 浙江永旗区块链科技有限公司 Distributed network node data synchronization method
CN114912856A (en) * 2022-07-19 2022-08-16 安胜(天津)飞行模拟系统有限公司 Flight simulator maintenance method based on block chain
CN115086350A (en) * 2022-06-13 2022-09-20 杭州复杂美科技有限公司 Block link point data synchronization method, equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108848184A (en) * 2018-06-29 2018-11-20 北京金山安全软件有限公司 Block link point synchronization method and device based on trust mechanism
US20190103958A1 (en) * 2017-09-29 2019-04-04 Alibaba Group Holding Limited Data storage method, data query method and apparatuses
CN110365768A (en) * 2019-07-15 2019-10-22 腾讯科技(深圳)有限公司 Method of data synchronization, device, medium, the electronic equipment of distributed system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190103958A1 (en) * 2017-09-29 2019-04-04 Alibaba Group Holding Limited Data storage method, data query method and apparatuses
CN108848184A (en) * 2018-06-29 2018-11-20 北京金山安全软件有限公司 Block link point synchronization method and device based on trust mechanism
CN110365768A (en) * 2019-07-15 2019-10-22 腾讯科技(深圳)有限公司 Method of data synchronization, device, medium, the electronic equipment of distributed system

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111818181A (en) * 2020-08-31 2020-10-23 腾讯科技(深圳)有限公司 Data processing method and device based on block chain and computer readable storage medium
CN112417052A (en) * 2020-12-03 2021-02-26 腾讯科技(深圳)有限公司 Data synchronization method, device, equipment and storage medium in block chain network
CN112417052B (en) * 2020-12-03 2021-08-20 腾讯科技(深圳)有限公司 Data synchronization method, device, equipment and storage medium in block chain network
CN113065867A (en) * 2021-03-30 2021-07-02 上海万向区块链股份公司 System, method and medium for data playback-based incompatible blockchain upgrade
CN113098970A (en) * 2021-04-12 2021-07-09 浙江永旗区块链科技有限公司 Distributed network node data synchronization method
CN115086350A (en) * 2022-06-13 2022-09-20 杭州复杂美科技有限公司 Block link point data synchronization method, equipment and storage medium
CN115086350B (en) * 2022-06-13 2024-01-19 亿度科创(深圳)有限公司 Block chain node data synchronization method, equipment and storage medium
CN114912856A (en) * 2022-07-19 2022-08-16 安胜(天津)飞行模拟系统有限公司 Flight simulator maintenance method based on block chain

Also Published As

Publication number Publication date
CN111294390B (en) 2021-11-23

Similar Documents

Publication Publication Date Title
CN111294390B (en) Block data rapid synchronization method, device, equipment and storage medium
CN109345388B (en) Block chain intelligent contract verification method and device and storage medium
CN109242500B (en) Block chain transaction validity verification method and device and storage medium
CN108683539B (en) Block chain network management method, block chain network management device, block chain network management medium and electronic equipment
CN109831487B (en) Fragmented file verification method and terminal equipment
CN110011788B (en) Data processing method, system and related equipment based on block chain
CN110049087B (en) Credibility verification method, system, device and equipment of alliance chain
US11336451B2 (en) Cross-blockchain resource transmission
CN108876384B (en) Transaction data processing method and device
CN110543448A (en) data synchronization method, device, equipment and computer readable storage medium
CN111447069B (en) Low-frequency access data processing method based on block chain
CN110597918A (en) Account management method and device and computer readable storage medium
CN111683118A (en) Block chain-based consensus method and device, master node equipment and slave node equipment
CN104866339A (en) Distributed persistent management method, system and device of FOTA data
CN110659905A (en) Transaction verification method, device, terminal equipment and storage medium
CN108765142B (en) Electronic device, multi-blockchain integration control method, and computer-readable storage medium
CN110989934B (en) Block chain link point data storage method, block chain system and block chain node
CN111061813B (en) Method, apparatus and computing device for data synchronization in blockchain network
CN116303343A (en) Data slicing method, device, electronic equipment and storage medium
CN110888892B (en) Block synchronization method, device and storage medium
CN111695098A (en) Multi-distributed cluster access method and device
CN116074308A (en) Method, system, equipment and readable storage medium for downloading vehicle-end upgrade package
CN113660353B (en) Method, device, equipment and medium for managing Provisioner address based on Bluetooth Mesh
CN110730063A (en) Security verification method and system, Internet of things platform, terminal and readable storage medium
CN114912097A (en) Certificate verification method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40024705

Country of ref document: HK

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant