Blockchain-based data processing method, device, equipment and storage medium
By determining in the blockchain that the number of second nodes is greater than or equal to the threshold, business data is added to the data list and blocks are generated, the problem of poor block generation reliability caused by transaction order adjustment is solved, and a more accurate transaction sequence is achieved. Higher blockchain reliability.
Patent Information
- Application Number
- CN202011436659.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-10
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2040-12-10
AI Technical Summary
In blockchain, the order of execution of transactions is adjusted by stakeholder nodes, resulting in poor reliability of block generation and affecting account balance and transaction results.
Before generating blocks, when the number of second nodes is greater than or equal to the threshold, business data is added to the data list and blocks are generated according to the order of the list to ensure the accuracy of the data sequence and avoid out-of-order data entering the blockchain .
It improves the reliability of the blockchain, ensures the accuracy of transaction sequence, reduces the risk of blocks generated by out-of-order data joining the blockchain, and improves the reliability and credibility of the system.
Smart Images

Figure CN112419065B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of financial technology (Fintech), and in particular to a data processing method, apparatus, device and storage medium based on blockchain. Background Art
[0002] With the development of computer technology, more and more technologies are applied in the financial field. The traditional financial industry is gradually transforming to Fintech, and blockchain technology is no exception. However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on technology.
[0003] In the related art, for transactions recorded in a block, transactions can be divided into one or more mutually exclusive transaction sets and a non-mutually exclusive transaction set according to whether mutually exclusive resources are operated between transactions. Two or more transactions in each mutually exclusive transaction set operate mutually exclusive resources. These transactions need to clarify their execution order, and different execution orders may produce different results. Take two transactions as an example, transaction Tx1 is a transfer of 80 from account A to account B, and transaction Tx2 is a transfer of 60 from account A to account C. Assuming that the current balance of account A is 100, only one of the above Tx1 and Tx2 can be executed successfully, and the other will fail. In this case, the execution order of the transaction will affect the balance of account B and account C. When the stakeholder nodes of account B and account C act as packaging nodes, they may adjust the order of Tx1 and Tx2 in the transaction list according to their own interests and generate corresponding blocks, rather than strictly following the order in which the two transactions are received, resulting in poor reliability of generated blocks. Summary of the invention
[0004] The embodiments of the present application provide a blockchain-based data processing method, device, equipment and storage medium to achieve.
[0005] In a first aspect, an embodiment of the present application provides a data processing method based on blockchain, including:
[0006] The first node obtains a plurality of first service data;
[0007] For any of the first service data, when it is determined that the number of second nodes corresponding to the first service data is greater than or equal to a first threshold, the first node adds the first service data to a first data list, and the second node is a node that receives the first service data;
[0008] The first node generates a block according to the first business data in the first data list.
[0009] In a second aspect, the embodiment of the present application provides a data processing method based on blockchain, including:
[0010] In a third aspect, an embodiment of the present application provides a data processing device based on blockchain, including:
[0011] An acquisition module, used for acquiring a plurality of first business data;
[0012] a processing module, configured to, for any of the first service data, add the first service data to a first data list when it is determined that the number of second nodes corresponding to the first service data is greater than or equal to a first threshold, wherein the second node is a node that receives the first service data;
[0013] The processing module is further used to generate a block according to the first business data in the first data list.
[0014] In a fourth aspect, an embodiment of the present application provides a data processing device based on blockchain, including:
[0015] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method described in any one of the first aspect and the second aspect is implemented.
[0016] In a sixth aspect, an embodiment of the present application provides an electronic device, including:
[0017] Processor; and
[0018] A memory, configured to store executable instructions of the processor;
[0019] The processor is configured to perform the method according to any one of the first aspects by executing the executable instructions.
[0020] In a seventh aspect, an embodiment of the present application provides an electronic device, including:
[0021] Processor; and
[0022] A memory, configured to store executable instructions of the processor;
[0023] The processor is configured to perform the method described in any one of the second aspects by executing the executable instructions.
[0024] In an eighth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the method as described in any one of the first and second aspects.
[0025] The blockchain-based data processing method, apparatus, device and storage medium provided by the embodiments of the present application, the first node obtains multiple first business data; for any first business data, when it is determined that the number of second nodes corresponding to the first business data is greater than or equal to the first threshold, the first node adds the first business data to the first data list, the second node is the node that receives the first business data, and the order in which the first business data is arranged in the first data list is the order in which most nodes receive the first business data, so it can be considered that the order is relatively accurate. Further, the first node generates a block according to the first business data in the first data list, that is, generates a block according to the arrangement order in the first data list, thereby avoiding the first node from changing the order of the received first business data, avoiding the blocks generated by disordered business data from being added to the blockchain, and improving the reliability of the blockchain. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0027] Figure 1 A schematic diagram of the system architecture provided for an embodiment of the present application;
[0028] Figure 2 This is a flowchart of an embodiment of a data processing method based on blockchain provided by the present application;
[0029] Figure 3 It is a schematic diagram of an interaction process provided by an embodiment of the present application;
[0030] Figure 4 It is a flowchart of another embodiment of the blockchain-based data processing method provided by the present application;
[0031] Figure 5 It is a structural diagram of an embodiment of a blockchain-based data processing device provided by the present application;
[0032] Figure 6 It is a structural schematic diagram of another embodiment of the blockchain-based data processing device provided by the present application;
[0033] Figure 7 It is a structural schematic diagram of an embodiment of an electronic device provided by the present application;
[0034] Figure 8 It is a structural schematic diagram of another embodiment of the electronic device provided by the present application.
[0035] The above drawings show clear embodiments of the present disclosure, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present disclosure in any way, but to illustrate the concepts of the present disclosure to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0036] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0037] The terms "including" and "having" and any variations thereof in the specification and claims of the present application and the drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices.
[0038] First, some vocabulary and application scenarios involved in the embodiments of the present application are introduced.
[0039] Blockchain is a distributed storage system jointly maintained and trusted by multiple nodes. The bottom layer of blockchain is a chain composed of a series of blocks. In addition to recording the data of the current block, each block also records the hash value of the previous block, forming a chain data structure in this way. A block consists of a block header and a block body. The block header includes important fields such as the block height and the hash value of the previous block, while the block body mainly stores an ordered list of transactions. Blockchain uses cryptography to ensure the security of data transmission and access, and uses a chain structure to ensure that the data on the chain cannot be tampered with.
[0040] Figure 1 This is a schematic diagram of the system architecture provided in the embodiment of the present application. Figure 1 As shown, the system architecture of the embodiment of the present application may include but is not limited to: a first node, a second ground and a third node.
[0041] The first node, the second node and the third node may be connected via a network.
[0042] There may be multiple first nodes, second nodes, and third nodes, but only one is shown in the figure.
[0043] The method provided in the embodiment of the present application can be implemented by an electronic device such as a processor executing corresponding software codes, or can be implemented by an electronic device executing corresponding software codes while interacting with a server for data.
[0044] In the related art, for transactions recorded in a block, transactions can be divided into one or more mutually exclusive transaction sets and a non-mutually exclusive transaction set according to whether mutually exclusive resources are operated between transactions. Two or more transactions in each mutually exclusive transaction set operate mutually exclusive resources. These transactions need to clarify their execution order, and different execution orders may produce different results. Take two transactions as an example, transaction Tx1 is a transfer of 80 from account A to account B, and transaction Tx2 is a transfer of 60 from account A to account C. Assuming that the current balance of account A is 100, only one of the above Tx1 and Tx2 can be executed successfully, and the other will fail. In this case, the execution order of the transaction will affect the balance of account B and account C. When the stakeholder nodes of account B and account C act as packaging nodes, they may adjust the order of Tx1 and Tx2 in the transaction list according to their own interests and generate corresponding blocks, rather than strictly following the order in which the two transactions are received, resulting in poor reliability of generated blocks.
[0045] In the related technology, there are two processing steps for the node to receive the transaction data sent by the client or forwarded by other nodes: A. The node puts the transaction data into its own data pool (in the order in which the transaction data is received); B. After the node becomes the leader node of this round, it takes out the transaction data from the data pool and packages it into blocks for other nodes to verify.
[0046] The method of the embodiment of the present application and the technical concept are as follows:
[0047] In order to avoid adjusting the order of business data when the node generates a block, the following operations are added before generating the block:
[0048] When it is determined that the number of second nodes corresponding to the first service data is greater than or equal to the first threshold, the first node adds the first service data to the first data list, and the second node is the node that receives the first service data; the order in the first data list is the order in which most nodes receive the first service data, so it can be considered that the order is a relatively accurate arrangement order;
[0049] The first node generates a block according to the arrangement order in the first data list, thereby preventing the first node from changing the order of the received first business data and preventing blocks generated by disordered business data from being added to the blockchain, thereby improving the reliability of the blockchain.
[0050] The technical solution of the present application is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0051] Figure 2 This is a flowchart of an embodiment of a data processing method based on blockchain provided by this application. Figure 2 As shown, the method provided in this embodiment includes:
[0052] Step 101: A first node obtains a plurality of first service data.
[0053] Specifically, the first node obtains a plurality of first business data. The first business data may be business data sent by a client or forwarded by other nodes. The business data may include transaction information, such as account A transferring 80 yuan to account B.
[0054] After receiving the first service data, the first node broadcasts the identifier of the received first service data to other nodes. The identifier may be a hash value of the first service data. Other nodes will perform the same operation after receiving the service data, that is, broadcast the information of the received service data.
[0055] Step 102: For any first business data, when it is determined that the number of second nodes corresponding to the first business data is greater than or equal to a first threshold, the first node adds the first business data to a first data list, and the second node is a node that receives the first business data.
[0056] Specifically, for each of the multiple first business data, it is necessary to determine the number of second nodes corresponding to the first business data. The second node is the node that receives the first business data. The second node will send a broadcast message to the first node. The broadcast message includes the identifier of the first business data, so that the first node can know which nodes have received the first business data.
[0057] When it is determined that the number of second nodes corresponding to the first service data is greater than or equal to the first threshold, the first node adds the first service data to the first data list.
[0058] In this step, since the order of receiving broadcast messages from other nodes may be different, the order of determining whether the number of second nodes corresponding to each first business data is greater than or equal to the first threshold is also different. Therefore, first determine which first business data has the number of second nodes greater than or equal to the first threshold, and then put that first business data into the first data list first. Therefore, the order of the first business data in the first data list is arranged according to the order in which it is determined that the number of second nodes corresponding to the first business data is greater than or equal to the first threshold.
[0059] The first threshold is, for example, two-thirds of the total number of nodes in the blockchain.
[0060] Step 103: The first node generates a block according to the first business data in the first data list.
[0061] Specifically, in the consensus stage, that is, after the first node is called the leader node, the first business data in the first data list is packaged to generate a block, and the block is generated according to the first order stored in the first data list.
[0062] Furthermore, the block can be broadcasted so that other nodes can verify the block, that is, verify the arrangement order of the first business data in the block; if the verification is successful, it means that the consensus of other nodes has been obtained, and the subsequent process will continue; if the verification fails, it means that the consensus of other nodes has not been obtained, and the block will be discarded.
[0063] In the method of this embodiment, the first node obtains multiple first business data; for any first business data, when it is determined that the number of second nodes corresponding to the first business data is greater than or equal to the first threshold, the first node adds the first business data to the first data list, and the second node is the node that receives the first business data. The order in which the first business data are arranged in the first data list is the order in which most nodes receive the first business data, so it can be considered that the order is relatively accurate. Further, the first node generates a block according to the first business data in the first data list, that is, generates a block according to the arrangement order in the first data list, thereby avoiding the first node from changing the order of the received first business data, avoiding the blocks generated by disordered business data from being added to the blockchain, and improving the reliability of the blockchain.
[0064] Based on the above embodiments, Figure 3 As shown, the step of "determining that the number of second nodes corresponding to the first service data is greater than or equal to the first threshold" can be implemented as follows:
[0065] The first node receives at least one broadcast message of the second node, where the broadcast message is used to indicate an identifier of first service data received by the second node;
[0066] The first node determines, according to the broadcast message of the second node, whether the number of second nodes corresponding to the first service data is greater than or equal to a first threshold.
[0067] Specifically, for any first service data, the first node receives a broadcast message from the second node, where the broadcast message is used to notify other nodes of an identifier of the first service data received by the second node, that is, the second node receives the first service data.
[0068] The first node determines, according to the received broadcast message, whether the number of second nodes corresponding to the first service data is greater than or equal to a first threshold.
[0069] This step may be performed continuously until the first node is called the leader node.
[0070] For example, for the first business data Tx1, the first node A receives broadcast messages sent by the second node B, the second node C, and the second node D. The broadcast messages all contain the identifier of the first business data Tx1. The number of second nodes is 3. Assuming the first threshold is 3, it is determined that the number of second nodes corresponding to the first business data Tx1 is greater than or equal to the first threshold.
[0071] In one embodiment, the step of “determining whether the number of second nodes corresponding to the first service data is greater than or equal to a first threshold” may be implemented in the following manner:
[0072] The first node records, according to the broadcast message of the second node, a correspondence between the identifier of the first service data and the identifier of the second node;
[0073] The first node determines, according to the corresponding relationship, whether the number of second nodes corresponding to the first service data is greater than or equal to a first threshold.
[0074] Specifically, the first node records the identifier of the first business data in the broadcast message and the corresponding relationship with the identifier of the second node according to the broadcast message received from the second node, for example, the identifier of the second node corresponding to the first business data is added to a node identifier list, each first business data corresponds to a node identifier list, and the node recorded in the node identifier list indicates that the node has received the first business data. If the number of nodes recorded in the node identifier list corresponding to a first business data exceeds the first threshold, the first business data is put into the first data list, that is, the first business data is put into the first data list in the order in which the nodes in the node identifier list meet the above conditions.
[0075] In the above implementation, according to the received second node broadcast message, the broadcast message indicates that the second node has received the first business data, so as to determine the second node corresponding to the first business data, and then determine whether the number of second nodes corresponding to the first business data is greater than or equal to the first threshold. If the number of second nodes corresponding to the first business data is greater than or equal to the first threshold, the first business data can be added to the first data list. The order in which the first business data is arranged in the first data list is the order in which most nodes receive the first business data. Therefore, it can be considered that the order is relatively accurate, which avoids the first node changing the order of the received first business data, and avoids the blocks generated by disordered business data from being added to the blockchain, thereby improving the reliability of the blockchain.
[0076] In one embodiment, during the broadcast phase, the first node may perform the following operations:
[0077] 1. The first node identifies each first service data according to the order in which the first service data are received. For example, the identification is a hash value of the first service data and puts it into its own data pool. At this time, an "entry order into the data pool" is generated, which is the order in which the first service data are received by the first node;
[0078] 2. The first node broadcasts the first service data to other nodes according to the "order of entering the data pool", which may be broadcasting one first service data each time it is put into the data pool;
[0079] 3. The first node maintains a record of mapping the identifier of the first business data to the node identifier list for the multiple first business data in the data pool, and adds the identifier of its own node (such as node ID) to the node identifier list associated with the identifier of the received first business data. If the first business data is forwarded by other nodes, the node identifier of the sending node is also added to the node identifier list.
[0080] 4. Traverse the node identification list recorded in step 3 to determine whether the number of nodes recorded in the node identification list associated with each first business data representation exceeds the first threshold. If yes, proceed to step 5; if not, wait for new business data to be received to trigger step 1.
[0081] 5. The first node will put the first business data that meets the conditions in step 4 into its own first data list in the order in which the conditions are met, and the "order of entering the first data list" is generated. This order has obtained the consensus of the accounting nodes that exceed the first threshold. This order may be different from the "order of entering the data pool".
[0082] In one embodiment, the method further comprises:
[0083] The first node broadcasts the block;
[0084] If a verification message from a third node is obtained and the number of the third nodes is greater than or equal to a second threshold, the first node adds the block to the blockchain;
[0085] If a verification message from a third node is obtained and the number of the third nodes is less than a second threshold, the first node discards the block.
[0086] The block may be broadcasted by the first node sending a broadcast message, where the broadcast message includes information about the block.
[0087] Specifically, the first node broadcasts the generated block and collects the verification message of the block. For the verification node that receives the broadcast message, the arrangement order of the first business data in the block is verified, that is, whether the order in the first data list in the block conflicts with the arrangement order of the business data in the second data list recorded by itself. If there is no conflict, the verification node (i.e., the third node) sends a verification message to the first node. If verification messages from multiple third nodes are received, and the number of multiple third nodes is greater than or equal to the second threshold, it means that the arrangement order of the first business data in the block is formed by the nodes whose number exceeds the second threshold. Consensus is formed, and the subsequent consensus process continues, and the block is added to the blockchain; otherwise, if the number of third nodes is less than the second threshold, the block is discarded. Start the next round of consensus process.
[0088] The second threshold is, for example, two-thirds of the number of nodes in the blockchain.
[0089] Conflict situations include the following:
[0090] One situation is: if the business data in the block does not exist in the second data list of the verification node, the verification fails;
[0091] Another situation is: for any two business data in the block, if their "relative order" conflicts with the "relative order" of the two business data in the second data list of the verification node, the verification fails. Example 1: The first data list of the block is "ABC", and the second data list of the verification node is "ABFC". In this case, the verification succeeds because the relative order of AB, BC and AC is consistent; Example 2: The transaction list of the block is "ABC", and the second data list of the verification node is "ACFB". It can be seen that the relative order of transaction BC conflicts and the verification fails.
[0092] In the above implementation, the arrangement order of the business data in the block is verified, which can prevent the leader node from adjusting the order in which the business data is received, thereby improving the reliability of the blockchain.
[0093] Exemplarily, the accounting node ABCD and five business data Tx1-Tx5 are taken as examples for explanation.
[0094] The order in which node A receives service data and puts it into the data pool is: Tx1-Tx3-Tx2-Tx5;
[0095] The order in which node B receives service data and puts it into the data pool is: Tx1-Tx2-Tx4-Tx5-Tx3;
[0096] The order in which node C receives service data and puts it into the data pool is: Tx1-Tx2-Tx4-Tx5;
[0097] The order in which node D receives service data and puts it into the data pool is: Tx1-Tx4-Tx2-Tx5;
[0098] In the above process, it is recorded that node A receives Tx1 before node B receives Tx1, node D receives Tx1 before node A receives Tx3, node D receives Tx5 before node B receives Tx3, and so on...; at the same time, it is assumed that each node broadcasts the hash value of the received business data to other nodes immediately after receiving the business data.
[0099] So we have:
[0100] The service data and the order of the service data put into the first data list by node A are: Tx1-Tx2-Tx5 (node A will record: for Tx1, node ABCD has received Tx1, and the number of nodes recorded in the node identification list associated with Tx1 has exceeded the first threshold, such as two-thirds of the total number of accounting nodes, so Tx1 is put into the first data list as the first service data; for Tx3, although it is already in the data pool, only nodes A and B have received Tx3, and the number of nodes recorded in the node identification list associated with Tx3 has not exceeded the first threshold);
[0101] The service data and the order of the service data put into the first data list by node B are: Tx1-Tx2-Tx4-Tx5;
[0102] The service data and the order of the service data put into the first data list by node C are: Tx1-Tx2-Tx4-Tx5;
[0103] The service data and the order of the service data put into the first data list by node D are: Tx1-Tx2-Tx4-Tx5;
[0104] Now we enter the packaging phase, and distinguish whether the leader node is an honest node or a malicious node in the following situations:
[0105] Assuming that the leader node is node B, node B packs transactions Tx1, Tx2, Tx4 and Tx5 into blocks in order and broadcasts them to nodes ACD. For nodes C and D, the arrangement order of the first data list recorded by themselves does not conflict with the arrangement order of the business data recorded in the block broadcast by B. The verification is successful, and nodes C and D send a verification message to node B. For node A, since the business data included in the block broadcast by node B has Tx4 more than the business data in its first data list, node A fails to verify the block. Assuming the first threshold is 2, the subsequent consensus process can continue.
[0106] Assume that the leader node is node A. Although Tx2 occurs first, that is, the order in the first data list is Tx1-Tx2-Tx5, it is beneficial for node A that Tx5 is executed before Tx2, so node A adjusts the order in the block to Tx1, Tx5, and Tx2. However, for nodes B and C that received the block, during verification, they found that the order of Tx2 and Tx5 in the block conflicted with the order of the first data list they recorded, so nodes B and C failed to verify the block. For node A, since it is impossible to collect verification messages from nodes exceeding the second threshold within the limited time, this round of consensus fails and the next round of consensus begins.
[0107] The method of the embodiment of the present application avoids the occurrence of chain forks caused by the need to roll back business data after blocks generated by disordered business data are added to the blockchain, or the entire chain including previous business data may be discarded, thereby reducing the maintenance cost of the chain. For the application party, it avoids the need to resend business data after the blockchain is rolled back, thereby increasing the operating cost of the application party.
[0108] Figure 4 This is a flow chart of another embodiment of the data processing method based on blockchain provided by this application. The execution subject of this embodiment is the third node, that is, the verification node. Figure 4 As shown, the method provided in this embodiment includes:
[0109] Step 201: The third node receives a broadcast message sent by the first node, where the broadcast message includes: information about a block, where the block includes: a plurality of first business data arranged in a first order in a first data list.
[0110] Specifically, the first node broadcasts the generated block and collects verification messages of the block.
[0111] The block includes information of a plurality of first service data, and the plurality of first service data are arranged in the first order in the first data list, for details, see Figure 2 The embodiment shown.
[0112] For the third node that receives the broadcast message, the first arrangement order of the first business data in the block is verified.
[0113] Step 202: The third node verifies the multiple first business data arranged in the first order included in the block according to the pre-acquired second data list, and obtains a verification result; the second data list includes: multiple second business data arranged in the second order.
[0114] Step 203: If the verification result indicates that the verification is successful, the third node sends a verification message to the first node.
[0115] Specifically, the third node verifies the order in the first data list in the block by using the arrangement order of the plurality of second service data in the second data list recorded by itself. The plurality of second service data in the second data list are arranged in the second order.
[0116] If the verification result is passed, the third node sends a verification message to the first node. If the first node receives verification messages from multiple third nodes, and the number of multiple third nodes is greater than or equal to the second threshold, it means that the arrangement order of the first business data in the block is formed by the nodes whose number exceeds the second threshold, and the subsequent consensus process continues, and the block is added to the blockchain; otherwise, if the number of third nodes is less than the second threshold, the block is discarded. Start the next round of consensus process.
[0117] In one embodiment, step 203 may be implemented as follows:
[0118] The third node determines whether the plurality of first service data arranged in the first order conflict with the order of the plurality of second service data arranged in the second order included in the second data list;
[0119] If there is no conflict, the third node determines that the verification result is verification passed.
[0120] Specifically, the third node verifies whether the order in the first data list in the block conflicts with the arrangement order of the plurality of second business data in the second data list recorded by itself;
[0121] If there is no conflict, the verification result is determined to be verification passed, and the third node sends a verification message to the first node; if there is a conflict, the verification result is determined to be verification failed, and the third node does not send a verification message to the first node.
[0122] In one embodiment, the method further comprises:
[0123] The third node acquires a plurality of second service data;
[0124] For any second business data, when it is determined that the number of second nodes corresponding to the second business data is greater than or equal to the first threshold, the third node adds the second business data to the second data list; the second node is the node that receives the second business data.
[0125] The principle of the third node forming the second data list is similar to the principle of the first node forming the first data list, which will not be repeated here.
[0126] In the method of this embodiment, the broadcast message sent by the first node includes a block, and the multiple first business data included in the block are arranged according to the first order in the first data list; the order of arrangement of the first business data in the first data list is the order in which most nodes receive the first business data, so it can be considered that the order is relatively accurate, and the third node further verifies the block to verify whether it matches the arrangement order in the second data list pre-acquired by the third node, thereby avoiding the first node from changing the order of the received first business data, avoiding the blocks generated by disordered business data from being added to the blockchain, and improving the reliability of the blockchain.
[0127] Figure 5 This is a structural diagram of an embodiment of a blockchain-based data processing device provided by the present application, such as Figure 5 As shown, the blockchain-based data processing device of this embodiment includes:
[0128] An acquisition module 110, configured to acquire a plurality of first service data;
[0129] A processing module 111 is configured to, for any first service data, add the first service data to a first data list when it is determined that the number of second nodes corresponding to the first service data is greater than or equal to a first threshold, where the second node is a node that receives the first service data;
[0130] The processing module 111 is further configured to generate a block according to the first service data in the first data list.
[0131] In a possible implementation, the processing module 111 is specifically configured to:
[0132] receiving a broadcast message from at least one of the second nodes, where the broadcast message is used to indicate an identifier of first service data received by the second node;
[0133] It is determined, according to the broadcast message of the second node, whether the number of second nodes corresponding to the first service data is greater than or equal to a first threshold.
[0134] In a possible implementation, the processing module 111 is specifically configured to:
[0135] Recording, according to the broadcast message of the second node, a correspondence between an identifier of the first service data and an identifier of the second node;
[0136] According to the corresponding relationship, it is determined whether the number of second nodes corresponding to the first service data is greater than or equal to a first threshold.
[0137] In a possible implementation, it also includes
[0138] A sending module, used for broadcasting the block;
[0139] The processing module 111 is further configured to: if a verification message of a third node is obtained and the number of the third nodes is greater than or equal to a second threshold, add the block to the blockchain;
[0140] If a verification message from a third node is obtained and the number of the third nodes is less than a second threshold, the first node discards the block.
[0141] In a possible implementation, the sending module is specifically used for:
[0142] The first node sends a broadcast message, where the broadcast message includes information about the block.
[0143] The device of this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar and will not be repeated here.
[0144] Figure 6 This is a structural diagram of an embodiment of a blockchain-based data processing device provided by the present application, such as Figure 6 As shown, the blockchain-based data processing device of this embodiment includes:
[0145] The receiving module 120 is configured to receive a broadcast message sent by the first node, wherein the broadcast message includes: information of a block, wherein the block includes: a plurality of first service data arranged in a first order in a first data list;
[0146] The processing module 121 is used to verify the multiple first business data arranged in the first order and included in the block according to the pre-acquired second data list, and obtain a verification result; the second data list includes: multiple second business data arranged in the second order;
[0147] The sending module 122 is configured to send a verification message to the first node if the verification result indicates that the verification is successful.
[0148] In a possible implementation, the processing module 121 is specifically configured to:
[0149] The third node determines whether the plurality of first service data arranged in the first order conflict with the order of the plurality of second service data arranged in the second order included in the second data list;
[0150] If there is no conflict, the third node determines that the verification result is verification passed.
[0151] In a possible implementation, the processing module 121 is further configured to:
[0152] The third node acquires a plurality of second service data;
[0153] For any second business data, when it is determined that the number of second nodes corresponding to the second business data is greater than or equal to the first threshold, the third node adds the second business data to the second data list; the second node is the node that receives the second business data.
[0154] The device of this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar and will not be repeated here.
[0155] Figure 7 A schematic diagram of the structure of an electronic device according to an embodiment of the present application is shown in FIG. Figure 7 As shown, the electronic device includes:
[0156] A processor 210 , and a memory 211 for storing executable instructions of the processor 210 .
[0157] Optionally, it may also include: a communication interface 212 for implementing communication with other devices.
[0158] The above components may communicate via one or more buses.
[0159] Among them, the processor 210 is configured to execute the corresponding method in the aforementioned method embodiment by executing the executable instructions. The specific implementation process can be found in the aforementioned method embodiment and will not be repeated here.
[0160] The electronic device may be an electronic device corresponding to the first node.
[0161] Figure 8 A structural diagram of another embodiment of the electronic device provided by the present application is shown in FIG. Figure 8 As shown, the electronic device includes:
[0162] A processor 220 , and a memory 221 for storing executable instructions of the processor 220 .
[0163] Optionally, it may also include: a communication interface 222 for implementing communication with other devices.
[0164] The above components may communicate via one or more buses.
[0165] Among them, the processor 220 is configured to execute the corresponding method in the aforementioned method embodiment by executing the executable instructions. The specific implementation process can be found in the aforementioned method embodiment and will not be repeated here.
[0166] The electronic device may be an electronic device corresponding to the third node.
[0167] A computer-readable storage medium is also provided in an embodiment of the present application, on which a computer program is stored. When the computer program is executed by a processor, the corresponding method in the aforementioned method embodiment is implemented. The specific implementation process can be found in the aforementioned method embodiment. The implementation principle and technical effects are similar and will not be repeated here.
[0168] An embodiment of the present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements a method as described in any one of the aforementioned method embodiments. The specific implementation process can be found in the aforementioned method embodiments. The implementation principles and technical effects are similar and will not be repeated here.
[0169] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0170] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A data processing method based on blockchain, characterized in that: include: The first node obtains a plurality of first service data; For any of the first service data, when it is determined that the number of second nodes corresponding to the first service data is greater than or equal to a first threshold, the first node adds the first service data to a first data list, and the second node is a node that receives the first service data; The first node generates a block according to the first service data in the first data list; The first node broadcasts the block; If a verification message from a third node is obtained and the number of the third nodes is greater than or equal to a second threshold, the first node adds the block to the blockchain; The verification message is a message sent by the third node to the first node after receiving the block broadcast by the first node, when the third node determines whether the plurality of first service data arranged in the first order conflict with the order of the plurality of second service data arranged in the second order included in the second data list, and the first order and the second order do not conflict; The first order is arranged in the order in which the first node determines that the number of second nodes corresponding to the first business data is greater than or equal to the first threshold; the second order is arranged in the order in which the third node determines that the number of second nodes corresponding to the first business data is greater than or equal to the first threshold; If the verification message from the third node is obtained and the number of the third nodes is less than the second threshold, the first node discards the block.
2. The method according to claim 1, characterized in that The determining whether the number of second nodes corresponding to the first service data is greater than or equal to a first threshold includes: The first node receives at least one broadcast message of the second node, where the broadcast message is used to indicate an identifier of first service data received by the second node; The first node determines, according to the broadcast message of the second node, whether the number of second nodes corresponding to the first service data is greater than or equal to a first threshold.
3. The method according to claim 2, characterized in that The first node determines, according to the broadcast message of the second node, whether the number of second nodes corresponding to the first service data is greater than or equal to a first threshold, including: The first node records, according to the broadcast message of the second node, a correspondence between the identifier of the first service data and the identifier of the second node; The first node determines, according to the corresponding relationship, whether the number of second nodes corresponding to the first service data is greater than or equal to a first threshold.
4. The method according to claim 1, characterized in that The first node broadcasts the block, including: The first node sends a broadcast message, where the broadcast message includes information about the block.
5. A data processing method based on blockchain, characterized in that: include: The third node receives a broadcast message sent by the first node, the broadcast message including: information of a block, the block including: a plurality of first service data arranged in a first order in the first data list; the first order is arranged in a sequence in which the number of second nodes corresponding to the first service data determined by the first node is greater than or equal to a first threshold; The third node determines whether the plurality of first business data arranged in the first order conflict with the order of the plurality of second business data arranged in the second order included in the second data list; if there is no conflict, the third node determines that the verification result is a passed verification; if there is a conflict, the third node determines that the verification result is a failed verification; the second order is arranged in the order in which the number of second nodes corresponding to the first business data determined by the third node is greater than or equal to the first threshold; If the verification result indicates that the verification is successful, the third node sends a verification message to the first node.
6. The method according to claim 5, characterized in that Also includes: The third node acquires a plurality of second service data; For any second service data, when it is determined that the number of second nodes corresponding to the second service data is greater than or equal to a first threshold, the third node adds the second service data to a second data list; The second node is a node that receives the first service data.
7. A data processing device, characterized in that: include: An acquisition module, used for acquiring a plurality of first business data; a processing module, configured to, for any of the first service data, add the first service data to a first data list when it is determined that the number of second nodes corresponding to the first service data is greater than or equal to a first threshold, wherein the second node is a node that receives the first service data; The processing module is further used to generate a block according to the first service data in the first data list; A sending module, used for broadcasting the block; The processing module is further configured to, if a verification message from a third node is obtained and the number of the third nodes is greater than or equal to a second threshold, cause the first node to add the block to the blockchain; The verification message is a message sent by the third node to the first node after receiving the block broadcast by the first node, when the third node determines whether the plurality of first service data arranged in the first order conflict with the order of the plurality of second service data arranged in the second order included in the second data list, and the first order and the second order do not conflict; The first order is arranged in the order in which the first node determines that the number of second nodes corresponding to the first business data is greater than or equal to the first threshold; the second order is arranged in the order in which the third node determines that the number of second nodes corresponding to the first business data is greater than or equal to the first threshold; if the verification message of the third node is obtained and the number of the third nodes is less than the second threshold, the first node discards the block.
8. A data processing device, characterized in that: include: A receiving module, configured to receive a broadcast message sent by a first node, wherein the broadcast message includes: information of a block, wherein the block includes: a plurality of first service data arranged in a first order in a first data list; the first order is arranged in a sequence in which the number of second nodes corresponding to the first service data determined by the first node is greater than or equal to a first threshold; A processing module, used to determine whether a plurality of first business data arranged in a first order conflict with an order of a plurality of second business data arranged in a second order included in a second data list; if not, the third node determines that the verification result is a passed verification; if conflicting, the third node determines that the verification result is a failed verification; the second order is arranged in a sequence in which the number of second nodes corresponding to the first business data determined by the third node is greater than or equal to a first threshold; A sending module is used to send a verification message to the first node if the verification result indicates that the verification is passed.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 and 5 to 6 is implemented.
10. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1-4, 5-6 by executing the executable instructions.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 4 and 5 to 6 is implemented.
