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

By hashing the block attribute data of the block height, the master node in the blockchain network is dynamically determined, which solves the problem that the master node is easy to predict in the existing technology and improves the security and stability of the blockchain. sex.

CN118535568APending Publication Date: 2024-08-23TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310201008.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-22
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

When the Byzantine consensus mechanism is used in existing blockchain networks, the master node is easily predictable, resulting in reduced security and stability of the blockchain.

Method used

By hashing the block attribute data of the block height and generating a random hash value, the target consensus node in the consensus node list is dynamically determined as the master node of the next block to avoid master node prediction.

Benefits of technology

It improves the security and stability of the blockchain, increases the difficulty of master node attacks, and makes the selection of master nodes fairer.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535568A
    Figure CN118535568A
Patent Text Reader

Abstract

The invention discloses a data processing method, device and equipment based on a block chain and a readable storage medium, and the method comprises the steps: obtaining a block attribute object list if it is determined that a first block of which the block height is X is successfully chained; the block attribute object list comprises one or more block attribute objects; obtaining block attribute data corresponding to the one or more block attribute objects according to the first block, and performing hash processing on the one or more block attribute data to obtain a random hash value; in the consensus node list, obtaining a consensus node index matched with the random hash value as a target consensus node index; the consensus node list comprises at least two consensus node indexes; and determining a consensus node corresponding to the target consensus node index as a main node for generating a block with the block height of X + 1. According to the invention, the security and stability of the block chain can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Blocks need to be agreed upon before they can be written into the blockchain, which makes the blockchain tamper-proof and authentic. Therefore, more and more companies are beginning to use blockchain to store transaction data to ensure the security of transaction data.

[0003] In existing blockchain networks, the Byzantine consensus mechanism is usually used to achieve consensus on blocks, that is, the master node in the consensus node cluster first assembles the block and initiates a proposal for the block to the consensus node cluster, and then the consensus node cluster votes on the block according to the proposal, and finally the consensus result for the block can be determined according to the voting result of the consensus node cluster. However, in existing blockchain networks that use the Byzantine consensus mechanism, the master node is usually determined by polling (rotation in a certain order), or one node is always the master node (if the master node fails, another node is replaced as the master node). Under these two master node selection methods, the master nodes at each height are fixed and easy to predict, and the master nodes are easy to be attacked, which will reduce the security and stability of the blockchain. Summary of the invention

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

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

[0006] If it is determined that the first block with a block height of X is successfully uploaded to the chain, a block attribute object list is obtained; the block attribute object list includes one or more block attribute objects;

[0007] Obtaining block attribute data corresponding to the one or more block attribute objects respectively according to the first block, and performing hash processing on the one or more block attribute data to obtain a random hash value;

[0008] In the consensus node list, obtain the consensus node index that matches the random hash value as the target consensus node index; the consensus node list includes at least two consensus node indexes;

[0009] The consensus node corresponding to the target consensus node index is determined as the master node for generating a block with a block height of X+1.

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

[0011] An acquisition module, used for acquiring a block attribute object list if it is determined that the first block with a block height of X is successfully uploaded to the chain; the block attribute object list includes one or more block attribute objects;

[0012] A first hash module, used to obtain block attribute data corresponding to one or more block attribute objects according to the first block, and perform hash processing on the one or more block attribute data to obtain a random hash value;

[0013] An index determination module, used to obtain a consensus node index matching the random hash value in a consensus node list as a target consensus node index; the consensus node list includes at least two consensus node indexes;

[0014] The node determination module is used to determine the consensus node corresponding to the target consensus node index as the master node for generating a block with a block height of X+1.

[0015] Wherein, the first hash module includes:

[0016] A splicing unit, used for performing data splicing processing on one or more block attribute data according to the position order of the one or more block attribute objects in the block attribute object list to obtain block attribute splicing data;

[0017] The first hash unit is used to perform a hash operation on the block attribute splicing data to obtain a random hash value.

[0018] The index determination module includes:

[0019] A modulo operation unit, used to determine the number of consensus node indexes contained in the consensus node list as the target index number;

[0020] The modulo operation unit is further used to perform a modulo operation on the target index number through the random hash value to obtain a random node index;

[0021] The index acquisition unit is used to obtain the consensus node index that is the same as the random node index in the consensus node list as the target consensus node index.

[0022] Among them, one or more block attribute objects include block hash, parent block hash, block timestamp, master node identifier, block height, block size, transaction set root hash, and master node signature;

[0023] The first hash module includes:

[0024] The second hash unit is used to obtain block attribute data corresponding to the block hash, parent block hash, block timestamp, master node identifier, block height, block size, transaction set root hash, and master node signature from the first block if the first block is not a genesis block, and perform hash processing on the obtained multiple block attribute data to obtain a random hash value.

[0025] The above data processing device further includes:

[0026] The second hash module is used to determine that the block attribute data corresponding to the parent block hash, the transaction set root hash, the master node identifier, and the master node signature are default empty data if the first block is a genesis block;

[0027] The second hash module is further used to obtain block attribute data corresponding to the block hash, block timestamp, block height and block size from the first block;

[0028] The second hash module is also used to perform hash processing on the acquired multiple block attribute data to obtain a random hash value.

[0029] The consensus node list further includes a consensus node identifier having a mapping relationship with at least two consensus node indexes respectively; a consensus node identifier is used to uniquely identify a consensus node participating in the consensus process of the first block;

[0030] The node determination module includes:

[0031] An identification acquisition unit, used to acquire a consensus node identification having a mapping relationship with a target consensus node index in the consensus node list as the target consensus node identification;

[0032] The node determination unit is used to determine the consensus node corresponding to the target consensus node identifier as the master node for generating a block with a block height of X+1.

[0033] Wherein, the above-mentioned data processing device further includes:

[0034] An identification acquisition module, used to obtain consensus node identifications corresponding to at least two consensus nodes participating in the consensus process of the first block;

[0035] An identifier sorting module, used to sort at least two consensus node identifiers according to a preset sorting rule to obtain at least two sorted consensus node identifiers;

[0036] An identification numbering module is used to perform index numbering on the at least two consensus node identifications after sorting to obtain a consensus node index mapped to each consensus node identification;

[0037] The list generation module is used to generate a consensus node list according to the at least two sorted consensus node identifiers and the consensus node index mapped to each consensus node identifier.

[0038] The preset sorting rules include dictionary sorting rules; the dictionary sorting rules include character arrangement order;

[0039] Identification sorting module, including:

[0040] A first sorting unit is used to traverse at least two consensus node identifiers to obtain a kth consensus node identifier; k is a positive integer less than or equal to the total number of at least two consensus node identifiers;

[0041] The first sorting unit is further used to obtain the i-th character in the k-th consensus node identifier as the first character; i is a positive integer less than or equal to the number of characters included in the k-th consensus node identifier;

[0042] The first sorting unit is further used to obtain, among the sorted k-1 consensus node identifiers, a consensus node identifier whose i-1th character is the same as the i-1th character of the k-th consensus node identifier, as a target sorting consensus node identifier;

[0043] The first sorting unit is further used to use the i-th character in each target sorting consensus node identifier as the second character;

[0044] The first sorting unit is further used to determine the insertion position of the first character in the second character according to the character arrangement sequence if there is no character in the second character that is the same as the first character;

[0045] The first sorting unit is further used to insert the kth consensus node identifier into the sorted k-1 consensus node identifiers according to the insertion position, so as to obtain the sorted k consensus node identifiers;

[0046] The first sorting unit is further used to continue to obtain the i+1th character in the kth consensus node identifier if there is a character in the second character that is the same as the first character.

[0047] Among them, the preset sorting rules include time sorting rules;

[0048] Identification sorting module, including:

[0049] The second sorting unit is used to obtain the node chain timestamps corresponding to at least two consensus nodes respectively according to the time sorting rule; the node chain timestamp refers to the system timestamp when the consensus node joins the blockchain network;

[0050] The second sorting unit is further used to sort the at least two consensus node identifiers according to the size order of the node on-chain timestamps corresponding to the at least two consensus nodes, so as to obtain the at least two sorted consensus node identifiers.

[0051] Wherein, the above-mentioned data processing device further includes:

[0052] The transaction acquisition module is used to obtain the property list update transaction; the property list update transaction includes the block attribute object to be updated;

[0053] The attribute list acquisition module is used to call the attribute list update contract according to the attribute list update transaction if it is determined that the attribute list update transaction consensus has passed, and obtain the block attribute object list through the attribute list update contract;

[0054] The attribute list updating module is used to update the block attribute object list according to the block attribute object to be updated to obtain a new block attribute object list.

[0055] The block attribute objects to be updated include block attribute objects to be added and block attribute objects to be deleted;

[0056] Property list update module, including:

[0057] A deleting unit, used to delete the block attribute object that is the same as the block attribute object to be deleted in the block attribute object list, and obtain an intermediate block attribute object list;

[0058] The adding unit is used to add the block attribute object to be added to the intermediate block attribute object list to obtain a new block attribute object list.

[0059] On the one hand, an embodiment of the present application provides a computer device, including: a processor, a memory, and a network interface;

[0060] The above-mentioned processor is connected to the above-mentioned memory and the above-mentioned network interface, wherein the above-mentioned network interface is used to provide a data communication network element, the above-mentioned memory is used to store a computer program, and the above-mentioned processor is used to call the above-mentioned computer program to execute the method in the embodiment of the present application.

[0061] On one hand, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. The computer program is suitable for being loaded by a processor and executing the method in the embodiment of the present application.

[0062] On the one hand, an embodiment of the present application provides a computer program product or a computer program, which includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method in the embodiment of the present application.

[0063] In the embodiment of the present application, if it is determined that the first block with a block height of X is successfully chained, a block attribute object list can be obtained, which includes one or more block attribute objects; then, the block attribute data corresponding to the one or more block attribute objects can be obtained according to the first block, and the one or more block attribute data can be hashed to obtain a random hash value; then, in the consensus node list including at least two consensus node indexes, the consensus node index matching the random hash value is obtained as the target consensus node index; finally, the consensus node corresponding to the target consensus node index is determined as the master node for generating a block with a block height of X+1. Through the method provided in the embodiment of the present application, the master node is determined based on the block attribute data related to the block of the previous block height, and the block attribute data related to the block of the previous block height can only be obtained based on the block of the previous block height, which cannot be predicted. Therefore, the determination of the master node cannot be predicted in advance, and the difficulty of attacking the master node will be greatly improved, thereby improving the security and stability of the blockchain. BRIEF DESCRIPTION OF THE DRAWINGS

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

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

[0066] Figure 2 This is a scenario diagram of a data processing method based on blockchain provided in an embodiment of the present application;

[0067] Figure 3 It is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application;

[0068] Figure 4 This is a schematic diagram of the data structure of a blockchain provided in an embodiment of the present application;

[0069] Figure 5 It is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application;

[0070] Figure 6 It is a structural schematic diagram of a blockchain-based data processing device provided in an embodiment of the present application;

[0071] Figure 7 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0073] To facilitate understanding, some nouns are briefly explained as follows:

[0074] 1. Blockchain: In a narrow sense, blockchain is a chain data structure with blocks as the basic unit. Digital summaries are used in blocks to verify previously acquired transaction histories, which is suitable for the needs of tamper-proofing and scalability in distributed accounting scenarios. In a broad sense, blockchain also refers to the distributed accounting technology implemented by the blockchain structure, including distributed consensus, privacy and security protection, peer-to-peer communication technology, network protocols, smart contracts, etc.

[0075] The goal of blockchain is to realize a distributed data record book, which only allows additions but not deletions. The basic structure of the underlying ledger is a linear linked list. The linked list is composed of "blocks" connected in series, and the hash value of the previous block is recorded in the subsequent block. Whether each block (and the transactions in the block) is legal can be quickly verified by calculating the hash value. If a node in the network proposes to add a new block, it must reach a consensus on the block through the consensus mechanism.

[0076] 2. Block: It is a data packet that carries transaction data on the blockchain network. It is a data structure marked with a timestamp and the hash value corresponding to the previous block. The block is verified and confirmed by the consensus mechanism of the network. The block includes a block header and a block body. The block header can record the meta information of the current block, including the current version number, the hash value corresponding to the previous block, the timestamp, the random number, the hash value of the Merkle Root, and other data. The block body can record the detailed data generated within a period of time, including all transaction records or other information generated during the block creation process that have been verified by the current block, which can be understood as a form of account book. In addition, the detailed data of the block body can include the unique Merkle Root generated through the hash process of the Merkle Tree and recorded in the block header.

[0077] The predecessor block, also known as the parent block, is sorted in time by recording the hash value corresponding to the block and the hash value corresponding to the parent block in the block header.

[0078] 3. Hash value: Also known as information characteristic value or characteristic value, the hash value is generated by converting input data of any length into a password and performing a fixed output through a hash algorithm. The original input data cannot be retrieved by decrypting the hash value. It is a one-way encryption function. In the blockchain, each block (except the initial block) contains the hash value of the previous block. The hash value is the potential core foundation and the most important aspect of blockchain technology. It retains the authenticity of the recorded and viewed data, as well as the integrity of the blockchain as a whole.

[0079] 4. Smart Contract: The concept of smart contract has three elements: commitment, agreement, and digital form. Therefore, it can expand the application scope of blockchain to all aspects of financial industry transactions, payments, settlements, and clearing. Smart contract means that when a pre-programmed condition is triggered, the corresponding contract terms are immediately executed. Its working principle is similar to the if-then statement of a computer program.

[0080] See also Figure 1 , Figure 1 This is a schematic diagram of the structure of a blockchain network provided by an embodiment of the present application. Figure 1The blockchain network shown may include but is not limited to the blockchain network corresponding to the alliance chain. The blockchain network may include multiple blockchain nodes, and the multiple blockchain nodes may specifically include blockchain node 10a, blockchain node 10b, blockchain node 10c, blockchain node 10d, ..., blockchain node 10n. Among them, each blockchain node can receive data sent from the outside when performing normal work, and perform block chain processing based on the received data, and can also send data to the outside. In order to ensure data intercommunication between each blockchain node, there may be a data connection between each blockchain node, for example, there is a data connection between blockchain node 10a and blockchain node 10b, there is a data connection between blockchain node 10a and blockchain node 10c, and there is a data connection between blockchain node 10b and blockchain node 10c.

[0081] It is understandable that data or blocks can be transferred between blockchain nodes through the above data connection. The blockchain network can realize data connection between blockchain nodes based on node identification. Each blockchain node in the blockchain network has a node identification corresponding to it, and each of the above blockchain nodes can store the node identifications of other blockchain nodes that are connected to itself, so that the acquired data or generated blocks can be broadcast to other blockchain nodes according to the node identifications of other blockchain nodes. For example, a node identification list as shown in Table 1 can be maintained in blockchain node 10a, and the node identification list stores the node names and node identifications of other nodes:

[0082] Table 1

[0083] Node Name Node ID Node 10a AAA.AAA.AAA.AAA Node 10b BBB.BBB.BBB.BBB Node 10c CCC.CCC.CCC.CCC Node 10d DDD.DDD.DDD.DDD … … Node 10n EEE.EEE.EEE.EEE

[0084] The node identifier may be an Internet Protocol (IP) address for interconnecting networks or any other information that can be used to identify a node in a blockchain network. Table 1 only uses the IP address as an example for illustration. For example, blockchain node 10a may send information (e.g., a block) to blockchain node 10b through node identifier BBB.BBB.BBB.BBB, and blockchain node 10b may determine that the information is sent by blockchain node 10a through node identifier AAA.AAA.AAA.AAA.

[0085] In the blockchain, before a block is put on the chain, it must be agreed upon by the consensus nodes in the blockchain network. Only after the consensus is passed can the block be added to the blockchain. It is understandable that when the blockchain is used in some scenarios of government or commercial organizations, not all participating nodes in the blockchain (i.e., the blockchain nodes in the above blockchain network) have sufficient resources and necessity to become consensus nodes of the blockchain. For example, in Figure 1 In the blockchain network shown, blockchain nodes 10a, 10b, 10c and 10d can be used as consensus nodes in the blockchain network. Consensus nodes in the blockchain network participate in consensus, that is, consensus on blocks (including a batch of transactions), that is, voting on blocks; while non-consensus nodes do not participate in consensus, but will help spread block and voting messages, as well as synchronize status with each other.

[0086] It is understandable that when the blockchain network adopts the Byzantine consensus mechanism to achieve block consensus, the assembly of blocks and the initiation of consensus are usually completed by the master node (also called the block-producing node). Figure 1 The blockchain network shown can use the Byzantine consensus mechanism to achieve the consensus of the block. At this time, the blockchain node with consensus function, for example, blockchain node 10a, after determining that the block with the current block height is successfully on the chain, needs to determine the master node corresponding to the block corresponding to the next block height, so as to complete the consensus operation for the block with the next block height. Specifically, if the blockchain node 10a determines that the first block with a block height of X is successfully on the chain, then obtains a block attribute object list, which may include one or more block attribute objects, such as block hash, parent block hash, block size, etc.; then, the blockchain node 10a can obtain the block attribute data corresponding to the one or more block attribute objects according to the first block, and perform hash processing on the one or more block attribute data to obtain a random hash value; then, the blockchain node 10a can obtain the consensus node index matching the random hash value in the consensus node list including at least two consensus node indexes as the target consensus node index, and finally, the consensus node corresponding to the target consensus node index is determined as the master node for generating the block with a block height of X+1.

[0087] It can be understood that the above-mentioned data connection does not limit the connection method, and can be directly or indirectly connected through wired communication, directly or indirectly connected through wireless communication, or through other connection methods, which are not limited in this application.

[0088] It is understandable that the data processing method provided in the embodiment of the present application can be executed by a computer device, which includes but is not limited to the above-mentioned blockchain node (which can be a terminal or a server). The above-mentioned server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The above-mentioned terminal can be a smart phone, a tablet computer, a laptop, a desktop computer, a smart speaker, a smart watch, etc., but is not limited to this.

[0089] It is understandable that the embodiments of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, etc. For example, the blockchain node system can reach a consensus on some driving behavior data, road trajectory data, etc. sent by the vehicle terminal, and store them on the chain after the consensus is reached.

[0090] It is understandable that in the specific implementation of this application, the transaction data, status data and other related data involved, when the above embodiments of this application are applied to specific products or technologies, need to obtain user permission or consent, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of relevant countries and regions.

[0091] To understand the above master node determination process, please refer to Figure 2 , Figure 2 is a schematic diagram of a scenario of a data processing method based on blockchain provided in an embodiment of the present application. Figure 2 The blockchain node 20 shown can be the above Figure 1 Any blockchain node in the blockchain network shown, for example, blockchain node 20 is blockchain node 10b. For ease of description, Figure 2 In the corresponding embodiment, a block with a block height of X is named as block X, and a block height of X is described as block height X, where X is a positive integer. For example, a block with a block height of 1 is named as block 1, and a block height of 1 is described as block height 1; a block with a block height of m is named as block m, and a block height of m is described as block height m. The same is true for the names of blocks corresponding to other block heights, which will not be repeated here one by one.

[0092] like Figure 2As shown, after the blockchain node 20 writes block m into the blockchain 21, it is determined that block m is successfully on the chain. At this time, the blockchain node 20 needs to determine the master node of the next block height (i.e., the blockchain node used to generate block m+1). The blockchain node 20 will first obtain the block attribute object list 22, which may include block attribute object 1, block attribute object 2, ..., block attribute object n, wherein the block attribute object can be selected according to the actual situation, for example, block attribute object 1 can be a block hash, block attribute object 2 can be a parent block hash, and block attribute object n can be a block size. Then, the blockchain node 20 can obtain the specific value corresponding to each block attribute object in the block attribute object list 22 according to block m, thereby obtaining n block attribute data. Then, the blockchain node 20 will hash the n block attribute data to obtain a random hash value. Then, the blockchain node 20 can obtain the target consensus node index that matches the consensus node index that matches the random hash value in the consensus node list 23, and use the target consensus node corresponding to the target consensus node index as the master node of the next block height. Among them, the consensus node list 23 may include consensus node index 1, consensus node index 2, ..., consensus node index k, and each consensus node index may correspond to a consensus node. Among them, the matching process of the random hash value and the consensus node index can be referred to as follows Figure 3 Detailed description of step S103 in the corresponding embodiment.

[0093] It can be seen that the selection of the master node in the embodiment of the present application needs to rely on the block of the previous block height to obtain the relevant block attribute data, and the block attribute data in the block of the previous block height, such as block hash, block size, etc., are random and unpredictable. Therefore, the selection of the master node is not easy to determine, and it is difficult to be attacked, thereby improving the security and stability of the blockchain.

[0094] For further information, see Figure 3 , Figure 3 is a flowchart of a data processing method based on blockchain provided by an embodiment of the present application. The data processing method can be performed by a blockchain node (for example, the above Figure 1 The data processing method is executed by any blockchain node in the blockchain network in the corresponding embodiment. The following will be described by taking the data processing method executed by the blockchain node as an example. Among them, the data processing method based on blockchain can at least include the following steps S101-S104:

[0095] Step S101: If it is determined that the first block with a block height of X is successfully uploaded to the chain, a block attribute object list is obtained; the block attribute object list includes one or more block attribute objects.

[0096] Specifically, a block attribute object refers to a random or non-fixed data type related to a block. The block attribute data (for example, a specific numerical value) corresponding to different block attribute objects can provide different information. The block attribute data corresponding to these block attribute objects are usually different in different blocks.

[0097] Specifically, one or more block attribute objects may include a block hash. Each block in the blockchain has a block hash, which is the hash of the block that is agreed upon after each consensus is completed. It is a hash generated for the entire block information. This is why the blockchain is called immutable and data is trustworthy. As long as the block in the blockchain changes, the block hash will definitely change, so the block hash of each block is different.

[0098] Specifically, one or more block attribute objects may include a parent block hash (preBlockHash). The block in the blockchain contains a piece of information called the parent block hash, which is the hash address of the previous block. The blockchain is a chain of blocks arranged one by one in order, just like a real account book, each page has a page number, and you can find the content you want through the page number; in the blockchain, the information after the settlement of the previous block can be found through the parent block hash value. The current block hash is the parent block hash of the next block, so each block has only one parent block hash, and the parent block hash of each block is different.

[0099] Specifically, one or more block attribute objects may include a block timestamp. When the master node packages transactions to generate blocks, it will generate a block timestamp based on the current timestamp. This timestamp will be included in the block information and then broadcast to all nodes for consensus. Therefore, after a block is submitted through consensus, the timestamp of the block cannot be tampered with. Since the blockchain is a process of continuously appending blocks, the block timestamps of each blockchain are different and keep increasing.

[0100] Specifically, one or more block attribute objects may include a block timestamp and a master node identification (Identity document, ID). The block in the blockchain will contain a piece of information, namely the master node ID (nodeID), which indicates who generated the block. In the Byzantine consensus, the master node of the block is a very important information. The master node generates a block and must set the master node of the block as its own node ID. When receiving a block from a node, it is necessary to verify that the block required for this consensus is generated by the master node, rather than voting for any block generated by any node. All nodes only vote for the blocks generated by the master node in this consensus, so the master node ID is also a very important information in the block.

[0101] Specifically, one or more block attribute objects may include block height (blockHeight). Each block has a piece of information, which is the block height. The block height starts from 0 and increases. Each block height is based on the height of the previous block plus one, so the height of the block in the blockchain is always increasing.

[0102] Specifically, one or more block attribute objects may include a block size (blockSize). The block size refers to the size of the entire block data. The size of each block is related to the number of transactions packaged in the block and other information. Generally, the size of each block is different.

[0103] Specifically, one or more block attribute objects may include a transaction set root hash (txRootHash). The most important content in a block is the transaction. The purpose of packaging a block is to package transactions. The consensus reached by the blockchain is the consensus reached on the transaction execution results. And the transactions packaged in each block are different, because the packaged transactions are not allowed to be packaged repeatedly, or the historical blocks of the entire blockchain will not contain the same transaction. Therefore, the transaction root hash generated by each block based on the transaction set is also different.

[0104] Specifically, one or more block attribute objects may include a master node signature (blockSignature). In order to prevent tampering with the block, the master node signs the block when it generates it. When the slave node receives the block sent by the master node, it needs to verify the signature generated by the master node to ensure that the block is generated by the master node. Since the content of each block height is different, the signature of the master node is also inconsistent.

[0105] It can be understood that there are a lot of random or inconsistent contents in each block. In addition to the above-mentioned block hash, parent block hash, block timestamp, master node identification, block height, block size, transaction set root hash, master node signature, one or more, the block attribute object list may also include other random or inconsistent block attribute objects, which is not limited in this application.

[0106] Step S102: acquiring block attribute data corresponding to the one or more block attribute objects respectively according to the first block, performing hash processing on the one or more block attribute data to obtain a random hash value.

[0107] Specifically, a feasible implementation process of obtaining block attribute data corresponding to one or more block attribute objects respectively according to the first block, performing hash processing on the one or more block attribute data, and obtaining a random hash value can be: performing data splicing processing on the one or more block attribute data according to the position order of the one or more block attribute objects in the block attribute object list to obtain block attribute splicing data; performing hash operation on the block attribute splicing data to obtain a random hash value. For example, when one or more block attribute objects include block hash (blockHash), parent block hash (preBlockHash), block generation timestamp (timestamp), master node ID (nodeID), block height (blockHeight), block size (blockSize), transaction set root hash (txRootHash), and master node signature (blockSignature), the hash operation process can be expressed as the following formula (1):

[0108] randomHash=sha256(blockHash+preBlockHash+timestamp+nodeID+blockSize+txRootHash+blockSignature) formula (1)

[0109] Among them, randomHash is a random hash value, blockHash, preBlockHash, timestamp, nodeID, blockSize, txRootHash, and blockSignature are block attribute data corresponding to the block attribute object, and sha256 is a hash algorithm used to generate a random hash value of 256 bits in length.

[0110] Specifically, when one or more block attribute objects include block hash, parent block hash, block timestamp, master node identifier, block height, block size, transaction set root hash, and master node signature, the first block obtains block attribute data corresponding to the one or more block attribute objects, performs hash processing on the one or more block attribute data, and obtains a random hash value. A feasible implementation process can be: if the first block is not a genesis block, obtain the block attribute data corresponding to the block hash, parent block hash, block timestamp, master node identifier, block height, block size, transaction set root hash, and master node signature from the first block, perform hash processing on the obtained multiple block attribute data, and obtain a random hash value.

[0111] Optionally, if the first block is a genesis block, determine that the block attribute data corresponding to the parent block hash, the transaction set root hash, the master node identifier, and the master node signature are default empty data; obtain the block attribute data corresponding to the block hash, the block timestamp, the block height, and the block size from the first block; and perform hash processing on the obtained multiple block attribute data to obtain a random hash value.

[0112] For easier understanding, please also refer to Figure 4 , Figure 4 This is a schematic diagram of the data structure of a blockchain provided in an embodiment of the present application. Figure 4 As shown, the blockchain 41 includes block 0 and block 1, wherein block 0 is the genesis block in the blockchain 41. It can be understood that the genesis block in the blockchain refers to the block with a block height of 0 in the blockchain, that is, the first block in the blockchain. Figure 4 As shown in the figure, block 0 does not have parent block hash, transaction set root hash, master node id, and master node signature. Therefore, when obtaining block attribute data based on block 0, the block attribute data corresponding to the parent block hash, transaction set root hash, master node id, and master node signature of the genesis block can be set to default empty data. Starting from block 1, the block can contain block attribute data corresponding to block hash, parent block hash, block timestamp, master node identification, block height, block size, transaction set root hash, and master node signature.

[0113] Step S103: in the consensus node list, obtain a consensus node index that matches the random hash value as a target consensus node index; the consensus node list includes at least two consensus node indexes.

[0114] Specifically, in the consensus node list, a consensus node index that matches the random hash value is obtained as a feasible implementation process of the target consensus node index, which can be: determining the number of consensus node indexes contained in the consensus node list as the target index number; performing a modulus operation on the target index number through the random hash value to obtain the random node index; in the consensus node list, obtaining the consensus node index that is the same as the random node index as the target consensus node index. Among them, the consensus node indexes contained in the consensus node list can be continuous natural numbers starting from 0. For example, the consensus node list can contain consensus node index 0, consensus node index 1, and consensus node index 2, then the target index number is 3. Assuming that the random hash value is 4569, a modulus operation is performed on 3 through 4569, that is, 4569 is divided by 3, and the remainder is 0, then the random node index is 0, and the target consensus node index is consensus node index 0.

[0115] Step S104, determining the consensus node corresponding to the target consensus node index as the master node for generating a block with a block height of X+1.

[0116] Specifically, in the consensus node list, a consensus node index can be mapped to a consensus node identifier, where the consensus node identifier is used to uniquely identify a consensus node. The blockchain node can obtain its mapped consensus node identifier through the target consensus node index, thereby determining the consensus node corresponding to the consensus node identifier as the master node.

[0117] Optionally, the blockchain node can obtain an attribute list update transaction; the attribute list update transaction includes the block attribute object to be updated; if it is determined that the attribute list update transaction consensus is passed, the attribute list update contract is called according to the attribute list update transaction, and the block attribute object list is obtained through the attribute list update contract; the block attribute object list is updated according to the block attribute object to be updated to obtain a new block attribute object list. Among them, the block attribute object to be updated includes the block attribute object to be added and the block attribute object to be deleted; a feasible implementation process of updating the block attribute object list according to the attribute object to be updated to obtain a new block attribute object list can be: in the block attribute object list, delete the block attribute object that is the same as the block attribute object to be deleted to obtain an intermediate block attribute object list; add the block attribute object to be added to the intermediate block attribute object list to obtain a new block attribute object list.

[0118] Through the method provided in the embodiment of the present application, when determining a new master node, randomly generated block attribute data is obtained through the block of the previous block height, so that the master node at each height becomes more random, making it impossible for attackers to predict the master node, resulting in a higher cost for attacking the master node. At the same time, the selection of the master node is also fairer, thereby greatly improving the security and stability of the Byzantine consensus.

[0119] For further information, see Figure 5 , Figure 5 is a flowchart of a data processing method based on blockchain provided in an embodiment of the present application. Figure 3 The consensus node list applied in the corresponding embodiment, the data processing method can be performed by the blockchain node (for example, the above Figure 1 The data processing method is executed by any blockchain node in the blockchain network in the corresponding embodiment. The following will be described by taking the data processing method executed by a blockchain node as an example. Among them, the data processing method based on blockchain can at least include the following steps S201-S204:

[0120] Step S201, obtaining consensus node identifiers corresponding to at least two consensus nodes participating in the consensus process of the first block.

[0121] Specifically, a consensus node identifier is used to uniquely identify a consensus node in the blockchain. In other words, the consensus node identifiers corresponding to different consensus nodes are different.

[0122] Step S202: sort at least two consensus node identifiers according to a preset sorting rule to obtain at least two sorted consensus node identifiers.

[0123] Specifically, the preset sorting rule includes a dictionary sorting rule; the dictionary sorting rule includes a character arrangement order; a feasible implementation process of sorting at least two consensus node identifiers according to the preset sorting rule to obtain at least two sorted consensus node identifiers can be: traversing at least two consensus node identifiers to obtain the kth consensus node identifier; k is a positive integer less than or equal to the total number of at least two consensus node identifiers; obtaining the i-th character in the k-th consensus node identifier as the first character; i is a positive integer less than or equal to the number of characters included in the k-th consensus node identifier; obtaining the i-th character in the sorted k-1 consensus node identifiers -1 characters of the consensus node identifier that are the same as the i-1 characters of the k-th consensus node identifier are used as the target sorting consensus node identifier; the i-th character in each target sorting consensus node identifier is used as the second character; if there is no character in the second character that is the same as the first character, then the insertion position of the first character in the second character is determined according to the character arrangement order; according to the insertion position, the k-th consensus node identifier is inserted into the sorted k-1 consensus node identifiers to obtain the sorted k consensus node identifiers; if there is a character in the second character that is the same as the first character, then continue to obtain the i+1th character in the k-th consensus node identifier. Among them, the character arrangement order can be in hexadecimal character size order, or in alphabetical order + numeric order, and can also be set according to actual conditions. For ease of understanding, assume that at least two consensus node identifiers include "qa123", "qb123", "rs890", and "asjd1". The character arrangement order at this time adopts the alphabetical order + numerical order, that is, between letters and numbers, letters take precedence over numbers; between letters, the priority is compared in alphabetical order; between numbers, the priority is compared in numerical order.First, get "qa123". Since there is only one consensus node identifier, there is no need to sort. You can directly get the second consensus node identifier "qb123". At this time, compare the first characters of the two consensus node identifiers. Since both are "q", continue to compare the second characters of the two consensus node identifiers. Since "a" is before "b" in the alphabetical order, the two consensus node identifiers after sorting can be obtained as "qa123" and "qb123". Then, continue to get the third consensus node identifier "rs890". Compare the first character first, because the first character of the third consensus node identifier is different from the first character of the two consensus node identifiers after sorting. Therefore, we can directly determine that "rs890" should be located after "qb123" according to the alphabetical order, and the three consensus node identifiers after sorting are "qa123", "qb123", and "rs890". Finally, we get the fourth consensus node identifier "asjd1", ​​and still compare the first character first, because the first character of the fourth consensus node identifier is different from the first character of the three consensus node identifiers after sorting. Therefore, we can directly determine that "asjd1" should be located before "qa123" according to the alphabetical order, and the three consensus node identifiers after sorting are "asjd1", ​​"qa123", "qb123", and "rs890".

[0124] Specifically, the preset sorting rules include time sorting rules; sorting at least two consensus node identifiers according to the preset sorting rules to obtain at least two consensus node identifiers after sorting is a feasible implementation process, which can be: obtaining the node chain timestamps corresponding to at least two consensus nodes respectively according to the time sorting rules; the node chain timestamp refers to the system timestamp when the consensus node joins the blockchain network; sorting at least two consensus node identifiers according to the size order of the node chain timestamps corresponding to at least two consensus nodes respectively, to obtain at least two consensus node identifiers after sorting. It can be understood that the smaller the node chain timestamp, the earlier the corresponding consensus node joined the blockchain network.

[0125] Step S203, performing index numbering processing on the at least two sorted consensus node identifiers to obtain a consensus node index mapped to each consensus node identifier.

[0126] Specifically, the index numbering process may be to number the at least two consensus node identifiers after sorting with consecutive natural numbers starting from 0, that is, the consensus node index may include 0, 1, 2, ..., N-1, where N is the number of consensus node identifiers included in the at least two consensus node identifiers.

[0127] Step S204: Generate a consensus node list according to the at least two sorted consensus node identifiers and the consensus node indexes mapped to each consensus node identifier.

[0128] Obviously, through the method provided in the embodiment of the present application, the mapping relationship between the consensus node identifier and the consensus node index can be set according to the actual situation, which further increases the difficulty of master node prediction, thereby greatly improving the consensus security and stability.

[0129] See also Figure 6 , Figure 6 1 is a schematic diagram of the structure of a blockchain-based data processing device provided in an embodiment of the present application. The data processing device 1 may be a computer program (including program code) running on a computer device, for example, the data processing device 1 is an application software; the data processing device 1 may be used to execute the corresponding steps in the data processing method provided in an embodiment of the present application. Figure 6 As shown, the data processing device 1 may include: an acquisition module 101 , a first hash module 102 , an index determination module 103 and a node determination module 104 .

[0130] The acquisition module 101 is used to acquire a block attribute object list if it is determined that the first block with a block height of X is successfully uploaded to the chain; the block attribute object list includes one or more block attribute objects;

[0131] The first hash module 102 is used to obtain block attribute data corresponding to one or more block attribute objects according to the first block, and perform hash processing on the one or more block attribute data to obtain a random hash value;

[0132] The index determination module 103 is used to obtain a consensus node index matching the random hash value in the consensus node list as a target consensus node index; the consensus node list includes at least two consensus node indexes;

[0133] The node determination module 104 is used to determine the consensus node corresponding to the target consensus node index as the master node for generating a block with a block height of X+1.

[0134] The specific implementation of the acquisition module 101, the first hash module 102, the index determination module 103 and the node determination module 104 can be found in the above Figure 3 The description of step S101 to step S104 in the corresponding embodiment will not be repeated here.

[0135] The first hash module 102 includes: a concatenation unit 1021 and a first hash unit 1022 .

[0136] The splicing unit 1021 is used to perform data splicing processing on one or more block attribute data according to the position order of one or more block attribute objects in the block attribute object list to obtain block attribute splicing data;

[0137] The first hash unit 1022 is used to perform a hash operation on the block attribute splicing data to obtain a random hash value.

[0138] The specific implementation of the splicing unit 1021 and the first hash unit 1022 can be found in the above Figure 3 The description of step S102 in the corresponding embodiment will not be repeated here.

[0139] The index determination module 103 includes: a modulo operation unit 1031 and an index acquisition unit 1032 .

[0140] A modulo operation unit 1031 is used to determine the number of consensus node indexes included in the consensus node list as the target index number;

[0141] The modulo operation unit 1031 is further used to perform a modulo operation on the target index number through the random hash value to obtain a random node index;

[0142] The index acquisition unit 1032 is used to acquire the consensus node index that is the same as the random node index in the consensus node list as the target consensus node index.

[0143] The specific implementation of the modulus operation unit 1031 and the index acquisition unit 1032 can be found in the above Figure 3 The description of step S103 in the corresponding embodiment will not be repeated here.

[0144] Among them, one or more block attribute objects include block hash, parent block hash, block timestamp, master node identifier, block height, block size, transaction set root hash, and master node signature;

[0145] The first hash module 102 includes: a second hash unit 1023 .

[0146] The second hash unit 1023 is used to obtain block attribute data corresponding to the block hash, parent block hash, block timestamp, master node identifier, block height, block size, transaction set root hash, and master node signature from the first block if the first block is not a genesis block, and perform hash processing on the obtained multiple block attribute data to obtain a random hash value.

[0147] The specific implementation of the second hash unit 1023 can be found in the above Figure 3 The description of step S102 in the corresponding embodiment will not be repeated here.

[0148] Wherein, the above-mentioned data processing device 1 further includes: a second hash module 105.

[0149] The second hash module 105 is used to determine that the block attribute data corresponding to the parent block hash, the transaction set root hash, the master node identifier, and the master node signature are default empty data if the first block is a genesis block;

[0150] The second hash module 105 is further used to obtain block attribute data corresponding to the block hash, block timestamp, block height and block size from the first block;

[0151] The second hash module 105 is further used to perform hash processing on the acquired multiple block attribute data to obtain a random hash value.

[0152] The specific implementation of the second hash module 105 can be found in the above Figure 3 The optional description of step S102 in the corresponding embodiment will not be repeated here.

[0153] The consensus node list further includes a consensus node identifier having a mapping relationship with at least two consensus node indexes respectively; a consensus node identifier is used to uniquely identify a consensus node participating in the consensus process of the first block;

[0154] The node determination module 104 includes: an identification acquisition unit 1041 and a node determination unit 1042 .

[0155] The identifier acquisition unit 1041 is used to acquire the consensus node identifier having a mapping relationship with the target consensus node index in the consensus node list as the target consensus node identifier;

[0156] The node determination unit 1042 is used to determine the consensus node corresponding to the target consensus node identifier as the master node for generating a block with a block height of X+1.

[0157] The specific implementation of the identification acquisition unit 1041 and the node determination unit 1042 can be found in the above Figure 3 The description of step S104 in the corresponding embodiment will not be repeated here.

[0158] The data processing device 1 further includes: an identification acquisition module 106 , an identification sorting module 107 , an identification numbering module 108 and a list generating module 109 .

[0159] The identification acquisition module 106 is used to obtain the consensus node identifications corresponding to at least two consensus nodes participating in the consensus process of the first block;

[0160] An identifier sorting module 107, used to sort at least two consensus node identifiers according to a preset sorting rule to obtain at least two sorted consensus node identifiers;

[0161] The identification numbering module 108 is used to perform index numbering on the at least two sorted consensus node identifications to obtain a consensus node index mapped to each consensus node identification;

[0162] The list generation module 109 is used to generate a consensus node list according to the sorted at least two consensus node identifiers and the consensus node index mapped to each consensus node identifier.

[0163] The specific implementation of the identification acquisition module 106, the identification sorting module 107, the identification numbering module 108 and the list generation module 109 can be found in the above Figure 5 The description of steps S201 to S204 in the corresponding embodiment will not be repeated here.

[0164] The preset sorting rules include dictionary sorting rules; the dictionary sorting rules include character arrangement order;

[0165] The identification sorting module 107 includes: a first sorting unit 1071 .

[0166] The first sorting unit 1071 is used to traverse at least two consensus node identifiers to obtain the kth consensus node identifier; k is a positive integer less than or equal to the total number of the at least two consensus node identifiers;

[0167] The first sorting unit 1071 is further used to obtain the i-th character in the k-th consensus node identifier as the first character; i is a positive integer less than or equal to the number of characters included in the k-th consensus node identifier;

[0168] The first sorting unit 1071 is further used to obtain, among the sorted k-1 consensus node identifiers, a consensus node identifier whose i-1th character is the same as the i-1th character of the k-th consensus node identifier, as a target sorting consensus node identifier;

[0169] The first sorting unit 1071 is further configured to use the i-th character in each target sorting consensus node identifier as the second character;

[0170] The first sorting unit 1071 is further configured to determine the insertion position of the first character in the second character according to the character arrangement sequence if there is no character in the second character that is identical to the first character;

[0171] The first sorting unit 1071 is further used to insert the kth consensus node identifier into the sorted k-1 consensus node identifiers according to the insertion position, so as to obtain the sorted k consensus node identifiers;

[0172] The first sorting unit 1071 is further configured to continue acquiring the i+1th character in the kth consensus node identifier if the second character contains the same character as the first character.

[0173] The specific implementation of the first sorting unit 1071 can be found in the above Figure 3 The description of step S202 in the corresponding embodiment will not be repeated here.

[0174] Among them, the preset sorting rules include time sorting rules;

[0175] The identification sorting module 107 includes: a second sorting unit 1072 .

[0176] The second sorting unit 1072 is used to obtain the node chain timestamps corresponding to at least two consensus nodes respectively according to the time sorting rule; the node chain timestamp refers to the system timestamp when the consensus node joins the blockchain network;

[0177] The second sorting unit 1072 is further used to sort the at least two consensus node identifiers according to the size order of the node on-chain timestamps corresponding to the at least two consensus nodes, so as to obtain the at least two sorted consensus node identifiers.

[0178] The specific implementation of the second sorting unit 1072 can refer to the above Figure 3 The description of step S202 in the corresponding embodiment will not be repeated here.

[0179] The data processing device 1 further includes: a transaction acquisition module 110 , an attribute list acquisition module 111 and an attribute list update module 112 .

[0180] The transaction acquisition module 110 is used to acquire an attribute list update transaction; the attribute list update transaction includes a block attribute object to be updated;

[0181] The attribute list acquisition module 111 is used to call the attribute list update contract according to the attribute list update transaction if it is determined that the attribute list update transaction consensus has passed, and obtain the block attribute object list through the attribute list update contract;

[0182] The attribute list updating module 112 is used to update the block attribute object list according to the block attribute object to be updated to obtain a new block attribute object list.

[0183] The specific implementation of the transaction acquisition module 110, the attribute list acquisition module 111 and the attribute list update module 112 can be found in the above Figure 3The optional description of step S104 in the corresponding embodiment will not be repeated here.

[0184] The block attribute objects to be updated include block attribute objects to be added and block attribute objects to be deleted;

[0185] The attribute list updating module 112 includes a deleting unit 1121 and an adding unit 1122 .

[0186] The deleting unit 1121 is used to delete the block attribute object that is the same as the block attribute object to be deleted in the block attribute object list, and obtain an intermediate block attribute object list;

[0187] The adding unit 1122 is used to add the block attribute object to be added to the intermediate block attribute object list to obtain a new block attribute object list.

[0188] The specific implementation of the deletion unit 1121 and the addition unit 1122 can refer to the above Figure 3 The optional description of step S104 in the corresponding embodiment will not be repeated here.

[0189] See also Figure 7 , Figure 7 Schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 7 As shown above Figure 6 The data processing device 1 in the corresponding embodiment can be applied to a computer device 1000, and the computer device 1000 may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, the user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the user interface 1003 may optionally include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 1005 may optionally also be at least one storage device located away from the aforementioned processor 1001. As Figure 7 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application program.

[0190] In such Figure 7In the computer device 1000 shown, the network interface 1004 can provide a network communication network element; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:

[0191] It should be understood that the computer device 1000 described in the embodiment of the present application can execute the above Figure 3 , Figure 5 The description of the data processing method in any corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated here.

[0192] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the data processing device 1 mentioned above, and the computer program includes program instructions. When the processor executes the program instructions, the computer program can execute the above-mentioned data processing device 1. Figure 3 , Figure 5 The description of the above data processing method in any corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.

[0193] The computer-readable storage medium may be the data processing device provided in any of the aforementioned embodiments or the internal storage unit of the computer device, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (flash card), etc. equipped on the computer device. Further, the computer-readable storage medium may also include both the internal storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.

[0194] In addition, it should be noted that: the embodiment of the present application also provides a computer program product or a computer program, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the above Figure 3 , Figure 5 Any method provided by the corresponding embodiment.

[0195] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, device, product, or equipment that includes a series of steps or units is not limited to the listed steps or modules, but optionally includes steps or modules that are not listed, or optionally includes other step units inherent to these processes, methods, devices, products, or equipment.

[0196] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of network elements in the above description. Whether these network elements are executed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described network elements for each specific application, but such implementation should not be considered to be beyond the scope of this application.

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

Claims

1. A data processing method based on blockchain, It is characterized in that include: If it is determined that the first block with a block height of X is successfully uploaded to the chain, a list of block attribute objects is obtained; The block attribute object list includes one or more block attribute objects; Acquire block attribute data corresponding to the one or more block attribute objects respectively according to the first block, and perform hash processing on the one or more block attribute data to obtain a random hash value; In the consensus node list, a consensus node index matching the random hash value is obtained as a target consensus node index; the consensus node list includes at least two consensus node indexes; The consensus node corresponding to the target consensus node index is determined as the master node for generating a block with a block height of X+1.

2. The method according to claim 1, It is characterized in that The acquiring, according to the first block, block attribute data corresponding to the one or more block attribute objects respectively, and performing hash processing on the one or more block attribute data to obtain a random hash value includes: According to the position order of the one or more block attribute objects in the block attribute object list, performing data splicing processing on one or more block attribute data to obtain block attribute splicing data; A hash operation is performed on the block attribute splicing data to obtain a random hash value.

3. The method according to claim 1, It is characterized in that The step of obtaining a consensus node index that matches the random hash value in the consensus node list as a target consensus node index includes: Determine the number of consensus node indexes included in the consensus node list as the target index number; Performing a modulo operation on the target index number through the random hash value to obtain a random node index; In the consensus node list, a consensus node index that is the same as the random node index is obtained as the target consensus node index.

4. The method according to claim 1, It is characterized in that The one or more block attribute objects include block hash, parent block hash, block timestamp, master node identifier, block height, block size, transaction set root hash, and master node signature; The acquiring, according to the first block, block attribute data corresponding to the one or more block attribute objects respectively, and performing hash processing on the one or more block attribute data to obtain a random hash value includes: If the first block is not a genesis block, the block attribute data corresponding to the block hash, the parent block hash, the block timestamp, the master node identifier, the block height, the block size, the transaction set root hash, and the master node signature are obtained from the first block, and hash processing is performed on the obtained multiple block attribute data to obtain a random hash value.

5. The method according to claim 4, It is characterized in that Also includes: If the first block is a genesis block, determining that the block attribute data corresponding to the parent block hash, the transaction set root hash, the master node identifier, and the master node signature, respectively, are default empty data; Obtaining block attribute data corresponding to the block hash, the block timestamp, the block height, and the block size, respectively, from the first block; Hash the acquired multiple block attribute data to obtain a random hash value.

6. The method according to claim 1, It is characterized in that The consensus node list also includes consensus node identifiers that have mapping relationships with the at least two consensus node indexes respectively; a consensus node identifier is used to uniquely identify a consensus node participating in the first block consensus process; The step of determining the consensus node corresponding to the target consensus node index as the master node for generating a block with a block height of X+1 includes: Acquire a consensus node identifier having a mapping relationship with the target consensus node index in the consensus node list as the target consensus node identifier; The consensus node corresponding to the target consensus node identifier is determined as the master node for generating a block with a block height of X+1.

7. The method according to claim 6, It is characterized in that Also includes: Obtain consensus node identifiers corresponding to at least two consensus nodes participating in the consensus process of the first block; Sorting the at least two consensus node identifiers according to a preset sorting rule to obtain at least two sorted consensus node identifiers; Performing index numbering processing on the at least two consensus node identifiers after the sorting to obtain a consensus node index mapped to each consensus node identifier; A consensus node list is generated according to the at least two sorted consensus node identifiers and the consensus node indexes respectively mapped to each consensus node identifier.

8. The method according to claim 7, It is characterized in that The preset sorting rule includes a dictionary sorting rule; the dictionary sorting rule includes a character arrangement order; The step of sorting the at least two consensus node identifiers according to a preset sorting rule to obtain the at least two sorted consensus node identifiers includes: Traversing the at least two consensus node identifiers to obtain the kth consensus node identifier; k is a positive integer less than or equal to the total number of the at least two consensus node identifiers; Obtain the i-th character in the k-th consensus node identifier as the first character; i is a positive integer less than or equal to the number of characters included in the k-th consensus node identifier; Obtaining, among the k-1 consensus node identifiers after sorting, a consensus node identifier whose i-1th character is the same as the i-1th character of the k-th consensus node identifier, as the target sorting consensus node identifier; Take the i-th character in each target sorting consensus node identifier as the second character; If there is no character in the second character that is the same as the first character, determining the insertion position of the first character in the second character according to the character arrangement sequence; Inserting the kth consensus node identifier into the sorted k-1 consensus node identifiers according to the insertion position to obtain sorted k consensus node identifiers; If the second characters contain the same character as the first character, then continue to obtain the i+1th character in the kth consensus node identifier.

9. The method according to claim 7, It is characterized in that The preset sorting rules include time sorting rules; The step of sorting the at least two consensus node identifiers according to a preset sorting rule to obtain the at least two sorted consensus node identifiers includes: Obtain the node chain timestamps corresponding to the at least two consensus nodes respectively according to the time sorting rule; the node chain timestamp refers to the system timestamp when the consensus node joins the blockchain network; According to the size order of the node on-chain timestamps corresponding to the at least two consensus nodes, the at least two consensus node identifiers are sorted to obtain the sorted at least two consensus node identifiers.

10. The method according to claim 1, It is characterized in that Also includes: Obtaining an attribute list update transaction; the attribute list update transaction includes a block attribute object to be updated; If it is determined that the attribute list update transaction consensus is passed, the attribute list update contract is called according to the attribute list update transaction, and the block attribute object list is obtained through the attribute list update contract; The block attribute object list is updated according to the block attribute object to be updated to obtain a new block attribute object list.

11. The method according to claim 10, It is characterized in that The block attribute objects to be updated include block attribute objects to be added and block attribute objects to be deleted; The updating process of the block attribute object list according to the attribute object to be updated to obtain a new block attribute object list includes: In the block attribute object list, deleting the block attribute object that is the same as the block attribute object to be deleted, to obtain an intermediate block attribute object list; The block attribute object to be added is added to the intermediate block attribute object list to obtain a new block attribute object list.

12. A data processing device based on blockchain, It is characterized in that include: An acquisition module, used to obtain a list of block attribute objects if it is determined that the first block with a block height of X is successfully uploaded to the chain; The block attribute object list includes one or more block attribute objects; A first hash module, configured to obtain block attribute data corresponding to the one or more block attribute objects respectively according to the first block, and perform hash processing on the one or more block attribute data to obtain a random hash value; An index determination module, configured to obtain a consensus node index matching the random hash value in a consensus node list as a target consensus node index; the consensus node list includes at least two consensus node indexes; The node determination module is used to determine the consensus node corresponding to the target consensus node index as the master node for generating a block with a block height of X+1.

13. A computer device, It is characterized in that include: Processor, memory, and network interface; The processor is connected to the memory and the network interface, wherein the network interface is used to provide a data communication function, the memory is used to store program code, and the processor is used to call the program code to execute the method described in any one of claims 1-11.

14. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the method according to any one of claims 1 to 11.

15. A computer program product comprising a computer program / instructions, It is characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 11 can be performed.