A blockchain data processing method and device
By electing the second consensus node in the blockchain and packaging its information into the block, the problem of the prone to attack of fixed consensus nodes is solved, and the security of the blockchain system is improved.
Patent Information
- Application Number
- CN202010247629.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-31
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2040-03-31
AI Technical Summary
In existing authenticated blockchains, fixed consensus nodes are easily attacked by illegal third parties, which affects the security of the blockchain system.
The first consensus node is elected to confirm the M-th block and package the first consensus sequence number information into the block, which increases the difficulty of illegal third-party attacking the consensus node and improves the blockchain System security.
Confirmation of different blocks through different consensus nodes improves the security of the blockchain system and reduces the risk of being illegally attacked.
Smart Images

Figure CN113472561B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the computer field, and specifically to a blockchain data processing method and device. Background Art
[0002] With the rapid development of information technology, blockchain technology has gradually become known to the public. Blockchain is a distributed ledger maintained by multiple nodes, which uses a special data structure "block" to record transactions.
[0003] Authentication blockchain, also known as "private blockchain" or "alliance blockchain". Authentication blockchain requires nodes to join the blockchain system through an authentication service and maintain a node list. Thanks to this node list, authentication blockchain can use a distributed fault-tolerant protocol with higher performance and lower energy consumption to reach consensus on block content and order. In an authentication blockchain, some special nodes will be set as consensus nodes. These consensus nodes run a distributed consensus protocol and are responsible for reaching consensus on the content and order of blocks; other nodes are only responsible for collecting user transactions, storing confirmation blocks, and executing user transactions.
[0004] In existing authenticated blockchains, a portion of nodes will be pre-set and fixed as consensus nodes. When these consensus nodes are deployed on the public network, they will face attacks from illegal third parties. Since these consensus nodes are pre-set and fixed, illegal third parties can easily find these fixed consensus nodes and launch targeted attacks. Once the number of attacked nodes among these fixed consensus nodes exceeds the number that the consensus protocol can withstand, the system will be unable to continue to provide services, affecting the security of the blockchain system. Summary of the invention
[0005] The embodiments of the present application provide a blockchain data processing method and device thereof, which are used to confirm different blocks through different consensus nodes in blockchain data processing, thereby increasing the difficulty for illegal third parties to attack consensus nodes and improving the security of the blockchain system.
[0006] A first aspect of the present application provides a data processing method.
[0007] In the proposal of a round of blocks, the first consensus node of the current round of blocks will elect the second consensus node of the next block, that is, when the first consensus node corresponds to the Nth block, the second consensus node corresponds to the Mth block, and M is greater than N.
[0008] After the first consensus node elects the second consensus node, the first consensus node generates first consensus sequence number information, which includes information of the second consensus node. The first target node among the other multiple nodes in the blockchain can confirm that the first target node belongs to the second consensus node based on the first consensus sequence number information.
[0009] In the embodiment of the present application, a second consensus node for confirming the Mth block is elected through the first consensus node, so that when the Mth block is confirmed, it can be confirmed through the second consensus node, that is, different blocks are confirmed through different consensus nodes, which increases the difficulty for illegal third parties to attack the consensus nodes and improves the security of the blockchain system.
[0010] Based on the implementation method of the first aspect of the embodiments of the present application, in the first implementation method of the first aspect of the embodiments of the present application, after the first consensus node generates the first serial number information, the first consensus node generates the Nth block by obtaining local unconfirmed user transaction transactions, and the Nth block includes the first consensus serial number information, the first consensus node generates a first proposal message, the first proposal message is used to confirm the Nth block, the first proposal message includes the Nth block, and after generating the first proposal message, the first consensus node sends the first proposal message to other nodes in the blockchain.
[0011] In an embodiment of the present application, the first consensus sequence number information is packaged into the Nth block of the current block and sent to other nodes, ensuring that the subsequent consensus nodes can be selected in each round of block confirmation process, thereby improving the fault tolerance of the solution.
[0012] Based on the first aspect of the embodiment of the present application or the first implementation of the first aspect of the embodiment of the present application, in the second implementation of the first aspect of the embodiment of the present application, the first consensus node encrypts the first consensus sequence number information to obtain the second consensus sequence number information. When the first consensus node generates a first proposal message, it packages the Nth block into the first proposal message, and the Nth block includes the second consensus sequence number information. Indirectly, the first proposal message includes the second consensus sequence number information.
[0013] In the embodiment of the present application, the security of the first consensus sequence number information is improved by encrypting the first consensus sequence number information.
[0014] Based on the first aspect, the first implementation manner of the first aspect, or the second implementation manner of the first aspect of the embodiments of the present application, in the third implementation manner of the first aspect of the embodiments of the present application, the first consensus node uses the public key of the elected second consensus node to encrypt the first consensus serial number information to obtain the second consensus serial number information, and the public key of the second consensus node is the serial number of the second consensus node.
[0015] In the embodiment of the present application, the first consensus sequence number information is encrypted by the public key of the second consensus node, thereby improving the security of the first consensus sequence number information.
[0016] Based on the first aspect, the first implementation manner of the first aspect or the third implementation manner of the first aspect of the embodiment of the present application, in the fourth implementation manner of the first aspect of the embodiment of the present application, the first consensus node elects a first proposing node, and the first proposing node is used to submit a second proposal message, and the second proposal message is used to confirm the M block, that is, the first proposing node is used to confirm the M block, and the first proposing node belongs to the second consensus node.
[0017] In the embodiment of the present application, the first consensus node elects the first proposing node for submitting the second proposal message, thereby improving the feasibility of the solution.
[0018] Based on the first aspect, the first implementation manner of the first aspect or the fourth implementation manner of the first aspect of the embodiments of the present application, in the fifth implementation manner of the first aspect of the embodiments of the present application, the first consensus node selects multiple first proposal candidate nodes from the nodes of the blockchain, and the multiple first proposal candidate nodes elect the first proposal node through internal election, that is, the first proposal node belongs to the multiple first proposal candidate nodes.
[0019] In the embodiment of the present application, the first consensus node selects multiple first proposal candidate nodes, and then selects the first proposal node through these multiple first proposal candidate nodes, thereby improving the fault tolerance of the solution.
[0020] Based on the first aspect, the first implementation manner of the first aspect or the fifth implementation manner of the first aspect of the embodiment of the present application, in the sixth implementation manner of the first aspect of the embodiment of the present application, the first consensus node elects a first receiving node, which is used to confirm the Mth block, and the second consensus node includes the first receiving node.
[0021] In the embodiment of the present application, the first consensus node confirms the Mth block by electing the first receiving node, that is, different blocks are confirmed by different receiving nodes in each round of block confirmation, thereby improving the security of the blockchain.
[0022] Based on the first aspect, the first implementation manner of the first aspect or the sixth implementation manner of the first aspect of the embodiment of the present application, in the seventh implementation manner of the first aspect of the embodiment of the present application, the first consensus node selects the first receiving node by means of a random sampling function.
[0023] In the embodiment of the present application, the first consensus node selects the first receiving node by means of a random sampling function, and the receiving node can be randomly and evenly selected in the blockchain.
[0024] Based on the first aspect of the embodiment of the present application, the first implementation mode of the first aspect or the seventh implementation mode of the first aspect, in the eighth implementation mode of the first aspect of the embodiment of the present application, when there is a new first newly added node in the blockchain that needs to be added to the blockchain, the first newly added node can find the node in the blockchain to initiate a joining request, and when the first consensus node receives the joining request of the first newly added node, the first consensus node will send a verification request to the verification server, and the verification request is used to verify the first newly added node. After receiving the verification request, the verification server will verify the first newly added node. When the verification passes, the verification server will send the first newly added information to the first consensus node, and the first newly added information includes the information of the new first newly added node. The first consensus node will then generate a first first newly added transaction message, and the first first newly added transaction message includes the information of the first newly added node. The first consensus node will send the first newly added transaction message to other nodes in the blockchain, so that other nodes in the blockchain can also save the first newly added transaction message, so that the first newly added transaction message can be quickly confirmed in the proposal of the next round of blocks, and then the first newly added node can be quickly added to the blockchain.
[0025] In the embodiment of the present application, the first consensus node can increase the difficulty for an illegal third party to join the blockchain by verifying the information of the first newly added node with the verification server, thereby improving the security of the blockchain.
[0026] Based on the first aspect, the first implementation manner of the first aspect or the eighth implementation manner of the first aspect of the embodiments of the present application, in the ninth implementation manner of the first aspect of the embodiments of the present application, after the first newly added node is determined to join the blockchain, if the public key of the first newly added node does not appear in the transactions of the next L blocks, then the first newly added node is marked as an invalid node by other nodes in the blockchain, that is, it is deleted from the blockchain, and L can be a positive integer greater than or equal to 1.
[0027] In the embodiment of the present application, by limiting the effective period of the first newly added node, the nodes that have been inactive in the blockchain for a long time are made invalid, thereby avoiding occupying the resources of the blockchain.
[0028] Based on the first aspect, the first implementation manner of the first aspect, or the ninth implementation manner of the first aspect of the embodiments of the present application, in the tenth implementation manner of the first aspect of the embodiments of the present application, after the first consensus node sends a first proposal message to other nodes in the blockchain, the first consensus node will receive P first reply messages, and these P first reply messages are sent to the first consensus node by other nodes in the blockchain. The first consensus node parses the P first reply messages and obtains I second reply messages, and these I second reply messages are valid confirmation messages, and these I valid confirmation messages are less than or equal to the P first reply messages.
[0029] If I is greater than the preset threshold, the first consensus node updates the block status of the Nth block to the confirmed status, and the first consensus node generates a first confirmation message, which indicates the block status of the Nth block. The first consensus node sends the first confirmation message to other nodes in the blockchain so that other nodes can confirm the status of the Nth block through the first confirmation message.
[0030] In the embodiment of the present application, the status of the Nth block is determined only when the number of replies to the valid confirmation message is greater than a preset threshold, thereby ensuring the stability of the blockchain.
[0031] Based on the first aspect, the first implementation manner of the first aspect, or the tenth implementation manner of the first aspect of the embodiments of the present application, in the eleventh implementation manner of the first aspect of the embodiments of the present application, after the first consensus node sends a first proposal message to other nodes in the blockchain, the first consensus node will receive P first reply messages, and these P first reply messages are sent to the first consensus node by other nodes in the blockchain. The first consensus node parses the P first reply messages and obtains I second reply messages, and these I second reply messages are valid confirmation messages, and these I valid confirmation messages are less than or equal to the P first reply messages.
[0032] If I is less than the preset threshold, the first consensus node updates the block status of the Nth block to a questionable state, and generates a first confirmation message, which indicates the block status of the Nth block. The first consensus node sends the first confirmation message to other nodes in the blockchain so that other nodes can confirm the status of the Nth block through the first confirmation message.
[0033] In the embodiment of the present application, when the number of replies to the valid confirmation message is less than a preset threshold, the status of the Nth block is determined to be in a questionable state, thereby ensuring the stability of the blockchain.
[0034] Based on the first aspect, the first implementation manner of the first aspect, or the eleventh implementation manner of the first aspect of the embodiment of the present application, in the twelfth implementation manner of the first aspect of the embodiment of the present application, the first proposal message also includes a message of a questionable block, and the message of the questionable block indicates that the block status of the Hth block is a questionable block, H is less than N, that is, the Hth block is a block before the Nth block. After the first consensus node sends the first proposal message to other nodes in the blockchain, the first consensus node will receive P first reply messages, and these P first reply messages are sent to the first consensus node by other nodes in the blockchain. The first consensus node parses the P first reply messages and obtains I second reply messages, and these I second reply messages are valid confirmation messages, and these I valid confirmation messages are less than or equal to the P first reply messages.
[0035] The first consensus node updates the block status of the Hth block according to I second reply messages.
[0036] In an embodiment of the present application, when there is a doubtful block in the blockchain, the feasibility of the solution is improved by confirming the block status of the doubtful block through reply messages from other nodes in the blockchain when confirming the Nth block.
[0037] Based on the first aspect, the first implementation manner of the first aspect, or the twelfth implementation manner of the first aspect of the embodiments of the present application, in the thirteenth implementation manner of the first aspect of the embodiments of the present application, if there is a confirmation message of the Hth block in the I second reply messages, the first consensus node updates the block status of the Hth block to a confirmed status.
[0038] In the embodiment of the present application, the block status of the questionable block is confirmed through the reply message of other nodes in the blockchain, which improves the feasibility of the solution.
[0039] Based on the first aspect, the first implementation manner of the first aspect, or the thirteenth implementation manner of the first aspect of the embodiments of the present application, in the fourteenth implementation manner of the first aspect of the embodiments of the present application, if there is no confirmation message of the Hth block in the I second reply messages, and the difference between N and H is greater than a preset threshold, the first consensus node updates the block status of the Hth block to a confirmed status.
[0040] In the embodiment of the present application, the H block is determined to be a confirmed block by the difference between N and H being greater than a preset threshold, thereby improving the feasibility of the solution.
[0041] Based on the first aspect, the first implementation manner of the first aspect, or the fourteenth implementation manner of the first aspect of the embodiments of the present application, in the fifteenth implementation manner of the first aspect of the embodiments of the present application, if there is no confirmation message of the Hth block in the I first reply messages, and the difference between N and H is less than the preset threshold, the first consensus node updates the block status of the Hth block to a questionable state.
[0042] In the embodiment of the present application, the difference between N and H is less than a preset threshold value, and the H block is confirmed to be a block in a questionable state, thereby improving the feasibility of the solution.
[0043] A second aspect of the present application provides a data processing method.
[0044] The first target node receives the first proposal message sent by the first consensus node, which includes information of the Nth block and the second consensus sequence number. The information of the second consensus sequence number is obtained by encrypting the first consensus sequence number information. The first consensus sequence number includes information of the second consensus node. The second consensus node is obtained by election of the first consensus node. The second consensus node is the consensus node of the Mth block and is used to determine the Mth block. M is greater than N.
[0045] The first target node decrypts the second consensus sequence number information to obtain decrypted information, and the first target node determines that the first target node is the consensus node of the Mth block through the decrypted information.
[0046] In an embodiment of the present application, the first target node determines that the first target node is the consensus node of the Mth block by parsing the second consensus sequence number information, so that the Mth block can be confirmed through the first target node, that is, different blocks are confirmed through different nodes in each round, thereby improving the security of the blockchain system.
[0047] Based on the implementation method of the second aspect of the embodiments of the present application, in the first implementation method of the second aspect of the embodiments of the present application, before the first target node receives the first proposal message sent by the first consensus node, the first target node does not receive a proposal request for the Qth block within a preset time period T, then the first target node adds a blank Qth block locally, and marks the block status of the Qth block as a questionable block.
[0048] In the embodiment of the present application, if the first target node does not receive a proposal message for a certain block within a certain period of time, a blank doubtful block is added locally, thereby improving the fault tolerance of the solution.
[0049] Based on the second aspect of the embodiment of the present application or the first implementation of the second aspect of the embodiment of the present application, in the second implementation of the second aspect of the embodiment of the present application, the first target node sends a third reply message to the first consensus node with a probability of W, and the third reply message does not include information for confirming the Nth block, and W is greater than 0.
[0050] In an embodiment of the present application, the first target node sends a message that does not contain a message for confirming the Nth block to the first consensus node with a probability of W, which can reduce the probability of an illegal third party obtaining knowledge of the consensus nodes in the blockchain by intercepting the message, thereby improving the security of the blockchain system.
[0051] Based on the second aspect of the embodiment of the present application or the second implementation of the second aspect of the embodiment of the present application, in the third implementation of the second aspect of the embodiment of the present application, the second consensus serial number information is obtained by encrypting the first consensus serial number information through the public key of the first target node, and when the first target node decrypts through the private key stored in the trusted execution environment TEE of the first target node, the decrypted information can be obtained, and the first target node confirms that the first target node belongs to the second consensus node.
[0052] In an embodiment of the present application, the first target node decrypts the second consensus sequence number information through the private key stored in the TEE to confirm that the first target node belongs to the second consensus node, thereby improving the security of the solution.
[0053] A third aspect of the embodiments of the present application provides a computer device.
[0054] The member module is used to elect the second consensus node. The first consensus node corresponds to the Nth block, and the second consensus node corresponds to the Mth block, where M is greater than N.
[0055] The consensus module is used to generate first consensus sequence number information, the first consensus sequence number information includes information of the second consensus node, and the information of the second consensus node is used for the target node to confirm that it belongs to the second consensus node.
[0056] Optionally, the computer device also includes:
[0057] The blockchain core module is used to generate the Nth block, which includes the first consensus sequence number information;
[0058] The blockchain core module is also used to generate a first proposal message, which is used to confirm the Nth block;
[0059] The network module is configured to send a first proposal message.
[0060] Optionally, the consensus module is further used to encrypt the first consensus sequence number information to obtain the second consensus sequence number information;
[0061] The first proposal message includes second consensus sequence number information.
[0062] Optionally, the consensus module is also used to encrypt the first consensus serial number information using a public key to obtain the second consensus serial number information, and the public key is the serial number of the second consensus node.
[0063] Optionally, the member module is specifically used to elect a first proposing node, the first proposing node is used to submit a second proposing message, the second proposing message is used to confirm the Mth block, and the first proposing node belongs to the second consensus node.
[0064] Optionally, the member module is specifically used to elect a plurality of first proposal candidate nodes, the plurality of first proposal candidate nodes are used to elect the first proposal node, and the plurality of first proposal candidates include the first proposal node.
[0065] Optionally, the member module is specifically used to elect a first receiving node, the first receiving node is used to confirm the Mth block, and the first receiving node belongs to the second consensus node.
[0066] Optionally, the member module is specifically configured to select the first receiving node through a random sampling function.
[0067] Optionally, the network module receives a joining request from the first newly added node, where the joining request is used to request to join a blockchain, where the blockchain is the blockchain where the first consensus node is located;
[0068] The network module is also used to send a verification request to the verification server, where the verification request is used to verify the first newly added node;
[0069] The network module is also used to receive first newly added information sent by the verification server, where the first newly added information includes information of the newly added node;
[0070] The blockchain core module generates a first new transaction message, where the first new transaction message includes first new information;
[0071] The network module sends a first new transaction message.
[0072] Optionally, after the first newly added node is determined to join the blockchain, if the public key of the first newly added node does not appear in the transactions of L blocks, the first newly added node is deleted from the blockchain, where L is a positive integer greater than or equal to 1.
[0073] Optionally, the computer device also includes:
[0074] A processor, configured to parse P first reply messages to obtain I second reply messages, where the second reply messages are valid confirmation messages, and I is less than or equal to P;
[0075] If I is greater than a preset threshold, the blockchain core module is also used to update the status of the Nth block to a confirmed status;
[0076] The processor is further configured to generate a first confirmation message, the first confirmation message indicating a status of the Nth block;
[0077] The network module is also used to send a first confirmation message.
[0078] Optionally, the network module is further used to receive P first reply messages;
[0079] The processor parses P first reply messages to obtain I second reply messages, where the second reply message is a valid confirmation message, and I is less than or equal to P;
[0080] If I is less than a preset threshold, the blockchain core module is also used to update the status of the Nth block to a questionable state;
[0081] The processor is further configured to generate a first confirmation message, the first confirmation message indicating a status of the Nth block;
[0082] The network module is also used to send a first confirmation message.
[0083] Optionally, the first proposal message includes a questionable block message, the questionable block message indicates that the block status of the Hth block is a questionable block, H is less than N, and the network module is further used to receive P first reply messages;
[0084] The processor parses P first reply messages to obtain I second reply messages, where the second reply message is a valid confirmation message, and I is less than or equal to P;
[0085] The blockchain core module is also used to update the block status of the H block according to the I second reply message.
[0086] Optionally, if there is a confirmation message of the Hth block in the I second reply messages, the blockchain core module is specifically used to update the block status of the Hth block to a confirmed status.
[0087] Optionally, if there is no confirmation message for the Hth block in the I second reply messages, and the difference between N and H is greater than a preset threshold, the blockchain core module is also used to update the block status of the Hth block to a confirmed status.
[0088] It is also used to, if there is no confirmation message of the Hth block in the I second reply messages, and the difference between N and H is less than a preset threshold, then the blockchain core module is specifically used to update the block status of the Hth block to a questionable state.
[0089] A fourth aspect of the embodiments of the present application provides a computer device.
[0090] A network module is used to receive a first proposal message sent by a first consensus node, the first proposal message includes the Nth block and the second consensus sequence number information, the second consensus sequence number information is obtained by encrypting the first consensus sequence number information, the first consensus sequence number includes information of the second consensus node, the second consensus node is obtained by election of the first consensus node, the second consensus node is the consensus node of the Mth block, and M is greater than N;
[0091] A processor, configured to decrypt the second consensus sequence number information to obtain decrypted information;
[0092] The member module is used to determine that the first target node is the consensus node of the Mth block through decrypted information.
[0093] Optionally, if no proposal request for the Qth block is received within a preset time period T, the computer device further includes:
[0094] The core module of blockchain is used to add the Qth block. The Qth block is a blank block and the status of the Qth block is in doubt.
[0095] Optionally, the network module is also used to send a third reply message to the first consensus node with a probability of W, and the third reply message does not include information for confirming the Nth block, and W is greater than 0.
[0096] Optionally, the second consensus sequence number information is obtained by encrypting the first consensus sequence number information with a public key of a computer device, and the computer device further includes:
[0097] The consensus module is used to decrypt the second consensus serial number information by using the private key of the computer device to obtain decrypted information, and the private key is stored in the trusted execution environment TEE of the computer device.
[0098] A fifth aspect of an embodiment of the present application provides a computer device.
[0099] A processor and a memory, the processor and the memory being electrically coupled;
[0100] A memory is used to store program instructions; a processor is used to read and execute the program instructions stored in the memory. When the program instructions are executed by the processor, the computer device executes the method as implemented in the first aspect of the present application.
[0101] Optionally, the computer device further comprises:
[0102] Communication interface, used to send or receive information.
[0103] A sixth aspect of an embodiment of the present application provides a computer device.
[0104] A processor and a memory, the processor and the memory being electrically coupled;
[0105] A memory is used to store program instructions; a processor is used to read and execute the program instructions stored in the memory. When the program instructions are executed by the processor, the computer device executes the method as implemented in the second aspect of the present application.
[0106] Optionally, the computer device further comprises:
[0107] Communication interface, used to send or receive information.
[0108] A seventh aspect of the embodiments of the present application provides a computer storage medium, wherein the computer storage medium stores instructions, and when the instructions are executed on the computer, the computer executes the method described in the implementation method of the first aspect of the present application.
[0109] An eighth aspect of the embodiments of the present application provides a computer program product. When the computer program product is executed on a computer, it enables the computer to execute the method described in the implementation method of the first aspect of the present application.
[0110] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0111] The second consensus node for confirming the Mth block is elected through the first consensus node, so that when the Mth block is confirmed, it can be confirmed through the second consensus node, that is, different blocks are confirmed through different consensus nodes, which increases the difficulty for illegal third parties to attack the consensus nodes and improves the security of the blockchain system. BRIEF DESCRIPTION OF THE DRAWINGS
[0112] Figure 1 A schematic diagram of a framework diagram of a data processing method provided in an embodiment of the present application;
[0113] Figure 2 A schematic diagram of a flow chart of a data processing method provided in an embodiment of the present application;
[0114] Figure 3 Another schematic diagram of a data processing method according to an embodiment of the present invention;
[0115] Figure 4 A schematic diagram of the structure of a computer device provided in an embodiment of the present application;
[0116] Figure 5 Another structural schematic diagram of a computer device provided in an embodiment of the present application;
[0117] Figure 6 Another structural schematic diagram of a computer device provided in an embodiment of the present application;
[0118] Figure 7 Another structural schematic diagram of a computer device provided in an embodiment of the present application;
[0119] Figure 8 Another structural schematic diagram of a computer device provided in an embodiment of the present application;
[0120] Fig. 9 Another structural schematic diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0121] The embodiment of the present application provides a data processing method for blockchain data processing, in which different consensus nodes confirm different blocks, which increases the difficulty for illegal third parties to attack consensus nodes and improves the security of the blockchain system.
[0122] See also Figure 1 , which is a framework diagram of the blockchain data processing method provided in this application.
[0123] like Figure 1 As shown, the blockchain includes multiple nodes, including consensus nodes and ordinary nodes 103, the consensus nodes include proposer nodes 101 and receiver nodes 102, and the blockchain also includes a verification server 104. The multiple nodes or the multiple nodes and the verification server are connected through a wired network or a wireless network.
[0124] If connected through a wired network, the general connection form is a fiber optic network. It is understandable that it can also be connected through other wired networks, such as ADSL connection, wired broadband connection, etc., which are not limited here. If connected through a wireless network, it can be connected through WLAN (i.e., Wi-Fi connection). It is understandable that it can also be connected through other wireless networks, such as Bluetooth connection, data network connection, such as 2G GPRS or EDGE and CDMA, 3G WCDMA, CDMA, 4G TD-LTE, FDD-LTE, 5G, 6G and other data network connections, which are not limited here.
[0125] The blockchain provided by this application runs in a P2P network mode. Nodes reach consensus on the content and order of blocks through a distributed consensus protocol to confirm a unique blockchain. Each block mainly consists of three components: 1. The hash value of the previous block; 2. Orderly arranged transactions; 3. Metadata attached to the consensus protocol (such as the signature provided by the proposer node of the block). Because each block stores the hash value of the previous block, forming a chain structure, modifying the block in the middle of the chain will cause the hash values of subsequent blocks to be inconsistent. This mechanism ensures that the blocks on the blockchain are difficult to be tampered with.
[0126] It should be noted that the blockchain provided by this application is an authenticated blockchain. Authentication blockchain requires nodes to join the blockchain system through the authentication service of an authentication server and maintain a node list. In an authenticated blockchain, some special nodes will be set as consensus nodes. These consensus nodes run a distributed consistency protocol and are responsible for reaching consensus on the content and order of blocks. Other ordinary nodes are only responsible for receiving user transactions, storing and confirming blocks, and executing user transactions.
[0127] The node in the present application can be a device with wireless transceiver function, or a device that only supports wired transmission, which is not limited here. For example, the node can be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a vehicle-mounted terminal device, a wireless terminal in self-driving, a wireless terminal in remote medical, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, a wearable terminal device, etc.
[0128] In the blockchain provided by the present application, the proposer node 101 is used to propose the current round of blocks. The proposer node 101 will send a proposal message to other nodes. The proposal message includes the content and related information of this round of blocks. When the ordinary node 103 receives the proposal message, the ordinary node 103 will save the block content included in the proposal message to the local blockchain core module. After receiving the proposal message, the receiver node 102 will also save the block content included in the proposal message to the local blockchain core module, and reply a confirmation message to the proposer node 101. After the proposer 101 receives the confirmation message sent by the receiver node 102, it will confirm the status of the block according to the confirmation message, thereby completing the confirmation work of this round of blocks.
[0129] It should be noted that the node of the blockchain provided by this application has a built-in trusted execution environment module (Trusted Execution Environment, TEE), and the programs and data in the trusted execution environment module are stored in a memory area isolated from the ordinary execution environment, so that those illegal third parties cannot extract or tamper with the data and programs in the trusted execution environment module. It is understandable that in the actual application process, the specific form of the trusted execution environment module can be a module implemented by software and hardware, or a separate physical module, which is not limited here.
[0130] The trusted execution environment module provides two security features: confidentiality and integrity. Confidentiality means that the data and code of the TEE program cannot be snooped by untrusted third parties such as untrusted operating systems. This is because the memory area storing data and code is isolated from ordinary untrusted memory. Integrity means that this part of the memory area cannot be tampered with by external illegal third parties. At the same time, TEE execution provides users with a remote verification mechanism to confirm that a specific program is indeed in a real TEE, rather than being completed through a virtual machine.
[0131] The verification server 104 in the blockchain can be a separate server device or a cloud platform with verification function, which is not limited here. The main function of the verification server 104 is to distinguish between a real TEE hardware and a virtual TEE hardware (such as a virtual machine). A user can use a virtual machine to simulate TEE hardware, but in fact these simulated hardware are actually a software on the host machine, so they do not have the security of a real TEE.
[0132] In actual application, the nodes in this framework can include several modules: TEE module, network module, blockchain core module and operating system. TEE module can also include: member module, consensus module and private key. The member module is responsible for maintaining the node list and sorting it according to the public key (account) of each node. The consensus module is responsible for running the formula algorithm of the blockchain system. Running in TEE ensures that the randomly selected consensus node will follow the algorithm and hide the identity information of the consensus node. The private key is generated inside the TEE and is only visible inside the TEE. It is used to sign all messages sent by the TEE to prove that the messages sent are indeed from the TEE.
[0133] The network module is used to broadcast data between nodes using the gossip protocol, and the functions of the blockchain core module may include: responsible for storing confirmed blocks locally; maintaining a pool of user transaction transactions to be confirmed, for example, when a user transaction transaction is confirmed, the confirmed user transaction transaction can be deleted from the pool of user transaction transactions to be confirmed; responsible for forming new blocks; responsible for executing confirmed transactions.
[0134] It should be noted that the number of nodes in the blockchain framework provided in this application is only an example. In actual application, more consensus nodes and ordinary nodes may be included. For example, the number of consensus nodes may be set according to the network scale. In an optional manner, it may be set to one tenth to one hundredth of the total number of nodes, which is not limited here.
[0135] It can also be understood that the composition mode of the modules in the node provided in this application is only an example. In actual application, more modules may be included, such as input and output modules, etc., or only a part of the modules listed above may exist. The specific situation shall prevail according to the actual application situation, and this application does not limit this.
[0136] Combine the following Figure 1 The data processing framework of the blockchain provided in this application describes the data processing method in the embodiments of the present application.
[0137] In the embodiment of the present application, when the blockchain system confirms a block, there are two working modes: one is the normal mode, that is, if there is no blank doubtful block in the previous block that needs to be confirmed, the current block is directly confirmed; the other is the query mode, that is, if there is a blank doubtful block in the previous block that needs to be confirmed, the query mode is turned on and the current block is confirmed at the same time. The embodiments of the present application will describe the above two situations respectively.
[0138] 1. There are no blank questionable blocks that need to be confirmed before confirming the current block.
[0139] See also Figure 2 , which is a flow chart of an embodiment of the data processing method provided in this application.
[0140] In step 201, the proposing node receives a joining request from a first newly added node.
[0141] When a new node needs to join the blockchain, that is, when the first newly added node needs to join the blockchain, the first newly added node can find a member node that is already in the blockchain through an external mechanism, such as in a forum or other platform, and send a joining request to the member node.
[0142] The joining request may include basic information of the first newly added node, such as the address and public key of the first newly added node. It can be understood that the basic information of the first newly added node may also include other information, such as TEE environment information and the code of the program therein, etc., which is not limited here.
[0143] In this embodiment, sending a joining request of the first newly added node to the proposing node is taken as an example for explanation. It can be understood that in actual application, the first newly added node can also initiate a joining request through other nodes in the blockchain, such as a receiver node or an ordinary node, which is not limited here.
[0144] In step 202, the proposing node sends a verification request to the verification server.
[0145] After the proposing node receives the joining request sent by the first newly added node, the proposing node sends a verification request to the verification server based on the joining request, where the verification request is used to verify basic information of the first newly added node.
[0146] After the verification server receives the basic information of the first newly added node, the verification server verifies the basic information of the first newly added node. For example, the verification server verifies the TEE environment information of the first newly added node, or verifies the integrity of the program code in the TEE of the first newly added node to determine whether the execution environment of the first newly added node is safe. It is understandable that other information of the first newly added node can also be verified, such as verifying the address information of the first newly added node, which is not limited here.
[0147] In actual application, the verification process can be verified through the protocol provided by the CPU, in which the algorithm used is the DHKE algorithm. During the verification process, an encrypted communication channel can be established between the first newly added node and the proposer node, for example, an encrypted communication channel is established through the https protocol. In this embodiment, the specific method of the verification process is not limited.
[0148] In step 203, the proposing node receives the first newly added information sent by the verification server.
[0149] After the verification server verifies the basic information of the first newly added node, the verification server sends the first newly added information to the proposing node, where the first newly added information includes the confirmed information of the newly added node.
[0150] After the proposing node receives the first new information sent by the verification server, it will send a confirmation message to the first newly added node. After receiving the confirmation message, the first newly added node will generate its own key group inside the TEE of the first newly added node. The key group includes a public key and a private key, where the private key is only visible inside the TEE. The public key serves as the account of the first newly added node. The first newly added node sends the public key of the first newly added node to the proposer node.
[0151] In step 204, the proposing node sends a first new transaction message.
[0152] After receiving the first newly added information and the public key of the first newly added node sent by the verification server, the proposing node generates a first newly added transaction message, which includes the first newly added information and the public key of the first newly added node.
[0153] For example, the first newly added transaction message may include the public key of the first newly added node, that is, the account of the first newly added node, the address of the first newly added node. It can be understood that other information may also be included, such as the verification result of the first newly added node, etc. The proposing node will sign the content in the first newly added transaction information, that is, encrypt the content in the first newly added transaction information.
[0154] After generating the first new transaction message, the proposing node will send the first new transaction message to other nodes in the blockchain, that is, broadcast the first new transaction message to other nodes in the blockchain.
[0155] When other nodes in the blockchain receive the first new transaction message, they will save the content of the first new transaction message locally. When the first new transaction message is packaged into a block and finally confirmed, the first new node is considered to have successfully joined the blockchain.
[0156] Optionally, in actual application, after the first newly added node is determined to have joined the blockchain, the first newly added node will obtain membership of L blocks, that is, the first newly added node is recognized as a member of the node in the blockchain in the proposals of the L blocks. When the first newly added node uses the public key once each time in the proposals of the L blocks, the membership of the first newly added node is refreshed to L blocks. When the public key of the first newly added node does not appear in the transactions of the L blocks, for example, the first newly added node does not participate in the transactions of the L blocks as a consensus node, or does not initiate user transaction transactions in the transactions of the L blocks, the first newly added node is deleted from the blockchain, that is, other nodes will update the local member node list, set the status of the first newly added node to invalid or delete the first newly added node. Optionally, the first newly added node can re-initiate a joining request after its membership is about to expire or expires.
[0157] For example, when the first newly added node is added to the blockchain, it has membership of 1000 blocks, and the block being confirmed in the blockchain at this time is the 200th block. If the public key of the first newly added node does not appear in the transactions of the blocks from the 200th block to the 1200th block, then after the 1200th block is confirmed, the first newly added node is no longer a node in the blockchain. Of course, the first newly added node can initiate a joining request again at the 1100th block, or initiate a joining request again after the expiration.
[0158] In step 205, the proposing nodes elect a first proposing node.
[0159] In a round of block proposals, the proposing node of the current round of blocks will elect the consensus node of the next block, that is, when the proposing node is the proposing node of the Nth block, it will elect the second consensus node of the Mth block. The second consensus node includes the first proposing node and the first receiving node. M is greater than N. When the proposing node elects the first proposing node, the proposing node can elect the first proposing node in a variety of ways.
[0160] Optionally, the proposing node may directly determine a node in the node list as the first proposing node of the Mth block. For example, the proposing node randomly selects a node in the node list through a random function and uses the node as the first proposing node. It is understandable that the first proposing node of the Mth block may also be directly determined by other methods, which are not limited here.
[0161] Optionally, the proposing node may also select multiple first proposing candidate nodes and then conduct another election among the multiple first proposing candidate nodes to generate the first proposing node.
[0162] For example, after multiple first proposal candidate nodes confirm their identities as first proposal candidate nodes, each of the multiple first proposal candidate nodes has a vote. Each first proposal candidate node first randomly generates a number as its priority. The larger the number, the higher the priority. Each first proposal candidate node first casts the vote in its hand for itself, and then generates a request for voting information. The request for voting information includes the priority of the first proposal candidate node, and broadcasts the request for voting information. When a first proposal candidate node receives a request for voting information from another first proposal candidate node with a higher priority than itself, it will cast all the votes in its hand, including the votes cast by others for the first proposal candidate node, to the first proposal candidate node with a higher priority than itself, and this vote is only conducted once. As the request for voting information of each first proposal candidate node is propagated in the blockchain, there will eventually be a first proposal candidate node with more than half of the votes, and the first candidate node with more than half of the votes will be confirmed as the first proposal node.
[0163] It is understandable that a first proposal node can be elected from multiple first proposal candidate nodes in other ways, such as a first-come, first-served election method, that is, not voting by priority, directly broadcasting a request for voting information, and when a first candidate node receives the request for voting information from other first candidate nodes, it directly casts all the votes in its hand to the first candidate node. In actual application, there are many ways to elect, which are not limited here.
[0164] In step 206, the proposing node elects a first receiving node.
[0165] When the proposing node elects the first receiving node, the first receiving node may also be elected in a variety of ways.
[0166] Optionally, the proposing node may randomly select multiple first receiving nodes from the node list through a random function. It will be understood that multiple first receiving nodes may also be selected through other methods, such as grouping the nodes in the node list, and then selecting a node with a public key ending in 1 from each group of nodes as the first receiving node. In the embodiments of the present application, the specific method of selecting the first receiving node is not limited.
[0167] In step 207, the proposing node generates first consensus sequence number information.
[0168] After the proposing node elects the consensus node for the block proposal, the proposing node generates first consensus serial number information, which includes information of multiple second consensus nodes, and the information of each second consensus node in the multiple second consensus nodes is encrypted using the public key of the corresponding second consensus node.
[0169] It should be noted that the public key of the second consensus node can be the serial number of the second consensus node, or it can be in other forms, as long as it is generated based on the information of the second consensus node, and there is no specific limitation here.
[0170] For example, the first consensus serial number information includes A encryption certificates, each of which is a preset text encrypted using the public key of the corresponding second consensus node. It can be understood that the first consensus serial number information can also be in other forms, which are not specifically limited here.
[0171] Optionally, the proposing node may encrypt the first consensus sequence number information by asymmetric encryption to obtain the second consensus sequence number information.
[0172] It is understandable that, in actual application, the information of the second consensus node may also be encrypted by other asymmetric encryption methods, which are not specifically limited here.
[0173] In step 208, the proposing node generates the Nth block.
[0174] The proposing node obtains the unconfirmed user transaction transactions stored locally and generates the Nth block, which includes the unconfirmed user transaction transactions stored locally.
[0175] For example, when generating the Nth block, the proposing node obtains the first consensus node serial number information or the second consensus node serial number information, and packages the first consensus serial number information or the second consensus serial number information into the Nth block.
[0176] When generating the Nth block, the proposing node will obtain the status of all blocks saved locally. If no doubtful blocks are found, the proposing node will generate the Nth block based on the local unconfirmed user transactions.
[0177] Optionally, the proposing node may also encrypt the Nth block, for example, by encrypting the Nth block using the public key of the proposing node. It is understandable that asymmetric encryption may also be performed in other ways, which are not specifically limited here.
[0178] In step 209, the proposing node generates a first proposing message.
[0179] After the proposing node generates the Nth block, the proposing node generates a first proposal message, which includes the Nth block and is used to confirm the Nth block.
[0180] In step 210, the proposing node sends a first proposing message.
[0181] After the proposing node generates the first proposal message, the proposing node sends the first proposal message to other receiving nodes and ordinary nodes in the blockchain.
[0182] After the receiving node in the blockchain receives the first proposal message, the receiving node will save the Nth block proposal in the first proposal message locally and reply with a first reply message.
[0183] For example, the receiving node will save the Nth block proposal in the first proposal message to the local proposal cache and reply with an ACK message. The ACK message may include the block number N, and the ACK message will be encrypted by the public key of the proposer node. Only the proposer can decrypt this information using the private key in the proposer's TEE.
[0184] After receiving the first proposal message, the ordinary node in the blockchain will save the Nth block proposal in the first proposal message locally and reply with a false first reply message with a probability of W.
[0185] For example, after saving the Nth block proposal to the local proposal cache, the ordinary node replies with an ACK message with a probability of 5%. The ACK message includes the block sequence number N, and the ACK message is also encrypted. However, when the proposer decrypts it with the private key in the proposer's TEE, it can be determined that the ACK message is a false message.
[0186] It should be noted that when other nodes in the blockchain do not receive the first proposal message within a certain period of time, the node will add a blank block as the block of this round and save it locally.
[0187] For example, if other nodes in the blockchain do not receive the first proposal message within 4 seconds, the node will add a blank block, that is, a block without any user transaction transactions as the block of this round, and save it in the local proposal cache. When there is a message that the block of this round is confirmed in the subsequent block proposal message, the node will update the blank block to the block confirmed in this round.
[0188] When other nodes in the blockchain receive the first proposal message of the Nth block, whether they are consensus nodes or ordinary nodes, they will try to decrypt the second consensus node information. If the decryption is successful, they will confirm that they are the consensus node of the Mth block.
[0189] For example, a consensus node or an ordinary node attempts to decrypt the encrypted certificate in the second consensus node information through the private key stored in the node TEE. If the decryption is successful, it confirms that it is the second consensus node of the Mth block. It can be understood that in actual application, other asymmetric decryption methods can be used to verify whether the node is the second consensus node of the Mth block. The specific details are not limited here.
[0190] In step 211, the proposing node receives the first reply message.
[0191] After other nodes in the blockchain receive the first proposal message, they will send P first reply messages to the proposing node.
[0192] After the proposing node receives P first reply messages, it will decrypt the P first reply messages. When the P first reply messages contain fake first reply messages sent by ordinary nodes, the proposing node will obtain I second reply messages. The I second reply messages are valid confirmation messages, that is, the I second reply messages are sent by the consensus node.
[0193] It can be understood that when the P first reply messages do not include a false first reply message sent by an ordinary node, I is equal to P at this time.
[0194] In step 212, the proposing node updates the status of the Nth block according to I second reply messages.
[0195] After the proposing node receives I second reply messages, it updates the status of the Nth block according to the contents of the I second reply messages.
[0196] Optionally, when the number of I second reply messages is greater than a preset threshold, the node is proposed to update the status of the Nth block to the confirmed status. For example, when the number of receiving nodes in the blockchain is 100, the number of I second reply messages is greater than 65% of the number of receiving nodes in the blockchain, that is, when there are 65 second reply messages or more, the node is proposed to update the status of the Nth block to the confirmed status.
[0197] Optionally, when the number of I second reply messages is less than a preset threshold, the node is proposed to update the status of the Nth block to a questionable state. For example, when the number of receiving nodes in the blockchain is 100, the number of I second reply messages is less than 65% of the number of receiving nodes in the blockchain, that is, when there are less than 35 second reply messages, the node is proposed to update the status of the Nth block to a questionable state.
[0198] In step 213, the proposing node sends a first confirmation message.
[0199] After the proposing node determines the status of the Nth block based on I second reply messages, the proposing node generates a first confirmation message, which is used to indicate the status of the Nth block, and sends the first confirmation message to other nodes in the blockchain.
[0200] For example, after the proposing node determines that the status of the Nth block is the confirmed status, the proposing node sends a first confirmation message to other nodes in the blockchain. The first confirmation message is used to allow other nodes to update the local blockchain status and update the Nth block to the confirmed status.
[0201] For example, after the proposing node determines that the status of the Nth block is in a questionable state, the proposing node sends a first confirmation message to other nodes in the blockchain. The first confirmation message is used to allow other nodes to update the local blockchain status and update the Nth block to a questionable state.
[0202] It should be noted that, in this embodiment, steps 201 to 204 are optional steps. For example, when there is no need to add new nodes in the blockchain system or the verification server fails, steps 201 to 204 are not executed, and the blockchain system uses the currently existing nodes to elect and confirm blocks.
[0203] In the embodiment of the present application, the proposing node elects a consensus node for confirming subsequent blocks, and confirms different blocks through different nodes, thereby reducing the risk of the blockchain system crashing due to an illegal third party attacking the consensus node and improving the security of the blockchain system.
[0204] The above describes the situation where there is no blank doubtful block that needs to be confirmed before the current block is confirmed. The following describes the situation where there is a blank doubtful block that needs to be confirmed before the current block is confirmed.
[0205] 2. Before confirming the current block, there is a blank block in doubt that needs to be confirmed.
[0206] See also Figure 3 , which is another flow chart of the data processing method provided in an embodiment of the present application.
[0207] In step 301, the proposing node receives a joining request from a first newly added node.
[0208] In step 302, the proposing node sends a verification request to the verification server.
[0209] In step 303, the proposing node receives the first newly added information sent by the verification server.
[0210] In step 304, the proposing node sends the first newly added transaction information.
[0211] In step 305, the proposing node elects a first proposing node.
[0212] In step 306, the proposing node elects a first receiving node.
[0213] In step 307, the proposing node generates first consensus sequence number information.
[0214] In this embodiment, the method description in steps 301 to 307 is the same as Figure 2 In the illustrated embodiment, steps 201 to 207 are similar and will not be described in detail herein.
[0215] In step 308, the proposing node generates the Nth block.
[0216] The proposing node obtains the unconfirmed user transaction transactions stored locally and generates the Nth block, which includes the unconfirmed user transaction transactions stored locally.
[0217] For example, when generating the Nth block 2, the proposing node obtains the first consensus node serial number information or the second consensus node serial number information, and packages the first consensus serial number information or the second consensus serial number information into the Nth block.
[0218] When generating the Nth block, the proposal node will obtain the status of all blocks saved locally. When it is found that the block status of the Hth block is a questionable block, H is less than N, and the block status of the questionable block is blank, and there is no proposal for the Hth block in the proposal cache saved locally on the proposal node, the proposal node will start the query mode. That is, the proposal node will generate the Nth block, which includes local unconfirmed user transactions, and attach a query message for querying the Hth block to the Nth block. The query message is used to ask other nodes whether the block proposal for the Hth block is saved.
[0219] Optionally, the proposing node may also encrypt the Nth block, for example, by encrypting the Nth block using the public key of the proposing node. It is understandable that asymmetric encryption may also be performed in other ways, which are not specifically limited here.
[0220] In step 309, the proposing node generates a first proposal message.
[0221] After the proposing node generates the Nth block, the proposing node generates a first proposal message, which includes the Nth block and is used to confirm the Nth block.
[0222] In step 310, the proposing node sends a first proposal message.
[0223] After the proposing node generates the first proposal message, the proposing node sends the first proposal message to other receiving nodes and ordinary nodes in the blockchain.
[0224] After the receiving node in the blockchain receives the first proposal message, the receiving node will save the Nth block proposal in the first proposal message locally and reply with a first reply message.
[0225] For example, the receiving node will save the Nth block proposal in the first proposal message to the local proposal cache and reply with an ACK message. The ACK message may include the block number N, and the ACK message will be encrypted by the public key of the proposer node. Only the proposer can decrypt this information using the private key in the proposer's TEE.
[0226] Because the Nth block contains a query message for the Hth block, after receiving the first proposal message, the receiving node in the blockchain will query whether the confirmed blocks stored locally contain the proposed content of the Hth block. If it is found that the locally confirmed blocks contain the proposed content of the Hth block, the proposed content of the Hth block will be packaged in the first reply message and sent to the proposing node.
[0227] After receiving the first proposal message, the ordinary node in the blockchain will save the Nth block proposal in the first proposal message locally and reply with a false first reply message with a probability of W.
[0228] For example, after saving the Nth block proposal to the local proposal cache, the ordinary node replies with an ACK message with a probability of 5%. The ACK message includes the block sequence number N, and the ACK message is also encrypted. However, when the proposer decrypts it with the private key in the proposer's TEE, it can be determined that the ACK message is a false message.
[0229] It should be noted that when other nodes in the blockchain do not receive the first proposal message within a certain period of time, the node will add a blank block as the block of this round and save it locally.
[0230] For example, if other nodes in the blockchain do not receive the first proposal message within 4 seconds, the node will add a blank block, that is, a block without any user transaction transactions as the block of this round, and save it in the local proposal cache. When there is a message that the block of this round is confirmed in the subsequent block proposal message, the node will update the blank block to the block confirmed in this round.
[0231] When other nodes in the blockchain receive the first proposal message of the Nth block, whether they are consensus nodes or ordinary nodes, they will try to decrypt the second consensus node information. If the decryption is successful, they will confirm that they are the consensus node of the Mth block.
[0232] For example, a consensus node or an ordinary node attempts to decrypt the encrypted certificate in the second consensus node information through the private key stored in the node TEE. If the decryption is successful, it confirms that it is the second consensus node of the Mth block. It can be understood that in actual application, other asymmetric decryption methods can be used to verify whether the node is the second consensus node of the Mth block. The specific details are not limited here.
[0233] In step 311, the proposing node receives the first reply message.
[0234] After other nodes in the blockchain receive the first proposal message, they will send P first reply messages to the proposing node.
[0235] After the proposing node receives P first reply messages, it will decrypt the P first reply messages. When the P first reply messages contain fake first reply messages sent by ordinary nodes, the proposing node will obtain I second reply messages. The I second reply messages are valid confirmation messages, that is, the I second reply messages are sent by the consensus node.
[0236] It can be understood that when the P first reply messages do not include a false first reply message sent by an ordinary node, I is equal to P at this time.
[0237] In step 312, the proposing node updates the status of the Nth block and the status of the Hth block according to the I second reply messages.
[0238] After the proposing node receives I second reply messages, the proposing node updates the status of the Nth block and the status of the Hth block according to the contents of the I second reply messages.
[0239] When the proposed content of the Hth block is included in the I second reply message, the proposing node will delete the blank and questionable Hth block stored locally and update it to the proposed content of the Hth block included in the second reply message.
[0240] If the proposal content of the Hth block is not included in I second reply messages, when the number of I second reply messages is less than the preset threshold, the proposing node updates the block status of the Nth block and the Hth block to a questionable state; when the number of I second reply messages is greater than the preset threshold, and the difference between N and H is greater than the preset threshold, the proposing node updates the block status of the Nth block and the Hth block to a confirmed state, and if the difference between N and H is less than the preset threshold, the proposing node updates the block status of the Nth block and the Hth block to a questionable state.
[0241] For example, when the number of receiving nodes in the blockchain is 100, the number of I second reply messages is greater than 65% of the number of receiving nodes in the blockchain, that is, more than 65 second reply messages, and the difference between N and H is greater than 10, then the proposing node updates the block status of the Nth block and the Hth block to the confirmed status.
[0242] In step 313, the proposing node sends a first confirmation message.
[0243] After the proposing node determines the status of the Nth block and the Hth block based on I second reply messages, the proposing node generates a first confirmation message, which is used to indicate the status of the Nth block and the Hth block, and sends the first confirmation message to other nodes in the blockchain.
[0244] For example, after the proposing node determines that the status of the Nth block and the Hth block is in the confirmed state, the proposing node sends a first confirmation message to other nodes in the blockchain. The first confirmation message is used to allow other nodes to update the local blockchain status and update the block status of the Nth block and the Hth block to the confirmed state.
[0245] For example, after the proposing node determines that the block status of the Nth block and the Hth block is in a questionable state, the proposing node sends a first confirmation message to other nodes in the blockchain. The first confirmation message is used to allow other nodes to update the local blockchain status and update the Nth block and the Hth block to a questionable state.
[0246] It should be noted that, in this embodiment, steps 201 to 204 are optional steps. For example, when there is no need to add new nodes in the blockchain system or the verification server fails, steps 201 to 204 are not executed, and the blockchain system uses the currently existing nodes to elect and confirm blocks.
[0247] In the embodiment of the present application, a false first reply message is sent with a probability of W by an ordinary node, which increases the difficulty for an illegal third party to know the consensus node by intercepting and viewing the first reply message, reduces the risk of consensus nodes in the blockchain being attacked, and improves the security of the blockchain system.
[0248] The data processing method in the embodiment of the present application is described above. The node device in the embodiment of the present application is described below. Figure 4 , which is a structural diagram of an embodiment of a computer device provided in this application.
[0249] Member module 401, used to elect a second consensus node, the first consensus node corresponds to the Nth block, the second consensus node corresponds to the Mth block, and M is greater than N;
[0250] The consensus module 402 is used to generate first consensus sequence number information, where the first consensus sequence number information includes information about the second consensus node, and the information about the second consensus node is used for the target node to confirm that it belongs to the second consensus node.
[0251] In this embodiment, the operations performed by each unit of the computer device are the same as those described above. Figure 2 or Figure 3 The description in the illustrated embodiment is similar and will not be repeated here.
[0252] See also Figure 5 , which is a structural diagram of another embodiment of the computer device provided by the present application.
[0253] Member module 501, used to elect a second consensus node, the first consensus node corresponds to the Nth block, the second consensus node corresponds to the Mth block, and M is greater than N;
[0254] The consensus module 502 is used to generate first consensus sequence number information, where the first consensus sequence number information includes information about the second consensus node, and the information about the second consensus node is used for the target node to confirm that it belongs to the second consensus node.
[0255] Optionally, the computer device also includes:
[0256] The blockchain core module 504 is used to generate the Nth block, where the Nth block includes the first consensus sequence number information;
[0257] The blockchain core module 504 is also used to generate a first proposal message, and the first proposal message is used to confirm the Nth block;
[0258] The network module 503 is configured to send a first proposal message.
[0259] Optionally, the consensus module 502 is further used to encrypt the first consensus sequence number information to obtain the second consensus sequence number information;
[0260] The first proposal message includes second consensus sequence number information.
[0261] Optionally, the consensus module 502 is also used to encrypt the first consensus serial number information using a public key to obtain the second consensus serial number information, and the public key is the serial number of the second consensus node.
[0262] Optionally, the member module 501 is specifically used to elect a first proposing node, the first proposing node is used to submit a second proposing message, the second proposing message is used to confirm the Mth block, and the first proposing node belongs to the second consensus node.
[0263] Optionally, the member module 501 is specifically used to elect a plurality of first proposal candidate nodes, the plurality of first proposal candidate nodes are used to elect a first proposal node, and the plurality of first proposal candidates include the first proposal node.
[0264] Optionally, the member module 501 is specifically used to elect a first receiving node, the first receiving node is used to confirm the Mth block, and the first receiving node belongs to the second consensus node.
[0265] Optionally, the member module 501 is specifically configured to select the first receiving node through a random sampling function.
[0266] Optionally, the network module 503 receives a joining request from the first newly added node, where the joining request is used to request to join a blockchain, where the blockchain is the blockchain where the first consensus node is located;
[0267] The network module 503 is further used to send a verification request to the verification server, where the verification request is used to verify the first newly added node;
[0268] The network module 503 is further used to receive first newly added information sent by the verification server, where the first newly added information includes information of the newly added node;
[0269] The blockchain core module 504 generates a first new transaction message, where the first new transaction message includes first new information;
[0270] The network module 503 sends a first new transaction message.
[0271] Optionally, after the first newly added node is determined to join the blockchain, if the public key of the first newly added node does not appear in the transactions of L blocks, the first newly added node is deleted from the blockchain, where L is a positive integer greater than or equal to 1.
[0272] Optionally, the computer device also includes:
[0273] Processor 505, configured to parse P first reply messages to obtain I second reply messages, where the second reply message is a valid confirmation message, and I is less than or equal to P;
[0274] If I is greater than a preset threshold, the blockchain core module 504 is further used to update the status of the Nth block to a confirmed status;
[0275] The processor 505 is further configured to generate a first confirmation message, where the first confirmation message indicates a status of the Nth block;
[0276] The network module 503 is further configured to send a first confirmation message.
[0277] Optionally, the network module 503 is further configured to receive P first reply messages;
[0278] The processor 505 parses the P first reply messages to obtain I second reply messages, where the second reply message is a valid confirmation message, and I is less than or equal to P;
[0279] If I is less than the preset threshold, the blockchain core module 504 is further used to update the status of the Nth block to a questionable status;
[0280] The processor 505 is further configured to generate a first confirmation message, where the first confirmation message indicates a status of the Nth block;
[0281] The network module 503 is further configured to send a first confirmation message.
[0282] Optionally, the first proposal message includes a questionable block message, the questionable block message indicates that the block status of the Hth block is a questionable block, H is less than N, and the network module is further used to receive P first reply messages;
[0283] The processor 505 parses the P first reply messages to obtain I second reply messages, where the second reply message is a valid confirmation message, and I is less than or equal to P;
[0284] The blockchain core module 504 is also used to update the block status of the H block according to I second reply messages.
[0285] Optionally, if there is a confirmation message of the Hth block in the I second reply messages, the blockchain core module 504 is specifically used to update the block status of the Hth block to a confirmed status.
[0286] Optionally, if there is no confirmation message for the Hth block in the I second reply messages, and the difference between N and H is greater than a preset threshold, the blockchain core module 504 is also used to update the block status of the Hth block to a confirmed status.
[0287] It is also used to, if there is no confirmation message of the Hth block in the I second reply messages, and the difference between N and H is less than a preset threshold, then the blockchain core module 504 is specifically used to update the block status of the Hth block to a questionable state.
[0288] In this embodiment, the operations performed by each unit of the computer device are the same as those described above. Figure 2 or Figure 3 The description of the proposed node in the illustrated embodiment is similar and will not be repeated here.
[0289] See also Figure 6 , which is a structural diagram of another embodiment of the computer device provided by the present application.
[0290] The network module 602 is used to receive a first proposal message sent by the first consensus node, the first proposal message includes the Nth block and the second consensus sequence number information, the second consensus sequence number information is obtained by encrypting the first consensus sequence number information, the first consensus sequence number includes the information of the second consensus node, the second consensus node is obtained by election of the first consensus node, and the second consensus node is the consensus node of the Mth block, where M is greater than N;
[0291] Processor 603, used for decrypting the second consensus sequence number information to obtain decrypted information;
[0292] The member module 601 is used to determine that the first target node is the consensus node of the Mth block through decrypted information.
[0293] In this embodiment, the operations performed by each unit of the computer device are the same as those described above. Figure 2 or Figure 3 The description in the illustrated embodiment is similar and will not be repeated here.
[0294] See also Figure 7 , which is a structural diagram of another embodiment of the computer device provided by the present application.
[0295] The network module 703 is used to receive a first proposal message sent by the first consensus node, the first proposal message includes the Nth block and the second consensus sequence number information, the second consensus sequence number information is obtained by encrypting the first consensus sequence number information, the first consensus sequence number includes the information of the second consensus node, the second consensus node is obtained by election of the first consensus node, and the second consensus node is the consensus node of the Mth block, where M is greater than N;
[0296] Processor 705, used to decrypt the second consensus sequence number information to obtain decrypted information;
[0297] The member module 701 is used to determine that the first target node is the consensus node of the Mth block through decrypted information.
[0298] Optionally, if no proposal request for the Qth block is received within a preset time period T, the computer device further includes:
[0299] The blockchain core module 704 is used to add the Qth block, the Qth block is a blank block, and the status of the Qth block is in a questionable state.
[0300] Optionally, the network module 703 is also used to send a third reply message to the first consensus node with a probability of W, and the third reply message does not include information for confirming the Nth block, and W is greater than 0.
[0301] Optionally, the second consensus sequence number information is obtained by encrypting the first consensus sequence number information with a public key of a computer device, and the computer device further includes:
[0302] The consensus module 702 is used to decrypt the second consensus serial number information by using the private key of the computer device to obtain decrypted information, and the private key is stored in the trusted execution environment TEE of the computer device.
[0303] In this embodiment, the operations performed by each unit of the computer device are the same as those described above. Figure 2 or Figure 3 The description in the illustrated embodiment is similar and will not be repeated here.
[0304] See also Figure 8 , which is another structural diagram of the computer device in the embodiment of the present application.
[0305] Processor 801, memory 802, bus 805, communication interface 804, processor 801 is connected to memory 802 and communication interface 804, bus 805 is respectively connected to processor 801, memory 802 and communication interface 804, communication interface 804 is used to receive or send data, processor 801 is a single-core or multi-core central processing unit, or a specific integrated circuit, or one or more integrated circuits configured to implement an embodiment of the present invention. Memory 802 can be a random access memory (RAM) or a non-volatile memory (non-volatile memory), such as at least one hard disk memory. Memory 802 is used to store computer execution instructions. Specifically, the computer execution instructions may include program 803.
[0306] In this embodiment, when the processor 801 calls the program 803, it can use Figure 8 The computer device in the embodiment performs the aforementioned Figure 2 or Figure 3 The operations performed by the nodes in the illustrated embodiment will not be described in detail here.
[0307] See also Fig. 9 , which is another structural diagram of the computer device in the embodiment of the present application.
[0308] Processor 901, memory 902, bus 905, communication interface 904, processor 901 is connected to memory 902 and communication interface 904, bus 905 is respectively connected to processor 901, memory 902 and communication interface 904, communication interface 904 is used to receive or send data, processor 901 is a single-core or multi-core central processing unit, or a specific integrated circuit, or one or more integrated circuits configured to implement an embodiment of the present invention. Memory 902 can be a random access memory (RAM) or a non-volatile memory (non-volatile memory), such as at least one hard disk memory. Memory 902 is used to store computer execution instructions. Specifically, the computer execution instructions may include program 903.
[0309] In this embodiment, when the processor 901 calls the program 903, it can use Fig. 9 The computer device in the embodiment performs the aforementioned Figure 2 or Figure 3 The operations performed by the nodes in the illustrated embodiment will not be described in detail here.
[0310] It should be understood that the processor mentioned in the computer device or storage system in the above embodiments of the present application, or the processor provided in the above embodiments of the present application, may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0311] It should also be understood that the number of processors in the computer device or storage system in the above embodiments of the present application can be one or more, and can be adjusted according to the actual application scenario. This is only an exemplary description and is not limited. The number of memories in the embodiments of the present application can be one or more, and can be adjusted according to the actual application scenario. This is only an exemplary description and is not limited.
[0312] It should also be noted that when a computer device includes a processor (or processing unit) and a memory, the processor in this application can be integrated with the memory, or the processor and the memory can be connected through an interface. It can be adjusted according to the actual application scenario and is not limited.
[0313] The embodiments of the present application further provide a computer program or a computer program product including a computer program. When the computer program is executed on a computer, the computer will implement the method flow with the node device in any of the above method embodiments.
[0314] An embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a computer, the method flow related to the node device in any of the above method embodiments is implemented.
[0315] In the above Figure 2-Figure 3 In various embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0316] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or a data center that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0317] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0318] The names of the messages / frames / information, modules or units, etc. provided in the embodiments of the present application are only examples, and other names may be used as long as the functions of the messages / frames / information, modules or units, etc. are the same.
[0319] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms of "a", "said" and "the" used in the embodiments of the present application are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that in the description of the present application, unless otherwise specified, " / " indicates that the objects associated before and after are in an "or" relationship, for example, A / B can represent A or B; "and / or" in the present application is only a description of the association relationship of the associated objects, indicating that there can be three relationships, for example, A and / or B, which can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural.
[0320] As used herein, the words “if” or “if” may be interpreted as “at the time of” or “when” or “in response to determining” or “in response to detecting”, depending on the context. Similarly, the phrases “if it is determined” or “if (stated condition or event) is detected” may be interpreted as “when it is determined” or “in response to determining” or “when detecting (stated condition or event)” or “in response to detecting (stated condition or event)”, depending on the context.
[0321] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A data processing method, characterized in that: The method comprises: The first consensus node elects the second consensus node, the first consensus node corresponds to the Nth block, the second consensus node corresponds to the Mth block, and the M is greater than the N; The first consensus node generates first consensus sequence number information, the first consensus sequence number information includes information about the second consensus node, and the information about the second consensus node is used for the target node to confirm that it belongs to the second consensus node; The first consensus node generates the Nth block, and the Nth block includes the first consensus sequence number information; The first consensus node generates a first proposal message, where the first proposal message is used to confirm the Nth block; The first consensus node sends a first proposal message; The first consensus node receives P first reply messages; The first consensus node parses the P first reply messages to obtain I second reply messages, where the second reply message is a valid confirmation message sent by the consensus node, and I is less than or equal to P; If I is greater than a preset threshold, the first consensus node updates the status of the Nth block to a confirmed status; If I is less than a preset threshold, the first consensus node updates the status of the Nth block to a questionable status; The first consensus node generates a first confirmation message, where the first confirmation message indicates the status of the Nth block; The first consensus node sends the first confirmation message.
2. The method according to claim 1, characterized in that After the first consensus node generates the first consensus sequence number information and before the first consensus node sends the first proposal message, the method further includes: The first consensus node encrypts the first consensus sequence number information to obtain second consensus sequence number information; The first proposal message includes second consensus sequence number information.
3. The method according to claim 2, characterized in that The first consensus node encrypts the first consensus sequence number information including: The first consensus node encrypts the first consensus serial number information using a public key to obtain second consensus serial number information, and the public key is the serial number of the second consensus node.
4. The method according to any one of claims 1 to 3, characterized in that The first consensus node electing the second consensus node includes: The first consensus node elects a first proposing node, the first proposing node is used to submit a second proposing message, the second proposing message is used to confirm the Mth block, and the first proposing node belongs to the second consensus node.
5. The method according to claim 4, characterized in that The first consensus node electing the first proposing node includes: The first consensus node elects a plurality of first proposal candidate nodes, where the plurality of first proposal candidate nodes are used to elect the first proposal node, and the plurality of first proposal candidates include the first proposal node.
6. The method according to any one of claims 1 to 3, characterized in that The first consensus node electing the second consensus node includes: The first consensus node elects a first receiving node, the first receiving node is used to confirm the Mth block, and the first receiving node belongs to the second consensus node.
7. The method according to claim 6, characterized in that The first consensus node electing the first receiving node includes: The first consensus node selects the first receiving node through a random sampling function.
8. The method according to claim 1, characterized in that Before the first consensus node broadcasts the first proposal message, the method further includes: The first consensus node receives a joining request from a first newly added node, where the joining request is used to request to join a blockchain, where the blockchain is the blockchain where the first consensus node is located; The first consensus node sends a verification request to a verification server, where the verification request is used to verify the first newly added node; The first consensus node receives first newly added information sent by the verification server, where the first newly added information includes information of the newly added node; The first consensus node generates a first new transaction message, where the first new transaction message includes the first new information; The first consensus node sends the first new transaction message.
9. The method according to claim 8, characterized in that After the first newly added node is determined to join the blockchain, if the public key of the first newly added node does not appear in the transactions of L blocks, the first newly added node is deleted from the blockchain, where L is a positive integer greater than or equal to 1.
10. The method according to claim 1, characterized in that The first proposal message includes a questionable block message, the questionable block message indicates that the block status of the Hth block is a questionable block, the H is less than the N, and after the first consensus node sends the first proposal message, the method further includes: The first consensus node receives P first reply messages; The first consensus node parses the P first reply messages to obtain I second reply messages, where the second reply message is a valid confirmation message, and I is less than or equal to P; The first consensus node updates the block status of the H block according to I second reply messages.
11. The method according to claim 10, characterized in that The first consensus node updates the block status of the H block according to the I second reply messages, including: If there is a confirmation message of the Hth block in the I second reply messages, the first consensus node updates the block status of the Hth block to a confirmed status.
12. The method according to claim 10, characterized in that The first consensus node updates the block status of the H block according to the I second reply messages, including: If there is no confirmation message of the Hth block in the I second reply messages, and the difference between the N and the H is greater than a preset threshold, the first consensus node updates the block status of the Hth block to a confirmed status.
13. The method according to claim 10, characterized in that The first consensus node updates the block status of the H block according to the I second reply messages, including: If there is no confirmation message of the Hth block in the I second reply messages, and the difference between the N and the H is less than a preset threshold, the first consensus node updates the block status of the Hth block to a questionable state.
14. A data processing method, characterized in that: include: The first target node receives a first proposal message sent by the first consensus node, the first proposal message includes the Nth block and the second consensus sequence number information, the second consensus sequence number information is obtained by encrypting the first consensus sequence number information, the first consensus sequence number includes information of the second consensus node, the second consensus node is obtained by election of the first consensus node, the second consensus node is the consensus node of the Mth block, and the M is greater than the N; The first target node decrypts the second consensus sequence number information to obtain decrypted information; The first target node determines, through the decrypted information, that the first target node is a consensus node of the Mth block; When the first target node determines that the first target node is a common node of the Mth block through the decrypted information, the first target node sends a third reply message to the first consensus node with a probability of W, and the third reply message does not include information for confirming the Nth block, and W is greater than 0.
15. The method according to claim 14, characterized in that Before the first target node receives the first proposal message sent by the first consensus node, the method further includes: If the first target node does not receive a proposal request for the Qth block within a preset time period T, the first target node adds a Qth block, the Qth block is a blank block, and the status of the Qth block is a questionable status.
16. The method according to claim 14, characterized in that The second consensus sequence number information is obtained by encrypting the first consensus sequence number information with the public key of the first target node.
17. The method according to claim 14, characterized in that The first target node decrypts the second consensus sequence number information, and the decrypted information obtained includes: The first target node decrypts the second consensus serial number information by using the private key of the first target node to obtain decrypted information, and the private key is stored in the trusted execution environment TEE of the first target node.
18. A computer device, characterized in that: include: a processor and a memory, the processor and the memory being electrically coupled; Wherein, the memory is used to store program instructions; The processor is used to read and execute the program instructions stored in the memory. When the program instructions are executed by the processor, the computer device executes any method as claimed in claims 1 to 13, or executes any method as claimed in claims 14 to 17.
19. The computer device according to claim 18, characterized in that Also includes: Communication interface; wherein the communication interface is used to send or receive information.
