Data synchronization processing method and device based on block chain, equipment and medium

By receiving data synchronization requests from nodes in the blockchain network and replacing source transaction data according to the data permission scope and block height, the data security problem caused by direct exposure of business data is solved, and data security is improved.

CN119494112APending Publication Date: 2025-02-21TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311043423.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-17
Publication Date
2025-02-21

AI Technical Summary

Technical Problem

In specific business scenarios using blockchain technology, direct exposure of business data will lead to low data security.

Method used

By receiving the data synchronization request from the receiving node, the data permission range and block height are obtained. When the conditions are met, the source transaction data that does not fall within the data permission range is replaced with transaction identification information to generate a second synchronization block to improve data security sex.

Benefits of technology

It has achieved improved data security in the blockchain network, avoided data leakage, and enhanced data protection mechanism.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119494112A_ABST
    Figure CN119494112A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a block chain-based data synchronization processing method and device, equipment and a medium, which can be used for improving data security. The method comprises the following steps: receiving a data synchronization request corresponding to a first node, and obtaining a first data permission range corresponding to the first node and a first block height corresponding to the first node according to the data synchronization request; if a second data permission range corresponding to the second node comprises the first data permission range and the first block height is smaller than a second block height corresponding to the second node, acquiring a first synchronization block in a block chain stored in the second node according to the first block height and the second block height; replacing the source transaction data, which does not belong to the first data permission range, in the first synchronization block with the transaction identification information to obtain a second synchronization block; and sending the second synchronization block to the first node, so that the first node adds the second synchronization block to the block chain stored in the first node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology, and in particular to a blockchain-based data synchronization processing method, device, equipment and medium. Background Art

[0002] Due to the characteristics of blockchain such as traceability and non-tamperability, the use of blockchain for data storage is becoming increasingly common. The information of each blockchain node in the blockchain system can be stored in the blockchain. Due to the decentralized nature of the blockchain, the data stored on the blockchain is shared by all blockchain nodes in the blockchain system, that is, each blockchain node can not only obtain its own information from the blockchain, but also obtain the information of other blockchain nodes. However, in some specific business scenarios using blockchain technology (for example, medical scenarios, etc.), the business data involved has particularity (for example, some data that is not convenient to be made public). If these business data are directly exposed on the blockchain, it will cause the leakage of business data, resulting in low data security. Summary of the invention

[0003] The embodiments of the present application provide a blockchain-based data synchronization processing method, device, equipment, and medium, which can improve data security.

[0004] On the one hand, an embodiment of the present application provides a data synchronization processing method based on blockchain, including:

[0005] Receive a data synchronization request corresponding to the first node, and obtain a first data authority range corresponding to the first node and a first block height corresponding to the first node according to the data synchronization request;

[0006] If the second data permission range corresponding to the second node includes the first data permission range, and the first block height is less than the second block height corresponding to the second node, then according to the first block height and the second block height, obtain the first synchronization block in the blockchain stored by the second node;

[0007] The source transaction data in the first synchronization block that does not belong to the first data authority range is replaced with the transaction identification information to obtain a second synchronization block; the second synchronization block includes the source transaction data in the first synchronization block that belongs to the first data authority range;

[0008] The second synchronization block is sent to the first node, so that the first node adds the second synchronization block to the blockchain stored by the first node.

[0009] On the one hand, an embodiment of the present application provides a data synchronization processing device based on blockchain, including:

[0010] A data synchronization request receiving module, used to receive a data synchronization request corresponding to the first node, and obtain a first data authority range corresponding to the first node and a first block height corresponding to the first node according to the data synchronization request;

[0011] A first synchronization block acquisition module, configured to acquire a first synchronization block from the blockchain stored in the second node according to the first block height and the second block height if the second data authority range corresponding to the second node includes the first data authority range and the first block height is less than the second block height corresponding to the second node;

[0012] A second synchronization block acquisition module is used to replace the source transaction data in the first synchronization block that does not belong to the first data authority range with the transaction identification information to obtain a second synchronization block; the second synchronization block includes the source transaction data in the first synchronization block that belongs to the first data authority range;

[0013] The synchronization block sending module is used to send the second synchronization block to the first node, so that the first node adds the second synchronization block to the blockchain stored by the first node.

[0014] The data synchronization processing device based on blockchain also includes:

[0015] A synchronization condition acquisition module, used to acquire a first independent synchronization condition and a first combined synchronization condition for determining a first data authority range, and to acquire a second independent synchronization condition and a second combined synchronization condition for determining a second data authority range;

[0016] a first authority range determination module, configured to determine that the second data authority range includes the first data authority range if the second independent synchronization condition includes the first independent synchronization condition and the synchronization sub-condition in the first combined synchronization condition includes the synchronization sub-condition in the second combined synchronization condition;

[0017] The second authority scope determination module is used to determine that the second data authority scope does not include the first data authority scope if the second independent synchronization condition does not include the first independent synchronization condition, or the synchronization sub-condition in the second combined synchronization condition includes the synchronization sub-condition in the first combined synchronization condition.

[0018] Wherein, the first block height is M, the second block height is N, and both M and N are positive integers; the first synchronization block acquisition module includes:

[0019] The first block determination unit is used to determine the block corresponding to the block height M+1 to the second block height N as the first synchronization block in the blockchain stored by the second node if the second data authority range corresponding to the second node includes the first data authority range and the first block height M is less than the second block height N corresponding to the second node.

[0020] The transaction identification information includes hash data; the second synchronization block acquisition module includes:

[0021] A block type acquisition unit, configured to acquire a block type corresponding to the first synchronization block from a block header of the first synchronization block;

[0022] A second block determination unit, configured to determine that the first synchronization block belongs to a first data authority range and determine the first synchronization block as a second synchronization block if the block type corresponding to the first synchronization block is a configuration block type;

[0023] The third block determination unit is used to determine the source transaction data in the block body of the first synchronization block that does not belong to the first data authority as transaction data to be processed if the block type corresponding to the first synchronization block is a non-configuration block type, obtain the hash data corresponding to the transaction data to be processed, replace the transaction data to be processed with the hash data, and determine the first synchronization block after the data replacement as the second synchronization block.

[0024] The third block determination unit includes:

[0025] The transaction data processing subunit is used to fill the transaction data to be processed to obtain filled transaction data, and split the filled transaction data to obtain P segmented transaction data; P is an integer greater than 1;

[0026] The transaction data compression subunit is used to obtain the i-th input data of the compression function; when i is 1, the i-th input data includes the initial compression value and the first segmented transaction data among the P segmented transaction data; when i is not 1, the i-th input data includes the i-1-th output data of the compression function and the i-th segmented transaction data among the P segmented transaction data; i is a positive integer less than or equal to P;

[0027] The hash data acquisition subunit is used to determine the i-th output data corresponding to the compression function according to the i-th input data and the compression function, and determine the P-th output data corresponding to the compression function as the hash data corresponding to the transaction data to be processed.

[0028] The data synchronization processing device based on blockchain also includes:

[0029] A processing status updating module, used to store the data synchronization request in the message queue corresponding to the second node, and update the processing status of the data synchronization request according to the storage position of the data synchronization request in the message queue corresponding to the second node;

[0030] The execution prompt message broadcast module is used to generate an execution prompt message for the data synchronization request if it detects that the processing status corresponding to the data synchronization request is updated to the execution status, and broadcast the execution prompt message in the blockchain network to which the second node belongs, so that the blockchain nodes other than the second node in the blockchain network clear the data synchronization request in the message queue.

[0031] The data synchronization processing device based on blockchain also includes:

[0032] A permission warning message generating module, used for generating a permission warning message for a data synchronization request if the first data permission range does not include the second data permission range;

[0033] The permission warning message sending module sends a permission warning message to the first node, so that the first node resends a data synchronization request to the blockchain nodes other than the second node in the blockchain network.

[0034] The data synchronization processing device based on blockchain also includes:

[0035] A permission setting request verification module, used to receive a permission setting request corresponding to the first node, verify the validity of the permission setting request, and obtain a request verification result corresponding to the permission setting request;

[0036] A data authority range setting module, configured to set a first data authority range for the first node according to a node type and a business type corresponding to the first node if the request verification result indicates that the verification is passed;

[0037] The configuration block chain module is used to encapsulate the first data permission range into a configuration block. If the configuration block reaches a consensus in the blockchain network to which the second node belongs, the configuration block is added to the blockchain stored by the second node.

[0038] Among them, the permission setting request verification module includes:

[0039] A digital signature acquisition unit, used to acquire the digital signature carried by the permission setting request and the node public key corresponding to the first node;

[0040] A summary information acquisition unit, configured to decrypt the digital signature by using a node public key to obtain first summary information corresponding to the digital signature, and perform a hash operation on the permission setting request according to a hash algorithm to obtain second summary information corresponding to the permission setting request;

[0041] The summary information comparing unit is used to determine that the permission setting request verification is passed if the first summary information is the same as the second summary information.

[0042] Among them, the data permission range setting module includes:

[0043] A data synchronization condition determination unit, configured to obtain a node type and a service type corresponding to the first node according to the permission setting request if the request verification result indicates that the verification is passed, and determine T data synchronization conditions matching the node type and the service type; T is a positive integer;

[0044] The data synchronization condition coding unit is used to obtain condition coding information corresponding to T data synchronization conditions, and combine the condition coding information corresponding to the T data synchronization conditions according to the logical relationship between the T data synchronization conditions to obtain the first data authority range corresponding to the first node.

[0045] Among them, the configuration block chain module includes:

[0046] A configuration transaction data encapsulation unit, used to encapsulate the first data permission range into configuration transaction data, and encapsulate the configuration transaction data into a configuration block according to the order of the configuration transaction data in the transaction pool;

[0047] A configuration block consensus unit, used to broadcast the configuration block in the blockchain network to which the second node belongs, so that the blockchain nodes in the blockchain network to which the second node belongs perform consensus processing on the configuration block;

[0048] The configuration block storage unit is used to obtain the number of consensus votes for the configuration block in the blockchain network to which the second node belongs. If the number of consensus votes is greater than or equal to the quantity threshold, it is determined that the configuration block has reached a consensus in the blockchain network to which the second node belongs, and the configuration block is added to the blockchain network stored at the second node.

[0049] On one hand, an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method in one aspect of the embodiment of the present application.

[0050] On one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, the steps of the method in one aspect of the embodiment of the present application are executed.

[0051] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various optional modes of the above-mentioned first aspect.

[0052] In the embodiment of the present application, the second node does not directly send the first synchronization block containing the source transaction data to the first node, but performs data synchronization according to the first data authority range corresponding to the first node and the second data authority range corresponding to the second node. When the second data authority range includes the first data authority range, and the first block height corresponding to the first node is less than the second block height corresponding to the second node, the source transaction data that does not belong to the first data authority in the first synchronization block can be replaced with the transaction identification information to obtain the second synchronization block, and then the source transaction data that does not belong to the first data authority in the first synchronization block is hidden, which can improve data security. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0054] Figure 1 This is a schematic diagram of the architecture of a blockchain network provided in an embodiment of the present application;

[0055] Figure 2 This is a schematic diagram of a blockchain node type provided in an embodiment of the present application;

[0056] Figure 3 This is a schematic diagram of a block synchronization scenario provided by an embodiment of the present application;

[0057] Figure 4 This is a timing diagram of a data synchronization processing method based on blockchain provided in an embodiment of the present application. Figure 1 ;

[0058] Figure 5 This is a schematic diagram of setting the data permission range provided in the embodiment of the present application. Figure 1 ;

[0059] Figure 6 It is a schematic diagram of a data permission scope inclusion relationship provided in an embodiment of the present application;

[0060] Figure 7 This is a timing diagram of a data synchronization processing method based on blockchain provided in an embodiment of the present application. Figure 2 ;

[0061] Figure 8 This is a schematic diagram of a data authority range being uploaded to a chain provided by an embodiment of the present application;

[0062] Fig. 9This is a schematic diagram of setting the data permission range provided in the embodiment of the present application. Figure 2 ;

[0063] Fig.10 It is a schematic diagram of a synchronization block data replacement provided by an embodiment of the present application;

[0064] Fig.11 is a schematic diagram of a hash operation provided in an embodiment of the present application;

[0065] Fig.12 It is a structural schematic diagram of a data synchronization processing device based on blockchain provided in an embodiment of the present application;

[0066] Fig.13 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0067] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0068] The embodiments of the present application mainly involve blockchain technology. Blockchain is a decentralized database with distributed storage characteristics. The data structure in the blockchain is a data structure that organizes data blocks in a time sequence in a manner similar to a linked list. It can safely store data that has a sequential relationship and can be verified within the system, and cryptographically ensure that the data cannot be tampered with or forged.

[0069] The present application also relates to the following concepts in blockchain technology:

[0070] Synchronization: Synchronization is an important process in the blockchain, which can be functionally divided into transaction synchronization and state synchronization. Transaction synchronization can be executed when the transaction is submitted, and it is prioritized to ensure that the transaction can be sent to all blockchain nodes in the blockchain network so that the blockchain nodes can package and process the received transactions. State synchronization can quickly catch up to the highest block height in the entire network through state synchronization when a blockchain node in the blockchain network finds that its own block height lags behind the entire network (for example, the block height of a blockchain node is 5, and the block height of the entire network is 7).

[0071] Consensus: The consensus mechanism (consensus protocol) can ensure that every transaction can be copied and recorded in the same order by all blockchain nodes in the blockchain network; the consensus mechanism can be considered as a multi-party collaboration mechanism, which is used to coordinate the blockchain nodes in the blockchain network to reach a single result that is commonly accepted, and ensure that this process is difficult to be deceived and runs continuously and stably. In the blockchain network, the consensus mechanism can be used to solve the trust problem between blockchain nodes.

[0072] See also Figure 1 , Figure 1 Schematic diagram of the architecture of a blockchain network provided in an embodiment of the present application. A blockchain network can be composed of multiple blockchain nodes, and the embodiment of the present application does not limit the number of blockchain nodes included in the blockchain network. Figure 1 Taking 6 blockchain nodes as an example, each blockchain node in the blockchain network is networked in a peer-to-peer manner, and blockchain nodes can communicate with each other according to the peer-to-peer network protocol. Each blockchain node in the blockchain network follows the broadcast mechanism and consensus mechanism to jointly ensure that the data on the blockchain cannot be tampered with or forged, while realizing the decentralization and trustlessness of the blockchain.

[0073] In the embodiments of the present application, the blockchain node in the blockchain network can be a terminal device, or a server, or a system composed of a terminal device and a server, and the embodiments of the present application do not limit this. The terminal device may include, but is not limited to: a personal computer, a smart phone, a tablet computer, a laptop computer, a PDA, a mobile internet device (MID), a wearable device (such as a smart watch, a smart bracelet, etc.), an intelligent voice interaction device, a smart home appliance (such as a smart TV, etc.), a vehicle-mounted device, an aircraft and other electronic devices, and the present application does not limit the type of the terminal device.

[0074] The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), as well as big data and artificial intelligence platforms.

[0075] like Figure 1As shown in the figure, in a blockchain network, each node is part of the blockchain network and jointly undertakes the work of distributed accounting. Different nodes can have different node types, that is, there can be nodes with different identities in a blockchain network. Among them, the blockchain nodes participating in the consensus are called consensus nodes. Consensus nodes can run blockchain consensus protocols and therefore can participate in the consensus-related work of the blockchain.

[0076] The blockchain network can also include business nodes, which can also be called ordinary nodes. Business nodes are usually used to execute transaction services to obtain transaction data associated with the transaction services. Normally, business nodes do not need to participate in the accounting consensus, but business nodes can obtain block data from other nodes (such as consensus nodes).

[0077] The node type of a blockchain node can be determined based on the consensus algorithm and the properties of the node itself. For ease of description, the present application embodiment takes the consensus algorithm as the Delegated Proof of Stake (DPoS) algorithm as an example to describe the node type classification process.

[0078] Specifically, see Figure 2 , Figure 2 It is a schematic diagram of a blockchain node type provided in an embodiment of the present application. Blockchain nodes can be divided into business nodes, candidate nodes and consensus nodes according to the node type. In an embodiment of the present application, different types of nodes have different data processing permissions. For example, a business node may only be able to synchronize block data and ledger data, and cannot initiate operations such as transactions; a candidate node can synchronize block data and ledger data, and can also initiate transfer transactions. Generally, consensus nodes have relatively high data processing permissions compared to other blockchain nodes in a blockchain network. For example, it can be set that only consensus nodes can initiate transactions such as chain configuration modification and deployment of new contracts.

[0079] like Figure 2 As shown in the figure, when nodes 1, 2, 3, 4, 5 and 6 join the blockchain network, they can become business nodes. Business nodes can become consensus nodes and participate in consensus by providing a certain amount of digital assets in exchange for corresponding rights and interests. If the rights and interests of a node (for example, node 6) are 0, then this node will always be a business node.

[0080] A candidate node refers to a node that intends to become a consensus node. Business nodes can provide digital assets in exchange for corresponding rights and interests. Different digital assets can be exchanged for different rights and interests. Generally, the more digital assets provided, the more rights and interests can be obtained in exchange. When the rights and interests of a business node are greater than the first rights and interests threshold, the business node can become a candidate node. The first rights and interests threshold here can be set according to actual conditions, and this embodiment of the application does not limit this. For ease of understanding, this embodiment of the application takes the example that the first rights and interests threshold can be set to 0. Figure 2 As shown, assuming that the equity of node 1, node 2, node 3 and node 4 is 100, the equity of node 5 is 50, and the equity of node 6 is 0. Assuming that the equity of node 1, node 2, node 3, node 4 and node 5 is greater than the first equity threshold, and node 6 is not greater than the first equity threshold, therefore, node 1, node 2, node 3, node 4 and node 5 can become candidate nodes.

[0081] Candidate nodes can have the opportunity to become consensus nodes by voting. In other words, candidate nodes are eligible to participate in the selection of consensus nodes, while business nodes are not eligible to participate in the selection of consensus nodes. Candidate nodes can participate in the selection of each cycle. If a candidate node fails the selection, then the candidate node will always be a candidate node. When a candidate node passes the selection in a certain cycle, the candidate node can become a consensus node. Figure 2 As shown in the figure, if nodes 1, 2, 3 and 4 pass the selection in a certain cycle, then nodes 1, 2, 3 and 4 can become consensus nodes to participate in the consensus. After a cycle ends, all consensus nodes will become candidate nodes again and wait for the selection of the next cycle.

[0082] Optionally, if the equity of a candidate node is greater than the second equity threshold, and the number of votes is greater than the voting threshold, it can be considered that the candidate node has passed the selection of the consensus node, otherwise it will not pass the selection. Among them, the second equity threshold can be considered as a limit or limit value set for the equity of the node. When the equity of a candidate node is less than or equal to the second equity threshold, it can be considered that the candidate node does not have the equity required to participate in the consensus, and the candidate node cannot become a consensus node. Similarly, the voting threshold can be considered as a limit or limit value set for the number of votes of the node. When the number of votes of the candidate node is less than or equal to the voting threshold, it can be considered that the candidate node does not have the resources required to participate in the consensus (for example, computing power, etc.), and the candidate node cannot become a consensus node. The specific values ​​of the second equity threshold and the voting threshold can be set according to actual conditions, and the embodiments of the present application do not limit this.

[0083] Optionally, in addition to the three types mentioned above, more node types can be set according to the actual application scenarios of the blockchain network through smart contracts and other means. For example, in the EOS blockchain network, consensus nodes with higher rights and interests or higher authority levels than other nodes can be set as super nodes. Compared with nodes in the blockchain network, super nodes usually have higher credibility and usually have more voting rights in the blockchain network.

[0084] The blockchain maintained by the blockchain nodes in the blockchain network can be composed of a series of blocks, which can also be called data blocks. After a block is created, it needs to perform consensus processing in the blockchain network. When the consensus of the block is successful, the block is allowed to be added to the blockchain. The blocks in the blockchain can be connected into a chain structure in the order of creation timestamps from small to large.

[0085] The block can include historical transaction data that has been uploaded to the chain. If the block height of a blockchain node is aligned with the block height of the blockchain network, the blockchain node can trace back the historical transaction data to obtain the latest data status. In other words, the most important basis for evaluating the newness of the transaction data status is the block height of the blockchain. When the block height of a node lags behind the block height of the nodes included in the blockchain network, it means that the data status of the node is not the latest, and block synchronization is required.

[0086] The reasons why a node needs to perform block synchronization may include but are not limited to: ① A node is a newly added blockchain node in the blockchain network; ② A node network fails, resulting in interruption of communication with other nodes in the blockchain network. When the above situations occur, the node needs to perform block synchronization. When a node generates a new block or completes a block synchronization operation, the node can broadcast its latest block height to other nodes in the blockchain network so that other nodes in the blockchain network can detect whether their own block height is the latest. When a node detects that its block height lags behind other nodes, the node needs to perform block synchronization.

[0087] For ease of description, the blockchain node that needs to synchronize blocks in the blockchain network can be called the first node, and the blockchain node that processes the data synchronization request corresponding to the first node can be called the second node. It can be understood that the embodiment of the present application does not limit the node types of the first node and the second node. The first node can be a business node, a candidate node, or a consensus node. For example, the first node can be Figure 2 The node 6 shown may also be the node 5, or may also be the node 4, etc. Similarly, the second node may be a business node or a consensus node. For example, the second node may be Figure 2The node 6 shown may also be the node 1, etc.

[0088] Specifically, the second node can broadcast the current block height of the second node to each node in the block network. When the current block height of the first node is less than the current block height of the second node, the first node can send a data synchronization request to the second node, and the data synchronization request is used to instruct the second node to send the missing block of the first node to the first node. After receiving the data synchronization request from the first node, the second node can determine the required synchronization block based on the current block height of the first node and its own current block height, and then send the synchronization block to the first node. After receiving the synchronization block, the first node can store the synchronization block in the blockchain corresponding to the first node, thereby completing the block synchronization process.

[0089] However, in some specific business scenarios, if the synchronization block containing the source transaction data is directly sent to the first node, it is very likely to cause data leakage of the second node, reducing the data security of the second node. The above-mentioned business scenarios may include but are not limited to medical scenarios, financial scenarios, game scenarios, etc. For example, in the game scenario, the block stored in the blockchain corresponding to the second node may be the source game data containing game website A and game website B, and the first node may be the electronic device corresponding to game website A. If the second node directly sends the synchronization block containing the source game data of game website A and game website B to the first node, it will cause the leakage of the source game data of game website B, reducing data security. For another example, in the medical scenario, the block stored in the blockchain corresponding to the second node may be the source medical diagnosis data containing hospital C and hospital D, and the first node may be the electronic device corresponding to hospital D. If the second node directly sends the synchronization block containing the source medical diagnosis data of hospital C and hospital D to the first node, it will cause the leakage of the source medical diagnosis data of hospital D, reducing data security.

[0090] In order to improve the data security of the second node, in an embodiment of the present application, the source transaction data is not synchronized directly, but data synchronization is performed based on the first data authority range of the first node and the second data authority range of the second node.

[0091] Specifically, see Figure 3 , Figure 3 Schematic diagram of a block synchronization scenario provided by an embodiment of the present application. Figure 3As shown, in the blockchain stored by the second node, blocks 8, 9 and 10 are connected in sequence to form a chain structure. The above 8, 9 and 10 can all be considered as the block height of the block contained in the second node in the blockchain corresponding to the second node. The block height can be used to indicate the number of blocks connected to the blockchain corresponding to the second node. The block height can be considered as the identifier of the block, which can be used to indicate the position of the block in the blockchain corresponding to the second node. The block height of the genesis block in the blockchain corresponding to the second node defaults to 0, the block height of the first block after the genesis block is 1 (the first block can be called block 1), the block height of the second block after the genesis block is 2 (the second block can be called block 2), and so on.

[0092] Among them, each block in the blockchain corresponding to the second node can be divided into two areas, a block header and a block body, in which different information of the block is recorded respectively. For example, the block header of block 8 can include information such as the summary value of the current block 8, the summary value of the previous block 7, and the Merkle root of the current block 8. Optionally, the block header of block 8 can also record the block type of block 8, such as a configuration block or a non-configuration block. The block body of block 8 can include each specific transaction data of the current block 8, and each transaction data can include information such as the transaction type of the transaction data (for example, a contract transaction or a transfer transaction), the node type of the sender of the transaction data, etc. The transaction data in the block body can include but is not limited to: invoice information, business information (for example, medical diagnosis information, insurance policy information, etc.), object information, etc. It can be understood that the definition of the blockchain corresponding to the first node is similar to the definition of the blockchain corresponding to the second node, and will not be repeated here.

[0093] In an embodiment of the present application, the transaction data in the blockchain stored by the second node may include source transaction data or transaction identification information. Source transaction data refers to the original data requested to be published in the blockchain network. If a transaction data in the blockchain network belongs to the second data authority corresponding to the second node, then the transaction data will be stored in the blockchain corresponding to the second node in the form of source transaction data. Transaction identification information may refer to the information obtained after data hiding of the original data, and the transaction identification information may include but is not limited to: hash data, mask data, or other identification information with a mapping relationship with the original data. If a transaction data in the blockchain network does not belong to the second data authority corresponding to the second node, then the transaction data will be stored in the blockchain corresponding to the second node in the form of transaction identification information, thereby improving data security. Similarly, the transaction data in the blockchain stored by the first node may also include source transaction data or transaction identification information. If a transaction data in the blockchain network belongs to the first data authority corresponding to the first node, then the transaction data will be stored in the blockchain corresponding to the first node in the form of source transaction data, otherwise the transaction data will be stored in the blockchain corresponding to the first node in the form of transaction identification information. The method for setting the first data authority range will be described in detail below and will not be repeated here.

[0094] like Figure 3 As shown, assuming that the first node is a blockchain node that has a network failure and recovers from the failure, the current block height of the first node is 8, and the first node knows through broadcast that the current block height of the second node is 10. At this time, the first node detects that its own block height is less than the block height of the second node. Therefore, the first node needs to synchronize blocks. The first node can send a data synchronization request to the second node, and the data synchronization request is used to instruct the second node to send the missing blocks of the first node to the first node. The data synchronization request can carry the current block height of the first node and the first data authority range corresponding to the first node.

[0095] After receiving the data synchronization request from the first node, the second node can compare whether the current block height of the first node is less than the current block height of the second node, and determine whether the second data permission range corresponding to the second node includes the first data permission range. Assuming that the second data permission range includes "TT=trans|CN=PSI" (transaction data with a synchronization transaction type of transfer type, or transaction data with a synchronization contract name of privacy protection set intersection), and the first data permission range includes "TT=trans" (transaction type of synchronization transaction data), the second data permission range includes the first data permission range; assuming that the second data permission range includes "TT=trans|CN=PSI" and the first data permission range includes "TT=contract" (transaction data with a synchronization transaction type of contract type), the second data permission range does not include the first data permission range.

[0096] If the second data permission range includes the first data permission range, and the current block height of the first node is less than the current block height of the second node, it indicates that the second node stores the transaction data that the first node needs to synchronize, and the second node can respond to the data synchronization request of the first node. The second node can obtain the missing blocks of the first node in the blockchain stored by the second node based on the current block height of the first node and its own current block height: block 9 and block 10.

[0097] For ease of description, blocks 9 and 10 that have not undergone data replacement may be referred to as first synchronization blocks, and blocks 9 and 10 that have undergone data replacement may be referred to as second synchronization blocks. The second node may replace the source transaction data that does not fall within the scope of the first data authority in the first synchronization block with transaction identification information to obtain a second synchronization block. For ease of understanding, the present application embodiment takes the transaction identification information as hash data as an example to describe in detail the data replacement process of the first synchronization block.

[0098] like Figure 3 As shown, the first synchronization block contains 6 source transaction data, namely: source transaction data 4, source transaction data 5, source transaction data 6, source transaction data 7, source transaction data 8 and source transaction data 9. Assume that source transaction data 4, source transaction data 5, source transaction data 8 and source transaction data 9 belong to the first data authority scope, and source transaction data 6 and source transaction data 7 do not belong to the first data authority scope. In this case, the first node does not have the authority to synchronize source transaction data 6 and source transaction data 7, and the second node cannot directly send the first synchronization block to the first node. The second node can obtain hash data 1 corresponding to source transaction data 6, and hash data 2 corresponding to source transaction data 7, and then replace source transaction data 6 with hash data 1, and replace source transaction data 7 with hash data 2, so as to obtain the second synchronization block. As shown Figure 3As shown, the transaction data in the second synchronization block may include: source transaction data 4, source transaction data 5, hash data 1, hash data 2, source transaction data 8 and source transaction data 9.

[0099] After obtaining the second synchronization block, the second node can send the second synchronization block to the first node. After receiving the second synchronization block, the first node can add the second synchronization block to the blockchain corresponding to the first node to complete the block synchronization process. Figure 3 As shown, after the second synchronization block storage is completed, the block height of the blockchain corresponding to the first node is 10, which is consistent with the block height of the blockchain corresponding to the second node. At this time, the data status of the first node is the latest status.

[0100] In the embodiment of the present application, the second node does not directly send the first synchronization block containing the source transaction data to the first node, but performs data synchronization according to the first data authority range corresponding to the first node and the second data authority range corresponding to the second node. When the second data authority range includes the first data authority range, and the first block height corresponding to the first node is less than the second block height corresponding to the second node, the source transaction data that does not belong to the first data authority in the first synchronization block can be replaced with the transaction identification information to obtain the second synchronization block, and then the source transaction data that does not belong to the first data authority in the first synchronization block is hidden, which can improve data security.

[0101] See also Figure 4 , Figure 4 This is a timing diagram of a data synchronization processing method based on blockchain provided in an embodiment of the present application. Figure 1 It can be understood that the data synchronization processing method based on blockchain can be performed by a first node (for example, Figure 1 or Figure 2 The corresponding embodiment of the node 5 or node 6, etc.), the second node (for example, Figure 1 or Figure 2 The corresponding node 1 or node 2 in the embodiment) is executed interactively. Figure 4 As shown, the data synchronization processing method based on blockchain may include the following steps S101-S106:

[0102] Step S101: Send a data synchronization request corresponding to the first node.

[0103] The first node sends a data synchronization request to the second node, and correspondingly, the second node receives the data synchronization request corresponding to the first node.

[0104] The data synchronization request is used to instruct the second node to send the missing blocks of the first node to the first node, so that the data state of the first node is synchronized with the blockchain network. The data synchronization request may include the identification information of the first node, the node type and business type of the first node, the first block height of the first node, and the first data permission range of the first node.

[0105] Among them, the identification information of the first node may include but is not limited to: the Internet Protocol (IP) address of the first node, the Media Access Control (MAC) address of the first node and other information; the node type is used to describe the different roles and functions of the node in the blockchain network, and the node type can help distinguish the task division of different nodes. The node type may include: business nodes, candidate nodes, consensus nodes, super nodes and other different types. The functions of each type of node can be found in the above description, and will not be repeated here. The business type is used to describe the specific business handled by the node, and the business type may include medical business, insurance business, game business and other business types. The first block height indicates the block height of the blockchain stored by the first node when sending a data synchronization request. The first data authority range is used to indicate the range of source transaction data in the blockchain network that the first node can synchronize. The first data authority range may refer to a range consisting of information such as conditional values, expressions, logical relationships and parameters. It can be understood that if a transaction data in the blockchain network belongs to the first data authority range corresponding to the first node, then the first node can directly synchronize the original data of the transaction data, otherwise the original data cannot be directly synchronized.

[0106] The first data permission range can be set for the first node by the management node of the blockchain network. The management node can be a node with higher data processing authority in the blockchain network, such as a consensus node or a super node. The first data permission range can be determined according to the node type and business type of the first node. Specifically, multiple data synchronization conditions can be generated according to the node type and business type of the first node, and then the multiple data synchronization conditions can be combined according to the logical relationship between the multiple data synchronization conditions to obtain the first data permission range. Data synchronization conditions refer to some requirements or constraints that need to be met when performing data synchronization.

[0107] Assuming that the first node is a business node and the first node processes medical services, the data synchronization conditions of the first node may include: transaction data whose synchronization transaction type is a transfer type (recorded as data synchronization condition 1); transaction data whose synchronization transaction initiator is a medical organization (recorded as data synchronization condition 2); the logical relationship between data synchronization condition 1 and data synchronization condition 2 is AND logic; then the first data authority scope may be set to: transaction data whose synchronization transaction type is a transfer type and whose transaction initiator is a medical organization. Assuming that the first node is a candidate node and the first node processes game services, transaction data whose synchronization transaction type is a transfer type (recorded as data synchronization condition 3); contract data whose synchronization transaction type is a transfer type (recorded as data synchronization condition 4); transaction data whose synchronization transaction initiator is a game organization (recorded as data synchronization condition 5). The logical relationship between data synchronization condition 3 and data synchronization condition 4 is OR logic, and the logical relationship between data synchronization condition 5 and data synchronization condition 3 and data synchronization condition 4 is AND logic, then the first data authority scope may be set to: transaction data whose synchronization transaction initiator is a game organization.

[0108] The first data permission range can be expressed by an expression. For details, see Figure 5 , Figure 5 This is a schematic diagram of setting the data permission range provided in the embodiment of the present application. Figure 1 .like Figure 5As shown, the first node includes data synchronization conditions 1, data synchronization conditions 2 and data synchronization conditions 3, etc. Data synchronization condition 1 is set as follows: the synchronization transaction type is the transaction data of the transfer type, which can be represented by the expression "TT = trans"; wherein TT (txType) represents the transaction type of the transaction data, the value of TT can be trans, or it can also be contract, trans represents the transaction type of the transaction data is the transfer type, and contract represents the transaction type of the transaction data is the contract type. Data synchronization condition 2 is set as follows: the synchronization contract name is the privacy-preserving set intersection (PSI), and does not contain transaction data whose contract attribute (CA) is a static contract attribute (static), which can be represented by the expression "CN = PSI & CA =! static"; wherein CN (contract name) represents the contract name, the value is the specific contract name, CA (contract attribute) represents the contract attribute, the value is the specific contract attribute, PSI represents the privacy-preserving set intersection, static represents the static attribute; "&" represents the AND logic; "!" represents the non-logic. Data synchronization condition 3 is set as: synchronizing transaction data from organization ORG1, which can be represented by the expression "ORG=ORG1"; wherein ORG (organization) represents organization identification information, and the value is specific organization identification information. Optionally, the data synchronization condition can also be set as: synchronizing transaction data from business nodes, which can be represented by the expression "OR=normal"; wherein OR (organization role) represents the node type, the value is the specific node type, and normal represents the business node.

[0109] Operation rules can be understood as logical relationships, such as Figure 5 As shown, the operation rules may include but are not limited to: AND logic (&), OR logic (|) and NOT logic (!). Among them, "A&B" means that the expression is true when both A and B are true; "A|B" means that the expression is true when either A or B is true; "!A" means not A. The operation rules may also include: IN, NOT, wildcard operation (*), etc. Among them, "IN(A,B)" means that A and B are included; "NOT(A,B)" means that A and B are not included; wildcard operation means that any value is matched.

[0110] Furthermore, the data synchronization condition and the operation rule can be combined to obtain the first data query range. Figure 5As shown, data synchronization condition 1 and data synchronization condition 2 in the data synchronization condition can be combined with the OR logic in the operation rule to obtain the expression "TT=trans|CN=PSI&CA=static", then the first data authority scope can be set to "transaction data with synchronization transaction type as transfer type, or synchronization contract name as PSI, and does not include transaction data with contract attributes as static contract attributes".

[0111] Step S102: receiving a data synchronization request corresponding to the first node, and obtaining a first data authority range corresponding to the first node and a first block height corresponding to the first node according to the data synchronization request.

[0112] When the data synchronization request carries the first data permission range corresponding to the first node and the first block height corresponding to the first node, the second node can obtain the first data permission range and the first block height from the data synchronization request. When the data synchronization request does not carry the first data permission range, after receiving the data synchronization request corresponding to the first node, the second node can obtain the first data permission range and the first block height from the broadcast message of the blockchain network.

[0113] After receiving the data synchronization request from the first node, the second node can compare whether the first block height of the first node is less than the second block height of the second node, and determine whether the second data authority range corresponding to the second node includes the first data authority range. The second data authority range is used to indicate the range of source transaction data in the blockchain network that the second node can synchronize. The setting method of the second data authority range can refer to the setting method of the first data authority range, and will not be repeated here. The second block height represents the block height of the blockchain stored by the second node when receiving the data synchronization request. When the first block height is equal to the second block height, it means that the first node does not need to perform block synchronization; when the first block height is greater than the second block height, it means that the data status of the second node needs to be updated, and the second node cannot provide the first node with the latest transaction data. In the above case, the second node may not respond to the data synchronization request.

[0114] When the second data permission range does not include the first data permission range, it means that the transaction data stored by the second node does not contain the transaction data required by the first node, and the second node does not have the authority to provide synchronization services to the first node. In this case, the second node can generate a permission warning message for the data synchronization request and send the permission warning message to the first node; the permission warning message can be used to indicate that the second node does not have the authority to process the data synchronization request of the first node. After receiving the permission warning message, the first node can resend the data synchronization request to the blockchain nodes other than the second node in the blockchain network, thereby improving the block synchronization efficiency of the first node.

[0115] In a possible implementation, a method for determining the inclusion relationship between a first data authority range corresponding to a first node and a second data authority range corresponding to a second node may include: the second node may obtain a first independent synchronization condition and a first combined synchronization condition for determining the first data authority range, and obtain a second independent synchronization condition and a second combined synchronization condition for determining the second data authority range; if the second independent synchronization condition includes the first independent synchronization condition, and the synchronization subcondition in the first combined synchronization condition includes the synchronization subcondition in the second combined synchronization condition, then it is determined that the second data authority range includes the first data authority range; if the second independent synchronization condition does not include the first independent synchronization condition, or the synchronization subcondition in the second combined synchronization condition includes the synchronization subcondition in the first combined synchronization condition, then it is determined that the second data authority range does not include the first data authority range.

[0116] Among them, the logical relationship between the first independent synchronization condition and the first combined synchronization condition is an OR logic, and the logical relationship between the second independent synchronization condition and the second combined synchronization condition is also an OR logic. The first independent synchronization condition may include one or more independent synchronization conditions. When there are multiple independent synchronization conditions, there is no constraint relationship between the independent synchronization conditions. In other words, the logical relationship between the independent synchronization conditions is an OR logic. The first combined synchronization condition may include multiple synchronization sub-conditions, and there is a constraint relationship between the synchronization sub-conditions. In other words, the logical relationship between the synchronization sub-conditions is an AND logic. Optionally, the first independent synchronization condition and the first combined synchronization condition can be expressed in the form of expressions, arrays, etc. The definition of the first independent synchronization condition and the second independent synchronization condition can refer to the definition of the first independent synchronization condition, and the definition of the second combined synchronization condition can refer to the definition of the first combined synchronization condition, which will not be repeated here.

[0117] See also Figure 6 , Figure 6 Schematic diagram of a data permission scope inclusion relationship provided in an embodiment of the present application. Figure 6 As shown, it is assumed that the second independent synchronization condition includes independent synchronization condition t1 and independent synchronization condition t2; the second combined synchronization condition includes synchronization sub-condition s1, synchronization sub-condition s2 and synchronization sub-condition s3; the first independent synchronization condition includes independent synchronization condition t1; the first combined synchronization condition includes synchronization sub-condition s1, synchronization sub-condition s2 and synchronization sub-condition s3. In this case, it can be determined that the second independent synchronization condition includes the first independent synchronization condition, and the synchronization sub-condition in the first combined synchronization condition includes the synchronization sub-condition in the second combined synchronization condition, so the second data authority range includes the first data authority range.

[0118] Assume that the second independent synchronization condition includes independent synchronization condition t1 and independent synchronization condition t2; the second combined synchronization condition includes synchronization sub-condition s1, synchronization sub-condition s2 and synchronization sub-condition s3; the first independent synchronization condition includes independent synchronization condition t1; the first combined synchronization condition includes synchronization sub-condition s1, synchronization sub-condition s2, synchronization sub-condition s3 and synchronization sub-condition s4. Similarly, it can also be determined that the second independent synchronization condition includes the first independent synchronization condition, and the synchronization sub-condition in the first combined synchronization condition includes the synchronization sub-condition in the second combined synchronization condition, so the second data authority range includes the first data authority range.

[0119] Assume that the second independent synchronization condition includes independent synchronization condition t1 and independent synchronization condition t2; the second combined synchronization condition includes synchronization sub-condition s1, synchronization sub-condition s2 and synchronization sub-condition s3; the first independent synchronization condition includes independent synchronization condition t1; the first combined synchronization condition includes synchronization sub-condition s1 and synchronization sub-condition s2. In this case, it can be determined that the second independent synchronization condition includes the first independent synchronization condition; but the synchronization sub-condition in the second combined synchronization condition includes the synchronization sub-condition in the first combined synchronization condition, that is, the synchronization sub-condition in the first combined synchronization condition does not include the synchronization sub-condition in the second combined synchronization condition, and therefore the second data authority range does not include the first data authority range.

[0120] Assume that the second independent synchronization condition includes independent synchronization condition t1 and independent synchronization condition t2; the second combined synchronization condition includes synchronization sub-condition s1, synchronization sub-condition s2 and synchronization sub-condition s3; the first independent synchronization condition includes independent synchronization condition t1 and independent synchronization condition t3; the first combined synchronization condition includes synchronization sub-condition s1, synchronization sub-condition s2 and synchronization sub-condition s3. In this case, it can be determined that the synchronization sub-condition in the first combined synchronization condition includes the synchronization sub-condition in the second combined synchronization condition, but the second independent synchronization condition does not include the first independent synchronization condition, so the second data authority range does not include the first data authority range.

[0121] Step S103: If the second data authority range corresponding to the second node includes the first data authority range, and the first block height is less than the second block height corresponding to the second node, then according to the first block height and the second block height, obtain the first synchronization block in the blockchain stored by the second node.

[0122] When the second data authority range includes the first data authority range, and the first block height is less than the second block height corresponding to the second node, it means that the first node needs to synchronize blocks, and the second node can provide synchronization services to the first node. The first synchronization block may include source transaction data or transaction identification information. Source transaction data refers to the original data requested to be published in the blockchain network. If a transaction data in the first synchronization block belongs to the second data authority range, then the transaction data will be stored in the first synchronization block in the form of source transaction data. Transaction identification information may refer to information obtained after data hiding of the original data. The transaction identification information may include but is not limited to: hash data, mask data, or other identification information that has a mapping relationship with the original data. If a transaction data in the first synchronization block does not belong to the second data authority range, then the transaction data will be stored in the first synchronization block in the form of transaction identification information.

[0123] In the embodiment of the present application, the first block height is M, the second block height is N, M and N are both positive integers, the specific value of M can be 1, 2, 3, 4..., the specific value of N can be 1, 2, 3, 4, 5...; the method of obtaining the first synchronization block can specifically include: if the second data authority range corresponding to the second node includes the first data authority range, and the first block height M is less than the second block height N corresponding to the second node, then in the blockchain stored by the second node, the block corresponding to the block height M+1 to the second block height N is determined as the first synchronization block. Assuming that the value of M is 8 and the value of N is 10, the first synchronization block is the block composed of block 9 and block 10.

[0124] Step S104: replace the source transaction data in the first synchronization block that does not belong to the first data authority range with the transaction identification information to obtain a second synchronization block; the second synchronization block includes the source transaction data in the first synchronization block that belongs to the first data authority range.

[0125] Optionally, a mapping relationship table between the source transaction data and the transaction identification information in the blockchain stored by the second node can be created in the second node, and the source transaction data and the transaction identification information correspond one to one, that is, one source transaction data uniquely corresponds to one transaction identification information. After obtaining the first synchronization block, the source transaction data that does not belong to the first data authority range can be screened out from the first synchronization block and determined as the transaction data to be processed; the transaction identification information that has a mapping relationship with the transaction data to be processed is queried from the mapping relationship table, and then the source transaction data that does not belong to the first data authority range in the first synchronization block is replaced with the transaction identification information to obtain the second synchronization block. In other words, the data of the second synchronization block includes the source transaction data in the first synchronization block that belongs to the first data authority range, and the transaction identification information.

[0126] Step S105: Send a second synchronization block.

[0127] Step S106: Add the second synchronization block to the blockchain stored by the first node.

[0128] The second node sends the second synchronization block to the first node, and correspondingly, the first node receives the second synchronization block sent by the second node. Normally, when the synchronization module of the first node receives the second synchronization block, it is necessary to verify the signature of the second synchronization block, and after the signature verification is passed, the second synchronization block is synchronized. In an embodiment of the present application, since the second synchronization block is very likely not all source transaction data, when verifying the signature of the second synchronization block, it may not be possible to generate a read-write set by reading each transaction data in the second synchronization block. Therefore, the first node needs to have 100% trust in the read-write set that comes with the second synchronization block.

[0129] In the embodiment of the present application, after receiving the second synchronization block, the second synchronization block can be broadcasted in the blockchain network, so that the remaining nodes in the blockchain network can perform consensus verification on the second synchronization block according to the consensus algorithm. When the second synchronization block consensus is passed, the second synchronization block can be formally put on the chain. After the second synchronization block is passed by consensus, the block height of the second synchronization block can be updated according to the first block height, and the updated second synchronization block is stored in the local database of the first node. Assuming that the first block height is 8 and the second synchronization block contains 2 blocks, then the block height of the blockchain corresponding to the first node is updated to 10, which is consistent with the block height of the blockchain corresponding to the second node, and the first node completes the block synchronization process.

[0130] In the embodiment of the present application, the second node does not directly send the first synchronization block containing the source transaction data to the first node, but performs data synchronization according to the first data authority range corresponding to the first node and the second data authority range corresponding to the second node. When the second data authority range includes the first data authority range, and the first block height corresponding to the first node is less than the second block height corresponding to the second node, the source transaction data that does not belong to the first data authority in the first synchronization block can be replaced with the transaction identification information to obtain the second synchronization block, and then the source transaction data that does not belong to the first data authority in the first synchronization block is hidden, which can improve data security.

[0131] See also Figure 7 , Figure 7 This is a timing diagram of a data synchronization processing method based on blockchain provided in an embodiment of the present application. Figure 2 It can be understood that the data synchronization processing method based on blockchain can be performed by a first node (for example, Figure 1 or Figure 2 The corresponding embodiment of the node 5 or node 6, etc.), the second node (for example, Figure 1 or Figure 2 The corresponding embodiment of the node 1 or node 2), the third node (for example, Figure 1 or Figure 2 The corresponding node 3 or node 4 in the embodiment) is executed interactively. Figure 7 As shown, the data synchronization processing method based on blockchain may include the following steps S201-S217:

[0132] Step S201: Sending a permission setting request corresponding to the first node to the second node.

[0133] In an embodiment of the present application, the first node may be a new node that has just joined the blockchain network. Before performing data synchronization, the new node may apply to the management node for the first data authority range corresponding to the first node; the second node may be the management node; the authority setting request may be used to instruct the second node to set the first data authority range corresponding to the first node.

[0134] Step S202: receiving a permission setting request corresponding to the first node, performing validity verification on the permission setting request, and obtaining a request verification result corresponding to the permission setting request.

[0135] See also Figure 8 , Figure 8 This is a schematic diagram of a data authority range chain provided by an embodiment of the present application. Figure 8 As shown, after the second node receives the permission setting request sent by the first node, it can verify the validity of the permission setting request, and the validity verification may include a signature verification process. For example, the second node can obtain the digital signature carried by the permission setting request and the node public key corresponding to the first node; decrypt the digital signature by the node public key to obtain the first summary information corresponding to the digital signature, perform a hash operation on the permission setting request according to the hash algorithm, and obtain the second summary information corresponding to the permission setting request; if the first summary information is the same as the second summary information, it is determined that the permission setting request has been verified.

[0136] In other words, in order to prevent the transaction data containing the permission setting request from being maliciously tampered with during transmission, the first node can generate a key pair (including a node private key and a node public key, the node private key is managed by the first node itself, or entrusted to a specific service for management, and the node public key can be notified to all blockchain nodes in the blockchain network), the first node can use a hash algorithm to perform a hash operation on the permission setting request (which can also be understood as the transaction data containing the permission setting request), generate a first summary information corresponding to the permission setting request, and use the generated node private key to encrypt the first summary information, and the encrypted first summary information is the digital signature corresponding to the permission setting request.

[0137] The first node sends a permission setting request carrying a digital signature to the second node. After receiving the permission setting request carrying the digital signature, the second node can obtain the node public key corresponding to the first node, decrypt the digital signature through the node public key, and obtain the first summary information corresponding to the digital signature; then perform a hash operation on the permission setting request received by the second node according to the hash algorithm (i.e., the hash algorithm used by the first node when generating the digital signature) to obtain the second summary information corresponding to the received permission setting request. If the first summary information is the same as the second summary information, it means that the permission setting request has not been tampered with during the upload process, and the signature verification passes, that is, it is determined that the permission setting request has been verified. If the first summary information is different from the second summary information, it means that the permission setting request may have been tampered with during the upload process, and the signature verification fails, that is, the request verification result corresponding to the permission setting request indicates that the verification has failed.

[0138] It should be understood that before the first node sends a permission setting request to the second node, it has notified the second node in the blockchain network of the node public key and the hash algorithm used to generate the digital signature. If the permission setting request is tampered with during the upload process, the digital signature received by the second node is not the digital signature originally generated by the first node. When the second node uses the node public key corresponding to the first node to decrypt the digital signature, it cannot be solved. Among them, the hash algorithm may include but is not limited to SM3, SM4, SHA-1, SHA-224, SHA-256, SHA-384 and SHA-512.

[0139] Optionally, the validity verification may also include an initial authority verification process. The authority setting request may carry the node type and business type of the first node, as well as the initial data authority range provided by the first node. When the second node receives the authority setting request, it may verify the initial data authority range according to the node type and business type of the first node. For example, the first node is a business node and can only synchronize transaction data of the transfer type. If the initial data authority range is set to "TT=trans", the initial data authority range verification passes; if the initial data authority range is set to "TT=contract", the initial data authority range fails the verification. When the initial data authority range passes the verification, the initial data authority range can be determined as the first data authority range.

[0140] Step S203: If the request verification result indicates that the verification is passed, a first data permission range is set for the first node according to the node type and business type corresponding to the first node.

[0141] like Figure 8 As shown, when the verification result corresponding to the permission setting request indicates that the verification is passed, the first data permission range can be set for the first node. In one possible implementation, the setting method of the first data permission range may include: if the request verification result indicates that the verification is passed, the second node can obtain the node type and business type corresponding to the first node according to the permission setting request, and determine T data synchronization conditions that match the node type and business type; T is a positive integer, and the specific value of T can be 1, 2, 3, 4... The process of obtaining the data synchronization conditions can refer to the above description and will not be repeated here. Furthermore, the second node can obtain the conditional coding information corresponding to the T data synchronization conditions, and according to the logical relationship between the T data synchronization conditions, the conditional coding information corresponding to the T data synchronization conditions is combined to obtain the first data permission range corresponding to the first node. T here can be an integer greater than 1.

[0142] Multiple data synchronization conditions can be combined into a data synchronization logical structure according to the logical relationship between the multiple data synchronization conditions. Optionally, the first data permission range can also be represented by the data synchronization logical structure. Fig. 9 , Fig. 9 This is a schematic diagram of setting the data permission range provided in the embodiment of the present application. Figure 2 .like Fig. 9As shown, the expression of the data synchronization logic structure is "TT=IN(trans,config)|CN=PSI&CA=static", which means that the synchronization transaction type is the transaction data of the configuration type (config) or the transfer type, or the synchronization contract name is PSI, and does not contain transaction data whose contract attributes are static contract attributes. It can be understood that when setting the expression of the data synchronization logic structure, some parameters may be discarded or abbreviated. For example, the expression "TT=IN(trans,config)|CN=PSI&CA=static" only contains the values ​​of CN and CA. When the second node parses the above expression, it needs to parse out "CN=PSI&CA=static" to indicate that the transaction data of the contract type needs to be synchronized. Therefore, the expression of the data synchronization logic structure can be completed according to the actual situation.

[0143] It is understandable that the expression of the data synchronization logic structure may not be a simple expression, but a comprehensive expression of multiple expressions. For example, when the expression contains "IN(a,b,c)", it is necessary to replace "IN(a,b,c)" with a basic expression. That is, "TT=IN(a,b,c)" can be replaced with

[0144] "TT=IN(trans,config)|CN=PSI&CA=static" can be replaced by "TT=trans|TT=config|TT=contract&CN=PSI&CA=static". At this time, the data synchronization conditions contained in the data synchronization logic structure can be quickly parsed from the expression, for example, "TT=trans", "TT=config", "TT=contract", "CN=PSI" and "CA=static" are data synchronization conditions.

[0145] The second node may generate conditional coding information corresponding to the data synchronization condition, and the conditional coding information may be used to identify the corresponding data synchronization condition. The data synchronization condition and the conditional coding information have a one-to-one mapping relationship, that is, one data synchronization condition uniquely corresponds to one conditional coding information. Fig. 9As shown, the conditional coding information corresponding to the data synchronization condition "TT=trans" is 1, the conditional coding information corresponding to the data synchronization condition "TT=config" is 2, the conditional coding information corresponding to the data synchronization condition "TT=contract" is 3, the conditional coding information corresponding to the data synchronization condition "CN=PSI" is 4, and the conditional coding information corresponding to the data synchronization condition "CA=static" is 5. According to the logical relationship between the data synchronization conditions, the conditional coding information corresponding to each data synchronization condition can be combined to obtain the synchronization permission expression "1|2|3&4&5".

[0146] Furthermore, a synchronization permission array corresponding to the synchronization permission expression can be generated, and the first data permission range is represented by the synchronization permission array. For example, the synchronization permission array corresponding to the synchronization permission expression "1|2|3&4&5" can be "[1][2][3,4,5]". It can be understood that if the logical relationship between the two conditional coding information is OR logic, then the two conditional coding information are values ​​corresponding to different indexes of the synchronization permission array; if the logical relationship between the two conditional coding information is AND logic, then the values ​​corresponding to the index of the same data. Therefore, when the synchronization permission expression "1|2|3&4&5" generates the synchronization permission array, "1|2" in the synchronization permission expression will generate the first two values ​​"[1][2]" in the synchronization permission array, and the third value of the synchronization permission array is "[3,4,5]". The synchronization permission array finally generated is: "[1][2][3,4,5]", and the first data permission range is represented by the synchronization permission array. It can be understood that the setting method of the second data permission range corresponding to the second node can refer to the setting method of the first data permission range, which will not be repeated here.

[0147] Step S204: Encapsulate the first data permission range into a configuration block. If a consensus is reached on the configuration block in the blockchain network to which the second node belongs, add the configuration block to the blockchain stored by the second node.

[0148] like Figure 8 As shown, the second node can encapsulate the first data permission range into configuration transaction data, and store the configuration transaction data in the transaction pool corresponding to the second node.

[0149] The second node can obtain the smart contract and deploy the smart contract in the blockchain corresponding to the second node by initiating a transaction. Smart contracts can be computer program codes. Developers can use smart contract high-level languages ​​to write them. The compiler can compile the contracts written in the high-level language into bytecodes in the virtual machine of the blockchain node, and the virtual machine can be used to interpret and execute the bytecodes in the smart contract. Smart contract high-level languages ​​include but are not limited to Solidity (a smart contract programming language), Serpent (a smart contract programming language), and LLL (a smart contract programming language). For example, developers can use Solidity to write data contracts and business contracts, and use the compiler to compile the data contracts and business contracts written in Solidity into virtual machine bytecodes respectively, and then submit the compiled virtual machine bytecodes to the blockchain network along with the configured transaction data and upload them to the chain.

[0150] Specifically, the second node can execute the contract code in the smart contract in the virtual machine. The contract code can automatically determine whether the current scenario meets the contract triggering conditions, and strictly execute the contract response rules. It determines whether the configuration transaction data is valid according to the execution result of the contract code. When the configuration transaction data is verified to be valid, the configuration transaction data can be encapsulated into a configuration block according to the order of the configuration transaction data in the transaction pool; the configuration block can contain other configuration transaction data in the transaction pool, that is, in addition to packaging the configuration transaction data corresponding to the first node, the remaining configuration transaction data can also be packaged, for example, the configuration transaction data corresponding to the third node

[0151] Furthermore, the configuration block can be broadcasted in the blockchain network to which the second node belongs, so that all consensus nodes in the blockchain network can receive the configuration block, and the consensus nodes in the blockchain network can perform consensus processing on the received configuration block. For example, each transaction data contained in the configuration block can be verified, and the second node can be verified, etc. After the consensus node obtains the verification result for the configuration block, the verification result can be broadcasted in the blockchain network. Under normal network communication, all nodes in the blockchain network can obtain the verification result of each consensus node for the configuration block.

[0152] The second node can count the verification results corresponding to each consensus node, and obtain the number of consensus votes for the configuration block in the blockchain network, that is, the number of nodes whose verification results for the configuration block in the business blockchain network are verified; if the number of consensus votes is greater than or equal to the quantity threshold (the quantity threshold here can be determined based on the consensus algorithm used in the blockchain network, such as the quantity threshold can be set to 2 / 3 of the number of consensus nodes included in the blockchain network), it can be determined that the configuration block has reached a consensus in the blockchain network, and then the configuration block can be added to the blockchain network stored in the second node. Among them, the consensus algorithm may include but is not limited to: Proof of Work (PoW) algorithm, Proof of Stake (PoS) algorithm, DPoS algorithm, Practical Byzantine Fault Tolerance (PBFT) algorithm and other consensus algorithms, and this application does not limit this.

[0153] Optionally, if the number of consensus votes is less than the quantity threshold, it can be determined that no consensus has been reached on the contract block in the blockchain network, and the first data authority range can be determined as a publishing failure state, and an alarm prompt message corresponding to the first data authority range can be generated, and the alarm prompt message can be returned to the first node, so that the first node resends the permission setting request according to the alarm prompt message.

[0154] When the configuration block consensus is passed, the configuration block can be formally put on the chain, that is, after the configuration block consensus is passed, the block height of the configuration block can be updated according to the maximum block height in the blockchain stored by the second node, and the updated configuration block is stored in the local database of the second node. At this time, the updated configuration block is block N+i in the local database of the second node. N+i is used to characterize the block sequence of the updated configuration block in the local blockchain, and N and i are both integers greater than or equal to 0. At this time, the deployment and chaining process of the first data authority range is completed in the blockchain corresponding to the second node, that is, the first data authority range is successfully chained in the blockchain, which can be represented as the first data authority range is successfully published in the blockchain network, and the nodes in the blockchain network can obtain the first data authority range.

[0155] Step S205: Send a data synchronization request corresponding to the first node to the second node.

[0156] After the first data authority range corresponding to the first node is set, the first node may send a data synchronization request corresponding to the first node to the second node, and correspondingly, the second node receives the data synchronization request corresponding to the first node.

[0157] Step S206: Send a data synchronization request corresponding to the first node to the third node.

[0158] It is understandable that the first node may also send a data synchronization request corresponding to the first node to the third node, and accordingly, the third node receives the data synchronization request corresponding to the first node. The third node is a node other than the second node and the first node in the blockchain network. The third node may be a business node, a consensus node, or a super node. The embodiment of the present application does not limit the node type of the third node.

[0159] Optionally, the third node may also be a node with a hierarchical relationship with the first node. For example, the third node may be the superior node of the first node. In this case, the third node is likely to store transaction data that the first node needs to synchronize. Therefore, the first node may send data synchronization requests to multiple nodes in the blockchain network, thereby improving the block synchronization efficiency of the first node.

[0160] It is understandable that the embodiment of the present application does not limit the execution order of step S205 and step S206. The first node can execute step S205 and step 206 simultaneously, or execute step S206 first and then step 205, or execute step S205 first and then step 206.

[0161] Step S207: receiving a data synchronization request corresponding to the first node, storing the data synchronization request in a message queue corresponding to the second node, and updating a processing status of the data synchronization request according to a storage position of the data synchronization request in the message queue corresponding to the second node.

[0162] Assume that there are 5 storage locations in the message queue corresponding to the second node, namely storage location 1, storage location 2, storage location 3, storage location 4 and storage location 5. Storage location 1 represents a message whose processing status is execution status, and storage location 2, storage location 3, storage location 4 and storage location 5 represent messages whose processing status is execution status. When the second node receives a data synchronization request corresponding to the first node, the second node can detect whether the number of messages in the message queue is less than 5. If it is less than 5, the second node can store the received data synchronization request corresponding to the first node in the message queue corresponding to the second node. If the number of messages is greater than or equal to 5, a busy prompt message can be sent to the first node. The busy prompt message is used to indicate that the current second node is busy and there are not enough free resources to process the data synchronization request corresponding to the first node.

[0163] For the messages stored in the message queue, the second node can process the messages in the message queue based on the storage position of each message in the message queue, such as the messages stored in the message queue first can be processed first, and the messages stored in the message queue later can be processed later. When the processing status of the message located in storage position 1 is updated from the execution status to the completion status, the message can be deleted from the message queue, and the message currently located in the message queue is moved forward by one storage position, and the processing status of the message located in storage position 1 after the move is updated to the execution status.

[0164] Step S208: Receive a data synchronization request corresponding to the first node, store the data synchronization request in the message queue corresponding to the third node, and update the processing status of the data synchronization request according to the storage position of the data synchronization request in the message queue corresponding to the third node.

[0165] The specific implementation process of step S208 can refer to the description of the aforementioned step S207, which will not be repeated here.

[0166] Step S209: If it is detected that the processing status corresponding to the data synchronization request is updated to the execution status, an execution prompt message for the data synchronization request is generated.

[0167] Step S210: broadcast an execution prompt message.

[0168] When it is detected that the processing status corresponding to the data synchronization request is updated to the execution status, it indicates that the second node starts to process the data synchronization request corresponding to the first node. In order to avoid other nodes (for example, the third node) in the blockchain network from repeatedly processing the data synchronization request corresponding to the first node, the second node can generate an execution prompt message for the data synchronization request, and the execution prompt message is used to indicate that the second node is processing the data synchronization request corresponding to the first node. The second node can broadcast the execution prompt message in the blockchain network, and all nodes in the blockchain network can obtain the execution prompt message. The node that receives the data synchronization request corresponding to the first node can clear the data synchronization request corresponding to the first node in the message queue according to the execution prompt message to save resources.

[0169] Step S211: receiving an execution prompt message, and clearing a data synchronization request in a message queue corresponding to the third node.

[0170] When the third node receives the execution prompt message through broadcasting, the data synchronization request of the first node can be cleared from the message queue corresponding to the third node to save resources.

[0171] Step S212: Obtain a first data permission range corresponding to the first node and a first block height corresponding to the first node according to the data synchronization request.

[0172] The specific implementation process of step S212 can be found in the above Figure 4 The description of step S102 in the corresponding embodiment will not be repeated here.

[0173] Step S213: Obtain the block type corresponding to the first synchronization block from the block header of the first synchronization block.

[0174] See also Fig.10 , Fig.10 Schematic diagram of a synchronous block data replacement provided by an embodiment of the present application. Fig.10 As shown, blocks can be divided into configuration (config) blocks and non-configuration (transaction) blocks according to block type, wherein configuration blocks are mainly used to store configuration transaction data, and non-configuration blocks are mainly used to store transaction data of transfer type and contract type. The block type of each block can be recorded in the block header of the block, so the block type corresponding to the first synchronization block can be obtained by parsing the block header of the first synchronization block. Fig.10 As shown, assuming that the first synchronization block includes block 4 and block 5, by parsing the block headers of block 4 and block 5, it can be determined that the block type corresponding to block 4 is a configuration block type, and the block type corresponding to block 5 is a non-configuration block type.

[0175] Step S214: If the block type corresponding to the first synchronization block is the configuration block type, it is determined that the first synchronization block belongs to the first data authority range, and the first synchronization block is determined as a second synchronization block.

[0176] like Fig.10 As shown, assuming that the block body of block 4 includes source transaction data tx1: type = contract (transaction data with a transaction type of contract type), contact name = B (transaction data with a contract name of B), sender org = org2 (transaction data uploaded by organization 2), sender role = super (transaction data uploaded by a super node), and source transaction data tx2: type = contract, contact name = A (transaction data with a contract name of B), sender org = org1, (transaction data uploaded by organization 1), sender role = normal (transaction data uploaded by a business node). Since the block type corresponding to block 4 is a configuration block type, it is determined that the transaction data contained in block 4 belongs to the first data authority range. In this case, the source transaction data tx1 and the source transaction data tx2 in block 4 are not replaced, but the source transaction data tx1 and the source transaction data tx2 in block 4 are retained in the second synchronization block.

[0177] Step S215: If the block type corresponding to the first synchronization block is a non-configuration block type, the source transaction data in the block body of the first synchronization block that does not belong to the first data authority range is determined as transaction data to be processed, and the hash data corresponding to the transaction data to be processed is obtained, and the transaction data to be processed is replaced with the hash data, and the first synchronization block after the data is replaced is determined as the second synchronization block.

[0178] like Fig.10 As shown, assuming that the first data authority range includes: "TT=trans&OR=super" (synchronizing transaction data uploaded from a super node and whose transaction type is a transfer type), the block body of block 5 includes source transaction data tx3: type=trans (transaction data whose transaction type is a transfer type), contact name=B, sender org=org1, sender role=super, and source transaction data tx4: type=contract, contact name=A, sender org=org2, sender role=normal. Since the block type corresponding to block 5 is a non-configured block type, the source transaction data tx4 that does not belong to the first data authority range can be screened out from the block body of block 5 and determined as the data to be traded; then, the hash data hx4 corresponding to the data to be traded can be obtained, and the source transaction data tx4 can be replaced with the hash data hx4, and the source transaction data tx3 can be retained in the second synchronization block. As shown Fig.10 As shown, the transaction data of the second synchronization block includes source transaction data tx1, source transaction data tx2, source transaction data tx3 and hash data hx4.

[0179] In a possible implementation, the method for obtaining the hash data corresponding to the transaction data to be processed may include: performing data padding on the transaction data to be processed to obtain the padding transaction data, splitting the padding transaction data to obtain P segmented transaction data; P is an integer greater than 1; the specific value of P may be 2, 3, 4, .... Obtain the i-th input data of the compression function; when i is 1, the i-th input data includes the initial compression value and the first segmented transaction data in the P segmented transaction data; when i is not 1, the i-th input data includes the i-1-th output data of the compression function and the i-th segmented transaction data in the P segmented transaction data; i is a positive integer less than or equal to P, and the specific value of i may be 2, 3, 4, ... P; and then the i-th output data corresponding to the compression function may be determined according to the i-th input data and the compression function, and the P-th output data corresponding to the compression function may be determined as the hash data corresponding to the transaction data to be processed. Wherein, the compression function is a function used to compress the input data block into hash data of a fixed length. The initial compression value is the initial state or starting value of the compression function, and its specific value can be determined according to actual conditions. The compression function may include but is not limited to: circular left shift function, modular addition function, XOR function, Boolean function, permutation function and other functions.

[0180] See also Fig.11 , Fig.11 Schematic diagram of a hash operation provided by an embodiment of the present application. Fig.11 As shown, after obtaining the transaction data to be processed, the second node can fill the transaction data to be processed to obtain the filled transaction data. Optionally, to ensure data consistency, the transaction data to be processed can be formatted first, for example, the transaction data to be processed can be converted into binary or hexadecimal, etc. The second node can add the number "1" to the end of the transaction data to be processed, and then add k numbers "0", where k is the smallest non-negative integer that satisfies I+1+k≡448mod512, I bits are the length of the transaction data to be processed, ≡ represents congruence, and mod represents modulo operation. Then add a 64-bit bit string of filling data, which is a binary representation of the length I, and finally obtain a positive integer multiple of 512, that is, the number of bits of the filled transaction data is 512*P.

[0181] Furthermore, the 512*P-bit padded transaction data can be split into 512-bit segments to obtain P segmented transaction data, namely segmented transaction data 1, segmented transaction data 2, ..., segmented transaction data P, each of which is 512 bits. Fig.11As shown, the initial compression value and P segmented transaction data can be substituted into the compression function and P iterative operations are performed. In the first iterative operation, the compression function input data includes the initial compression value and the segmented transaction data 1; in subsequent iterative operations, the compression function input data includes the output data of the previous compression function and the segmented transaction data corresponding to this iterative operation, and the output data of the Pth iterative operation is determined as the hash data corresponding to the transaction data to be processed.

[0182] Optionally, after obtaining P segmented transaction data, each of the P segmented transaction data can be expanded into 132 message words, wherein the first 16 message words (w1-w16) of each segmented transaction data are generated based on 512 bits of data in a segmented transaction data, and one message word is 32 bytes. The subsequent 17th to 132nd message words are generated based on the permutation function expansion, wherein the permutation algorithm used to generate the 17th to 68th message words is different from the permutation function used to generate the 69th to 132nd message words. Finally, segmented transaction data 1 is expanded into extended transaction data 1, segmented transaction data 2 is expanded into extended transaction data 2, ..., and segmented transaction data P is expanded into extended transaction data P. The initial compression value IV is stored in the word register ABCDEFGH, the initial compression value and P extended transaction data are substituted into the compression function, and P iterations are performed. The calculation result of each iteration is used as the initial compression value of the next compression function, and finally the splicing result of the 256-bit word register ABCDEFGH is obtained. The 256-bit splicing result is determined as the hash data corresponding to the transaction data to be processed.

[0183] Step S216: Send the second synchronization block.

[0184] Step S217: Add the second synchronization block to the blockchain stored by the first node.

[0185] The specific implementation process of step S216 and step S217 can be found in the above Figure 4 The description of step S105 and step S106 in the corresponding embodiment will not be repeated here.

[0186] In the embodiment of the present application, the second node does not directly send the first synchronization block containing the source transaction data to the first node, but performs data synchronization according to the first data authority range corresponding to the first node and the second data authority range corresponding to the second node. When the second data authority range includes the first data authority range, and the first block height corresponding to the first node is less than the second block height corresponding to the second node, the source transaction data that does not belong to the first data authority in the first synchronization block can be replaced with the transaction identification information to obtain the second synchronization block, and then the source transaction data that does not belong to the first data authority in the first synchronization block is hidden, which can improve data security.

[0187] It is understandable that in the specific implementation of this application, relevant information of the user in the blockchain (for example, the user's business data in the blockchain, etc.) may be involved. When the above embodiments of this application are applied to specific products or technologies, the user's permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0188] See also Fig.12 , Fig.12 1 is a schematic diagram of a data synchronization processing device based on blockchain provided in an embodiment of the present application. It can be understood that the data synchronization processing device based on blockchain 1 can be applied to a second node in a blockchain network, such as Fig.12 As shown, the blockchain-based data synchronization processing device 1 may include a data synchronization request receiving module 11, a first synchronization block acquisition module 12, a second synchronization block acquisition module 13, and a synchronization block sending module 14, wherein:

[0189] The data synchronization request receiving module 11 is used to receive a data synchronization request corresponding to the first node, and obtain a first data authority range corresponding to the first node and a first block height corresponding to the first node according to the data synchronization request;

[0190] A first synchronization block acquisition module 12 is used to acquire the first synchronization block in the blockchain stored in the second node according to the first block height and the second block height if the second data authority range corresponding to the second node includes the first data authority range and the first block height is less than the second block height corresponding to the second node;

[0191] The second synchronization block acquisition module 13 is used to replace the source transaction data in the first synchronization block that does not belong to the first data authority range with the transaction identification information to obtain a second synchronization block; the second synchronization block includes the source transaction data in the first synchronization block that belongs to the first data authority range;

[0192] The synchronization block sending module 14 is used to send the second synchronization block to the first node, so that the first node adds the second synchronization block to the blockchain stored by the first node.

[0193] The specific functional implementation of the data synchronization request receiving module 11, the first synchronization block acquisition module 12, the second synchronization block acquisition module 13, and the synchronization block sending module 14 can be found in Figure 4 Steps S102 to S105 in the corresponding embodiment will not be described in detail here.

[0194] In a possible implementation, the blockchain-based data synchronization processing device 1 may further include: a synchronization condition acquisition module 15, a first authority scope determination module 16, and a second authority scope determination module 17, wherein:

[0195] A synchronization condition acquisition module 15, configured to acquire a first independent synchronization condition and a first combined synchronization condition for determining a first data authority range, and to acquire a second independent synchronization condition and a second combined synchronization condition for determining a second data authority range;

[0196] A first authority range determining module 16, configured to determine that the second data authority range includes the first data authority range if the second independent synchronization condition includes the first independent synchronization condition and the synchronization sub-condition in the first combined synchronization condition includes the synchronization sub-condition in the second combined synchronization condition;

[0197] The second authority scope determination module 17 is used to determine that the second data authority scope does not include the first data authority scope if the second independent synchronization condition does not include the first independent synchronization condition, or the synchronization sub-condition in the second combined synchronization condition includes the synchronization sub-condition in the first combined synchronization condition.

[0198] The specific functional implementation of the synchronization condition acquisition module 15, the first authority range determination module 16, and the second authority range determination module 17 can be found in Figure 4 Step S102 in the corresponding embodiment will not be described in detail here.

[0199] In a possible implementation, the first block height is M, the second block height is N, and both M and N are positive integers; the first synchronization block acquisition module 12 may include a first block determination unit 121, wherein:

[0200] The first block determination unit 121 is used to determine the block corresponding to the block height M+1 to the second block height N as the first synchronization block in the blockchain stored by the second node if the second data authority range corresponding to the second node includes the first data authority range and the first block height M is less than the second block height N corresponding to the second node.

[0201] The specific functional implementation of the first block determination unit 121 can be found in Figure 4 Step S103 in the corresponding embodiment will not be described in detail here.

[0202] In a possible implementation, the transaction identification information includes hash data; the second synchronization block acquisition module 13 may include: a block type acquisition unit 131, a second block determination unit 132, and a third block determination unit 133, wherein:

[0203] The block type acquisition unit 131 is used to acquire the block type corresponding to the first synchronization block from the block header of the first synchronization block;

[0204] A second block determining unit 132, configured to determine that the first synchronization block belongs to the first data authority range and determine the first synchronization block as a second synchronization block if the block type corresponding to the first synchronization block is a configuration block type;

[0205] The third block determination unit 133 is used to determine the source transaction data in the block body of the first synchronization block that does not belong to the first data authority as transaction data to be processed if the block type corresponding to the first synchronization block is a non-configuration block type, obtain the hash data corresponding to the transaction data to be processed, replace the transaction data to be processed with the hash data, and determine the first synchronization block after the data replacement as the second synchronization block.

[0206] The specific functional implementation of the block type acquisition unit 131, the second block determination unit 132, and the third block determination unit 133 can be found in Figure 7 Steps S213 to S215 in the corresponding embodiment will not be described in detail here.

[0207] In a possible implementation, the third block determination unit 133 may include: a transaction data processing subunit 1331, a transaction data compression subunit 1332, and a hash data acquisition subunit 1333, wherein:

[0208] The transaction data processing subunit 1331 is used to fill the transaction data to be processed to obtain filled transaction data, and split the filled transaction data to obtain P segmented transaction data; P is an integer greater than 1;

[0209] The transaction data compression subunit 1332 is used to obtain the i-th input data of the compression function; when i is 1, the i-th input data includes the initial compression value and the first segmented transaction data among the P segmented transaction data; when i is not 1, the i-th input data includes the i-1-th output data of the compression function and the i-th segmented transaction data among the P segmented transaction data; i is a positive integer less than or equal to P;

[0210] The hash data acquisition subunit 1333 is used to determine the i-th output data corresponding to the compression function according to the i-th input data and the compression function, and determine the P-th output data corresponding to the compression function as the hash data corresponding to the transaction data to be processed.

[0211] The specific functional implementation of the transaction data processing subunit 1331, the transaction data compression subunit 1332, and the hash data acquisition subunit 1333 can be found in Figure 7 Step S215 in the corresponding embodiment will not be described in detail here.

[0212] In a possible implementation, the blockchain-based data synchronization processing device 1 may further include: a processing status update module 18 and an execution prompt message broadcast module 19, wherein:

[0213] A processing status updating module 18, used to store the data synchronization request in the message queue corresponding to the second node, and update the processing status of the data synchronization request according to the storage position of the data synchronization request in the message queue corresponding to the second node;

[0214] The execution prompt message broadcast module 19 is used to generate an execution prompt message for the data synchronization request if it is detected that the processing status corresponding to the data synchronization request is updated to the execution status, and broadcast the execution prompt message in the blockchain network to which the second node belongs, so that the blockchain nodes other than the second node in the blockchain network clear the data synchronization request in the message queue.

[0215] The specific functional implementation of the processing status update module 18 and the execution prompt message broadcast module 19 can be found in Figure 7 Step S207, step S209 and step S210 in the corresponding embodiment will not be described in detail here.

[0216] In a possible implementation, the blockchain-based data synchronization processing device 1 may further include: an authority warning message generating module 20 and an authority warning message sending module 21, wherein:

[0217] The permission warning message generating module 20 is used to generate a permission warning message for the data synchronization request if the first data permission range does not include the second data permission range;

[0218] The permission warning message sending module 21 sends a permission warning message to the first node so that the first node re-sends a data synchronization request to the blockchain nodes other than the second node in the blockchain network.

[0219] The specific functional implementation of the permission warning message generating module 20 and the permission warning message sending module 21 can be found in Figure 4 Step S102 in the corresponding embodiment will not be described in detail here.

[0220] In a possible implementation, the data synchronization processing device 1 based on blockchain may further include: an authority setting request verification module 22, a data authority range setting module 23, and a configuration block chaining module 24, wherein:

[0221] The permission setting request verification module 22 is used to receive the permission setting request corresponding to the first node, verify the validity of the permission setting request, and obtain a request verification result corresponding to the permission setting request;

[0222] A data authority range setting module 23, configured to set a first data authority range for the first node according to a node type and a business type corresponding to the first node if the request verification result indicates that the verification is passed;

[0223] The configuration block chain module 24 is used to encapsulate the first data permission range into a configuration block. If the configuration block reaches a consensus in the blockchain network to which the second node belongs, the configuration block is added to the blockchain stored by the second node.

[0224] The specific functional implementation of the permission setting request verification module 22, the data permission range setting module 23, and the configuration block chain module 24 can be found in Figure 7 Steps S202 to S204 in the corresponding embodiment will not be described in detail here.

[0225] In a possible implementation, the permission setting request verification module 22 includes: a digital signature acquisition unit 221, a summary information acquisition unit 222, and a summary information comparison unit 223, wherein:

[0226] The digital signature acquisition unit 221 is used to acquire the digital signature carried by the permission setting request and the node public key corresponding to the first node;

[0227] The summary information acquisition unit 222 is used to decrypt the digital signature by using the node public key to obtain the first summary information corresponding to the digital signature, and perform a hash operation on the permission setting request according to the hash algorithm to obtain the second summary information corresponding to the permission setting request;

[0228] The summary information comparing unit 223 is configured to determine that the permission setting request verification is successful if the first summary information is identical to the second summary information.

[0229] The specific functional implementation of the digital signature acquisition unit 221, the summary information acquisition unit 222 and the summary information comparison unit 223 can be found in Figure 7 The step S202 in the corresponding embodiment will not be described in detail here.

[0230] In a possible implementation, the data permission range setting module 23 may include: a data synchronization condition determination unit 231 and a data synchronization condition encoding unit 232, wherein:

[0231] The data synchronization condition determination unit 231 is used to obtain the node type and service type corresponding to the first node according to the permission setting request if the request verification result indicates that the verification is passed, and determine T data synchronization conditions matching the node type and service type; T is a positive integer;

[0232] The data synchronization condition encoding unit 232 is used to obtain conditional encoding information corresponding to T data synchronization conditions, and combine the conditional encoding information corresponding to the T data synchronization conditions according to the logical relationship between the T data synchronization conditions to obtain the first data authority range corresponding to the first node.

[0233] The specific functional implementation of the data synchronization condition determination unit 231 and the data synchronization condition encoding unit 232 can be found in Figure 7 Step S203 in the corresponding embodiment will not be described in detail here.

[0234] In a possible implementation, the configuration block chain module 24 may include: a configuration transaction data encapsulation unit 241, a configuration block consensus unit 242, and a configuration block storage unit 243, wherein:

[0235] The configuration transaction data encapsulation unit 241 is used to encapsulate the first data permission range into configuration transaction data, and encapsulate the configuration transaction data into configuration blocks according to the order of the configuration transaction data in the transaction pool;

[0236] A configuration block consensus unit 242, configured to broadcast the configuration block in the blockchain network to which the second node belongs, so that the blockchain nodes in the blockchain network to which the second node belongs perform consensus processing on the configuration block;

[0237] The configuration block storage unit 243 is used to obtain the number of consensus votes for the configuration block in the blockchain network to which the second node belongs. If the number of consensus votes is greater than or equal to the quantity threshold, it is determined that the configuration block has reached a consensus in the blockchain network to which the second node belongs, and the configuration block is added to the blockchain network stored at the second node.

[0238] The specific functional implementation of the configuration transaction data encapsulation unit 241, the configuration block consensus unit 242, and the configuration block storage unit 243 can be found in Figure 7 Step S204 in the corresponding embodiment will not be described in detail here.

[0239] In the embodiment of the present application, the second node does not directly send the first synchronization block containing the source transaction data to the first node, but performs data synchronization according to the first data authority range corresponding to the first node and the second data authority range corresponding to the second node. When the second data authority range includes the first data authority range, and the first block height corresponding to the first node is less than the second block height corresponding to the second node, the source transaction data that does not belong to the first data authority in the first synchronization block can be replaced with the transaction identification information to obtain the second synchronization block, and then the source transaction data that does not belong to the first data authority in the first synchronization block is hidden, which can improve data security.

[0240] See also Fig.13 , Fig.13 Schematic diagram of the structure of a computer device provided in an embodiment of the present application. Fig.13 As shown, the computer device 1000 can be a server, or it can also be a terminal device, which will not be limited here. For ease of understanding, the embodiment of the present application takes the computer device as a terminal device as an example. The computer device 1000 may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, the user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and optionally, the user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 can be a high-speed RAM memory, or it can be a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 1005 can also optionally be at least one storage device located away from the aforementioned processor 1001. As Fig.10 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application program.

[0241] Among them, Fig.13In the computer device 1000 shown, the network interface 1004 can provide a network communication function; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:

[0242] Receive a data synchronization request corresponding to the first node, and obtain a first data authority range corresponding to the first node and a first block height corresponding to the first node according to the data synchronization request;

[0243] If the second data permission range corresponding to the second node includes the first data permission range, and the first block height is less than the second block height corresponding to the second node, then according to the first block height and the second block height, obtain the first synchronization block in the blockchain stored by the second node;

[0244] The source transaction data in the first synchronization block that does not belong to the first data authority range is replaced with the transaction identification information to obtain a second synchronization block; the second synchronization block includes the source transaction data in the first synchronization block that belongs to the first data authority range;

[0245] The second synchronization block is sent to the first node, so that the first node adds the second synchronization block to the blockchain stored by the first node.

[0246] It should be understood that the computer device 1000 described in the embodiment of the present application can execute the above Figure 4 and Figure 7 The description of the data synchronization processing method based on blockchain in the corresponding embodiment can also be performed as described above. Fig.12 The description of the data synchronization processing device 1 based on blockchain in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated here.

[0247] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the blockchain-based data synchronization processing device 1 mentioned above, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the above Figure 4 and Figure 7The description of the data synchronization processing method based on blockchain in any corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application. As an example, program instructions can be deployed on a computing device for execution, or on multiple computing devices located at one location, or on multiple computing devices distributed at multiple locations and interconnected by a communication network. Multiple computing devices distributed at multiple locations and interconnected by a communication network can constitute a blockchain system.

[0248] In addition, it should be noted that: the embodiment of the present application also provides a computer program product or a computer program, which may include computer instructions, and the computer instructions may be stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor may execute the computer instructions, so that the computer device executes the above Figure 4 and Figure 7 The description of the data synchronization processing method based on blockchain in any corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer program product or computer program embodiment involved in this application, please refer to the description of the method embodiment of this application.

[0249] It should be noted that, for the above-mentioned various method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0250] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs.

[0251] The modules in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.

[0252] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0253] The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A data synchronization processing method based on blockchain, characterized in that: include: receiving a data synchronization request corresponding to the first node, and acquiring a first data authority range corresponding to the first node and a first block height corresponding to the first node according to the data synchronization request; If the second data authority range corresponding to the second node includes the first data authority range, and the first block height is less than the second block height corresponding to the second node, then according to the first block height and the second block height, obtain a first synchronization block in the blockchain stored by the second node; The source transaction data in the first synchronization block that does not belong to the first data authority scope is replaced with transaction identification information to obtain a second synchronization block; the second synchronization block includes the source transaction data in the first synchronization block that belongs to the first data authority scope; Sending the second synchronization block to the first node, so that the first node adds the second synchronization block to the blockchain stored by the first node.

2. The method according to claim 1, characterized in that The method further comprises: Acquire a first independent synchronization condition and a first combined synchronization condition for determining the first data authority range, and acquire a second independent synchronization condition and a second combined synchronization condition for determining the second data authority range; If the second independent synchronization condition includes the first independent synchronization condition, and the synchronization sub-condition in the first combined synchronization condition includes the synchronization sub-condition in the second combined synchronization condition, then determining that the second data authority range includes the first data authority range; If the second independent synchronization condition does not include the first independent synchronization condition, or the synchronization sub-condition in the second combined synchronization condition includes the synchronization sub-condition in the first combined synchronization condition, it is determined that the second data authority range does not include the first data authority range.

3. The method according to claim 1, characterized in that The first block height is M, the second block height is N, and both M and N are positive integers; If the second data authority range corresponding to the second node includes the first data authority range, and the first block height is less than the second block height corresponding to the second node, obtaining a first synchronization block in the blockchain stored by the second node according to the first block height and the second block height, including: If the second data authority range corresponding to the second node includes the first data authority range, and the first block height M is less than the second block height N corresponding to the second node, then in the blockchain stored by the second node, the block corresponding to the block height M+1 to the second block height N is determined as the first synchronization block.

4. The method according to claim 1, characterized in that: The transaction identification information includes hash data; The step of replacing the source transaction data in the first synchronization block that does not belong to the first data authority range with the transaction identification information to obtain the second synchronization block includes: Obtaining a block type corresponding to the first synchronization block in a block header of the first synchronization block; If the block type corresponding to the first synchronization block is a configuration block type, determining that the first synchronization block belongs to the first data authority range, and determining the first synchronization block as the second synchronization block; If the block type corresponding to the first synchronization block is a non-configuration block type, the source transaction data in the block body of the first synchronization block that does not belong to the first data authority is determined as transaction data to be processed, the hash data corresponding to the transaction data to be processed is obtained, the transaction data to be processed is replaced with the hash data, and the first synchronization block after the data replacement is determined as the second synchronization block.

5. The method according to claim 4, characterized in that The obtaining of hash data corresponding to the transaction data to be processed includes: Performing data padding on the transaction data to be processed to obtain padded transaction data, and performing splitting processing on the padded transaction data to obtain P segmented transaction data, where P is an integer greater than 1; Obtain the i-th input data of the compression function; when i is 1, the i-th input data includes the initial compression value and the first segmented transaction data among the P segmented transaction data; when i is not 1, the i-th input data includes the i-1-th output data of the compression function and the i-th segmented transaction data among the P segmented transaction data; i is a positive integer less than or equal to P; According to the i-th input data and the compression function, the i-th output data corresponding to the compression function is determined, and the P-th output data corresponding to the compression function is determined as the hash data corresponding to the transaction data to be processed.

6. The method according to claim 1, characterized in that The method further comprises: storing the data synchronization request in a message queue corresponding to the second node, and updating a processing status of the data synchronization request according to a storage position of the data synchronization request in the message queue corresponding to the second node; If it is detected that the processing status corresponding to the data synchronization request is updated to the execution status, an execution prompt message for the data synchronization request is generated, and the execution prompt message is broadcast in the blockchain network to which the second node belongs, so that the blockchain nodes in the blockchain network other than the second node clear the data synchronization request in the message queue.

7. The method according to claim 1, characterized in that The method further comprises: If the first data permission range does not include the second data permission range, generating a permission warning message for the data synchronization request; The authority warning message is sent to the first node, so that the first node re-sends the data synchronization request to the blockchain nodes other than the second node in the blockchain network.

8. The method according to claim 1, characterized in that The method further comprises: receiving a permission setting request corresponding to the first node, performing validity verification on the permission setting request, and obtaining a request verification result corresponding to the permission setting request; If the request verification result indicates that the verification is passed, setting the first data permission range for the first node according to the node type and service type corresponding to the first node; The first data permission range is encapsulated as a configuration block. If a consensus is reached on the configuration block in the blockchain network to which the second node belongs, the configuration block is added to the blockchain stored by the second node.

9. The method according to claim 8, characterized in that The performing validity verification on the permission setting request to obtain a request verification result corresponding to the permission setting request includes: Obtaining the digital signature carried by the permission setting request and the node public key corresponding to the first node; Decrypting the digital signature by using the node public key to obtain first summary information corresponding to the digital signature, and performing a hash operation on the permission setting request according to a hash algorithm to obtain second summary information corresponding to the permission setting request; If the first summary information is the same as the second summary information, it is determined that the permission setting request is verified successfully.

10. The method according to claim 8, characterized in that If the request verification result indicates that the verification is passed, setting the first data permission range for the first node according to the node type and business type corresponding to the first node indicated by the permission setting request includes: If the request verification result indicates that the verification is passed, the node type and the service type corresponding to the first node are obtained according to the permission setting request, and T data synchronization conditions matching the node type and the service type are determined; T is a positive integer; Conditional coding information corresponding to the T data synchronization conditions is obtained, and the conditional coding information corresponding to the T data synchronization conditions is combined according to a logical relationship between the T data synchronization conditions to obtain a first data authority range corresponding to the first node.

11. The method according to claim 8, characterized in that The step of encapsulating the initial data permission range into a configuration block, and if a consensus is reached on the configuration block in the blockchain network to which the second node belongs, adding the configuration block to the blockchain stored by the second node, includes: Encapsulating the first data permission range into configuration transaction data, and encapsulating the configuration transaction data into a configuration block according to the order of the configuration transaction data in the transaction pool; Broadcasting the configuration block in the blockchain network to which the second node belongs, so that the blockchain nodes in the blockchain network to which the second node belongs perform consensus processing on the configuration block; Obtain the number of consensus votes for the configuration block in the blockchain network to which the second node belongs. If the number of consensus votes is greater than or equal to a quantity threshold, determine that the configuration block has reached a consensus in the blockchain network to which the second node belongs, and add the configuration block to the blockchain network stored at the second node.

12. A data synchronization processing device based on blockchain, characterized in that: include: A data synchronization request receiving module, configured to receive a data synchronization request corresponding to a first node, and obtain a first data authority range corresponding to the first node and a first block height corresponding to the first node according to the data synchronization request; A first synchronization block acquisition module, configured to acquire a first synchronization block in the blockchain stored in the second node according to the first block height and the second block height if the second data authority range corresponding to the second node includes the first data authority range and the first block height is less than the second block height corresponding to the second node; A second synchronization block acquisition module is used to replace the source transaction data in the first synchronization block that does not belong to the first data authority range with transaction identification information to obtain a second synchronization block; the second synchronization block includes the source transaction data in the first synchronization block that belongs to the first data authority range; The synchronization block sending module is used to send the second synchronization block to the first node, so that the first node adds the second synchronization block to the blockchain stored by the first node.

13. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the steps of the method according to any one of claims 1 to 11 are executed.

15. A computer program product, characterized in that The method comprises a computer program / instruction, which implements the method according to any one of claims 1 to 11 when executed by a processor.