Data processing method and device, computer equipment and storage medium
By encoding and signing transaction data through a decentralized set of proposal nodes, the problem of malicious proposal nodes in the blockchain network is solved, and the efficiency of on-chain storage of transaction data and data security are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2024-10-30
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies have the problem of malicious proposal nodes when storing transaction data on blockchain networks, resulting in low transaction data storage efficiency and requiring two rounds of interactive confirmation, which also affects efficiency.
A decentralized set of proposal nodes is used to encode and sign transaction data. The transaction data is recovered and packaged by obtaining broadcast information from different proposal nodes in the blockchain network through packaging nodes, thereby reducing the participation of witness nodes.
It improves the efficiency of storing transaction data on the blockchain, reduces the influence of the proposing node on the transaction data, ensures data security and accuracy, and avoids malicious tampering by a single proposing node.
Smart Images

Figure CN121967156A_ABST
Abstract
Description
Data processing methods, apparatus, computer equipment and storage media Technical Field
[0001] This application relates to the field of computer technology, and in particular to a data processing method, apparatus, computer equipment, and storage medium. Background Technology
[0002] With the continuous development of blockchain technology, the security of data storage on blockchain networks has become increasingly important. Currently, data is generally stored on blockchain networks to ensure its security. The process involves the proposing node submitting transaction data to the packaging node, which then packages and verifies the transaction data before storing it on the blockchain network.
[0003] Practice has shown that the current method of storing transaction data on the blockchain network is closely related to the transaction data submitted by the proposing node. Therefore, to prevent malicious behavior by the proposing node, a witness node is added to witness the submission process. This means that the current method of storing transaction data on the blockchain network involves two rounds of interactive confirmation (confirmation from the witness node and confirmation from the packaging node), resulting in low efficiency in the transaction data storage process. Therefore, improving the efficiency of storing transaction data on the blockchain network has become a current research hotspot. Summary of the Invention
[0004] This invention provides a data processing method, apparatus, computer equipment, and storage medium that can improve the efficiency of on-chain storage of transaction data.
[0005] On one hand, embodiments of the present invention provide a data processing method based on a blockchain network, wherein the blockchain network includes packaging nodes and a set of proposal nodes, the set of proposal nodes includes at least one proposal node, the data processing method is executed by a target proposal node, the target proposal node being any one of the proposal nodes in the set of proposal nodes, and the method includes:
[0006] The target transaction data to be uploaded to the blockchain is obtained, and the target transaction data is encoded to obtain the encoded data of the target transaction data; wherein, the encoded data contains at least one encoded segment;
[0007] Based on the node identifier of the target proposal node, a target encoding segment that successfully matches the node identifier is determined from the at least one encoding segment, and the target encoding segment is signed to obtain the broadcast information of the target transaction data;
[0008] The broadcast information is sent to the blockchain network so that the packaging node can obtain the broadcast information sent by different proposing nodes from the blockchain network, and restore the target transaction data according to the broadcast information of different proposing nodes, so as to package the restored transaction data.
[0009] In another aspect, embodiments of the present invention provide a data processing apparatus based on a blockchain network, wherein the blockchain network includes packaging nodes and a set of proposal nodes, the set of proposal nodes includes at least one proposal node, the data processing apparatus is an apparatus for a target proposal node, and the target proposal node is any one of the proposal nodes in the set of proposal nodes, the apparatus comprising:
[0010] An acquisition unit is used to acquire target transaction data to be uploaded to the blockchain and encode the target transaction data to obtain encoded data of the target transaction data; wherein the encoded data contains at least one encoded segment;
[0011] The processing unit is configured to determine, based on the node identifier of the target proposal node, a target encoded segment that successfully matches the node identifier from the at least one encoded segment, and perform signature processing on the target encoded segment to obtain broadcast information of the target transaction data;
[0012] The processing unit is further configured to send the broadcast information to the blockchain network, so that the packaging node can obtain the broadcast information sent by different proposing nodes from the blockchain network, and restore the target transaction data according to the broadcast information of different proposing nodes, so as to package the restored transaction data.
[0013] In one embodiment, the acquiring unit is specifically used for:
[0014] Obtain at least one transaction data to be uploaded to the blockchain from the transaction mempool, and storage information of each transaction data in the transaction mempool; the storage information includes at least one of the following: the storage duration in the transaction mempool, and the amount of electronic resources transferred after being stored in the blockchain network;
[0015] The priority of each transaction data is determined based on the stored information, and the target transaction data is determined from the transaction memory pool based on the priority.
[0016] In one embodiment, the processing unit is specifically used for:
[0017] Obtain the data length of the target transaction data and the number of proposing nodes contained in the blockchain network;
[0018] Based on the data length and the number of proposing nodes, the encoding length of the target transaction data is determined, and the target transaction data is encoded according to the encoding length to obtain the encoded data of the target transaction data.
[0019] In one embodiment, the target transaction data consists of multiple byte fragments; the processing unit is specifically used for:
[0020] The encoding matrix is determined based on the encoding length; wherein the number of rows in the encoding matrix is equal to the encoding length.
[0021] The encoding matrix is multiplied by each byte segment of the target transaction data to obtain multiple encoding segments, and these multiple encoding segments are used as the encoded data of the target transaction data.
[0022] In one embodiment, the encoded data includes at least one encoded segment arranged sequentially and each corresponding to a different segment identifier; the processing unit is specifically used for:
[0023] Obtain the node identifier corresponding to the target proposal node in the proposal node set of the blockchain network, and perform identifier mapping on the node identifier of the target proposal node to obtain the target mapping identifier;
[0024] Obtain the segment identifier of each encoded segment of the encoded data, and match the target mapping identifier with the segment identifier corresponding to each encoded segment;
[0025] The encoded segment corresponding to the segment identifier that successfully matches the target mapping identifier is taken as the target encoded segment.
[0026] In one embodiment, the blockchain network further includes consensus nodes;
[0027] The acquisition unit is further configured to acquire one or more target blocks from the blockchain network and determine the block hash of the target blocks;
[0028] The processing unit is further configured to perform i repeated hash operations on the block hash and obtain the result of each repeated hash operation, where i is a positive integer greater than or equal to 1.
[0029] The processing unit is also used to perform a modulo operation on the result of each repeated hash operation and the total number of consensus nodes contained in the blockchain network.
[0030] The processing unit is further configured to map the result of the modulo operation to the node identifier of the consensus node, and use the consensus node corresponding to the mapped node identifier as the selected proposal node.
[0031] In one embodiment, the processing unit is specifically used for:
[0032] From the blocks contained in the blockchain network, obtain the block with the highest height, and use the obtained block with the highest height as the target block to be obtained from the blockchain network; or,
[0033] Obtain each block contained in the blockchain network and use each obtained block as the target block.
[0034] In one embodiment, the method by which the packaging node restores the target transaction data includes:
[0035] The packaging node obtains broadcast information sent by different proposing nodes from the blockchain network, and performs verification processing on the encoded fragments in each broadcast information based on the signature information in each broadcast information;
[0036] After determining that the corresponding encoded segment has passed verification based on the signature information, the packaging node obtains the number of encoded segments that have passed verification.
[0037] When the number of fragments reaches the target number, the packaging node recovers the target transaction data based on the target number of encoded fragments to obtain the recovered target transaction data; wherein, the target number is greater than or equal to the number of byte fragments contained in the target transaction data.
[0038] In one embodiment, after obtaining the recovered target transaction data, the packaging node packages the recovered target transaction data in the following manner:
[0039] The packaging node generates a reference block based on the recovered target transaction data and sends the reference block to the consensus node;
[0040] After determining that the reference block has passed the consensus processing of the consensus node, the packaging node sends the reference block to the blockchain network for storage.
[0041] In one embodiment, the consensus processing method of the consensus node for the reference block includes:
[0042] The consensus node obtains broadcast information sent by different proposing nodes from the blockchain network, and performs recovery processing on the target transaction data based on the broadcast information to obtain the recovered reference transaction data;
[0043] The consensus node matches the recovered reference transaction data with the target transaction data contained in the reference block, and when the match is successful, determines that the reference block has passed the consensus process.
[0044] In another aspect, embodiments of the present invention provide a computer device including a processor, an input device, an output device, and a memory, wherein the processor, input device, output device, and memory are interconnected, wherein the memory is used to store a computer program that supports the computer device in executing the above-described method, the computer program including program instructions, and the processor is configured to invoke the program instructions to execute the method as described in the first aspect.
[0045] In another aspect, embodiments of the present invention provide a computer-readable storage medium storing a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the method described in the first aspect.
[0046] In another aspect, embodiments of the present invention provide a computer program product, the computer program product including a computer program, the computer program including program instructions, and when the program instructions are invoked by a processor, causing the processor to execute the method described in the first aspect.
[0047] In this embodiment, when submitting and packaging transaction data, a centralized single proposal node is no longer used. Instead, a decentralized set of proposal nodes submits the transaction data. If one or more proposal nodes in this decentralized set act maliciously and audit the transaction data, the packaging node can directly invalidate the coded fragments submitted by the malicious proposal node. The transaction data can then be recovered using coded fragments submitted by other, non-malicious proposal nodes. This effectively identifies transaction audits and enables the effective recovery and on-chain storage of transaction data while avoiding audits. When storing the transaction data submitted by the proposal node set on the blockchain, the packaging node can obtain a sufficient number of verified coded fragments from the blockchain network, recover the transaction data based on these fragments, and then use the recovered transaction data to package and upload it to the blockchain. Therefore, even in scenarios where some proposal nodes act maliciously (i.e., some proposal nodes submit invalid erasure coding fragments), the original transaction data can still be recovered from the coded fragments submitted by other proposal nodes, thus solving the problem of malicious actions by some proposal nodes. Therefore, by adopting this method of packaging and uploading transaction data to the blockchain, the proposing nodes, packaging nodes, and consensus nodes in the blockchain network only need one round of transactions to complete the process of packaging and uploading transaction data to the blockchain. Moreover, this packaging and uploading process does not require the participation of witness nodes, which can effectively improve the efficiency of uploading transaction data to the blockchain. In addition, even if some proposing nodes act maliciously, it is still possible to recover the transaction data, so as to ensure that the transaction data in the blockchain network can operate normally and be stored in the blockchain network. Attached Figure Description
[0048] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0049] Figure 1a is a schematic diagram of a blockchain network provided in an embodiment of the present invention;
[0050] Figure 1b is a schematic diagram of a data processing system based on a blockchain network provided in an embodiment of the present invention;
[0051] Figure 2 is a schematic flowchart of a data processing method based on a blockchain network provided by an embodiment of the present invention;
[0052] Figure 3a is a schematic diagram of determining a byte segment according to an embodiment of the present invention;
[0053] Figure 3b is a schematic diagram of another method for determining byte segments provided by an embodiment of the present invention;
[0054] Figure 3c is a schematic diagram of an information broadcasting method provided in an embodiment of the present invention;
[0055] Figure 3d is a schematic diagram of packaging and uploading target transaction data to the blockchain according to an embodiment of the present invention;
[0056] Figure 4 is a schematic block diagram of a data processing device based on a blockchain network provided in an embodiment of the present invention;
[0057] Figure 5 is a schematic block diagram of a computer device provided in an embodiment of the present invention. Detailed Implementation
[0058] The technical solutions of this application will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0059] This application proposes a blockchain-based data processing method. After obtaining target transaction data to be packaged, the target proposal node can encode the target transaction data to obtain encoded data. Since the encoded data contains at least one encoded segment, and different proposal nodes in the blockchain network only verify a portion of this encoded segment, the target proposal node can determine the target encoded segment to be verified from the at least one encoded segment contained in the encoded data. After obtaining the target encoded segment, the target proposal node can sign it and send the resulting broadcast information to the blockchain network. This allows the packaging node in the blockchain network to obtain the broadcast information sent by different proposal nodes. Based on this broadcast information, the packaging node can then recover the target transaction data and package and store the recovered data on the blockchain. This means that when the target proposing node proposes transaction data, it only performs signature verification on a portion of the encoded data corresponding to the transaction data. In other words, the target proposing node's influence on the transaction data only affects a portion of the corresponding encoded data, and does not affect the entire transaction data. Therefore, there is no need to use other witnessing nodes to witness the transaction data proposal process of the proposing node, thereby effectively reducing the process required to submit transaction data to the packaging node and thus effectively improving the efficiency of transaction data submission.
[0060] Furthermore, since the target proposal node can only affect a portion of the encoded information of the target transaction data, but not the entire encoded data, its influence on the transaction data's encoding is effectively reduced. This reduced influence prevents a single proposal node from maliciously tampering with the entire encoded data, thus effectively ensuring the security of the submitted transaction data. Additionally, when restoring transaction data, the packaging node can use the encoded fragments sent by the confirmed untampered proposal node to recover the data, achieving effective recovery of the corresponding transaction data during the data storage process and ensuring the accuracy of transaction data storage.
[0061] In one embodiment, the target proposal node is any one of a set of proposal nodes included in the blockchain network. This set of proposal nodes contains at least one proposal node, and each proposal node is selected from the consensus nodes included in the blockchain network. The proposal node is used to select one or more transaction data from the transaction data to be stored, as the transaction data currently being stored on the blockchain. The consensus nodes are used to perform consensus verification on the transaction data (and / or the blocks formed by packaging the transaction data). It can be understood that the transaction data is stored in the blockchain network only after consensus processing is completed. Furthermore, the blockchain network also includes packaging nodes, which are used to package transaction data into blocks. The corresponding blocks can be stored on the blockchain after consensus is achieved.
[0062] In this application, the proposal node, packaging node, and consensus node mentioned in the embodiments can be the same node device or different node devices, and this application does not limit them. To facilitate understanding of the embodiments of this application, the blockchain technology and related concepts involved in the embodiments of this application will be explained below.
[0063] (1) Blockchain and blockchain networks.
[0064] A blockchain network is a distributed system, specifically a data sharing system as shown in Figure 1a. As shown in Figure 1a, this data sharing system 100 refers to a system for data sharing between nodes. This data sharing system can include multiple nodes 101, which can refer to various node devices (clients or servers) within the data sharing system. Each node 101, in its normal operation, receives input information and maintains the shared data within the data sharing system based on the received input information. To ensure information interoperability within the data sharing system, information connections can exist between each node in the data sharing system 100, allowing information transmission between nodes. In the distributed system shown in Figure 1a, any device, such as a server or terminal, can join the distributed system and become a node device. The proposal node, packaging node, and consensus node mentioned in the aforementioned embodiments of this application are all nodes in this blockchain network; that is, the aforementioned proposal node, packaging node, and consensus node constitute the nodes of the distributed system.
[0065] In the data sharing system shown in Figure 1a, each node stores the same blockchain, which consists of multiple blocks. Each block is composed of transactions generated within a certain period of time, and after being packaged and verified, it is stored in the blockchain network.
[0066] (2) Transaction data.
[0067] In a blockchain network, a transaction refers to an operation executed in the blockchain ledger, such as a transfer between accounts or a call to a smart contract. Transaction data, on the other hand, refers to the data that records these operations. Each transaction (or transaction data) is signed by the private key corresponding to the initiating account address. After being signed, the transaction (or transaction data) can be stored in the memory pool of the node first and then be written onto the blockchain when the opportunity arrives.
[0068] (3) Transaction review.
[0069] Transaction review means that the node determining the transaction order within a block can also decide which transactions are included in that block, that is, selectively pack transactions into the block, thus giving rise to the risk of centralized review. When the block producer refuses to include a user transaction in the block, transaction review occurs. The more concentrated the block producers are, the greater the likelihood of transaction review. Transaction review can cause users to miss the transaction opportunity at best or be unable to transact at worst.
[0070] Anti-review (or anti-transaction review) means ensuring that transaction data in a decentralized network cannot be reviewed or manipulated by any device, that is, ensuring that each transaction data in the blockchain network will not be rejected from being included in the block due to other factors (such as privacy like a small amount of transferred electronic resources), thus guaranteeing the fairness of transaction data in the blockchain network.
[0071] (4) Data encoding.
[0072] Encoding refers to the process of converting transaction data into another data format. The data encoding adopted in the embodiments of this application is a fault-tolerant encoding method. Fault-tolerant encoding means that the encoding result has a certain fault tolerance ability, that is, the original transaction data can be restored using part of the encoding result. In other words, when part of the encoding result is incorrect, the original correct transaction data can still be restored.
[0073] This fault-tolerant encoding can be an erasure code. In the embodiments of this application, the erasure code supports encoding transaction data with a length of k into an erasure code with a length of m. Then, when decoding, only the encoded data with a data volume of k′ needs to be provided to obtain the original transaction data with a length of k. Here, k ≤ k′ < m, and the values of k, k′, and m are all positive integers. It can be seen that using erasure encoding can tolerate data errors with a length of (m - k′). That is, when the amount of incorrect data in the encoded data is less than or equal to (m - k′), the original transaction data can still be accurately restored using the incorrect encoded data.
[0074] Please refer to Figure 1b, which is a schematic diagram of the network architecture of a data processing method based on a blockchain network provided in an embodiment of this application. As shown in Figure 1b, the network architecture may include a server 200 and a cluster of terminal devices. The cluster of terminal devices may include one or more terminal devices; the number of terminal devices is not limited here. As shown in Figure 1b, the multiple terminal devices may specifically include terminal device 1, terminal device 2, terminal device 3, ..., terminal device n, where n is a positive integer. As shown in Figure 1b, terminal device 1, terminal device 2, terminal device 3, ..., terminal device n can all connect to the server 200 via the network, so that each terminal device can interact with the server 200 through the network connection.
[0075] In one embodiment, the server 200 and the terminal device cluster in this network architecture constitute the distributed system of the blockchain network. That is, both the server 200 and the terminal devices in this network architecture are nodes in the blockchain network. In another implementation, the node devices in this blockchain network may consist only of the server 200. The terminal device cluster in Figure 1b is used to interact with the blockchain network (server 200), and based on this interaction, the corresponding data of each terminal device in the terminal device cluster can also be transmitted to the blockchain network for storage.
[0076] As shown in Figure 1b, server 200 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Terminal devices can be smart terminals such as smartphones, tablets, laptops, desktop computers, smart TVs, in-vehicle terminals, and smart home devices. The following description uses the communication between terminal device 1 and server 200 as an example to illustrate the specific implementation of this application.
[0077] In this context, terminal device 1 can be a user terminal, which may include a business client. This business client is used to submit transaction data (such as the aforementioned target transaction data). The client can be software, a mini-program (a program that does not require installation), a webpage, etc. Server 200 can be the backend server to which this business client belongs. It is understood that the aforementioned proposal node can be either the server in Figure 1b or the terminal device in Figure 1b.
[0078] The following is a brief description of the blockchain-based data processing method involved in this application, using terminal device 1 and server 200 as examples, and assuming that server 200 is a target proposal node in the blockchain network:
[0079] ① Terminal device 1 submits the target transaction data to be uploaded to the blockchain to the transaction memory pool for storage, and waits to be uploaded to the blockchain;
[0080] ② When server 200 determines that the target transaction data can be stored on the blockchain, it encodes the target transaction data and determines the target encoded segment that server 200 is responsible for from the multiple encoded segments obtained by encoding.
[0081] ③ Server 200 signs the target encoded fragment and sends the signed target encoded fragment to the blockchain network;
[0082] ④ Packaging nodes in the blockchain network obtain encoded fragments from the blockchain network and perform verification processing on the corresponding encoded fragments based on the signature information carried by the obtained encoded fragments;
[0083] ⑤ After the packaging node obtains a sufficient number of coded fragments from the blockchain network and passes the verification process, it restores the transaction data based on the obtained coded fragments;
[0084] ⑥ The packaging node packages the recovered transaction data into a reference block and uploads the reference block to the blockchain network for storage.
[0085] By shifting the proposal process from a single proposing node to a decentralized one involving multiple proposing nodes within a set of nodes during the transaction data packaging process, blockchain networks effectively mitigate the risks of malicious activity and censorship by a single node. Furthermore, each proposing node in this set only verifies a portion of the encoded data, further preventing malicious behavior during the encoding process. Furthermore, the proposing node employs a fault-tolerant encoding method when encoding the data. After the proposing node signs the encoded fragment of the transaction data and broadcasts it to the blockchain network, the packaging node can obtain the encoded fragments sent by different proposing nodes from the blockchain network. Once the packaging node has obtained a sufficient number of verified encoded fragments, it can use these fragments to restore and package the transaction data onto the blockchain. This gives the blockchain network a certain degree of fault tolerance when packaging transaction data, thus effectively improving the efficiency of storing transaction data on the blockchain while ensuring its accuracy and security.
[0086] It should be specifically noted that the data involved in the data processing based on the blockchain network in this application (e.g., transaction data, target transaction data, etc. in the embodiments of this application) requires the permission or consent of the target entity when applied to specific products or technologies. Furthermore, the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the region, adhering to the principles of legality, legitimacy, and necessity, and must not involve acquiring data types prohibited or restricted by laws and regulations. In some optional embodiments, the related data involved in the embodiments of this application is obtained after separate authorization from the target entity. Additionally, when obtaining separate authorization from the target entity, the purpose of the related data is explained to the target entity.
[0087] Please refer to Figure 2, which is a schematic flowchart of a data processing method based on a blockchain network mentioned in an embodiment of this application. The blockchain network includes packaging nodes and a set of proposal nodes. The set of proposal nodes contains at least one proposal node. The data processing method is executed by a target proposal node, which is any one of the proposal nodes in the set. The target proposal node can be the terminal device shown in Figure 1b, or it can be the server shown in Figure 1b. This is not limited in this embodiment. As shown in Figure 2, the method may include:
[0088] S201, Obtain the target transaction data to be uploaded to the blockchain, and encode the target transaction data to obtain the encoded data of the target transaction data; wherein, the encoded data contains at least one encoded segment.
[0089] When storing transaction data on the blockchain, the target proposing node needs to select one or more target transaction data to be uploaded to the blockchain from the transaction mempool as the transaction data currently waiting to be uploaded. The transaction mempool is a data storage area for caching transaction data. The transaction data in the transaction mempool can be obtained from different node devices in the blockchain network or from off-chain devices outside the blockchain network. In this embodiment, the source of the transaction data stored in the transaction mempool is not limited.
[0090] After transaction data has been stored in the transaction mempool for a period of time, it can be stored on the blockchain. When storing data on the blockchain, the proposing node can first select the target transaction data to be stored on the blockchain from the transaction mempool.
[0091] In one embodiment, the blockchain network contains at least two proposal nodes, forming a decentralized set of proposal nodes. When determining the target transaction data, the proposal nodes in the blockchain network can decide through discussion and voting. That is, the target transaction data selected for storage on the blockchain is agreed upon by a target number of proposal nodes (generally exceeding half the total number of nodes in the set). In another implementation, each proposal node in the proposal node set can individually select the target transaction data to be stored on the blockchain, encode the data accordingly, and then wait for the packaging node to package and upload it.
[0092] By setting the proposal nodes in the blockchain network as a decentralized set of proposal nodes, each proposal node in the set can achieve censorship resistance when determining the transaction data to be uploaded to the chain, under the mutual constraints of different proposal nodes. This ensures that each transaction data can be uploaded to the chain under fair rules, effectively avoiding the risk of transaction censorship.
[0093] When any proposal node (such as the target proposal node) in the proposal node set obtains target transaction data to be uploaded to the blockchain, it can select the target transaction data based on the priority of each transaction data in the transaction mempool. In a specific implementation, the target proposal node can first obtain at least one transaction data to be uploaded to the blockchain from the transaction mempool, as well as the storage information of each transaction data in the transaction mempool; the storage information includes at least one of the following: the storage duration in the transaction mempool, and the amount of electronic resources transferred after being stored in the blockchain network; then, the priority of each transaction data can be determined according to the storage information, and the target transaction data can be determined from the transaction mempool according to the priority.
[0094] In one implementation, the target proposal node can determine priority solely based on storage duration (denoted as `time_seen`). Therefore, the longer a transaction's storage time in the transaction mempool, the higher its priority. In another implementation, the target proposal node can also determine the priority of corresponding transaction data solely based on the amount of electronic resources transferred (denoted as `fee`). Here, the more electronic resources transferred after a transaction is stored in the blockchain network, the higher its priority. In yet another implementation, the target proposal node can combine the storage duration `time_seen` and the transferred electronic resources `fee` to jointly determine the priority of transaction data. Specifically, the transaction priority determined by the target proposal node can be determined using Equation 1.
[0095] Priority = time_seen * fee (Equation 1)
[0096] Among them, Priority represents the priority of a certain transaction data in the transaction memory pool.
[0097] After the target proposal node determines the priorities corresponding to the respective transaction data in the transaction memory pool, it can select the maximum value of the priorities from the transaction memory pool, so as to use the transaction data corresponding to the maximum priority as the target transaction data. Alternatively, the target proposal node can also select any transaction data corresponding to a priority greater than or equal to the priority threshold from the transaction memory pool based on the priority as the target transaction data.
[0098] It should be further noted that since the proposal nodes included in the blockchain network are a set of proposal nodes, each proposal node in this set of proposal nodes uses the same rule to determine the target transaction data based on the priority. The transaction data determined from the transaction memory pool through such a determination method cannot be subject to transaction review, thereby realizing the constraint on the risk of transaction review on a single proposal node.
[0099] After the target proposal node determines the target transaction data to be put on the chain, it can perform error-tolerant encoding on the target transaction data. In a specific implementation, when encoding the target transaction data to obtain the encoded data of the target transaction data, the target proposal node can first obtain the data length of the target transaction data and the number of proposal nodes included in the blockchain network; then, it can determine the encoding length of the target transaction data according to the data length and the number of proposal nodes, and encode the target transaction data according to the encoding length to obtain the encoded data of the target transaction data.
[0100] In one embodiment, the data length of the target transaction data refers to the number of byte segments included in the target transaction data. Generally speaking, as shown in FIG. 3a, one byte of the target transaction data can be used as one byte segment, or, as shown in FIG. 3b, at least two bytes of the target transaction data can be used as one byte segment. In the embodiments of the present application, the case where one byte of the transaction data is used as one byte segment is mainly described.
[0101] In one embodiment, if the length of the target transaction data obtained by the target proposal node is k and the number of proposal nodes is n, then the encoding length determined according to the data length k of the transaction data and the number of proposal nodes n can be m, where m > k and m < k + n, and k, m, and n are all positive integers.
[0102] After determining the encoding length, when the target proposal node encodes the target transaction data consisting of multiple byte fragments, it can first determine the encoding matrix based on the encoding length; wherein the number of rows in the encoding matrix is equal to the encoding length; then, the encoding matrix is multiplied by each byte fragment of the target transaction data to obtain multiple encoding fragments, and the obtained multiple encoding fragments are used as the encoded data of the target transaction data.
[0103] Specifically, if the target transaction data contains four coded segments (k=4), and the code length is determined to be m=6, then the coding matrix determined by the target proposal node is a 4*6 matrix (4 columns, 6 rows). A single coded segment from the target transaction data can be considered a row in this matrix, meaning the target transaction data can be converted into a 4-row matrix. Then, the 4-column, 6-row coding matrix is multiplied by the corresponding 4-row matrix of the target transaction data to obtain the target coded data. In other words, multiplying the 4-column, 6-row coding matrix by the corresponding 4-row matrix of the target transaction data results in a 6-row matrix, where each row represents a coded segment from the coded data.
[0104] In one embodiment, the determined encoding matrix m*k is a matrix containing an identity matrix k*k and an encoding matrix (mk)*k. Then, the first k rows of the resulting encoded data (as mentioned above, the first 4 rows) are byte fragments of the original target transaction data, and the last (mk) rows (as mentioned above, the last 2 rows) are check data blocks. This encoding method provides a certain degree of error tolerance for the encoded target transaction data.
[0105] In other words, the target proposal node can encode the target transaction data priority_tx of length k into encoded data encoded_priority_tx of length m. The resulting encoded data is obtained using fault-tolerant encoding, such as erasure coding. After obtaining the encoded data, the target proposal node can perform pre-verification and submission on the encoded segment it is responsible for, and then proceed to step S202.
[0106] S202, based on the node identifier of the target proposal node, determine the target encoded segment that successfully matches the node identifier from at least one encoded segment, and perform signature processing on the target encoded segment to obtain the broadcast information of the target transaction data.
[0107] In one embodiment, the encoded data contains at least one encoded segment arranged sequentially and each corresponding to a different segment identifier. When the target proposal node determines the target encoded segment that matches the node identifier from at least one encoded segment based on the node identifier of the target proposal node, it can first obtain the node identifier corresponding to the target proposal node in the proposal node set of the blockchain network, and perform identifier mapping on the node identifier of the target proposal node to obtain the target mapping identifier. Further, the target proposal node can obtain the segment identifier of each encoded segment of the encoded data, and perform matching processing between the target mapping identifier and the segment identifier corresponding to each encoded segment, so that the encoded segment corresponding to the segment identifier that matches the target mapping identifier can be used as the target encoded segment.
[0108] Where the target proposal node is the j-th proposal node in the proposal node set, i.e., j is the node identifier of the target proposal node and j is a positive integer greater than or equal to 1, then, based on the mapping relationship, the target proposal node can determine the j-th encoded segment to be signed by the target proposal node from at least one encoded segment. That is, the j-th proposal node in the proposal node set will store the j-th encoded segment in the encoded data. The segment identifier of the encoded segment can be determined based on the row number of the encoded segment in the matrix.
[0109] After the target proposal node determines the target encoded segment, it can sign the target encoded segment to obtain the corresponding broadcast message_j. In one embodiment, the broadcast message_j of the target proposal node can be denoted as Equation 2.
[0110] message_j = {encoded_prorjty_tx[j], sjgnature_j} Equation 2
[0111] Where encoded_prorjty_tx[j] is the target encoded fragment corresponding to the target proposal node, and sjgnature_j is the signature information of the target proposal node for the target encoded fragment.
[0112] After receiving the broadcast information, it can be sent to the blockchain network, so that the packaging nodes in the blockchain network can recover the transaction data based on the broadcast information sent by different proposing nodes, and package and put the recovered target transaction data on the chain.
[0113] In one embodiment, the target proposal node is selected from the consensus nodes included in the blockchain network. The method for determining the proposal node from the blockchain network is described below. In a specific implementation, any node in the blockchain network (such as the aforementioned target proposal node) can first obtain one or more target blocks from the blockchain network and determine the block hash (block_hash) of the target block. The obtained block hash is used as a random number source. Then, the block hash can be subjected to i repeated hash operations, and the result of each repeated hash operation can be obtained, where i is a positive integer greater than or equal to 1. Further, the result of each repeated hash operation and the total number of consensus nodes included in the blockchain network can be moduloed, and the result of the modulo operation can be mapped to the node identifier of the consensus node. The consensus node corresponding to the mapped node identifier is then used as the selected proposal node.
[0114] Specifically, when retrieving one or more target blocks from the blockchain network, the block with the highest height can be retrieved from all the blocks contained in the blockchain network, and the retrieved block with the highest height can be used as the target block retrieved from the blockchain network; or, all the blocks contained in the blockchain network can be retrieved, and each retrieved block can be used as the target block.
[0115] In other words, when the block height corresponding to the block to be generated is h, the computer device can use the block hash block_hash of block height h-1 as a random number source to randomly select n transaction proposers from N consensus nodes, constructing a proposal node set {index_1, ..., index_n}. h is a positive integer greater than or equal to 1, N is greater than or equal to n and is a positive integer, index represents a proposal node, and index_i represents the i-th proposal node in the proposal node set. Then, according to the aforementioned method for determining proposal nodes, the i-th proposal node, when determined, satisfies Equation 3.
[0116] index_i = Hash i (block_hash)mod N (Formula 3)
[0117] Where index_i represents the i-th proposal node in the proposal node set, and Hash i This indicates that the hash calculation is performed i times repeatedly, such as Hash. 2 =Hash(Hash(blockHash)); mod represents the modulo operation, which maps the result of the operation to a set of N consensus nodes.
[0118] Regarding the method for determining each proposal node in the proposal node set, any one of the proposal nodes in the set can be used as the target proposal node, and the determined target transaction data will be broadcast. The overall process is shown in Figure 3c, and the following steps are specifically executed:
[0119] <1> For consensus nodes in a blockchain network, the block hash of the maximum block height h-1 corresponding to the existing block is obtained as the source of random numbers.
[0120] <2> Using this random number source, m proposal nodes are determined from the consensus node set, and the node identifier index_i corresponding to each proposal node is obtained;
[0121] <3> Select the highest priority transaction data from the transaction memory pool as the target transaction data priority_tx;
[0122] <4> Fault-tolerant encoding is performed on the target transaction data priority_tx to obtain the encoded data of the target transaction data encoded_priority_tx;
[0123] <5> From the encoded data, determine the target encoded fragment encoded_priority_tx[i] corresponding to the target proposal node;
[0124] <6> The target proposal node signs the target encoded fragment to obtain signature information signature_i;
[0125] <7> Generate broadcast message_i based on the target encoded fragment and signature information;
[0126] <8> Broadcast information is sent to the blockchain network.
[0127] S203, broadcast information is sent to the blockchain network so that the packaging node can obtain broadcast information sent by different proposing nodes from the blockchain network, and restore the target transaction data according to the broadcast information of different proposing nodes, so as to package the restored transaction data.
[0128] After each proposal node in the proposal node set sends the corresponding broadcast information to the blockchain network, the packaging node in the blockchain network can obtain the broadcast information from the blockchain network. Thus, after obtaining a certain amount of broadcast information, it can recover the information based on the encoded fragments contained in the obtained broadcast information.
[0129] In one embodiment, when a packaging node performs target transaction data recovery, the packaging node may first obtain broadcast information sent by different proposing nodes from the blockchain network, and based on the signature information in each broadcast information, perform verification processing on the encoded fragments in each broadcast information. Then, after the packaging node determines that the corresponding encoded fragment passes the verification based on the signature information, the packaging node obtains the number of fragments of the encoded fragment that passes the verification. Further, when the number of fragments is the target number, the packaging node recovers the target transaction data according to the encoded fragments of the target number, and obtains the recovered target transaction data; wherein, the target number is greater than or equal to the number of byte fragments included in the target transaction data.
[0130] Among them, when the packaging node obtains the message sent by the submitting node from the blockchain network, the target number corresponding to the number of fragments to be obtained is k', where the value range of k' is k ≤ k' < m. And in the process of the packaging node recovering based on the encoded fragments of k', if the erasure coding method is used for the erasure coding, the packaging node can use the erasure decoding method to recover the data, so as to recover the original target transaction data priority_tx. Then, in the scenario where some transaction proposers act maliciously, that is, some proposing nodes submit invalid erasure code fragments, as long as the number of malicious proposing nodes is less than m - k', the packaging node can still obtain the erasure code fragments from other proposing nodes and recover the original target transaction data.
[0131] After the packaging node recovers the target transaction data priority_tx, it can use the recovered target transaction data to generate a reference block with a block height of h. Among them, when the packaging node generates a reference block with a height of h, at least one transaction data needs to be added to the reference block, and at least one of the added transactions needs to ensure that it contains at least the recovered target transaction data priority_tx.
[0132] After the packaging node generates a reference block based on the recovered target transaction data, it will also send the reference block to the consensus node. Then, after the packaging node determines that the reference block passes the consensus processing of the consensus node, it sends the reference block to the blockchain network for storage. Among them, when the consensus node performs consensus processing on the reference block, it can first obtain broadcast information sent by different proposing nodes from the blockchain network, and perform recovery processing on the target transaction data based on the broadcast information to obtain the recovered reference transaction data; further, the consensus node matches the recovered reference transaction data with the target transaction data included in the reference block, and when the match is successful, determines that the reference block passes the consensus processing. That is to say, during block consensus, the consensus node will require priority_tx to be included in the block, otherwise it determines that the block is invalid.
[0133] The following, referring to Figure 3d, provides an overall explanation of the process of packaging and uploading transaction data to the blockchain network. It specifically includes the following steps:
[0134] (1) Determine the set of proposal nodes from the consensus node set of the blockchain network, and have each proposal node in the set of proposal nodes perform erasure coding on the target transaction data to obtain the encoded data of the target transaction data, so that each proposal node, after signing the encoded fragment it is responsible for, broadcasts the encoded fragment carrying the signature information to the blockchain network.
[0135] (2) Packaging nodes in the blockchain network obtain broadcast messages sent by the proposing nodes from the blockchain network;
[0136] (3) Verify the signature in the broadcast message and obtain the erasure code fragment (i.e. the encoded fragment) that has passed the verification;
[0137] (4) When the number of erasure code fragments obtained reaches a certain amount, the anti-censorship target transaction data priority_tx is restored based on the set of erasure code fragments;
[0138] (5) Pack the recovered target transaction data priority_tx, and pack the other transaction data in the transaction memory pool to obtain a reference block with block height h, and broadcast the reference block to the blockchain network;
[0139] (6) The consensus node retrieves and recovers erasure code fragments from the blockchain network, obtains reference transaction data, and retrieves a reference block with block height h from the blockchain network;
[0140] (7) The consensus node checks whether the reference block contains reference transaction data. If it does, it determines to perform block verification; otherwise, it determines that the reference block is invalid.
[0141] In this embodiment, instead of a centralized single proposal node, a decentralized set of proposal nodes submits transaction data during submission and packaging. If one or more proposal nodes in this decentralized set act maliciously and audit the transaction data, the packaging node can directly invalidate the coded fragments submitted by the malicious node. The transaction data can then be recovered using coded fragments submitted by other, non-malicious proposal nodes. This effectively identifies transaction audits and enables efficient recovery and on-chain storage of transaction data while avoiding audits. When storing the transaction data submitted by the proposal node set on-chain, the packaging node can obtain a sufficient number of verified coded fragments from the blockchain network, recover the transaction data based on these fragments, and then package and upload the recovered transaction data. Therefore, even in scenarios where some proposal nodes act maliciously (i.e., some submit invalid erasure coding fragments), the original transaction data can still be recovered from the coded fragments submitted by other proposal nodes, thus solving the problem of malicious actions by some proposal nodes. Therefore, by adopting this method of packaging and uploading transaction data to the blockchain, the proposing nodes, packaging nodes, and consensus nodes in the blockchain network only need one round of transactions to complete the process of packaging and uploading transaction data to the blockchain. Moreover, this packaging and uploading process does not require the participation of witness nodes, which can effectively improve the efficiency of uploading transaction data to the blockchain. In addition, even if some proposing nodes act maliciously, it is still possible to recover the transaction data, so as to ensure that the transaction data in the blockchain network can operate normally and be stored in the blockchain network.
[0142] Please refer to Figure 4, which is a schematic diagram of the structure of a data processing device based on a blockchain network according to an embodiment of this application. The blockchain network includes packaging nodes and a set of proposal nodes. The set of proposal nodes includes at least one proposal node. The data processing device is a device among the target proposal nodes, and the target proposal node is any one of the proposal nodes in the set of proposal nodes. As shown in Figure 4, the data processing device based on the blockchain network may include: an acquisition unit 401 and a processing unit 402.
[0143] The acquisition unit 401 is used to acquire the target transaction data to be uploaded to the blockchain and encode the target transaction data to obtain the encoded data of the target transaction data; wherein the encoded data contains at least one encoded segment.
[0144] Processing unit 402 is configured to determine, based on the node identifier of the target proposal node, a target encoded segment that successfully matches the node identifier from the at least one encoded segment, and perform signature processing on the target encoded segment to obtain broadcast information of the target transaction data;
[0145] The processing unit 402 is further configured to send the broadcast information to the blockchain network, so that the packaging node can obtain the broadcast information sent by different proposing nodes from the blockchain network, and restore the target transaction data according to the broadcast information of different proposing nodes, so as to package the restored transaction data.
[0146] In one embodiment, the acquisition unit 401 is specifically used for:
[0147] Obtain at least one transaction data to be uploaded to the blockchain from the transaction mempool, and storage information of each transaction data in the transaction mempool; the storage information includes at least one of the following: the storage duration in the transaction mempool, and the amount of electronic resources transferred after being stored in the blockchain network;
[0148] The priority of each transaction data is determined based on the stored information, and the target transaction data is determined from the transaction memory pool based on the priority.
[0149] In one embodiment, the processing unit 402 is specifically used for:
[0150] Obtain the data length of the target transaction data and the number of proposing nodes contained in the blockchain network;
[0151] Based on the data length and the number of proposing nodes, the encoding length of the target transaction data is determined, and the target transaction data is encoded according to the encoding length to obtain the encoded data of the target transaction data.
[0152] In one embodiment, the target transaction data consists of multiple byte fragments; the processing unit 402 is specifically used for:
[0153] The encoding matrix is determined based on the encoding length; wherein the number of rows in the encoding matrix is equal to the encoding length.
[0154] The encoding matrix is multiplied by each byte segment of the target transaction data to obtain multiple encoding segments, and these multiple encoding segments are used as the encoded data of the target transaction data.
[0155] In one embodiment, the encoded data includes at least one encoded segment arranged sequentially and corresponding to different segment identifiers; the processing unit 402 is specifically used for:
[0156] Obtain the node identifier corresponding to the target proposal node in the proposal node set of the blockchain network, and perform identifier mapping on the node identifier of the target proposal node to obtain the target mapping identifier;
[0157] Obtain the segment identifier of each encoded segment of the encoded data, and match the target mapping identifier with the segment identifier corresponding to each encoded segment;
[0158] The encoded segment corresponding to the segment identifier that successfully matches the target mapping identifier is taken as the target encoded segment.
[0159] In one embodiment, the blockchain network further includes consensus nodes;
[0160] The acquisition unit 401 is further configured to acquire one or more target blocks from the blockchain network and determine the block hash of the target blocks;
[0161] The processing unit 402 is further configured to perform i repeated hash operations on the block hash and obtain the result of each repeated hash operation, wherein i is a positive integer greater than or equal to 1.
[0162] The processing unit 402 is further configured to perform a modulo operation on the result of each repeated hash operation and the total number of consensus nodes contained in the blockchain network.
[0163] The processing unit 402 is further configured to map the result of the modulo operation to the node identifier of the consensus node, and use the consensus node corresponding to the mapped node identifier as the selected proposal node.
[0164] In one embodiment, the processing unit 402 is specifically used for:
[0165] From the blocks contained in the blockchain network, obtain the block with the highest height, and use the obtained block with the highest height as the target block to be obtained from the blockchain network; or,
[0166] Obtain each block contained in the blockchain network and use each obtained block as the target block.
[0167] In one embodiment, the method by which the packaging node restores the target transaction data includes:
[0168] The packaging node obtains broadcast information sent by different proposing nodes from the blockchain network, and performs verification processing on the encoded fragments in each broadcast information based on the signature information in each broadcast information;
[0169] After determining that the corresponding encoded segment has passed verification based on the signature information, the packaging node obtains the number of encoded segments that have passed verification.
[0170] When the number of fragments reaches the target number, the packaging node recovers the target transaction data based on the target number of encoded fragments to obtain the recovered target transaction data; wherein, the target number is greater than or equal to the number of byte fragments contained in the target transaction data.
[0171] In one embodiment, after obtaining the recovered target transaction data, the packaging node packages the recovered target transaction data in the following manner:
[0172] The packaging node generates a reference block based on the recovered target transaction data and sends the reference block to the consensus node;
[0173] After determining that the reference block has passed the consensus processing of the consensus node, the packaging node sends the reference block to the blockchain network for storage.
[0174] In one embodiment, the consensus processing method of the consensus node for the reference block includes:
[0175] The consensus node obtains broadcast information sent by different proposing nodes from the blockchain network, and performs recovery processing on the target transaction data based on the broadcast information to obtain the recovered reference transaction data;
[0176] The consensus node matches the recovered reference transaction data with the target transaction data contained in the reference block, and when the match is successful, determines that the reference block has passed the consensus process.
[0177] In this embodiment, when submitting and packaging transaction data, a centralized single proposal node is no longer used. Instead, a decentralized set of proposal nodes submits the transaction data. If one or more proposal nodes in this decentralized set act maliciously and audit the transaction data, the packaging node can directly invalidate the coded fragments submitted by the malicious proposal node. The transaction data can then be recovered using coded fragments submitted by other, non-malicious proposal nodes. This effectively identifies transaction audits and enables the effective recovery and on-chain storage of transaction data while avoiding audits. When storing the transaction data submitted by the proposal node set on the blockchain, the packaging node can obtain a sufficient number of verified coded fragments from the blockchain network, recover the transaction data based on these fragments, and then use the recovered transaction data to package and upload it to the blockchain. Therefore, even in scenarios where some proposal nodes act maliciously (i.e., some proposal nodes submit invalid erasure coding fragments), the original transaction data can still be recovered from the coded fragments submitted by other proposal nodes, thus solving the problem of malicious actions by some proposal nodes. Therefore, by adopting this method of packaging and uploading transaction data to the blockchain, the proposing nodes, packaging nodes, and consensus nodes in the blockchain network only need one round of transactions to complete the process of packaging and uploading transaction data to the blockchain. Moreover, this packaging and uploading process does not require the participation of witness nodes, which can effectively improve the efficiency of uploading transaction data to the blockchain. In addition, even if some proposing nodes act maliciously, it is still possible to recover the transaction data, so as to ensure that the transaction data in the blockchain network can operate normally and be stored in the blockchain network.
[0178] According to one embodiment of this application, the modules in the blockchain-based data processing device shown in Figure 4 can be individually or entirely merged into one or more units, or some of the units can be further divided into multiple functionally smaller sub-units to achieve the same operation without affecting the technical effect of the embodiment of this application. The above modules are based on logical function division. In practical applications, the function of one module can also be implemented by multiple units, or the function of multiple modules can be implemented by one unit. In other embodiments of this application, the blockchain-based data processing device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.
[0179] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0180] According to one embodiment of this application, a computer program capable of executing the steps involved in the corresponding methods shown in the various embodiments of this application can be run on a general-purpose computer device (which may include processing elements and storage elements such as a central processing unit (CPU), random access storage medium (RAM), and read-only storage medium (ROM)) to construct the data processing device based on a blockchain network as shown in FIG4. The aforementioned computer program can be recorded on a computer-readable recording medium, and can be loaded into and run in the aforementioned computer device via the computer-readable recording medium.
[0181] Please refer to Figure 5, which is a schematic diagram of the structure of a computer device provided in an embodiment of this application. This computer device is a target proposal node in a blockchain network. The blockchain network includes packaging nodes and a set of proposal nodes. The set of proposal nodes includes at least one proposal node, and the target proposal node is any one of the proposal nodes in the set of proposal nodes. As shown in Figure 5, the computer device 1000 may include: a processor 1001, a network interface 1004, and a memory 1005. Furthermore, in some embodiments, the computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. The communication bus 1002 is used to implement communication between these components. The user interface 1003 may include a display screen and a keyboard. Optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as at least one disk storage device. Alternatively, the memory 1005 may be at least one storage device located remotely from the aforementioned processor 1001. As shown in FIG5, the memory 1005, as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a device control application program.
[0182] In the computer device 1000 shown in Figure 5, the network interface 1004 provides network communication functions; 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:
[0183] The target transaction data to be uploaded to the blockchain is obtained, and the target transaction data is encoded to obtain the encoded data of the target transaction data; wherein, the encoded data contains at least one encoded segment;
[0184] Based on the node identifier of the target proposal node, a target encoding segment that successfully matches the node identifier is determined from the at least one encoding segment, and the target encoding segment is signed to obtain the broadcast information of the target transaction data;
[0185] The broadcast information is sent to the blockchain network so that the packaging node can obtain the broadcast information sent by different proposing nodes from the blockchain network, and restore the target transaction data according to the broadcast information of different proposing nodes, so as to package the restored transaction data.
[0186] In one embodiment, the processor 1001 can be used to invoke a device control application stored in the memory 1005, and also to implement:
[0187] Obtain at least one transaction data to be uploaded to the blockchain from the transaction mempool, and storage information of each transaction data in the transaction mempool; the storage information includes at least one of the following: the storage duration in the transaction mempool, and the amount of electronic resources transferred after being stored in the blockchain network;
[0188] The priority of each transaction data is determined based on the stored information, and the target transaction data is determined from the transaction memory pool based on the priority.
[0189] In one embodiment, the processor 1001 can be used to invoke a device control application stored in the memory 1005, and also to implement:
[0190] Obtain the data length of the target transaction data and the number of proposing nodes contained in the blockchain network;
[0191] Based on the data length and the number of proposing nodes, the encoding length of the target transaction data is determined, and the target transaction data is encoded according to the encoding length to obtain the encoded data of the target transaction data.
[0192] In one embodiment, the target transaction data consists of multiple byte fragments; the processor 1001 can be used to call the device control application stored in the memory 1005, and is also used to implement:
[0193] The encoding matrix is determined based on the encoding length; wherein the number of rows in the encoding matrix is equal to the encoding length.
[0194] The encoding matrix is multiplied by each byte segment of the target transaction data to obtain multiple encoding segments, and these multiple encoding segments are used as the encoded data of the target transaction data.
[0195] In one embodiment, the encoded data includes at least one encoded segment arranged sequentially and each corresponding to a different segment identifier; the processor 1001 can be used to call the device control application stored in the memory 1005, and is also used to implement:
[0196] Obtain the node identifier corresponding to the target proposal node in the proposal node set of the blockchain network, and perform identifier mapping on the node identifier of the target proposal node to obtain the target mapping identifier;
[0197] Obtain the segment identifier of each encoded segment of the encoded data, and match the target mapping identifier with the segment identifier corresponding to each encoded segment;
[0198] The encoded segment corresponding to the segment identifier that successfully matches the target mapping identifier is taken as the target encoded segment.
[0199] In one embodiment, the blockchain network further includes consensus nodes; the processor 1001 can be used to invoke a device control application stored in the memory 1005, and is also used to implement:
[0200] Obtain one or more target blocks from the blockchain network and determine the block hash of the target blocks;
[0201] Perform i repeated hash operations on the block hash and obtain the result of each repeated hash operation, where i is a positive integer greater than or equal to 1;
[0202] The modulo operation is performed on the result of each repeated hash operation and the total number of consensus nodes in the blockchain network.
[0203] The result of the modulo operation is mapped to the node identifier of the consensus node, and the consensus node corresponding to the mapped node identifier is selected as the proposal node.
[0204] In one embodiment, the processor 1001 can be used to invoke a device control application stored in the memory 1005, and also to implement:
[0205] From the blocks contained in the blockchain network, obtain the block with the highest height, and use the obtained block with the highest height as the target block to be obtained from the blockchain network; or,
[0206] Obtain each block contained in the blockchain network and use each obtained block as the target block.
[0207] In one embodiment, the method by which the packaging node restores the target transaction data includes:
[0208] The packaging node obtains broadcast information sent by different proposing nodes from the blockchain network, and performs verification processing on the encoded fragments in each broadcast information based on the signature information in each broadcast information;
[0209] After determining that the corresponding encoded segment has passed verification based on the signature information, the packaging node obtains the number of encoded segments that have passed verification.
[0210] When the number of fragments reaches the target number, the packaging node recovers the target transaction data based on the target number of encoded fragments to obtain the recovered target transaction data; wherein, the target number is greater than or equal to the number of byte fragments contained in the target transaction data.
[0211] In one embodiment, after obtaining the recovered target transaction data, the packaging node packages the recovered target transaction data in the following manner:
[0212] The packaging node generates a reference block based on the recovered target transaction data and sends the reference block to the consensus node;
[0213] After determining that the reference block has passed the consensus processing of the consensus node, the packaging node sends the reference block to the blockchain network for storage.
[0214] In one embodiment, the consensus processing method of the consensus node for the reference block includes:
[0215] The consensus node obtains broadcast information sent by different proposing nodes from the blockchain network, and performs recovery processing on the target transaction data based on the broadcast information to obtain the recovered reference transaction data;
[0216] The consensus node matches the recovered reference transaction data with the target transaction data contained in the reference block, and when the match is successful, determines that the reference block has passed the consensus process.
[0217] It should be understood that the computer device 1000 described in the embodiments of this application can execute the data processing method based on the blockchain network described in the various embodiments of this application, and can also execute the data processing device based on the blockchain network described in the embodiment corresponding to Figure 4 above, which will not be repeated here. In addition, the beneficial effects of using the same method will not be repeated here either.
[0218] Furthermore, it should be noted that this application also provides a computer-readable storage medium storing a computer program. When a processor executes this computer program, it can perform the data processing methods based on blockchain networks described in the various embodiments of this application; therefore, these methods will not be repeated here. Additionally, the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the embodiments of the computer storage medium involved in this application, please refer to the description of the method embodiments of this application.
[0219] As an example, the aforementioned computer program can be deployed and executed on a single computer device, or deployed and executed on multiple computer devices located in one location, or executed on multiple computer devices distributed across multiple locations and interconnected via a communication network. These multiple computer devices distributed across multiple locations and interconnected via a communication network can form a blockchain network.
[0220] The aforementioned computer-readable storage medium can be an internal storage unit of the computer device, such as a hard drive or memory. It can also be an external storage device, such as a plug-in hard drive, smart media card (SMC), secure digital card (SD) card, or flash card. Furthermore, the computer-readable storage medium can include both internal and external storage units of the computer device. This computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. It can also be used to temporarily store data that has been output or will be output.
[0221] This application provides a computer program product comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the data processing method based on a blockchain network described in the various embodiments of this application; therefore, it will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the embodiments of the computer-readable storage medium involved in this application, please refer to the description of the method embodiments of this application.
[0222] The terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the term "comprising," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, product, or device that includes a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules not listed, or may optionally include other step units inherent to these processes, methods, apparatuses, products, or devices.
[0223] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.
[0224] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.
Claims
1. A data processing method based on a blockchain network, characterized in that, The blockchain network includes packaging nodes and a set of proposal nodes. The set of proposal nodes contains at least one proposal node. The data processing method is executed by a target proposal node, which is any one of the proposal nodes in the set of proposal nodes. The method includes: acquiring target transaction data to be uploaded to the blockchain and encoding the target transaction data to obtain encoded data of the target transaction data; wherein the encoded data contains at least one encoded segment; based on the node identifier of the target proposal node, determining a target encoded segment that successfully matches the node identifier from the at least one encoded segment, and signing the target encoded segment to obtain broadcast information of the target transaction data; sending the broadcast information to the blockchain network so that the packaging node can obtain broadcast information sent by different proposal nodes from the blockchain network, and recover the target transaction data according to the broadcast information of different proposal nodes, so as to package the recovered transaction data.
2. The method as described in claim 1, characterized in that, The process of acquiring target transaction data to be uploaded to the blockchain includes: acquiring at least one transaction data to be uploaded to the blockchain from a transaction memory pool, and storage information of each transaction data in the transaction memory pool; the storage information includes at least one of the following: the storage duration in the transaction memory pool, and the amount of electronic resources transferred after being stored in the blockchain network; determining the priority of each transaction data according to the storage information, and determining the target transaction data from the transaction memory pool according to the priority.
3. The method as described in claim 1, characterized in that, The step of encoding the target transaction data to obtain the encoded data of the target transaction data includes: obtaining the data length of the target transaction data and the number of proposal nodes contained in the blockchain network; determining the encoding length of the target transaction data according to the data length and the number of proposal nodes, and encoding the target transaction data according to the encoding length to obtain the encoded data of the target transaction data.
4. The method as described in claim 3, characterized in that, The target transaction data consists of multiple byte segments; the step of encoding the target transaction data according to the encoding length to obtain the encoded data of the target transaction data includes: determining an encoding matrix according to the encoding length; wherein the number of rows of the encoding matrix is equal to the encoding length; multiplying the encoding matrix with each byte segment of the target transaction data to obtain multiple encoding segments, and using the obtained multiple encoding segments as the encoded data of the target transaction data.
5. The method as described in claim 1, characterized in that, The encoded data contains at least one encoded segment arranged sequentially and each corresponding to a different segment identifier. The step of determining the target encoded segment that successfully matches the node identifier from the at least one encoded segment based on the node identifier of the target proposal node includes: obtaining the node identifier corresponding to the target proposal node in the proposal node set of the blockchain network, and performing an identifier mapping on the node identifier of the target proposal node to obtain a target mapping identifier; obtaining the segment identifier of each encoded segment of the encoded data, and performing a matching process between the target mapping identifier and the segment identifier corresponding to each encoded segment; and taking the encoded segment corresponding to the segment identifier that successfully matches the target mapping identifier as the target encoded segment.
6. The method as described in claim 1, characterized in that, The blockchain network also includes consensus nodes; the method further includes: obtaining one or more target blocks from the blockchain network and determining the block hash of the target blocks; performing i repeated hash operations on the block hash and obtaining the result of each repeated hash operation, where i is a positive integer greater than or equal to 1; performing a modulo operation on the result of each repeated hash operation and the total number of consensus nodes included in the blockchain network; mapping the result of the modulo operation to the node identifier of the consensus node, and using the consensus node corresponding to the mapped node identifier as the selected proposal node.
7. The method as described in claim 6, characterized in that, The step of obtaining one or more target blocks from the blockchain network includes: obtaining the block with the highest height from the blocks included in the blockchain network, and using the obtained block with the highest height as the target block obtained from the blockchain network; or, obtaining each block included in the blockchain network, and using each obtained block as the target block.
8. The method as described in claim 1, characterized in that, The method by which the packaging node restores the target transaction data includes: the packaging node obtaining broadcast information sent by different proposing nodes from the blockchain network, and verifying the encoded fragments in each broadcast information based on the signature information in each broadcast information; after determining that the corresponding encoded fragments have passed the verification based on the signature information, the packaging node obtaining the number of encoded fragments that have passed the verification; when the number of fragments is a target number, the packaging node restoring the target transaction data according to the target number of encoded fragments to obtain the restored target transaction data; wherein, the target number is greater than or equal to the number of byte fragments contained in the target transaction data.
9. The method as described in claim 8, characterized in that, After obtaining the recovered target transaction data, the packaging node packages the recovered target transaction data in the following ways: the packaging node generates a reference block based on the recovered target transaction data and sends the reference block to the consensus node; after determining that the reference block has passed the consensus processing of the consensus node, the packaging node sends the reference block to the blockchain network for storage.
10. The method as described in claim 9, characterized in that, The consensus processing method of the consensus node for the reference block includes: the consensus node obtains broadcast information sent by different proposal nodes from the blockchain network, and performs recovery processing on the target transaction data based on the broadcast information to obtain the recovered reference transaction data; the consensus node matches the recovered reference transaction data with the target transaction data contained in the reference block, and determines that the reference block has passed the consensus processing when the matching is successful.
11. A data processing device based on a blockchain network, characterized in that, The blockchain network includes packaging nodes and a set of proposal nodes. The set of proposal nodes includes at least one proposal node. The data processing device is a device for a target proposal node, which is any one of the proposal nodes in the set of proposal nodes. The device includes: an acquisition unit, used to acquire target transaction data to be uploaded to the blockchain and encode the target transaction data to obtain encoded data of the target transaction data; wherein the encoded data includes at least one encoded segment; a processing unit, used to determine, based on the node identifier of the target proposal node, a target encoded segment that successfully matches the node identifier from the at least one encoded segment, and perform signature processing on the target encoded segment to obtain broadcast information of the target transaction data; the processing unit is further used to send the broadcast information to the blockchain network so that the packaging node can obtain broadcast information sent by different proposal nodes from the blockchain network and recover the target transaction data according to the broadcast information of different proposal nodes, so as to package the recovered transaction data.
12. A computer device, characterized in that, The system includes a processor, an input device, an output device, and a memory, which are interconnected. The memory is used to store a computer program, which includes program instructions. The processor is configured to invoke the program instructions to execute the method as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the method as described in any one of claims 1 to 10.
14. A computer program product, characterized in that, The computer program product includes a computer program, which includes program instructions that, when invoked by a processor, cause the processor to perform the method as described in any one of claims 1 to 10.