Data processing methods, devices and equipment, media, and products based on blockchain.
By introducing privacy transaction queues and independent transaction pools and data pools into the blockchain, combined with randomized transaction packaging order, the problem of transaction manipulation attacks is solved, thereby improving the credibility and transaction security of the blockchain.
Patent Information
- Application Number
- CN202510630798.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-15
- Publication Date
- 2026-11-17
AI Technical Summary
Transaction manipulation attacks (such as pre-transaction, post-transaction, MEV, etc.) exist in existing blockchain systems, leading to transaction failures and increased transaction costs, seriously jeopardizing the credibility of the blockchain, but there is a lack of effective countermeasures.
By introducing privacy transaction queues and independent transaction pools and data pools into the blockchain, transactions are first processed to generate transaction identifiers and then submitted to the blockchain in stages. Combined with a randomized transaction packaging order, transaction data is prevented from being directly exposed in the transaction pool, increasing the difficulty of cracking and preventing manipulation attacks.
It effectively resists transaction manipulation attacks, enhances the credibility of the blockchain, reduces the risk of data exposure, and improves the speed of transaction on-chaining and data privacy.
Smart Images

Figure CN123122834A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more particularly to the field of blockchain technology, specifically to a blockchain-based data processing method, a blockchain-based data processing device, a computer device, a computer-readable storage medium, and a computer program product. Background Technology
[0002] Transaction manipulation attacks (such as pre-transaction manipulation, post-transaction manipulation, and MEV (Maximum Extractable Value)) typically refer to attacks that exploit vulnerabilities in the blockchain's transaction sorting and processing mechanisms to profit from or cause harm by manipulating the order or content of transactions. Currently, blockchain transactions are temporarily stored in a transaction pool before being recorded on the chain. Transaction data is publicly visible, and the order of transactions is uncertain, which may lead to transaction manipulation attacks and cause damage, such as transaction failures or increased transaction costs. Transaction manipulation attacks seriously jeopardize the trustworthiness of blockchains, but currently, there are no effective solutions to resist such attacks. Summary of the Invention
[0003] This application provides a data processing method, apparatus, device, medium, and product based on blockchain, which can effectively resist transaction manipulation attacks and improve the credibility of blockchain.
[0004] On one hand, embodiments of this application provide a blockchain-based data processing method, which includes:
[0005] Receive transaction data for N transactions to be processed on the blockchain, where N is a positive integer;
[0006] The transaction data of N transactions are processed to preserve privacy, generating transaction identifiers for N transactions. The transaction identifiers and transaction data of the N transactions are then stored in a privacy transaction queue, which is located under the blockchain.
[0007] When the transaction submission conditions are met, the transaction identifiers of M transactions are obtained from the privacy transaction queue, the transaction identifiers of the M transactions are aggregated to form an aggregated transaction, and the aggregated transaction is submitted to the transaction pool of the blockchain. M is a positive integer and M is less than or equal to N.
[0008] When the data submission conditions are met, the transaction data of M transactions are retrieved from the privacy transaction queue and submitted to the blockchain's data pool. The transaction pool and the data pool are independent of each other. Aggregated transactions are processed on the blockchain based on the transaction identifiers of the M transactions stored in the transaction pool and the transaction data of the M transactions stored in the data pool.
[0009] On one hand, embodiments of this application provide a blockchain-based data processing method. The blockchain includes a transaction pool and a data pool. The transaction pool stores transaction identifiers of transactions to be processed on the blockchain, and the data pool stores transaction data of transactions to be processed on the blockchain. The transaction pool and the data pool are independent of each other. The method includes:
[0010] The aggregated transactions to be processed on the blockchain are obtained from the transaction pool. The aggregated transactions are processed by the privacy processing device when the transaction submission conditions are met. The aggregated transactions are processed by the privacy processing device, which aggregates the transaction identifiers of M transactions in the privacy transaction queue and submits them to the transaction pool. M is a positive integer.
[0011] Based on the transaction identifiers of M transactions in the aggregated transaction, the transaction data of M transactions are obtained from the data pool; the transaction data of M transactions are submitted to the data pool by the privacy processing device when the data submission conditions are met.
[0012] Based on the transaction identifiers and transaction data of M transactions, the aggregated transactions are processed on the blockchain.
[0013] On one hand, embodiments of this application provide a blockchain-based data processing apparatus, which includes:
[0014] The acquisition unit is used to receive transaction data for N transactions to be processed on the blockchain, where N is a positive integer;
[0015] The processing unit is used to perform privacy processing on the transaction data of N transactions, generate transaction identifiers for N transactions, and store the transaction identifiers and transaction data of N transactions in a privacy transaction queue, which is located under the blockchain.
[0016] The processing unit is also used to obtain the transaction identifiers of M transactions from the privacy transaction queue when the transaction submission conditions are met, aggregate the transaction identifiers of the M transactions to form an aggregate transaction, and submit the aggregate transaction to the transaction pool of the blockchain, where M is a positive integer and M is less than or equal to N;
[0017] The processing unit is also used to retrieve transaction data of M transactions from the privacy transaction queue and submit them to the blockchain's data pool when the data submission conditions are met. The transaction pool and the data pool are independent of each other, and the aggregated transaction is processed on the blockchain based on the transaction identifiers of the M transactions stored in the transaction pool and the transaction data of the M transactions stored in the data pool.
[0018] In one embodiment, any one of the N transactions is represented as transaction i, where i is a positive integer less than or equal to N;
[0019] The processing unit performs privacy processing on the transaction data of transaction i and generates a transaction identifier for transaction i, including:
[0020] Perform a legality check on the transaction data of transaction i;
[0021] If the transaction data of transaction i passes the validity check, then the transaction data of transaction i is hashed to obtain the hash value of transaction i.
[0022] Obtain the transaction signature of transaction i from the transaction data of transaction i;
[0023] The hash value of transaction i and the transaction signature of transaction i are combined to form the transaction identifier of transaction i.
[0024] In one embodiment, satisfying the transaction submission conditions includes at least one of the following:
[0025] The number of transaction identifiers stored in the privacy transaction queue exceeds the preset threshold for the number of identifiers defined by the transaction submission conditions;
[0026] The amount of transaction data stored in the privacy transaction queue exceeds the preset data volume threshold defined by the transaction submission conditions;
[0027] The preset period interval defined by the transaction submission conditions has been reached.
[0028] In one embodiment, satisfying the data submission conditions includes at least one of the following:
[0029] Based on the submission time of the aggregated transaction, the preset delay time defined by the data submission conditions is reached;
[0030] When aggregated transactions submitted to the transaction pool are triggered to perform on-chain processing.
[0031] On one hand, embodiments of this application provide a blockchain-based data processing device. The blockchain includes a transaction pool and a data pool. The transaction pool stores transaction identifiers of transactions to be processed on the blockchain, and the data pool stores transaction data of transactions to be processed on the blockchain. The transaction pool and the data pool are independent of each other. The device includes:
[0032] The acquisition unit is used to acquire aggregated transactions to be processed on the blockchain from the transaction pool. The aggregated transaction is generated by the privacy processing device when the transaction submission conditions are met, by aggregating the transaction identifiers of M transactions in the privacy transaction queue and submitting them to the transaction pool, where M is a positive integer.
[0033] The acquisition unit is also used to acquire transaction data of M transactions from the data pool based on the transaction identifiers of M transactions in the aggregated transaction; the transaction data of the M transactions is submitted to the data pool by the privacy processing device when the data submission conditions are met;
[0034] The processing unit is used to perform on-chain processing of aggregated transactions based on the transaction identifiers and transaction data of M transactions.
[0035] In one embodiment, any one of the M transactions is represented as transaction j, and the transaction identifier of transaction j includes the hash value and transaction signature of transaction j; j is a positive integer less than or equal to M;
[0036] The acquisition unit retrieves the transaction data of transaction j from the data pool based on the transaction identifier of transaction j in the aggregated transaction, including:
[0037] Iterate through and calculate the hash value of each transaction in the data pool;
[0038] Identify target transaction data from the data pool whose hash value matches the hash value in the transaction identifier of transaction j;
[0039] Compare the transaction signature in the target transaction data with the transaction signature in the transaction identifier of transaction j;
[0040] If the transaction signature in the target transaction data is the same as the transaction signature in the transaction identifier of transaction j, then the target transaction data is retrieved from the data pool as the transaction data of transaction j.
[0041] In one embodiment, the on-chain processing of the aggregated transaction includes packaging the transaction data of the M transactions into a proposal block, wherein the proposal block contains the transaction data of P transactions, and the P transactions contain the M transactions, where P is a positive integer greater than or equal to M.
[0042] The process of uploading the aggregated transaction to the blockchain based on the transaction identifiers and transaction data of the M transactions includes:
[0043] Obtain the hash values of the P transactions, wherein the hash values of the M transactions are contained in the transaction identifiers of the M transactions;
[0044] Based on the hash values of the P transactions and the preset transaction order randomization rules, the packaging order of the P transactions is determined;
[0045] The transaction data of the P transactions are packaged according to the packaging order to form a proposal block;
[0046] The proposed block is then processed for consensus and uploaded to the blockchain.
[0047] In one embodiment, the preset transaction order random rule includes a random value generation function;
[0048] The process of determining the packaging order of the P transactions based on their hash values and a preset transaction order randomization rule includes:
[0049] Obtain the first aggregate signature contained in the first block on the blockchain, where the first block refers to the block with the highest block height on the blockchain;
[0050] The first aggregated signature is passed to the random value generation function to obtain a random value;
[0051] The packaging order of the P transactions is obtained by performing a modulo operation based on the random value and the hash values of the P transactions.
[0052] In one embodiment, the processing unit performs consensus on-chain processing on the proposal block, including:
[0053] The proposal block undergoes consensus voting to obtain the consensus voting result, which includes voting information and the signature of the voting information. The voting information is used to indicate whether the proposal block passes consensus.
[0054] If the number of first voting messages in the consensus voting results exceeds a preset node number threshold, then the signatures of the voting messages in the consensus voting results are used to generate a second aggregate signature for the proposal block; the first voting messages are used to indicate that the proposal block passes consensus.
[0055] Add the second aggregate signature to the proposal block to obtain the second block, and verify the second aggregate signature in the second block.
[0056] When the second aggregate signature in the second block passes signature verification, the second block is stored on the blockchain.
[0057] In one embodiment, the processing unit performs consensus voting on the proposal block to obtain the consensus voting result, including:
[0058] The proposal block is sent to the consensus node devices in the blockchain so that the consensus node devices in the blockchain can vote on the proposal block;
[0059] Receive voting information and the signature of the voting information returned by the consensus node device in the blockchain for the proposal block; the signature of the voting information is obtained by encrypting the voting information using the private key of the consensus node device in the blockchain;
[0060] The signature of the voting information is verified using the public key of the consensus node device in the blockchain.
[0061] When the signature of the voting information passes signature verification, the voting information and its signature are identified as the consensus voting result.
[0062] In one embodiment, when the order of P transactions in the proposal block matches the order in which the P transactions are packaged, the consensus node device in the blockchain returns the first vote information for the proposal block.
[0063] When the order of P transactions in the proposal block does not match the order in which they are packaged, the consensus node in the blockchain returns a second vote for the proposal block; the second vote indicates that the proposal block has not passed consensus.
[0064] In one embodiment, any one of the M transactions is represented as transaction j, where j is a positive integer less than or equal to M; the acquisition unit is also used for:
[0065] If transaction data for transaction j is not retrieved from the data pool, then the transaction identifier of transaction j is returned to the transaction pool.
[0066] If the storage time of the transaction identifier of transaction j in the transaction pool exceeds the preset time threshold, the transaction identifier of transaction j in the transaction pool will be discarded.
[0067] On one hand, embodiments of this application provide a computer device, the computer device comprising:
[0068] A processor is used to load and execute computer programs;
[0069] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned blockchain-based data processing method.
[0070] On the one hand, embodiments of this application provide a computer-readable storage medium storing a computer program adapted to be loaded by a processor and executed by the aforementioned blockchain-based data processing method.
[0071] On the one hand, embodiments of this application provide a computer program product, which includes a computer program that, when executed by a processor, implements the aforementioned blockchain-based data processing method.
[0072] This application proposes a blockchain-based data processing scheme that can be collaboratively executed by a privacy processing device and a block-producing node device in the blockchain.
[0073] On the privacy processing device side: It receives transaction data for N (N is a positive integer) transactions to be processed on the blockchain, performs privacy processing on the transaction data of the N transactions, generates transaction identifiers for the N transactions, and stores the transaction identifiers and transaction data of the N transactions in a privacy transaction queue, which is located off-chain. This allows transactions to be submitted to the privacy transaction queue before being directly published to the blockchain's transaction pool. When the transaction submission conditions are met, the privacy processing device can obtain the transaction identifiers of M transactions from the privacy transaction queue, aggregate the transaction identifiers of the M transactions (a positive integer less than or equal to N) to form an aggregate transaction, and submit the aggregate transaction to the blockchain's transaction pool. This prevents the specific transaction data from being deciphered through the aggregate transaction in the transaction pool, thus preventing transaction manipulation attacks. When the data submission conditions are met, the transaction data of M transactions are retrieved from the privacy transaction queue and submitted to the blockchain's data pool. The transaction pool and the data pool are independent of each other. On the one hand, this separates the transaction identifier and the transaction data, avoiding excessive exposure of sensitive transaction data during transaction processing and improving data privacy. On the other hand, this phased data submission method can further increase the difficulty of cracking specific transaction data from aggregated transactions and effectively resist transaction manipulation attacks.
[0074] On the block-producing node device side of the blockchain: it obtains aggregated transactions to be processed on the chain from the transaction pool, and retrieves the transaction data of M transactions from the data pool based on the transaction identifiers of the M transactions in the aggregated transaction. Based on the transaction identifiers and transaction data of the M transactions, it processes the aggregated transaction on the chain. In this way, the aggregated transactions in the transaction pool can be associated with the transaction data in the data pool through the transaction identifiers, ensuring that the transaction data on the chain is accurate. Moreover, it can avoid the frequent transmission of a large amount of raw transaction data during the transaction processing, which helps to improve the transaction on-chain speed, reduce the risk of data exposure, and improve the credibility of the blockchain. Attached Figure Description
[0075] Figure 1 This is a schematic diagram of the structure of a P2P network provided in an embodiment of this application;
[0076] Figure 2 This is a schematic diagram of the architecture of a data processing system provided in an embodiment of this application;
[0077] Figure 3 This is a flowchart illustrating a blockchain-based data processing scheme provided in an embodiment of this application;
[0078] Figure 4 This is a flowchart illustrating a blockchain-based data processing method provided in an embodiment of this application. Figure 1 ;
[0079] Figure 5 This is a flowchart illustrating a transaction privacy processing method provided in an embodiment of this application;
[0080] Figure 6 This is a flowchart illustrating a blockchain-based data processing method provided in an embodiment of this application. Figure 2 ;
[0081] Figure 7 This is a flowchart illustrating a transaction packaging randomization method provided in an embodiment of this application;
[0082] Figure 8 This is a schematic diagram of the structure of a blockchain-based data processing device provided in an embodiment of this application;
[0083] Figure 9 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0084] To better understand the technical solutions provided in the embodiments of this application, the key terms involved in this solution will be introduced first:
[0085] I. Blockchain Technology:
[0086] In a narrow sense, a blockchain is a chain-like data structure with blocks as the basic unit, composed of interconnected blocks. Each block contains a hash value, which is a unique identifier obtained by hashing all the data in that block. Subsequent blocks can record the hash values of previous blocks. The validity of each block (and the data within it) can be quickly verified by calculating the hash value. For example, if the data in a block is tampered with, its hash value will change, and the hash value recorded by subsequent blocks will not match the actually calculated hash value, making it easy to detect data tampering.
[0087] In the chain structure of a blockchain, for any given block, the block that existed before it and is connected to it is its predecessor block, and the next block generated and connected to the chain after it is its successor block. For example, if the blockchain is generated in the order of block A and block B, then with block B as a reference, block A is the predecessor block of block B, and with block A as a reference, block B is the successor block of block A. Block height is a core concept in blockchain, reflecting the block's position within the blockchain. For example, the genesis block is the first block on a blockchain, and its block height is generally considered to be 0. The block height of the successor block to the genesis block is 1.
[0088] In a broader sense, blockchain also refers to the distributed ledger technology implemented using a blockchain structure, including peer-to-peer communication technology, distributed consensus, privacy and security protection, network protocols, smart contracts, etc.
[0089] (1) Point-to-point communication technology:
[0090] A blockchain is essentially a decentralized distributed ledger (called a blockchain ledger). For example, a blockchain ledger can include a blockchain chain structure and a world state. The blockchain chain structure consists of blocks, each including a block header and a block body. The block header records metadata about the current block, such as the hash value of the previous block, timestamp, random number, difficulty target, and its own hash value. The block body records all transaction information uploaded to the chain within a certain period, such as transaction data and execution results (e.g., successful or failed). The world state refers to the global state of the blockchain at a specific moment, updated in real time with the execution of each valid transaction. It records information about all accounts in the blockchain, such as account balances and the number of transactions initiated.
[0091] The core objective of blockchain is to achieve secure data storage, reliable transmission, and the immutability of the blockchain ledger without the intervention of a centralized institution. This requires a network environment that enables direct communication and data sharing between node devices, and point-to-point (P2P) networks perfectly meet this requirement. Please see [link / reference]. Figure 1 This is a schematic diagram of a P2P network structure provided in an embodiment of this application. The P2P network may include multiple node devices, such as node device 10a, node device 10b, node device 10c, ..., node device 10n. These node devices are the basic units constituting the P2P network, and each of them undertakes the tasks of data storage, processing, and transmission.
[0092] Node devices can refer to computer equipment, such as terminal devices and servers. Terminal devices can include, but are not limited to, mobile phones, tablets, desktop computers, laptops, PDAs, in-vehicle devices, smart TVs, wearable devices, and other mobile internet devices (MIDs) with network access capabilities. Servers can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers that provide 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, vehicle-to-everything (V2X) communication, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0093] Information connections can exist between node devices. For example, there is an information connection between node devices 10a and 10b, between node devices 10a and 10c, and between node devices 10b and 10c. For instance, a P2P network can establish information connections between node devices based on node identifiers. Each node device in the P2P network has a corresponding node identifier, and each node device can store the node identifiers of other connected node devices. This allows for the subsequent broadcasting of acquired data or generated blocks to other node devices based on their node identifiers. For example, node device 10a can maintain a node identifier list as shown in Table 1, which stores the node names and identifiers of other nodes.
[0094] Table 1
[0095] Node Name Node identifier Node 10a AAA.AAA.AAA.AAA Node 10b BBB.BBB.BBB.BBB Node 10c CCC.CCC.CCC.CCC … … Node 10n EEE.EEE.EEE.EEE
[0096] The node identifier can be an Internet Protocol (IP) address or any other information that can be used to identify node devices in a P2P network. Table 1 only uses IP addresses as an example. For instance, node device 10a can send information (e.g., a block) to node device 10b using the node identifier BBB.BBB.BBB.BBB, and node device 10b can determine that the information was sent by node device 10a using the node identifier AAA.AAA.AAA.AAA.
[0097] Node devices can communicate with each other through the aforementioned information connections to maintain the same blockchain ledger. For example, each node device can receive input information (such as transaction data of transactions awaiting on-chain processing) during normal operation. When a node device receives input information, it can process and verify it, and then broadcast the input information to the P2P network according to the consensus mechanism. Other node devices in the P2P network, after receiving the broadcast input information, verify and confirm it, and store the input information as data in their own maintained blockchain ledger. In this way, the data stored on all node devices in the P2P network is consistent, ensuring the consistency and accuracy of the blockchain ledger.
[0098] In actual P2P network operation, the information connections between node devices may change dynamically. That is, new node devices may join the P2P network, while existing node devices may leave the network for various reasons (such as device failure, network interruption, etc.). When a new node device joins, it needs to broadcast its presence and node identifier to other node devices in the P2P network. Other node devices will add the new node device's information to their own node identifier lists, thus establishing an information connection with the new node device. When a node device leaves the P2P network, other node devices will detect the node device's loss of connection after a certain period of time and remove it from their node identifier lists to ensure the normal operation of the P2P network and data consistency.
[0099] (2) Distributed consensus:
[0100] Consensus mechanisms are algorithms used in distributed ledger technology to resolve conflicts between different nodes in computer networks (such as P2P networks). Common consensus mechanisms in blockchain include Byzantine Fault Tolerance, Proof-of-Work, Proof-of-Stake, and Delegated Proof-of-Stake. The following uses Byzantine Fault Tolerance as an example to illustrate the process of a consensus mechanism:
[0101] ① When any node device receives a transaction to be processed on the blockchain, it can verify the legality of the transaction data. When the transaction data passes the legality verification, it broadcasts the transaction data to the P2P network so that other node devices in the P2P network can store the transaction data in their own transaction pools.
[0102] A transaction refers to an operation that causes a change in the state of the blockchain ledger, such as a resource transfer transaction or a smart contract deployment transaction. Transaction data (i.e., the original content information of the transaction) may include, but is not limited to: the identifiers of the transacting parties (such as the addresses of the transacting initiator and transacting recipient, which are usually referred to as accounts), the amount of transaction resources, the transaction timestamp, the transaction type (such as resource transfer type, smart contract deployment type, etc.), the amount of resources consumed by the transaction execution (such as gas, which is usually the reward obtained by the block-producing node device for its labor), and the transaction signature (generated by the transacting initiator using its private key to encrypt the transaction data).
[0103] The verification methods for legitimacy verification may include at least one of the following: checking whether the transaction signature in the transaction data is valid, for example, decrypting the transaction signature in the transaction data using the public key of the transaction initiator, comparing the decrypted data with the transaction data; if they are the same, the legitimacy verification passes; if they are different, the legitimacy verification fails; checking whether the account balance of the transaction initiator is sufficient to pay for the transaction; if it is insufficient, the legitimacy verification fails; if it is sufficient, the legitimacy verification passes; checking whether the format of the transaction data conforms to the prescribed format, for example, checking whether the fields in the transaction data are complete and whether the data type is correct; if the fields in the transaction data are complete and the data type is correct, the legitimacy verification passes; if the fields in the transaction data are incomplete or the data type is incorrect, the legitimacy verification fails; if a smart contract is involved, checking whether the execution of the smart contract conforms to the preset conditions and logic; if it does, the legitimacy verification passes; if it does not, the legitimacy verification fails.
[0104] Transactions awaiting on-chain processing refer to those that have been submitted but not yet packaged into a block. In a P2P network, each node device can maintain a transaction pool to cache and manage these transactions awaiting on-chain processing. A transaction pool is a type of mempool (a temporary storage space in memory), a dynamic data structure whose content is constantly updated as new transactions are added and packaged transactions are removed. If the transaction pool stores transaction data, because there is a time lag between a transaction's submission to the pool and its packaging into a block, attackers can observe the original content of the transaction during this time lag and then construct corresponding transactions to launch transaction manipulation attacks (such as MEV), compromising the blockchain's credibility. Therefore, the transaction pool in this application only caches and manages transaction identifiers, and the transaction data and identifiers employ a phased, storage-isolated batch on-chain caching mechanism to increase the difficulty for attackers to crack the original content of the transaction, thereby effectively resisting transaction manipulation attacks.
[0105] ② In each block production cycle of the blockchain, a block-producing node device needs to be selected from the P2P network. The block-producing node device refers to the node device that obtains the block production permission in the current block production cycle. The block-producing node device can obtain a number of transaction data from its own transaction pool, package them into a proposal block, and broadcast the proposal block to other node devices.
[0106] The block generation cycle refers to the time interval for generating a new block (e.g., every 10 minutes). The block generation cycle is set to balance blockchain security, transaction processing speed, and network stability. In one implementation, node devices can compete for block-generating rights by calculating complex hash functions, or they can be selected based on the amount of cryptographic resources they hold and the duration of that holding. Alternatively, a voting process can be used to determine the block-generating node.
[0107] When block-producing nodes package proposal blocks, they typically select transactions according to certain rules, such as prioritizing transactions requiring high resource consumption to maximize profits. This mechanism, which selects transactions based on resource consumption, provides opportunities for attackers to manipulate transactions. For instance, by monitoring the transaction pool, attackers can identify large resource transactions about to be packaged and insert their own transaction before these large transactions, thus increasing resource prices and reducing the amount of resources available for exchange during the large transaction's execution. This loss is significant for ordinary investors and undermines the blockchain's credibility. Therefore, this application addresses this issue by not arranging transactions based on resource consumption but by using a persistent random source on the blockchain to randomize the packaging order. This random source is determined by the signatures of each node in the P2P network (e.g., signatures generated by encrypting voting information with their private keys), ensuring the randomness of the transaction packaging order and preventing attackers from using deterministic strategies to manipulate transactions.
[0108] ③ After receiving the proposal block, other node devices can verify the transaction data within the proposal block (such as verifying the integrity and consistency of the transaction data within the proposal block, verifying the transaction signature in the transaction data, etc.), and broadcast the voting information for the proposal block. For example, when the transaction data within the proposal block passes verification, the voting information for the proposal block is "the proposal block has passed consensus"; when the transaction data within the proposal block fails verification, the voting information for the proposal block is "the proposal block has not passed consensus".
[0109] ④ During the process of broadcasting and receiving voting information, each node device will continuously count the number of first voting information (i.e., the voting information of "the proposed block has passed consensus"). When the number of first voting information is greater than the preset node number threshold (such as two-thirds of the voting nodes), it means that the proposed block has been recognized by most node devices. The proposed block can be stored in the blockchain chain structure it maintains and the world state it maintains can be updated. If it is less than or equal to the preset node number threshold, the proposed block can be discarded.
[0110] (3) Privacy and security protection:
[0111] A public key and a private key are a key pair obtained through an algorithm (such as elliptic curve cryptography). The public key is the publicly disclosed part of the key pair, while the private key is the private part. This algorithm ensures that the resulting key pair is unique. When using this key pair, if data is encrypted with one key, it must be decrypted with the other key. For example, if data is encrypted with the public key, it must be decrypted with the private key, and vice versa; otherwise, decryption will fail.
[0112] In blockchain, a public key serves as a public identifier for an account, while a private key proves ownership of that identity. For example, during a transaction or data transfer, the transaction initiator uses their private key to sign the data, and the transaction recipient uses the initiator's public key to verify the signature. If the signature verification passes, it means that the data was indeed sent by the sender with the corresponding private key and has not been tampered with during transmission, ensuring the authenticity and integrity of the data's origin.
[0113] (4) Network protocols:
[0114] Blockchain network protocols are used to enable communication and data synchronization between node devices in a P2P network. They ensure that different node devices can reach consensus without centralized control, guaranteeing data consistency and integrity. For example, types of blockchain network protocols can include: public blockchain protocols, private blockchain protocols, and consortium blockchain protocols. Public blockchain protocols are open, permissionless blockchain protocols that anyone can participate in; consortium blockchain protocols are blockchain protocols composed of multiple pre-approved node devices, typically used for cooperation and alliances between enterprises; private blockchain protocols are blockchain protocols controlled by a single organization or institution, open only to specific participants.
[0115] (5) Smart Contracts:
[0116] Smart contracts operate based on the distributed ledger and consensus mechanism of blockchain. They are written into code and deployed on the blockchain. When the triggering conditions are met, node devices can verify the execution of the smart contract according to the consensus mechanism. After verification, the operations specified in the smart contract are automatically executed, such as resource transfer and data update. These operations are recorded on the blockchain ledger and are immutable and traceable.
[0117] II. Transaction Manipulation Attacks:
[0118] Transaction manipulation attacks typically refer to attacks that exploit vulnerabilities in the blockchain's transaction ordering and processing mechanisms to profit or cause harm by manipulating the order or content of transactions. Transaction manipulation attacks can include, but are not limited to: front-running, back-running, and MEV (Maximal Extractable Value, initially called Miner Extractable Value, validator extractable value), etc. Front-running refers to an attacker inserting their own transaction before a transaction is broadcast, profiting or causing harm by exploiting market fluctuations. Back-running refers to an attacker executing their own transaction immediately after a transaction is executed, profiting or causing harm by exploiting resource fluctuations. MEV refers to an attacker exploiting the manipulability of blockchain transaction ordering, information asymmetry, and transaction privileges to extract additional value beyond the resources required for normal transaction execution.
[0119] MEV attacks include, but are not limited to: front-running, where attackers monitor the transaction pool, discover profitable transactions, and immediately insert their own transactions to execute before the original transactions, profiting from the information advantage; sandwich attacks, where attackers, after discovering a large amount of resources, quickly insert buy and sell orders before and after the transaction, forming a pincer attack, profiting from price fluctuations; and validator self-interest, where validators (node devices with specific permissions (such as block production permissions, consensus permissions)) use their control over transaction packaging to prioritize packaging transactions that are beneficial to themselves.
[0120] Transaction manipulation attacks that cause transaction reordering can severely impact the user experience, even leading to economic losses. They undermine market fairness, put ordinary traders at a disadvantage, and affect the stability and credibility of the entire blockchain ecosystem.
[0121] This application provides a blockchain-based data processing solution that fundamentally blocks the path to transaction manipulation attacks. Specifically, it makes transaction data invisible in the transaction pool and randomizes the packaging order through a random source when packaging transactions. As a result, attackers cannot observe the specific transaction data or manipulate the order of transactions, and are therefore completely unable to carry out corresponding transaction manipulation attacks. This effectively improves the stability and credibility of the blockchain.
[0122] The following describes the data processing system to which this data processing solution applies. Please refer to [link / reference]. Figure 2 This is a schematic diagram of the architecture of a data processing system provided in this application embodiment. The data processing system includes a client, a privacy processing device, and a P2P network. The client is an application running on a terminal device, which can be used to initiate transactions to be processed on the blockchain. There can be one or more clients. The privacy processing device can be a computer device, and there can be one or more privacy processing devices. Each privacy processing device can include one or more privacy processing queues, and each privacy processing queue can be used to cache transaction identifiers and transaction data. The P2P network contains multiple node devices. Each node device is responsible for maintaining the same blockchain ledger (including the chain structure and world state of the blockchain), and each node device has block-producing and consensus-building permissions. That is, the blockchain ledgers on each node device in the P2P network are consistent. Furthermore, within each block-producing cycle, each node device can compete to become a block-producing node device. The block-producing node device is responsible for packaging transactions and creating new blocks (called proposal blocks). At this time, other node devices can become consensus node devices, participating in the verification and consensus voting process of the proposal blocks created by the block-producing node devices to achieve network-wide consensus, store the proposal blocks on the blockchain, and complete the on-chain processing of the proposal blocks. In addition, each node device has its own transaction pool and data pool. The transaction pool is used to store the transaction identifiers of transactions to be processed on the blockchain, and the data pool is used to store the transaction data of transactions to be processed on the blockchain. Based on the data sharing mechanism of the P2P network, the transaction data cached in the data pools of each node device and the transaction identifiers cached in the transaction pools of each node device are the same.
[0123] The client can establish a communication connection with the privacy processing device, and the privacy processing device can establish a communication connection with various node devices in the P2P network. This communication connection is not limited to any particular method; it can be established directly or indirectly via wired communication, wireless communication, or other methods. This application does not impose any restrictions on this method.
[0124] This data processing system can be used to execute the blockchain-based data processing scheme provided in this application. Please refer to [link / reference]. Figure 3This is a flowchart illustrating a blockchain-based data processing scheme provided in an embodiment of this application. The blockchain-based data processing scheme includes the following steps:
[0125] S31. The client submits a transaction to the privacy processing device for on-chain processing. This application does not limit the type of transaction; for example, when resources need to be transferred, the client can initiate a resource transfer transaction, and when a smart contract needs to be deployed, the client can initiate a smart contract deployment transaction.
[0126] S32. The privacy processing device performs privacy processing on the transaction data, generates a transaction identifier, and stores the transaction identifier and transaction data in a privacy transaction queue, which is located under the blockchain. For example, this privacy transaction queue is created and contained within the privacy processing device, which is a computer device independent of the P2P network; therefore, it can be concluded that the privacy transaction queue is located under the blockchain.
[0127] S33. When the transaction submission conditions are met, the privacy processing device retrieves the transaction identifiers of M transactions from the privacy transaction queue, and aggregates the transaction identifiers of the M transactions to form an aggregated transaction. For example, the privacy transaction queue may contain transaction data of N transactions to be processed on the blockchain, where M is a positive integer and M is less than or equal to N.
[0128] S34. When the data submission conditions are met, the privacy processing device retrieves transaction data for M transactions from the privacy transaction queue and submits them to the blockchain's data pool; the transaction pool and the data pool are independent of each other. Since the transaction identifiers stored in the transaction pools of each node device are the same, it can be called the blockchain's transaction pool. Similarly, since the transaction data stored in the data pools of each node device are the same, it can be called the blockchain's data pool. For example, the data pool, like the transaction pool, can be a temporary storage space (i.e., a memory pool) located in the memory of the node device. The independence of the transaction pool and the data pool refers to their non-overlapping physical memory locations.
[0129] S35. When the current block production cycle of the blockchain is reached, the block production node device in the blockchain obtains the aggregated transactions to be processed on the chain from its own transaction pool, and obtains the transaction data of M transactions from its own data pool according to the transaction identifiers of M transactions in the aggregated transactions.
[0130] S36. The block-producing node device in the blockchain processes aggregated transactions on the blockchain based on the transaction identifiers and transaction data of M transactions. That is, the transaction information of M transactions is recorded in the blockchain ledger, for example, the transaction data of M transactions are packaged into a proposal block, the proposal block is added to the blockchain chain structure maintained by each blockchain node, and the world state maintained by each blockchain node is updated based on the execution results of the M transactions (e.g., the amount of resources remaining after transfer). Since the block-producing node device typically selects multiple transactions from the transaction pool to package into a proposal block, the proposal block can contain the transaction data of P transactions, where P is a positive integer greater than or equal to M, meaning that at least the M transactions are included among the P transactions. When packaging the transaction data of P transactions into a proposal block, this application utilizes a persistent random source on the blockchain, such as the signature of the voting information of the last block in the blockchain (i.e., the block with the highest block height), to determine the packaging order of the P transaction data, thereby achieving randomization of the transaction order.
[0131] Therefore, the data processing solution provided in this application allows clients to initiate arbitrary transactions without being subjected to transaction manipulation attacks, thereby avoiding the possibility of losses to the target due to transaction manipulation attacks and improving the stability and credibility of the blockchain.
[0132] Figure 2 The data processing system shown in the embodiments is intended to more clearly illustrate the technical solutions of the embodiments of this application, and does not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of system architecture and the emergence of new business scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0133] The data collection and processing in this application embodiment should strictly comply with the requirements of relevant laws and regulations. Obtaining personal information requires the knowledge or consent of the individual (or a legal basis for information acquisition), and subsequent data use and processing should be carried out within the scope of laws, regulations, and the authorization of the personal information subject. For example, when this application embodiment is applied to specific products or technologies, such as obtaining transaction data, permission or consent from the client is required, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant regions.
[0134] The following section provides a detailed description of the blockchain-based data processing solution provided in the embodiments of this application.
[0135] Please see Figure 4 This is a flowchart illustrating a blockchain-based data processing method provided in an embodiment of this application. Figure 1The data processing method can be executed by a privacy processing device, and the data processing method includes, but is not limited to, steps S41-S44:
[0136] S41. Receive transaction data for N transactions to be processed on the blockchain, where N is a positive integer.
[0137] For example, the client may have the function of creating transactions. The object can use the client's interface or programming interface to write transaction data according to the format and rules specified by the blockchain network protocol, and send the transaction data to the privacy processing device for processing.
[0138] The transaction data for these N transactions can be submitted to the privacy processing device by the same client or by different clients; they can be sent to the privacy processing device at the same time or at different times.
[0139] In one implementation, the transaction data carries the transaction type. When the transaction type is the first type, the privacy processing device can directly submit the transaction data to the blockchain's transaction pool for packaging and on-chain processing. When the transaction type is the second type, the privacy processing device can continue to execute S42. The first transaction type can include, but is not limited to: transactions with low privacy requirements, transactions with relatively simple data processing, and transactions that meet fast processing standards. Transactions with low privacy requirements typically do not involve sensitive information, and the identities of the transacting parties and the transaction content can be relatively public, such as transactions involving the public donation of digital collectibles (such as songs or paintings). Transactions with relatively simple data processing refer to transactions with relatively simple data structure and logic, requiring no extensive computation or complex verification, such as simple small-amount encrypted resource transfer transactions. Transactions that meet fast processing standards typically have clear rules and less uncertainty, and can be processed quickly, such as some standardized commodity transactions where transaction rules and processes are pre-defined. The second transaction type can include, but is not limited to: large-amount resource transactions, transactions involving complex business logic, and transactions involving sensitive information. Large-amount resource transactions involve the transfer of large amounts of resources or important resources; the security and accuracy of these transactions are crucial. Transactions involving complex business logic refer to transactions that involve multiple steps and conditions during execution, requiring complex calculations and judgments; for example, the execution of a smart contract may involve interactions among multiple parties, condition judgments, and data processing. Transactions involving sensitive information refer to transactions where the transaction data contains sensitive information such as personal privacy and trade secrets, requiring strict privacy protection.
[0140] In another implementation, when the transaction initiator has transaction privacy permissions, the privacy processing device can continue executing S42. When the transaction initiator does not have transaction privacy permissions, the privacy processing device can directly submit the transaction data to the blockchain's transaction pool for packaging and on-chain processing. This transaction privacy permission can be requested and granted by the transaction initiator from the privacy processing device. Thus, providing transaction privacy permissions can meet the personalized needs of those with privacy requirements, attracting more participants to blockchain transactions; for transactions that do not require privacy protection, transaction data can be directly submitted to the transaction pool.
[0141] S42. Perform privacy processing on the transaction data of N transactions, generate transaction identifiers for N transactions, and store the transaction identifiers and transaction data of N transactions in a privacy transaction queue, which is located under the blockchain.
[0142] Transaction data contains sensitive information such as the identity information of the transacting parties, the amount of transaction resources, and the transaction time. Privacy processing of transaction data refers to the use of a series of technologies and methods to process the transaction data and generate transaction identifiers to ensure that the original transaction data cannot be parsed from the transaction identifiers.
[0143] Suppose any one of N transactions is denoted as transaction i, where i is a positive integer less than or equal to N. The following uses transaction i as an example to illustrate the privacy processing process. In one implementation, the transaction data of transaction i is privacy-enhanced to generate a transaction identifier for transaction i, including:
[0144] Step 1: Verify the legality of transaction data for transaction i.
[0145] Legality verification can check the validity of transaction data of transaction i from multiple aspects. For example, the verification methods of legality verification may include at least one of the following: checking whether the transaction signature in the transaction data of transaction i is valid; checking whether the account balance of the initiator of transaction i is sufficient to pay for this transaction; checking whether the format of the transaction data of transaction i conforms to the prescribed format; and if smart contracts are involved, checking whether the execution of smart contracts conforms to the preset conditions and logic.
[0146] Step 2: If the transaction data of transaction i passes the validity check, then perform hash processing on the transaction data of transaction i to obtain the hash value of transaction i.
[0147] Hash processing is a process of converting data of arbitrary length into a fixed-length hash value. When hashing transaction data of transaction i, the transaction data of transaction i can be converted into binary data, and then a preset hash algorithm (such as SHA-256) is used to convert this binary data into a hash value for transaction i. Different transaction data will produce different hash values; even slight changes in the transaction data will result in significant differences in the hash values. This allows the hash value to serve as a unique identifier for transactions, enabling rapid location and verification. Furthermore, the original transaction data cannot be deduced from the hash value, ensuring the security of the transaction data; even if the hash value is made public, the specific content of the transaction will not be revealed. In addition, hash calculation is very fast, allowing for the processing of large amounts of transaction data in a short time.
[0148] Step 3: Obtain the transaction signature of transaction i from the transaction data of transaction i.
[0149] The transaction signature of transaction i is the key information to ensure the authenticity, legality and non-repudiation of transaction i. It is a specific string of data obtained by the initiator of transaction i after encrypting the transaction data with his / her private key. It can be used to prove that the transaction data was indeed authorized by the initiator and has not been tampered with during transmission.
[0150] For example, the transaction identifier and transaction data of a transaction in the privacy transaction queue can be stored in the following structure:
[0151]
[0152] S43. When the transaction submission conditions are met, retrieve the transaction identifiers of M transactions from the privacy transaction queue, aggregate the transaction identifiers of the M transactions to form an aggregate transaction, and submit the aggregate transaction to the transaction pool of the blockchain. M is a positive integer and M is less than or equal to N.
[0153] To improve transaction processing efficiency and reduce network load, the transaction identifiers of M transactions in the privacy transaction queue can be aggregated to form an aggregated transaction. This aggregated transaction is then submitted to the blockchain's transaction pool for packaging and on-chain processing (i.e., on-chain processing). On-chain processing refers to packaging the transaction into a proposal block and submitting the proposal block to the blockchain. Aggregating the transaction identifiers of M transactions means combining these identifiers into a data structure that conforms to the blockchain transaction format. This ensures that the aggregated transaction contains the transaction identifiers of all M transactions, reducing the number of transactions in the transaction pool, lowering network load, and improving transaction processing efficiency. Furthermore, aggregating the transaction identifiers of M transactions into a single transaction (i.e., the aggregated transaction) increases the difficulty for attackers to parse the transaction and saves the resources required for transaction execution. In other words, the cost of a single transaction (i.e., the aggregated transaction) is shared by the initiators of the M transactions.
[0154] The conditions for transaction submission include at least one of the following: ① The number of transaction identifiers stored in the privacy transaction queue exceeds a preset identifier number threshold defined by the transaction submission conditions (this threshold can be set as needed). This is a transaction quantity-based triggering mechanism. When the number of transaction identifiers stored in the privacy transaction queue exceeds this preset threshold, it indicates that enough transactions have been accumulated for aggregation and submission. For example, if the preset identifier number threshold is 100, the transaction submission condition is met when the number of transaction identifiers in the privacy transaction queue reaches 101. This mechanism ensures that transactions are processed all at once when a certain number have accumulated, improving processing efficiency. ② The amount of transaction data stored in the privacy transaction queue exceeds a preset data volume threshold defined by the transaction submission conditions (this data volume can be set as needed). This is a data volume-based triggering mechanism. When the total amount of all transaction data stored in the privacy transaction queue exceeds this preset data volume threshold, it indicates that the transaction data in the privacy transaction queue has reached a certain scale and is suitable for aggregation and submission. For example, if the preset data volume threshold is 1MB (megabytes), the transaction submission condition is met when the total amount of transaction data in the privacy transaction queue exceeds 1MB. This mechanism avoids frequent submissions due to small individual transaction data volumes, reducing network overhead. ③ Reaching a preset periodic interval defined by the transaction submission conditions (configurable as needed); this is a time-based triggering mechanism. When this preset periodic interval is reached, regardless of whether the number of transaction identifiers or the transaction data volume in the privacy transaction queue reaches the corresponding threshold, the transaction aggregation and submission operation will be triggered. For example, if the preset periodic interval is 10 minutes, then every 10 minutes, transaction identifiers will be selected from the privacy transaction queue for aggregation processing and submission. This mechanism ensures that transactions are processed within a certain time, avoiding long-term transaction backlogs.
[0155] In one implementation, M transaction identifiers can be randomly selected from the privacy transaction queue and aggregated to form an aggregated transaction. Alternatively, M transaction identifiers can be selected from the privacy transaction queue in chronological order of submission time, or M transaction identifiers can be selected from the privacy transaction queue based on the amount of resources required for transaction execution. This application does not impose any restrictions on this. Furthermore, M can be any value. For example, M can be a preset threshold for the number of identifiers, or the sum of the transaction data of several transactions can be used as the selected M transactions if it does not exceed a preset data volume threshold.
[0156] S44. When the data submission conditions are met, retrieve the transaction data of M transactions from the privacy transaction queue and submit them to the blockchain's data pool. The transaction pool and the data pool are independent of each other. Aggregated transactions are processed on the blockchain based on the transaction identifiers of the M transactions stored in the transaction pool and the transaction data of the M transactions stored in the data pool.
[0157] When specific data submission conditions are met, transaction data for M transactions can be retrieved from the privacy transaction queue and submitted to the data pool. Meeting the data submission conditions includes at least one of the following: ① Reaching a preset delay time defined by the data submission conditions, based on the submission time of the aggregated transaction; this is a time-based triggering mechanism that records the submission time when the aggregated transaction is submitted to the transaction pool. Simultaneously, a preset delay time can be predefined. Once this preset delay time has elapsed since the submission time of the aggregated transaction, the data submission conditions are met. For example, if the preset delay time is 5 minutes, and the aggregated transaction is submitted to the transaction pool at 10:00 AM, then at 10:05 AM, transaction data for M transactions can be retrieved from the privacy transaction queue and submitted to the blockchain's data pool. For instance, this preset delay time setting ensures that when the aggregated transaction is triggered for on-chain processing, the block-producing node device can obtain the original transaction data from the data pool. ② When an aggregated transaction submitted to the transaction pool is triggered for on-chain processing, this is an event-based triggering mechanism. When an aggregated transaction in the transaction pool is triggered for on-chain processing, it means that the aggregated transaction is about to be packaged into a proposal block and added to the blockchain. To ensure that the aggregated transaction can be successfully added to the blockchain, transaction data of M transactions can be obtained from the privacy transaction queue and submitted to the data pool, so that the block-producing node device can obtain the corresponding transaction data from the data pool based on the transaction identifier in the transaction pool. For example, when the block-producing node device selects an aggregated transaction from the transaction pool for packaging, it can immediately obtain the corresponding transaction data from the privacy transaction queue and submit it to the data pool when this selection action is triggered. Both of these schemes can achieve delayed publication of transaction data in the P2P network (compared to the publication of transaction identifiers), which can prevent attackers from obtaining the transaction identifier and the original transaction data at the same time; moreover, the transaction data in the data pool is isolated from the transaction identifier in the transaction pool, making it more costly and complex for attackers to obtain the specific transaction data.
[0158] In summary, please refer to Figure 5 This is a flowchart illustrating a transaction privacy processing method provided in an embodiment of this application. The transaction privacy processing method is executed by a privacy processing device and includes the following steps S51-S56:
[0159] S51, Receive transaction data for transactions to be processed on the blockchain.
[0160] S52. If the transaction data fails the validity check, the transaction data shall be discarded.
[0161] S53. If the transaction data passes the legality verification, the transaction data will be privatized to obtain a transaction identifier.
[0162] S54. Store the transaction identifier along with the transaction data in the privacy processing queue.
[0163] S55. If the transaction submission conditions are met, the transaction identifiers of the M transactions in the privacy processing queue are aggregated to form an aggregated transaction. The aggregated transaction is published to the P2P network and stored in the transaction pool of each node device in the P2P network, waiting to be packaged and processed on the blockchain (which can be simply referred to as on-chain processing).
[0164] S56. If the data submission conditions are met, the transaction data of M transactions will be published to the P2P network so that the transaction data of M transactions can be stored in the data pool of each node device in the P2P network.
[0165] Specifically, aggregated transactions are processed on-chain based on the transaction identifiers of M transactions stored in the transaction pool and the transaction data of M transactions stored in the data pool. For detailed implementation details, please refer to [link to relevant documentation]. Figure 6 The corresponding implementation examples will not be described in detail here.
[0166] Therefore, privacy processing devices can separate the submission of transactions in a P2P network from the acquisition of transaction data, increasing the difficulty for attackers to parse transactions, protecting client-submitted transactions from transaction manipulation attacks, and ensuring the reliability of the blockchain.
[0167] Please see Figure 6 This is a flowchart illustrating a blockchain-based data processing method provided in an embodiment of this application. Figure 2 This data processing method can be executed by block-producing node devices in a blockchain, which includes a transaction pool and a data pool. The transaction pool stores transaction identifiers of transactions to be processed on the blockchain, and the data pool stores transaction data of transactions to be processed on the blockchain. The transaction pool and the data pool are independent of each other. This data processing method includes, but is not limited to, steps S61-S63:
[0168] S61. Obtain aggregated transactions to be processed on the blockchain from the transaction pool. Aggregated transactions are processed by the privacy processing device when the transaction submission conditions are met. The device aggregates the transaction identifiers of M transactions in the privacy transaction queue and submits them to the transaction pool. M is a positive integer.
[0169] In one implementation, the transaction pool may contain not only aggregated transactions but also ordinary transactions described by the original transaction data. The block-producing node can package one or more transactions (which may include aggregated transactions and ordinary transactions) from the transaction pool into a proposal block. For example, the block-producing node aims to maximize its profits; therefore, during the packaging process, it can still select a series of transactions from the transaction pool based on the amount of resources required for transaction execution. However, this application randomizes the packaging order of the transactions. The packaging order of transactions refers to the sequence in which they are packaged into the proposal block. This application uses the example of packaging P transactions into a proposal block, where P transactions contain M transactions, and P is a positive integer greater than or equal to M.
[0170] S62. Based on the transaction identifiers of M transactions in the aggregated transaction, obtain the transaction data of M transactions from the data pool; the transaction data of M transactions is submitted to the data pool by the privacy processing device when the data submission conditions are met.
[0171] Assume any one of the M transactions is represented as transaction j. The transaction identifier of transaction j includes the hash value and transaction signature of transaction j; j is a positive integer less than or equal to M. The following describes the process of obtaining the transaction data of transaction j using transaction j as an example. In one embodiment, the transaction data of transaction j is obtained from the data pool based on the transaction identifier of transaction j in the aggregated transactions, including: ① Iterating through and calculating the hash value of each transaction data in the data pool. The calculation logic of this hash value is the same as the calculation logic of the privacy processing device to ensure the consistency and comparability of the calculation results. ② Determining the target transaction data from the data pool whose hash value is the same as the hash value in the transaction identifier of transaction j. This is because of the uniqueness of hash values; the same hash value means that the corresponding transaction data is likely to be the same. ③ Comparing the transaction signature in the target transaction data with the transaction signature in the transaction identifier of transaction j. This can be used to prove the authenticity and non-repudiation of transaction j. ④ If the transaction signature in the target transaction data is the same as the transaction signature in the transaction identifier of transaction j, then the target transaction data is obtained from the data pool as the transaction data of transaction j. The entire process can be verified by both hash value and transaction signature to ensure that the transaction data of transaction j is accurately obtained from the data pool, thereby improving the accuracy and security of transaction processing.
[0172] In one feasible implementation, the transaction identifier of a transaction may contain only the hash value of the transaction, or only the transaction signature of the transaction. When obtaining the transaction data of transaction j, it is possible to compare only the hash value of each transaction data in the data pool with the transaction identifier in the transaction identifier of the transaction, or to compare only the transaction signature of each transaction data in the data pool with the transaction signature in the transaction identifier of the transaction.
[0173] In one embodiment, if transaction data for transaction j is not retrieved from the data pool—for example, if the transaction signature in the transaction data of target i is different from the transaction signature in the transaction identifier of transaction j, or if there is no transaction data in the transaction pool with the same hash value as the hash value in the transaction identifier of transaction j—then the transaction identifier of transaction j is returned to the transaction pool to avoid processing the on-chain processing of transaction j in this packaging, thus preventing interference with the execution of normal transactions. If the storage time of the transaction identifier of transaction j in the transaction pool exceeds a preset time threshold (which can be set as needed), it indicates that the transaction data of transaction j has not been published or has been lost, and the transaction identifier of transaction j in the transaction pool can be discarded.
[0174] S63. Based on the transaction identifiers and transaction data of M transactions, perform on-chain processing of aggregated transactions.
[0175] The on-chain processing of aggregated transactions includes packaging the transaction data of M transactions into a proposal block. This application uses a proposal block containing P transactions (including the M transactions) as an example for illustration. After obtaining the transaction data of P transactions, the block-producing node needs to package the transaction data of P transactions into the proposal block. To prevent transaction manipulation attacks, the hash values of the P transactions can be obtained. Based on the hash values of the P transactions and a preset transaction order random rule, the packaging order of the P transactions is determined. The hash values of the M transactions in the aggregated transaction are contained in the transaction identifiers of the M transactions, while the hash values of ordinary transactions can be obtained by hashing the obtained transaction data. The preset transaction order random rule refers to a fair and random method for determining the packaging order of transactions. The preset transaction order random rule includes a random value generation function; the random value generation function is the core part of the preset transaction order random rule. It can generate a random value based on the input. This random value will serve as an important basis for subsequently determining the packaging order of transactions, ensuring the randomness and unpredictability of the packaging order. For example, the random value generation function can be a VRF (Verifiable Random Function), which is a cryptographic tool that can generate random values and provide a mathematical proof of those random values, verifying that the random values were indeed generated by a specified participant according to specific rules and have not been tampered with.
[0176] In one implementation, the packaging order of P transactions is determined based on the hash values of P transactions and a preset random transaction order rule. This includes obtaining the first aggregate signature contained in the first block of the blockchain. The first block refers to the block with the highest block height on the blockchain (i.e., the last block on the blockchain). The first aggregate signature refers to the aggregate signature contained in the first block. During the blockchain consensus process, multiple consensus node devices vote on the first block to confirm its legitimacy. The first aggregate signature is a signature obtained by aggregating the signatures of these voting information (obtained by the consensus node devices encrypting their voting information using their private keys). Aggregating signatures combines multiple signatures into one, reducing signature storage space and verification time, and improving the processing efficiency of the blockchain. This application does not limit the generation method of the aggregate signature. For example, the generation methods of the aggregate signature include, but are not limited to, Schnorr signature algorithm, certificateless aggregate signature algorithm, and threshold signature-based aggregation algorithm. Because the private key is unpredictable, the first aggregate signature is unique and unpredictable, making it suitable as a random source, i.e., as input to a random value generation function. The first aggregate signature can be passed to the random value generation function to obtain a random value. A modulo operation is then performed between the random value and the hash values of P transactions to determine the packaging order of the P transactions. For example, the random value and the hash value of each transaction can be ANDed, ORed, or AND-ORed, and then a modulo operation can be performed with any value (such as P). The packaging order can be determined by the remainders obtained from the modulo operation, or by arranging the remainders in descending order.
[0177] The block-producing node can package the transaction data of P transactions according to their packaging order to form a proposal block. For example, it can arrange the transaction data of P transactions according to their packaging order, generate corresponding block headers, and then encapsulate the arranged transaction data and block header information according to the block data structure to form a complete proposal block. After obtaining the proposal block, consensus processing can be performed on the blockchain.
[0178] In one implementation, consensus-based on-chain processing of the proposal block includes: performing consensus voting on the proposal block to obtain a consensus voting result. The consensus voting result contains voting information and a signature of the voting information. The voting information is used to indicate whether the proposal block passes consensus. For example, the proposal block can be sent to consensus node devices in the blockchain so that the consensus node devices in the blockchain can vote on the proposal block. The consensus node devices can include all node devices in the P2P network except for the block-producing node devices. The process involves receiving the voting information and the signature of the voting information returned by the consensus node devices in the blockchain for the proposal block. The signature of the voting information is obtained by encrypting the voting information using the private key of the consensus node device in the blockchain, which can be used to ensure the authenticity and non-repudiation of the voting information. The block-producing node can use the public key of the consensus node device in the blockchain to verify the signature of the voting information. That is, it uses the public key of the consensus node device in the blockchain to decrypt the signature of the voting information and compares whether the information obtained after decryption is the same as the voting information. If they are the same, the signature of the voting information passes signature verification; if they are different, the signature of the voting information fails signature verification. When the signature of the voting information passes signature verification, the voting information and its signature can be identified as the consensus voting result.
[0179] Specifically, when the order of P transactions in the proposal block matches the packaging order of those P transactions (i.e., they are the same), it indicates that the transaction data in the proposal block is arranged in the correct order. The consensus node in the blockchain can return a first vote for the proposal block, indicating that the proposal block has passed consensus. When the order of P transactions in the proposal block does not match the packaging order of those P transactions (i.e., they are not the same), it means that the transaction data in the proposal block is arranged incorrectly. The consensus node in the blockchain can return a second vote for the proposal block, indicating that the proposal block has not passed consensus. For example, the consensus node can receive a random value and a mathematical proof of that random value from the block-producing node. After verifying that the random value was indeed generated by a designated participant according to specific rules and has not been tampered with, it can perform a modulo operation based on the hash value of the P transactions and the random value to obtain the packaging order of the P transactions. For example, when voting on a proposal block, the consensus node can also verify the consistency and integrity of the transaction data in the proposal block, the consistency of the transaction execution results, etc.
[0180] If the number of first-vote messages in the consensus voting result exceeds a preset node count threshold (which can be set as needed, such as two-thirds of the total number of participating nodes), it indicates that a sufficient number of consensus node devices participating in the voting endorse the proposal block. The proposal block has gained majority support at the consensus level, and the signatures of the voting messages in the consensus voting result can be used to generate a second aggregate signature for the proposal block. Aggregate signatures are a technique that combines multiple signatures into one, reducing the storage space and verification time of signature data without sacrificing signature verification capabilities. The second aggregate signature can be added to the proposal block to obtain a second block; for example, it can be added to the block header or the block body of the proposal block. The second aggregate signature in the second block undergoes signature verification. On one hand, the block-producing node itself verifies the second aggregate signature in the second block. On the other hand, the block-producing node can send the second block to the consensus node in the blockchain, allowing the consensus node to also verify the second aggregate signature. This ensures the authenticity and integrity of the second aggregate signature, preventing tampering or forgery and thus guaranteeing the reliability of the entire consensus process. Once the second aggregate signature in the second block passes verification, the second block is stored on the blockchain. For example, the block-producing node and the consensus node add the second block to their maintained blockchain chain structure and update their maintained world state.
[0181] In summary, please refer to Figure 7 This is a flowchart illustrating a transaction packaging randomization method provided in an embodiment of this application. The transaction packaging randomization method is executed by the block-producing node device and includes the following steps S71-S77:
[0182] S71. Select the transactions to be packaged according to the amount of resources required for the execution of each transaction in the transaction pool.
[0183] S72. Detect whether the transaction to be packaged is an aggregated transaction. An aggregated transaction contains transaction identifiers of M transactions.
[0184] S73. If the transaction to be packaged is an aggregated transaction, then retrieve the transaction data of M transactions from the data pool.
[0185] S74. If the transaction data of the first transaction is not obtained from the data pool, then the packaging of the transaction data of the first transaction is abandoned. The first transaction is any one of the M transactions.
[0186] S75. If the transaction to be packaged is a normal transaction, then obtain the transaction data of the normal transaction from the transaction pool.
[0187] S76. When the transaction restriction conditions are met, the packaging order of the multiple acquired transaction data is randomized, and the multiple acquired transaction data are packaged according to the packaging order to form a proposal block. Meeting the transaction restriction conditions includes at least one of the following: the sum of the data volume of the acquired transaction data exceeds a data volume upper limit (which can be set as needed); the number of acquired transaction data exceeds a number upper limit (which can be set as needed); and the current block production cycle has been reached.
[0188] S77. Consensus on-chain processing of the proposed blocks.
[0189] Therefore, it can be seen that the block-producing node device can use the aggregate signature and random value generation function of the last block on the blockchain, combined with the hash value of the transaction identifier, to determine the packaging order of transactions in a fair and random manner. It can also effectively verify that the transaction data in the proposal block is arranged in the correct order. While minimizing the interests of the block-producing node device, it can increase the uncertainty of the transaction packaging order, ensure the fairness and consistency of transaction processing, thereby effectively reducing the risk of transaction manipulation attacks and ensuring the fairness and security of blockchain transaction processing.
[0190] Please see Figure 8 This is a schematic diagram of the structure of a blockchain-based data processing device provided in an embodiment of this application. In one embodiment, the blockchain-based data processing device may be a computer program (including program code) running on a privacy processing device, and the blockchain-based data processing device includes:
[0191] The acquisition unit 81 is used to receive transaction data for N transactions to be processed on the blockchain, where N is a positive integer;
[0192] Processing unit 82 is used to perform privacy processing on the transaction data of N transactions, generate transaction identifiers for N transactions, and store the transaction identifiers and transaction data of N transactions in a privacy transaction queue, which is located under the blockchain;
[0193] The processing unit 82 is also used to obtain the transaction identifiers of M transactions from the privacy transaction queue when the transaction submission conditions are met, aggregate the transaction identifiers of the M transactions to form an aggregate transaction, and submit the aggregate transaction to the transaction pool of the blockchain, where M is a positive integer and M is less than or equal to N;
[0194] Processing unit 82 is also used to retrieve transaction data of M transactions from the privacy transaction queue and submit them to the data pool of the blockchain when the data submission conditions are met; the transaction pool and the data pool are independent of each other, and the aggregated transaction is processed on the chain based on the transaction identifiers of the M transactions stored in the transaction pool and the transaction data of the M transactions stored in the data pool.
[0195] In one embodiment, any one of the N transactions is represented as transaction i, where i is a positive integer less than or equal to N;
[0196] Processing unit 82 performs privacy processing on the transaction data of transaction i and generates a transaction identifier for transaction i, including:
[0197] Perform a legality check on the transaction data of transaction i;
[0198] If the transaction data of transaction i passes the validity check, then the transaction data of transaction i is hashed to obtain the hash value of transaction i.
[0199] Obtain the transaction signature of transaction i from the transaction data of transaction i;
[0200] The hash value of transaction i and the transaction signature of transaction i are combined to form the transaction identifier of transaction i.
[0201] In one embodiment, satisfying the transaction submission conditions includes at least one of the following:
[0202] The number of transaction identifiers stored in the privacy transaction queue exceeds the preset threshold for the number of identifiers defined by the transaction submission conditions;
[0203] The amount of transaction data stored in the privacy transaction queue exceeds the preset data volume threshold defined by the transaction submission conditions;
[0204] The preset period interval defined by the transaction submission conditions has been reached.
[0205] In one embodiment, satisfying the data submission conditions includes at least one of the following:
[0206] Based on the submission time of the aggregated transaction, the preset delay time defined by the data submission conditions is reached;
[0207] When aggregated transactions submitted to the transaction pool are triggered to perform on-chain processing.
[0208] In another embodiment, the blockchain-based data processing device may be a computer program (including program code) running on a block-producing node device in the blockchain. The blockchain includes a transaction pool and a data pool. The transaction pool is used to store transaction identifiers of transactions to be processed on the blockchain, and the data pool is used to store transaction data of transactions to be processed on the blockchain. The transaction pool and the data pool are independent of each other. The blockchain-based data processing device includes:
[0209] The acquisition unit 81 is used to acquire aggregated transactions to be processed on the blockchain from the transaction pool. The aggregated transaction is generated by the privacy processing device when the transaction submission conditions are met, by aggregating the transaction identifiers of M transactions in the privacy transaction queue and submitting them to the transaction pool. M is a positive integer.
[0210] The acquisition unit 81 is also used to acquire transaction data of M transactions from the data pool based on the transaction identifiers of M transactions in the aggregated transaction; the transaction data of the M transactions is submitted to the data pool by the privacy processing device when the data submission conditions are met;
[0211] Processing unit 82 is used to perform on-chain processing of aggregated transactions based on the transaction identifiers and transaction data of M transactions.
[0212] In one embodiment, any one of the M transactions is represented as transaction j, and the transaction identifier of transaction j includes the hash value and transaction signature of transaction j; j is a positive integer less than or equal to M;
[0213] The acquisition unit 81 retrieves the transaction data of transaction j from the data pool based on the transaction identifier of transaction j in the aggregated transaction, including:
[0214] Iterate through and calculate the hash value of each transaction in the data pool;
[0215] Identify target transaction data from the data pool whose hash value matches the hash value in the transaction identifier of transaction j;
[0216] Compare the transaction signature in the target transaction data with the transaction signature in the transaction identifier of transaction j;
[0217] If the transaction signature in the target transaction data is the same as the transaction signature in the transaction identifier of transaction j, then the target transaction data is retrieved from the data pool as the transaction data of transaction j.
[0218] In one embodiment, the on-chain processing of the aggregated transaction includes packaging the transaction data of the M transactions into a proposal block, wherein the proposal block contains the transaction data of P transactions, and the P transactions contain the M transactions, where P is a positive integer greater than or equal to M.
[0219] The process of uploading the aggregated transaction to the blockchain based on the transaction identifiers and transaction data of the M transactions includes:
[0220] Obtain the hash values of the P transactions, wherein the hash values of the M transactions are contained in the transaction identifiers of the M transactions;
[0221] Based on the hash values of the P transactions and the preset transaction order randomization rules, the packaging order of the P transactions is determined;
[0222] The transaction data of the P transactions are packaged according to the packaging order to form a proposal block;
[0223] The proposed block is then processed for consensus and uploaded to the blockchain.
[0224] In one embodiment, the preset transaction order random rule includes a random value generation function;
[0225] The process of determining the packaging order of the P transactions based on their hash values and a preset transaction order randomization rule includes:
[0226] Obtain the first aggregate signature contained in the first block on the blockchain, where the first block refers to the block with the highest block height on the blockchain;
[0227] The first aggregated signature is passed to the random value generation function to obtain a random value;
[0228] The packaging order of the P transactions is obtained by performing a modulo operation based on the random value and the hash values of the P transactions.
[0229] In one embodiment, the processing unit 82 performs consensus on-chain processing on the proposal block, including:
[0230] The proposal block undergoes consensus voting to obtain the consensus voting result, which includes voting information and the signature of the voting information. The voting information is used to indicate whether the proposal block passes consensus.
[0231] If the number of first voting messages in the consensus voting results exceeds a preset node number threshold, then the signatures of the voting messages in the consensus voting results are used to generate a second aggregate signature for the proposal block; the first voting messages are used to indicate that the proposal block passes consensus.
[0232] Add the second aggregate signature to the proposal block to obtain the second block, and verify the second aggregate signature in the second block.
[0233] When the second aggregate signature in the second block passes signature verification, the second block is stored on the blockchain.
[0234] In one embodiment, processing unit 82 performs consensus voting on the proposal block to obtain the consensus voting result, including:
[0235] The proposal block is sent to the consensus node devices in the blockchain so that the consensus node devices in the blockchain can vote on the proposal block;
[0236] Receive voting information and the signature of the voting information returned by the consensus node device in the blockchain for the proposal block; the signature of the voting information is obtained by encrypting the voting information using the private key of the consensus node device in the blockchain;
[0237] The signature of the voting information is verified using the public key of the consensus node device in the blockchain.
[0238] When the signature of the voting information passes signature verification, the voting information and its signature are identified as the consensus voting result.
[0239] In one embodiment, when the order of P transactions in the proposal block matches the order in which the P transactions are packaged, the consensus node device in the blockchain returns the first vote information for the proposal block.
[0240] When the order of P transactions in the proposal block does not match the order in which they are packaged, the consensus node in the blockchain returns a second vote for the proposal block; the second vote indicates that the proposal block has not passed consensus.
[0241] In one embodiment, any one of the M transactions is represented as transaction j, where j is a positive integer less than or equal to M; the acquisition unit 81 is further configured to:
[0242] If transaction data for transaction j is not retrieved from the data pool, then the transaction identifier of transaction j is returned to the transaction pool.
[0243] If the storage time of the transaction identifier of transaction j in the transaction pool exceeds the preset time threshold, the transaction identifier of transaction j in the transaction pool will be discarded.
[0244] According to one embodiment of this application, Figure 8 The data processing device based on blockchain shown can be constructed by combining each unit into one or more other units, or by further dividing one or more units into multiple functionally smaller units. This achieves the same operation without affecting the technical effect of the embodiments of this application. The above units are based on logical function division. In practical applications, the function of one unit can be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of this application, the data management device for the space adjustment object can also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by multiple units working together. According to another embodiment of this application, a computer program (including program code) capable of performing the steps involved in the corresponding methods described above can be run on a general-purpose computing device, such as a computer, which includes 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 a system such as a computer. Figure 8 The data processing apparatus shown herein is based on a blockchain, and the data processing method based on a blockchain described in the foregoing embodiments of this application is also described herein. The computer program may be recorded on, for example, a computer-readable recording medium, loaded onto the aforementioned computing device via the computer-readable recording medium, and executed therein.
[0245] In summary, the privacy processing device receives transaction data from N (N is a positive integer) transactions awaiting on-chain processing. It then performs privacy processing on the N transaction data, generating transaction identifiers for each of the N transactions. These identifiers and transaction data are stored in a privacy transaction queue, which resides off-chain. This allows transactions to be submitted to the privacy transaction queue before being directly published to the blockchain's transaction pool. When the transaction submission conditions are met, the privacy processing device retrieves the transaction identifiers of M transactions from the privacy transaction queue. It then aggregates these identifiers into an aggregated transaction and submits it to the blockchain's transaction pool. This prevents the attacker from deciphering the specific transaction data through the aggregated transaction in the transaction pool, thus eliminating the possibility of initiating a transaction manipulation attack. When the data submission conditions are met, transaction data for M transactions are retrieved from the privacy transaction queue and submitted to the blockchain's data pool. The transaction pool and the data pool are independent of each other. On the one hand, this separates transaction identifiers and transaction data, preventing sensitive transaction data from being excessively exposed during transaction processing and improving data privacy. On the other hand, this phased data submission method further increases the difficulty of deciphering specific transaction data from aggregated transactions, effectively resisting transaction manipulation attacks. The block-producing node device is used to: retrieve aggregated transactions to be processed on the blockchain from the transaction pool; and, based on the transaction identifiers of the M transactions in the aggregated transaction, retrieve the transaction data of the M transactions from the data pool. Based on the transaction identifiers and transaction data of the M transactions, it processes the aggregated transaction on the blockchain. This allows the aggregated transactions in the transaction pool to be associated with the transaction data in the data pool through transaction identifiers, ensuring the accuracy of the transaction data on the blockchain. It also avoids frequently transmitting large amounts of raw transaction data during transaction processing, which helps improve the speed of transaction on-chain processing, reduces the risk of data exposure, and enhances the credibility of the blockchain.
[0246] Figure 9 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Please refer to [link / reference]. Figure 9The computer device 90 includes a processor 91, a communication interface 92, and a computer-readable storage medium 93. The processor 91, communication interface 92, and computer-readable storage medium 93 can be connected via a bus or other means. The communication interface 92 is used to receive and transmit data, and may optionally include a standard wired interface or a wireless interface (such as Wi-Fi, mobile communication interface, etc.), controlled by the processor 91 for sending and receiving data. The computer-readable storage medium 93 can be stored in the memory of the computer device 90 (including the computer device 90's built-in memory, and may also include extended memory supported by the computer device 90). The computer-readable storage medium 93 is used to store computer programs, including program instructions, and the processor 91 is used to execute the program instructions stored in the computer-readable storage medium 93. The processor 91 (or CPU (Central Processing Unit)) is the computing and control core of the computer device 90. It can parse various instructions within the computer device 90 and process various data of the computer device 90. It is suitable for implementing one or more instructions, specifically for loading and executing one or more instructions to achieve the corresponding method flow or corresponding function.
[0247] This application embodiment also provides a computer-readable storage medium (Memory), which is a memory device in a computer device 90 for storing programs and data. It is understood that the computer-readable storage medium here may include the built-in storage medium in the computer device 90, or it may include extended storage media supported by the computer device 90. The computer-readable storage medium provides storage space that stores the processing system of the computer device 90. Furthermore, the storage space also stores one or more instructions suitable for loading and execution by the processor 91. These instructions may be one or more computer programs (including program code). It should be noted that the computer-readable storage medium here may be high-speed RAM memory, or non-volatile memory, such as at least one disk storage device; optionally, it may also be at least one computer-readable storage medium located remotely from the aforementioned processor.
[0248] In one embodiment, the computer-readable storage medium stores one or more instructions; the processor 91 loads and executes one or more instructions stored in the computer-readable storage medium to implement the corresponding steps in the above-described embodiment of the blockchain-based data processing method.
[0249] In one implementation, when the computer device 90 is a privacy processing device, one or more instructions in the computer-readable storage medium are loaded by the processor 91 and executed as follows:
[0250] Receive transaction data for N transactions to be processed on the blockchain, where N is a positive integer;
[0251] The transaction data of N transactions are processed to preserve privacy, generating transaction identifiers for N transactions. The transaction identifiers and transaction data of the N transactions are then stored in a privacy transaction queue, which is located under the blockchain.
[0252] When the transaction submission conditions are met, the transaction identifiers of M transactions are obtained from the privacy transaction queue, the transaction identifiers of the M transactions are aggregated to form an aggregated transaction, and the aggregated transaction is submitted to the transaction pool of the blockchain. M is a positive integer and M is less than or equal to N.
[0253] When the data submission conditions are met, the transaction data of M transactions are retrieved from the privacy transaction queue and submitted to the blockchain's data pool. The transaction pool and the data pool are independent of each other. Aggregated transactions are processed on the blockchain based on the transaction identifiers of the M transactions stored in the transaction pool and the transaction data of the M transactions stored in the data pool.
[0254] In one embodiment, any one of the N transactions is represented as transaction i, where i is a positive integer less than or equal to N;
[0255] Processor 91 performs privacy processing on the transaction data of transaction i and generates a transaction identifier for transaction i, including:
[0256] Perform a legality check on the transaction data of transaction i;
[0257] If the transaction data of transaction i passes the validity check, then the transaction data of transaction i is hashed to obtain the hash value of transaction i.
[0258] Obtain the transaction signature of transaction i from the transaction data of transaction i;
[0259] The hash value of transaction i and the transaction signature of transaction i are combined to form the transaction identifier of transaction i.
[0260] In one embodiment, satisfying the transaction submission conditions includes at least one of the following:
[0261] The number of transaction identifiers stored in the privacy transaction queue exceeds the preset threshold for the number of identifiers defined by the transaction submission conditions;
[0262] The amount of transaction data stored in the privacy transaction queue exceeds the preset data volume threshold defined by the transaction submission conditions;
[0263] The preset period interval defined by the transaction submission conditions has been reached.
[0264] In one embodiment, satisfying the data submission conditions includes at least one of the following:
[0265] Based on the submission time of the aggregated transaction, the preset delay time defined by the data submission conditions is reached;
[0266] When aggregated transactions submitted to the transaction pool are triggered to perform on-chain processing.
[0267] In one implementation, when the computer device 90 is a block-producing node device, one or more instructions in the computer-readable storage medium are loaded by the processor 91 and executed as follows:
[0268] The aggregated transactions to be processed on the blockchain are obtained from the transaction pool. The aggregated transactions are processed by the privacy processing device when the transaction submission conditions are met. The aggregated transactions are processed by the privacy processing device, which aggregates the transaction identifiers of M transactions in the privacy transaction queue and submits them to the transaction pool. M is a positive integer.
[0269] Based on the transaction identifiers of M transactions in the aggregated transaction, the transaction data of M transactions are obtained from the data pool; the transaction data of M transactions are submitted to the data pool by the privacy processing device when the data submission conditions are met.
[0270] Based on the transaction identifiers and transaction data of M transactions, the aggregated transactions are processed on the blockchain.
[0271] In one embodiment, any one of the M transactions is represented as transaction j, and the transaction identifier of transaction j includes the hash value and transaction signature of transaction j; j is a positive integer less than or equal to M;
[0272] Processor 91 retrieves transaction data of transaction j from the data pool based on the transaction identifier of transaction j in the aggregated transaction, including:
[0273] Iterate through and calculate the hash value of each transaction in the data pool;
[0274] Identify target transaction data from the data pool whose hash value matches the hash value in the transaction identifier of transaction j;
[0275] Compare the transaction signature in the target transaction data with the transaction signature in the transaction identifier of transaction j;
[0276] If the transaction signature in the target transaction data is the same as the transaction signature in the transaction identifier of transaction j, then the target transaction data is retrieved from the data pool as the transaction data of transaction j.
[0277] In one embodiment, the on-chain processing of the aggregated transaction includes packaging the transaction data of the M transactions into a proposal block, wherein the proposal block contains the transaction data of P transactions, and the P transactions contain the M transactions, where P is a positive integer greater than or equal to M.
[0278] The process of uploading the aggregated transaction to the blockchain based on the transaction identifiers and transaction data of the M transactions includes:
[0279] Obtain the hash values of the P transactions, wherein the hash values of the M transactions are contained in the transaction identifiers of the M transactions;
[0280] Based on the hash values of the P transactions and the preset transaction order randomization rules, the packaging order of the P transactions is determined;
[0281] The transaction data of the P transactions are packaged according to the packaging order to form a proposal block;
[0282] The proposed block is then processed for consensus and uploaded to the blockchain.
[0283] In one embodiment, the preset transaction order random rule includes a random value generation function;
[0284] The process of determining the packaging order of the P transactions based on their hash values and a preset transaction order randomization rule includes:
[0285] Obtain the first aggregate signature contained in the first block on the blockchain, where the first block refers to the block with the highest block height on the blockchain;
[0286] The first aggregated signature is passed to the random value generation function to obtain a random value;
[0287] The packaging order of the P transactions is obtained by performing a modulo operation based on the random value and the hash values of the P transactions.
[0288] In one embodiment, the processor 91 performs consensus on-chain processing on the proposal block, including:
[0289] The proposal block undergoes consensus voting to obtain the consensus voting result, which includes voting information and the signature of the voting information. The voting information is used to indicate whether the proposal block passes consensus.
[0290] If the number of first voting messages in the consensus voting results exceeds a preset node number threshold, then the signatures of the voting messages in the consensus voting results are used to generate a second aggregate signature for the proposal block; the first voting messages are used to indicate that the proposal block passes consensus.
[0291] Add the second aggregate signature to the proposal block to obtain the second block, and verify the second aggregate signature in the second block.
[0292] When the second aggregate signature in the second block passes signature verification, the second block is stored on the blockchain.
[0293] In one embodiment, the processor 91 performs consensus voting on the proposal block to obtain the consensus voting result, including:
[0294] The proposal block is sent to the consensus node devices in the blockchain so that the consensus node devices in the blockchain can vote on the proposal block;
[0295] Receive voting information and the signature of the voting information returned by the consensus node device in the blockchain for the proposal block; the signature of the voting information is obtained by encrypting the voting information using the private key of the consensus node device in the blockchain;
[0296] The signature of the voting information is verified using the public key of the consensus node device in the blockchain.
[0297] When the signature of the voting information passes signature verification, the voting information and its signature are identified as the consensus voting result.
[0298] In one embodiment, when the order of P transactions in the proposal block matches the order in which the P transactions are packaged, the consensus node device in the blockchain returns the first vote information for the proposal block.
[0299] When the order of P transactions in the proposal block does not match the order in which they are packaged, the consensus node in the blockchain returns a second vote for the proposal block; the second vote indicates that the proposal block has not passed consensus.
[0300] In one embodiment, any one of the M transactions is represented as transaction j, where j is a positive integer less than or equal to M; the processor 91 is further configured to:
[0301] If transaction data for transaction j is not retrieved from the data pool, then the transaction identifier of transaction j is returned to the transaction pool.
[0302] If the storage time of the transaction identifier of transaction j in the transaction pool exceeds the preset time threshold, the transaction identifier of transaction j in the transaction pool will be discarded.
[0303] Based on the same inventive concept, the principle and beneficial effects of the computer device 90 provided in the embodiments of this application in solving the problem are similar to the principle and beneficial effects of the data processing method in the embodiments of this application in solving the problem. Please refer to the principle and beneficial effects of the implementation of the method. For the sake of brevity, they will not be repeated here.
[0304] In the embodiments of this application, 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.
[0305] This application also provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the aforementioned blockchain-based data processing method.
[0306] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. 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 implementation should not be considered beyond the scope of this application.
[0307] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in or transmitted through a computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a management device that integrates one or more available media, such as a server, data center, or other space-managed object. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0308] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A blockchain-based data processing method, characterized in that, The method includes: Receive transaction data for N transactions to be processed on the blockchain, where N is a positive integer; The transaction data of the N transactions are processed to be made more private, and transaction identifiers of the N transactions are generated. The transaction identifiers and transaction data of the N transactions are stored in a privacy transaction queue, which is located under the blockchain. When the transaction submission conditions are met, the transaction identifiers of M transactions are obtained from the privacy transaction queue, the transaction identifiers of the M transactions are aggregated to form an aggregated transaction, and the aggregated transaction is submitted to the transaction pool of the blockchain, where M is a positive integer and M is less than or equal to N; When the data submission conditions are met, the transaction data of the M transactions are obtained from the privacy transaction queue and submitted to the data pool of the blockchain. The transaction pool and the data pool are independent of each other. The aggregated transaction is processed on the blockchain based on the transaction identifiers of the M transactions stored in the transaction pool and the transaction data of the M transactions stored in the data pool.
2. The method of claim 1, wherein, Any one of the N transactions is represented as transaction i, where i is a positive integer less than or equal to N; The transaction data of transaction i is processed to preserve privacy, and a transaction identifier for transaction i is generated, including: Perform a validity check on the transaction data of transaction i; If the transaction data of transaction i passes the validity check, then the transaction data of transaction i is hashed to obtain the hash value of transaction i. Obtain the transaction signature of transaction i from the transaction data of transaction i; The hash value of transaction i and the transaction signature of transaction i are combined to form the transaction identifier of transaction i.
3. The method of claim 1 or 2, wherein, The conditions for transaction submission include at least one of the following: The number of transaction identifiers stored in the privacy transaction queue is higher than the preset identifier number threshold defined by the transaction submission conditions; The amount of transaction data stored in the privacy transaction queue is higher than the preset data amount threshold defined by the transaction submission conditions; The preset period interval defined by the transaction submission conditions has been reached.
4. The method of claim 1 or 2, wherein, The conditions for satisfying data submission include at least one of the following: Based on the submission time of the aggregated transaction, the preset delay time defined by the data submission conditions is reached; When the aggregated transaction submitted to the transaction pool is triggered to perform on-chain processing.
5. A data processing method based on blockchain, characterized in that, The blockchain includes a transaction pool and a data pool. The transaction pool stores transaction identifiers of transactions awaiting on-chain processing, and the data pool stores transaction data of transactions awaiting on-chain processing. The transaction pool and the data pool are independent of each other. The method includes: The aggregated transactions to be processed on the blockchain are obtained from the transaction pool. The aggregated transactions are processed by the privacy processing device when the transaction submission conditions are met, by aggregating the transaction identifiers of M transactions in the privacy transaction queue and submitting them to the transaction pool. M is a positive integer. Based on the transaction identifiers of the M transactions in the aggregated transaction, the transaction data of the M transactions are obtained from the data pool; the transaction data of the M transactions are submitted to the data pool by the privacy processing device when the data submission conditions are met. Based on the transaction identifiers and transaction data of the M transactions, the aggregated transaction is processed on the blockchain.
6. The method as described in claim 5, characterized in that, The method is executed by the block-producing node device in the blockchain. Any one of the M transactions is represented as transaction j, and the transaction identifier of transaction j includes the hash value and transaction signature of transaction j; j is a positive integer less than or equal to M. Based on the transaction identifier of transaction j in the aggregated transaction, the transaction data of transaction j is obtained from the data pool, including: Iterate through and calculate the hash value of each transaction in the data pool; Determine target transaction data from the data pool whose hash value is the same as the hash value in the transaction identifier of transaction j; Compare the transaction signature in the target transaction data with the transaction signature in the transaction identifier of transaction j; If the transaction signature in the target transaction data is the same as the transaction signature in the transaction identifier of transaction j, then the target transaction data is obtained from the data pool as the transaction data of transaction j.
7. The method as described in claim 5, characterized in that, The on-chain processing of the aggregated transaction includes packaging the transaction data of the M transactions into a proposal block, wherein the proposal block contains the transaction data of P transactions, where P is a positive integer greater than or equal to M. The process of uploading the aggregated transaction to the blockchain based on the transaction identifiers and transaction data of the M transactions includes: Obtain the hash values of the P transactions, wherein the P transactions contain the M transactions, and the hash values of the M transactions are contained in the transaction identifiers of the M transactions; Based on the hash values of the P transactions and the preset transaction order randomization rules, the packaging order of the P transactions is determined; The transaction data of the P transactions are packaged according to the packaging order to form a proposal block; The proposed block is then processed for consensus and uploaded to the blockchain.
8. The method as described in claim 7, characterized in that, The preset random rules for transaction order include a random value generation function; The process of determining the packaging order of the P transactions based on their hash values and a preset transaction order randomization rule includes: Obtain the first aggregate signature contained in the first block on the blockchain, where the first block refers to the block with the highest block height on the blockchain; The first aggregated signature is passed to the random value generation function to obtain a random value; The packaging order of the P transactions is obtained by performing a modulo operation based on the random value and the hash values of the P transactions.
9. The method as described in claim 7, characterized in that, The method is executed by the block-producing node device in the blockchain, and the consensus-building and on-chain processing of the proposal block includes: The proposal block is subjected to consensus voting to obtain a consensus voting result. The consensus voting result includes voting information and the signature of the voting information. The voting information is used to indicate whether the proposal block passes consensus. If the number of first voting information in the consensus voting result is higher than a preset node number threshold, then the signature of the voting information in the consensus voting result is used to generate a second aggregate signature for the proposal block; the first voting information is used to indicate that the proposal block passes consensus; The second aggregated signature is added to the proposal block to obtain a second block, and the second aggregated signature in the second block is verified. When the second aggregate signature in the second block passes signature verification, the second block is stored on the blockchain.
10. The method as described in claim 9, characterized in that, The consensus voting process for the proposal block, to obtain the consensus voting result, includes: The proposal block is sent to the consensus node device in the blockchain so that the consensus node device in the blockchain can vote on the proposal block; The system receives voting information and a signature of the voting information returned by the consensus node device in the blockchain for the proposal block; the signature of the voting information is obtained by encrypting the voting information using the private key of the consensus node device in the blockchain. The signature of the voting information is verified using the public key of the consensus node device in the blockchain. When the signature of the voting information passes signature verification, the voting information and its signature are determined as the consensus voting result.
11. The method as described in claim 10, characterized in that, When the order of the P transactions in the proposal block matches the order in which the P transactions are packaged, the consensus node device in the blockchain returns the first vote information for the proposal block. When the order of the P transactions in the proposal block does not match the order in which the P transactions are packaged, the consensus node device in the blockchain returns a second voting message for the proposal block; the second voting message indicates that the proposal block has not passed consensus.
12. The method as described in claim 5, characterized in that, Any one of the M transactions is denoted as transaction j, where j is a positive integer less than or equal to M; the method further includes: If the transaction data of transaction j is not obtained from the data pool, the transaction identifier of transaction j is returned to the transaction pool. If the storage time of the transaction identifier of transaction j in the transaction pool exceeds a preset time threshold, the transaction identifier of transaction j in the transaction pool will be discarded.
13. A data processing device based on blockchain, characterized in that, The device includes: The acquisition unit is used to receive transaction data for N transactions to be processed on the blockchain, where N is a positive integer; The processing unit is used to perform privacy processing on the transaction data of the N transactions, generate transaction identifiers for the N transactions, and store the transaction identifiers and transaction data of the N transactions in a privacy transaction queue, which is located under the blockchain; The processing unit is further configured to, when the transaction submission conditions are met, obtain the transaction identifiers of M transactions from the privacy transaction queue, aggregate the transaction identifiers of the M transactions to form an aggregated transaction, and submit the aggregated transaction to the transaction pool of the blockchain, where M is a positive integer and M is less than or equal to N; The processing unit is further configured to, when the data submission conditions are met, retrieve the transaction data of the M transactions from the privacy transaction queue and submit them to the data pool of the blockchain; the transaction pool and the data pool are independent of each other, and the aggregated transaction is processed on-chain based on the transaction identifiers of the M transactions stored in the transaction pool and the transaction data of the M transactions stored in the data pool.
14. A data processing device based on blockchain, characterized in that, The blockchain includes a transaction pool and a data pool. The transaction pool stores transaction identifiers of transactions awaiting on-chain processing, and the data pool stores transaction data of transactions awaiting on-chain processing. The transaction pool and the data pool are independent of each other. The device includes: The acquisition unit is used to acquire aggregated transactions to be processed on the blockchain from the transaction pool. The aggregated transactions are generated by the privacy processing device when the transaction submission conditions are met, by aggregating the transaction identifiers of M transactions in the privacy transaction queue and submitting them to the transaction pool, where M is a positive integer. The acquisition unit is further configured to acquire transaction data of the M transactions from the data pool based on the transaction identifiers of the M transactions in the aggregated transaction; the transaction data of the M transactions is submitted to the data pool by the privacy processing device when the data submission conditions are met; The processing unit is used to perform on-chain processing of the aggregated transaction based on the transaction identifiers and transaction data of the M transactions.
15. A computer device, characterized in that, The computer device includes: A processor, adapted to execute computer programs; A computer-readable storage medium storing a computer program, which, when executed by the processor, implements the blockchain-based data processing method as described in any one of claims 1-12.
16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted to be loaded by a processor and executed as described in any one of claims 1-12.
17. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the blockchain-based data processing method as described in any one of claims 1-12.
