Batch transaction chain-up method and system based on blockchain
By building directed acyclic graphs and sharding processing, the read and write set conflict problem during batch transactions on the chain in the blockchain system is solved, the transaction reliability and system performance are improved, and the file integrity and security are ensured. .
Patent Information
- Application Number
- CN202110300436.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-22
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2041-03-22
AI Technical Summary
In blockchain systems, batch transactions are prone to failure due to read and write set conflicts when on-chain, and the existing technology cannot effectively process the integrity and security of files, resulting in low system performance and waste of resources.
By building directed acyclic graphs, perform batch transactions simulated and generate sharded read and write sets, endorse the signature, and package them into blocks to broadcast them to the blockchain network, avoid read and write set conflicts, and ensure the reliability of transactions and File integrity.
Improve the reliability of transactions on the chain, reduce data transmission overhead, ensure transactions are executed in the order of dependencies, ensure concurrency to the greatest extent, avoid system resource exclusiveness and read-write set conflicts, and improve overall system efficiency and resources Utilization.
Smart Images

Figure CN112837163B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of blockchain technology and can also be used in the financial field, and in particular to a method and system for uploading batch transactions to a blockchain. Background Art
[0002] In the actual application of blockchain, in addition to traditional online transactions, there is also a demand for batch transactions. For the scenario of batch transactions on the chain, the mainstream processing methods include: batch transfer online and data file on the chain.
[0003] The batch transfer online method initiates requests for the batch transactions corresponding to the transaction files one by one to realize the processing of transaction files. On the one hand, this method needs to initiate a large number of requests, which consumes a lot of network resources. On the other hand, for the blockchain system based on read-write sets, it can only process evidence transactions. For account transactions, due to the problem of transaction failure caused by read-write set conflicts, multiple retransmissions are required to ensure the successful execution of all transactions, resulting in low overall system performance and waste of resources.
[0004] The method of uploading data files to the chain is to upload the files or file hashes to the chain and process the files through an external system. This method can only confirm the integrity of the files and cannot deal with the problems of file tampering and loss. At the same time, since the blockchain system cannot be used to process the specific content in the files, the files can only be parsed and processed through external systems, resulting in a lack of security and credibility in the processing process. Summary of the invention
[0005] In response to at least one problem in the prior art, the present application proposes a blockchain-based batch transaction on-chain method and system, which can avoid read-write set conflicts that lead to transaction on-chain failures, thereby improving the reliability of transaction on-chain.
[0006] In order to solve the above technical problems, this application provides the following technical solutions:
[0007] In a first aspect, the present application provides a method for batch transaction on-chain based on blockchain, comprising:
[0008] Obtain a target transaction file, and construct a directed acyclic graph according to the target transaction file, wherein nodes in the directed acyclic graph are used to represent transactions, and directed edges between two nodes are used to represent dependency relationships between transactions;
[0009] According to the directed acyclic graph, simulate the execution of batch transactions and generate shard read-write sets;
[0010] Endorsing and signing the shard read-write set to obtain the endorsement signature result;
[0011] The shard read-write set and the endorsement signature result are packaged into blocks, and the blocks are broadcast to each accounting node in the blockchain network to complete the batch transaction chain.
[0012] Furthermore, the step of obtaining the target transaction file and constructing a directed acyclic graph according to the target transaction file includes:
[0013] receiving endorsement requests;
[0014] Obtaining a target transaction file corresponding to the endorsement request from a distributed file system;
[0015] A directed acyclic graph is constructed according to the target transaction file.
[0016] Further, the target transaction file includes batch transaction data, each transaction data corresponds to a different transaction, and each transaction data includes: a transaction timestamp, a first transaction status, and a second transaction status;
[0017] Correspondingly, the step of constructing a directed acyclic graph according to the target transaction file includes:
[0018] Each transaction corresponding to the target transaction file is used as a node;
[0019] Establishing an edge between nodes that meet a dependency condition, the dependency condition comprising: at least one of the first transaction status of the transaction being the same, the second transaction status being the same, and the first transaction status and the second transaction status being the same;
[0020] Determine the direction of each edge based on the order of transaction timestamps;
[0021] Each node and the edges with directions form the directed acyclic graph.
[0022] Furthermore, simulating the execution of batch transactions and generating shard read-write sets according to the directed acyclic graph includes:
[0023] Execute a sharding step, which includes: obtaining a node with an in-degree of 0 as a starting node from the current directed acyclic graph; concurrently simulating and executing transactions corresponding to the starting node, and if the number of the starting nodes is less than or equal to a shard number threshold, after the simulation is completed, taking the transaction corresponding to the starting node as a shard and generating a shard read-write set corresponding to the shard; deleting the starting node and the edge connected to the starting node from the current directed acyclic graph;
[0024] Return to execute the sharding step until the directed acyclic graph is empty.
[0025] Further, constructing a directed acyclic graph according to the target transaction file includes:
[0026] Verify whether the file hash value in the endorsement request is consistent with the hash value of the target transaction file in the distributed file system, and if so, construct a directed acyclic graph based on the target transaction file.
[0027] Furthermore, the block is broadcasted to each accounting node in the blockchain network to complete the batch transaction chain, including:
[0028] If the shard read-write set and the endorsement signature results in the block are verified successfully, the ledgers in each accounting node are updated according to the block.
[0029] Furthermore, the broadcasting of the block to each accounting node in the blockchain network to complete the batch transaction chain also includes:
[0030] If there are transactions in the transactions corresponding to the block that fail to verify the shard read / write set and / or the endorsement signature result, then determine the subsequent transactions of the transactions that failed to verify according to the directed acyclic graph;
[0031] According to the transaction that failed verification and its subsequent transactions, a directed acyclic graph is rebuilt and the transaction that failed verification and its subsequent transactions are resent.
[0032] In a second aspect, the present application provides a blockchain-based batch transaction on-chain system, including: an accounting node and a sorting node;
[0033] The accounting node is used to obtain a target transaction file, and construct a directed acyclic graph according to the target transaction file. The nodes in the directed acyclic graph are used to represent transactions, and the edges with directions between two nodes are used to represent the dependency relationship between transactions; according to the directed acyclic graph, batch transactions are simulated and a shard read-write set is generated; the shard read-write set is endorsed and signed to obtain an endorsement signature result;
[0034] The sorting node is used to package the shard read-write set and the endorsement signature result into a block, and broadcast the block to each accounting node in the blockchain network to complete the batch transaction chain.
[0035] In a third aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the blockchain-based batch transaction on-chain method is implemented.
[0036] In a fourth aspect, the present application provides a computer-readable storage medium having computer instructions stored thereon, which, when executed, implement the blockchain-based batch transaction on-chain method.
[0037] It can be seen from the above technical solution that the present application provides a method and system for batch transaction chaining based on blockchain. The method includes: obtaining a target transaction file, constructing a directed acyclic graph according to the target transaction file, wherein the nodes in the directed acyclic graph are used to represent transactions, and the edges with directions between two nodes are used to represent the dependency relationship between transactions; according to the directed acyclic graph, simulating the execution of batch transactions and generating sharded read-write sets; endorsing and signing the sharded read-write sets to obtain endorsement signature results; packaging the sharded read-write sets and the endorsement signature results into blocks, broadcasting the blocks to each accounting node in the blockchain network to complete the batch transaction chaining, which can avoid read-write set conflicts that lead to transaction chaining failures, thereby improving the reliability of transaction chaining; specifically, it can reduce customer It can reduce the data transmission overhead of the target transaction file distributed to the client; it can ensure the integrity of the transaction file while preventing the transaction file from being tampered with and lost; it can ensure that transactions are executed in the order of dependencies while ensuring the concurrency of transaction execution to the greatest extent; it can avoid long-term monopoly of system resources when processing large-scale transactions, and avoid the system from being unable to respond to other online transactions when processing batch transactions; it can ensure that when transaction verification fails, the amount of retransmission transactions is minimized, thereby improving the overall efficiency and resource utilization of the system when processing batch transactions; it can reduce the resource consumption of the read-write set during the transmission and verification process, and also avoid conflicts between read-write sets of different shards during verification. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 It is a flowchart of a method for uploading batch transactions to a blockchain based on an embodiment of the present application;
[0040] Figure 2 It is a flowchart of steps 301 to 304 of the method for uploading batch transactions to a blockchain based on an embodiment of the present application;
[0041] Figure 3 It is a flowchart of step 401 and step 402 of the method for uploading batch transactions to a blockchain based on an embodiment of the present application;
[0042] Figure 4 It is a logical diagram of a sharding process included in an example of the present application;
[0043] Figure 5It is a structural diagram of a batch transaction on-chain system based on blockchain in the application example of this application;
[0044] Figure 6 It is a flowchart of a method for uploading batch transactions on a blockchain based on the application example of this application;
[0045] Figure 7 A schematic block diagram of the system structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0046] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0047] In addition, the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be performed in an order different from that shown here.
[0048] In order to facilitate the understanding of the present application, before describing the method of the present application, the relevant contents of the technical solution of the present application are first explained here.
[0049] Blockchain is a data structure in which blocks are linked in order from back to front, and each block points to the previous block. It can be stored as a file containing non-relative records or in a simple database.
[0050] A block is a container data structure that aggregates data and is included in the blockchain. It consists of a block header containing metadata and a long list of transactions that form the main body of the block. The block specifically includes: a block size field, usually 4 bytes; a block header field, usually 80 bytes; a transaction counter field, usually 1-9 bytes, recording the number of transactions; and a transaction field, usually of variable length, recording transaction details.
[0051] Data on-chain means that data is packaged in a block through a consensus mechanism to become a new block, and is linked to the previous block, becoming tamper-proof data on the chain.
[0052] The blockchain system based on the read-write set model, such as Hyperledger Fabric 1.X and above, includes: client, accounting node cluster and sorting node cluster. The client initiates an endorsement request to several accounting nodes in the blockchain network. The node that receives the request simulates the execution of the transaction based on the snapshot of the current ledger, generates a transaction execution result including the read-write set, and endorses the transaction execution result. Finally, the transaction execution result and the endorsement signature result are returned to the client as the return result. After the client receives the return results of all endorsement requests, it encapsulates the results into transactions and sends them to the sorting node for sorting and block generation, and synchronizes the blocks to all accounting nodes. When the node receives the block, it verifies the transactions in the block, which may include: endorsement signature, endorsement policy verification and read-write set verification. Only after the verification is passed will the contents of the read-write set be officially written into the ledger.
[0053] A read-write set refers to the changes in the state value of a ledger obtained by simulating the execution of a transaction on a ledger snapshot. In a blockchain system based on a read-write set model, a complete transaction process needs to include a series of steps such as endorsement, sorting, and verification before it is finally written into the ledger. Therefore, the process of simulating execution and generating a read-write set does not actually modify the state of the ledger, but only records the changes in the state of the ledger.
[0054] The structure of the read-write set includes a read set and a write set. The read set includes several specific states of reading the ledger and the version number of the state, and the write set includes several state key-value pairs that simulate writing to the ledger. Assume that a transaction scenario is that account A transfers 100 yuan to account B. When executing the transaction, you first need to read the values of state A and state B in the ledger. At the same time, based on the state value, subtract 100 from the value of A and add 100 to the value of B. Finally, the changed values are simulated and written into the ledger. Assuming that the values of state A and state B in the ledger snapshot are both 200, and the version numbers are both 1, in the process of the above transaction simulation execution, two read sets will be generated first, namely<read A,1> and<read B,1> , then two write sets will be generated, namely<write A,100> and<write B,300> , these data constitute the read-write set of the simulated execution of the transaction. When the transaction is endorsed, sorted and finally enters the verification process, the read-write set verification is required.
[0055] At present, blockchain transactions are mainly divided into evidence transactions and account transactions. Among them, evidence transactions mainly operate on blockchain ledgers by adding new states, and the correlation between each transaction is not great. In the processing flow of blockchain systems based on the read-write set model, there is usually no read-write set conflict, and high-performance concurrent processing can be achieved. For account transactions, the number of states for blockchain ledgers usually rarely changes, and the main focus is on the modification of state values, which means that account transactions have a strong correlation with the order of transactions. In a batch of account transactions, different transaction orders often result in different execution results. In blockchain systems based on the read-write set model, due to the asynchronous nature of transaction confirmation, when two transactions operating the same account are initiated at the same time, the verification of one of the transactions will inevitably fail.
[0056] It should be noted that the blockchain-based batch transaction on-chain method and system disclosed in this application can be used in the field of financial technology, and can also be used in any field outside the field of financial technology. The application field of the blockchain-based batch transaction on-chain method and system disclosed in this application is not limited.
[0057] The details are described through the following embodiments.
[0058] In order to avoid the failure of transaction on-chain caused by read-write set conflicts and thus improve the reliability of transaction on-chain, this embodiment provides a batch transaction on-chain method based on blockchain, such as Figure 1 As shown, the method specifically includes the following contents:
[0059] Step 101: Obtain a target transaction file, and construct a directed acyclic graph according to the target transaction file. The nodes in the directed acyclic graph are used to represent transactions, and the directed edges between two nodes are used to represent the dependency relationship between transactions.
[0060] Specifically, the accounting node can obtain the target transaction file from the distributed file system, and construct a directed acyclic graph according to the target transaction file; the transaction file can include batch transaction data corresponding to the batch transaction; the transaction can be a transfer transaction.
[0061] Step 102: According to the directed acyclic graph, simulate the execution of batch transactions and generate shard read-write sets.
[0062] Step 103: Endorsing and signing the shard read / write set to obtain the endorsement signature result.
[0063] Specifically, the accounting node can endorse and sign the sharded read-write set, obtain the endorsement signature result, and send the sharded read-write set and the endorsement signature result to the client. After receiving the sharded read-write set and the endorsement signature result, the client encapsulates the sharded read-write set and the endorsement signature result, and sends the encapsulated sharded read-write set and the endorsement signature result to the sorting node.
[0064] Step 104: Package the shard read-write set and the endorsement signature result into a block, and broadcast the block to each accounting node in the blockchain network to complete the batch transaction chain.
[0065] Specifically, the sorting node can package the shard read-write set and the endorsement signature result into a block, and broadcast the block to each accounting node in the blockchain network to complete the batch transaction chain.
[0066] In current technology, account transactions fail due to read-write set conflicts, and files are usually processed through external systems. This method can only confirm the integrity of the files, but cannot deal with the problem of file tampering and loss. From the above description, it can be seen that the blockchain-based batch transaction chain method provided in this embodiment can solve the problem of transaction failure caused by read-write set conflicts, and then the blockchain network can be used to process the batch transactions corresponding to the files, which can improve the security and credibility of the processing flow.
[0067] In order to transmit the target transaction file between the client and the accounting node cluster and reduce the data transmission overhead of the client distributing the target transaction file, in one embodiment of the present application, step 101 includes:
[0068] Step 201: Receive an endorsement request.
[0069] Specifically, the accounting node may receive an endorsement request sent by a client; the endorsement request includes an endorsement proposal, and the endorsement proposal includes: a file path, a file identifier, and a file hash value.
[0070] Step 202: Obtain the target transaction file corresponding to the endorsement request from the distributed file system.
[0071] Specifically, the accounting node may obtain the target transaction file corresponding to the endorsement request from a distributed file system; the distributed file system may be a server cluster.
[0072] Step 203: Construct a directed acyclic graph according to the target transaction file.
[0073] From the above description, it can be seen that the batch transaction chain method provided in this embodiment, by introducing a distributed file system, transmits the target transaction file between the client and the accounting node cluster, which can reduce the data transmission overhead of the client distributing the target transaction file.
[0074] In order to solve the read-write set conflict problem caused by batch execution of account-based transactions in a blockchain system based on read-write sets, improve the reliability of transactions, and thus improve the overall performance of the system and reduce resource waste, in one embodiment of the present application, the target transaction file contains batch transaction data, each transaction data corresponds to a different transaction, and each transaction data includes: a transaction timestamp, a first transaction status, and a second transaction status; correspondingly, see Figure 2 , the step 101 of constructing a directed acyclic graph according to the target transaction file includes:
[0075] Step 301: Each transaction corresponding to the target transaction file is taken as a node.
[0076] Step 302: Establish an edge between nodes that meet the dependency condition, where the dependency condition includes: at least one of the first transaction status of the transaction being the same, the second transaction status being the same, and the first transaction status and the second transaction status being the same.
[0077] Step 303: Determine the direction of each edge according to the order of transaction timestamps.
[0078] Step 304: Each node and the edges with directions are combined into the directed acyclic graph.
[0079] In order to solve the problem of concurrent processing of account-based transactions, the transaction data may include: transaction number, transaction status 1, transaction status 2, state value transfer amount and transaction timestamp, wherein the transaction number is the unique number of the transaction, which is used to locate and trace the specific transaction, and transaction status 1 indicates the state of value reduction, and transaction status 2 indicates the state of value increase. In an example, the state in this embodiment may refer to the account name or account number, etc., which can distinguish different accounts, the state value transfer amount indicates the specific state change amount, and the transaction timestamp indicates the specific occurrence time of the transaction, and is also used to describe the order between transactions. The two ends of each edge in the directed acyclic graph can be connected to the starting node and the ending node respectively, and point from the starting node to the ending node, wherein the transaction timestamp of the starting node is before the transaction timestamp of the ending node.
[0080] For example, the transaction data of transaction 1 (No10,A,B,10,20210117231713123) indicates a transfer of 10 yuan from account A to account B, as well as the transaction number and occurrence time. The order of transactions and the dependencies between transactions can be intuitively seen from the transaction parameters. For example, from the transaction data of transaction 2 (No45,B,C,10,20210117231718456), it can be seen that its occurrence time is later than transaction 1, and there is a transaction account B that is co-operated with transaction 1. Therefore, transaction 2 must be executed after transaction 1 is confirmed to ensure the correctness of the result. From the transaction data of transaction 3 (No35,D,E,10,20210117231713456), it can be seen that there is no co-operated transaction account with transaction 1, and there is no need to wait for the confirmation of transaction 1, and it can be executed in parallel with transaction 1.
[0081] In one example, in order to describe the dependency relationship between batch transactions, a directed acyclic graph can be used. The process of constructing a directed acyclic graph is as follows:
[0082] First, the transactions are sorted by transaction timestamps. After the sorting is completed, each transaction is processed as follows according to the chronological order of the transactions until all transactions are processed: 1. The conflict domain in the transaction data is parsed, and the conflict domain is the ledger state of the exchange operation; 2. The transaction is regarded as a node of a directed acyclic graph, and edges are established with all nodes in the directed acyclic graph that have the same conflict domain; after completing the above steps, a directed acyclic graph for describing the dependency relationship between batch transactions can be constructed; wherein, the existence of the same conflict domain may refer to at least one of the following situations: the transaction state 1 of the transaction is the same, the transaction state 2 is the same, and the transaction state 1 and the transaction state 2 are the same.
[0083] From the above description, it can be seen that the batch transaction chain-up method provided in this embodiment, by constructing a directed acyclic graph for batch transactions to describe the dependency relationship between batch transactions, can ensure the concurrency of transaction execution to the greatest extent while ensuring that the subsequent batch transactions are executed in the order of dependency.
[0084] When the number of transactions corresponding to the transaction file is very large, the transaction processing time will be very time-consuming. On the one hand, the verification of the read-write set will occupy system resources for a long time, causing the system to be unable to respond to other online transactions; on the other hand, if the verification of a certain state in the read-write set fails, the entire batch transaction will fail, resulting in a waste of system resources. Based on this, in order to ensure that batch transactions are executed in the order of dependencies while maximizing the concurrency of transaction execution, see Figure 3 In one embodiment of the present application, step 102 includes:
[0085] Step 401: Execute the sharding step, which includes: obtaining a node with an in-degree of 0 as a starting node from the current directed acyclic graph; concurrently simulating the execution of transactions corresponding to the starting node, if the number of the starting nodes is less than or equal to the shard number threshold, then after the simulation is completed, taking the transaction corresponding to the starting node as a shard and generating a shard read-write set corresponding to the shard; deleting the starting node and the edge connected to the starting node from the current directed acyclic graph.
[0086] Specifically, an in-degree of 0 means that the node in the directed graph does not serve as the end point of any edge, and the shard number threshold represents the maximum number of nodes that a shard can contain; the accounting node can add the node (transaction) with an in-degree of 0 in the directed acyclic graph to the concurrent execution queue, waiting for the idle processing thread to obtain and execute it from the queue; when the transaction is executed, delete the node and the edge connected to the node from the directed acyclic graph; repeat the above steps until all transactions are executed.
[0087] It can be understood that the directed acyclic graph contains one or more nodes with an in-degree of 0. A node (transaction) with an in-degree of 0 indicates that it has no dependency on other transactions and can be executed in parallel with each other. A node (transaction) with an in-degree other than 0 needs to wait for the completion of the previous transaction before it can be executed.
[0088] Furthermore, if the number of the starting nodes is greater than the shard number threshold, the starting nodes can be divided into n shards, wherein the number of nodes in n-1 shards is equal to the shard number threshold, and the number of nodes in 1 shard is less than or equal to the shard number threshold.
[0089] Among them, after the simulation execution is completed, the transaction corresponding to the starting node is taken as a shard and a shard read-write set corresponding to the shard is generated, which may include: after the simulation execution is completed, a transaction read-write set corresponding to each starting node is generated according to the current account book snapshot, each transaction read-write set constitutes a shard read-write set of the current shard, and the account book snapshot is updated according to the shard read-write set.
[0090] Step 402: Return to execute the sharding step until the directed acyclic graph is empty.
[0091] It can be understood that the directed acyclic graph being empty may indicate that all batch transactions corresponding to the directed acyclic graph have completed the sharding steps.
[0092] In a blockchain system based on read-write sets, the read-write sets are obtained by simulating the execution of the accounting nodes based on the current blockchain ledger snapshot, and will only be finally updated to the ledger after the transactions are sorted and verified. As a result, in the process from the generation of the read-write set to the final writing of the ledger, if other transactions involve the same state operation, that is, when there is a read-write set conflict with the previous transaction, only the first transaction will be successfully written into the ledger, and the subsequent conflicting read-write sets will fail to be written, which will eventually cause these conflicting transactions to fail to be included in the block. The main reason for the read-write set conflict is that multiple transactions generate read-write sets based on the same ledger snapshot. In order to solve the problem of read-write set conflicts in batch transactions, the generation method of read-write sets needs to be adjusted.
[0093] Based on this, for the same shards in the same batch, the transaction corresponding to the starting node is used as a shard and the shard read-write set corresponding to the shard is generated by combining transaction read-write sets. For example, assuming that the values of states A, B, C, and D in the ledger snapshot before the current shard is executed are all 100, and the version numbers are all 1. After simulating the execution of transactions (A, B, 50) and (C, D, 40), a shard read-write set is obtained, which includes:<read A,1> ,<read B,1> ,<read C,1> ,<readD,1> as well as<write,A,50> ,<write,B,150> ,<write,C,60> ,<write,D,140> .
[0094] For different shards in the same batch, the read-write set is generated by updating the ledger snapshot. After the current shard is executed, the state of the ledger snapshot will be updated according to the execution result, and the subsequent shards will simulate the execution of transactions based on the updated ledger snapshot. For example, based on the above example, when the shard is executed, the state values of A, B, C, and D of the ledger snapshot will be changed to 50, 150, 60, and 140 respectively, and the version number is 2. The subsequent shards will simulate the execution of transactions based on this new ledger snapshot instead of the initial ledger snapshot.
[0095] Specifically, when the number of transactions in a batch file is very large, the transaction processing time will be very time-consuming. On the one hand, when verifying the read-write set, the system resources will be occupied for a long time, causing the system to be unable to respond to other online transactions. On the other hand, if the verification of a certain state in the read-write set fails, the entire batch transaction will fail, resulting in a waste of system resources. Therefore, the batch file needs to be sharded.
[0096] The size of the shard follows two principles and takes the minimum value:
[0097] 1. Define the batch sharding parameter, that is, the shard number threshold s mentioned above, which means that a shard is formed by at most s transactions in a batch transaction. The generation and verification of shard read-write sets will be based on shards, that is, each shard has a shard read-write set after execution.
[0098] 2. There cannot be interdependent transactions within a shard. When the read-write set of the next transaction conflicts with the transaction to be sharded, the next shard will start after the next transaction.
[0099] When verifying a block, if the verification of a sharded read / write set fails, you only need to find the transactions under the shard to which the sharded read / write set belongs, as well as all subsequent transactions of these transactions in the directed acyclic graph, and resend these transactions without having to push the entire disk to redo it.
[0100] like Figure 4 As shown, in an example of the present application, a directed acyclic graph can be generated according to the transaction data of the batch transaction, and a group of parallel execution queues, i.e., a shard, are formed of nodes (A, B), (D, E) and (G, H) in the directed acyclic graph whose in-degree is 0 and is less than or equal to the threshold of the number of shards; the nodes (A, B), (D, E) and (G, H) in the directed acyclic graph are deleted; and the nodes (A, C) and (B, F) in the directed acyclic graph after the deletion whose in-degree is 0 and is less than or equal to the threshold of the number of shards are obtained again as A group of parallel execution queues; delete nodes (A, C) and (B, F) in the directed acyclic graph; obtain nodes (F, A) and (C, E) with an in-degree of 0 and less than or equal to the threshold of the number of shards from the deleted directed acyclic graph as a group of parallel execution queues; delete nodes (F, A) and (C, E) in the directed acyclic graph; obtain nodes (C, H) with an in-degree of 0 and less than or equal to the threshold of the number of shards from the deleted directed acyclic graph as a group of parallel execution queues to complete the sharding process. Figure 4 (A, B), (A, C), (D, E), (B, F), (F, A), (C, E), (G, H), (C, H) are used to represent batch transactions sorted by transaction timestamps in sequence, and A to H represent transaction status. In addition, during the block verification process, if it is determined that the endorsement signature result and / or shard read-write set verification of transaction (B, F) fails, then the subgraph with (B, F) as the root node can be intercepted from the directed acyclic graph generated according to the transaction data of the batch transaction, that is, the subgraph composed of nodes (B, F) and (F, A), as a new directed acyclic graph to be executed, and the transaction can be re-executed according to the above rules.
[0101] In order to ensure the integrity of the transaction file and thus improve the reliability of the directed acyclic graph, in one embodiment of the present application, step 101 includes:
[0102] Verify whether the file hash value in the endorsement request is consistent with the hash value of the target transaction file in the distributed file system, and if so, construct a directed acyclic graph based on the target transaction file.
[0103] Specifically, if it is verified that the file hash value in the endorsement request is inconsistent with the hash value of the target transaction file, the current operation is terminated.
[0104] In order to further improve the reliability of the block on-chain processing, in one embodiment of the present application, step 104 includes:
[0105] If the read-write sets of each shard in the block and the corresponding endorsement signature results are verified successfully, the ledgers in each accounting node are updated according to the block.
[0106] Specifically, the read-write set verification may include: reading state A and state B from the real ledger, checking whether their version numbers are consistent with the version numbers in the read set, if they are consistent, the verification passes, and the ledger state is eventually updated according to the content in the write set. Otherwise, the read-write set verification fails, and the ledger state is not updated.
[0107] In order to further improve the reliability of the block on-chain processing, in one embodiment of the present application, step 104 also includes:
[0108] Step 041: If there are transactions in the transactions corresponding to the block that fail to verify the shard read / write set and / or endorsement signature result, then determine the subsequent transactions of the transactions that failed to verify based on the directed acyclic graph.
[0109] It can be understood that the block can correspond to multiple shards, each shard can correspond to multiple transactions, and each shard includes: an endorsement signature result and a group of shard read-write sets. Therefore, each endorsement signature result can correspond to multiple transactions, and a group of shard read-write sets can correspond to multiple transactions.
[0110] Step 042: Based on the transaction that failed verification and its subsequent transactions, rebuild the directed acyclic graph and resend the transaction that failed verification and its subsequent transactions.
[0111] Specifically, the nodes in the reconstructed directed acyclic graph may represent the nodes that failed verification or subsequent nodes.
[0112] From the software level, in order to avoid the failure of transaction on-chain caused by read-write set conflicts and thus improve the reliability of transaction on-chain, the present application provides an embodiment of a batch transaction on-chain system based on blockchain for implementing all or part of the content of the batch transaction on-chain method. The batch transaction on-chain system based on blockchain specifically includes:
[0113] An accounting node and a sorting node; the accounting node is used to obtain a target transaction file, and a directed acyclic graph is constructed according to the target transaction file. The nodes in the directed acyclic graph are used to represent transactions, and the edges with directions between two nodes are used to represent the dependency relationship between transactions; according to the directed acyclic graph, batch transactions are simulated and sharded read / write sets are generated; the sharded read / write sets are endorsed and signed to obtain endorsement signature results; the sorting node is used to package the sharded read / write sets and the endorsement signature results into blocks, and the blocks are broadcast to each accounting node in the blockchain network to complete the batch transaction chain.
[0114] Wherein, both the accounting node and the sorting node can be servers, and are communicatively connected with each other.
[0115] The embodiment of the blockchain-based batch transaction on-chain system provided in this specification can be specifically used to execute the processing flow of the embodiment of the above-mentioned batch transaction on-chain method. Its functions will not be repeated here, and reference can be made to the detailed description of the embodiment of the above-mentioned batch transaction on-chain method.
[0116] To further illustrate this solution, this application provides an application example of a batch transaction on-chain system based on blockchain. In this application example, see Figure 5 The system includes: client, accounting node cluster, sorting node cluster and distributed file system, which are described as follows:
[0117] The client is used to provide the application party with a transaction interface of the blockchain system, and is used on the system side to initiate an endorsement request to the accounting node and obtain the endorsement result, and to encapsulate the endorsement result into a transaction and send it to the sorting node for packaging and sorting.
[0118] The sorting node cluster includes multiple sorting nodes, which are used to receive transactions sent from the client, sort and package the received transactions into blocks according to preset sorting conditions, and reach consensus within the cluster, and finally synchronize them to all accounting nodes. The preset sorting condition can be one of the transaction quantity, size and a certain time interval of the transaction.
[0119] The distributed file system is used to temporarily store target transaction files and is used for file transmission between the client and the accounting node cluster, which can reduce the data transmission volume of the client.
[0120] The accounting node cluster includes multiple sorting nodes, see Figure 5, each sorting node includes: a communication module, a security module, a storage module, a verification module, a file processing module, a contract module and an endorsement module. Among them, the communication module is used to provide node external communication functions, including communication with blockchain clients, accounting node clusters, sorting node clusters and distributed file systems; the security module is used to provide node identity authentication, authority management, encryption and decryption, and signature verification functions; the storage module is used to provide blockchain account storage and related cache functions, wherein the blockchain account includes a blockchain stored in the file system and a state key-value pair stored in the KV database; the verification module is used to verify the endorsement signature of the transaction in the block and the read-write set of the transaction; the file processing module provides the analysis of the target transaction file, the construction of a directed acyclic graph and the transaction retransmission processing. The contract module provides the management function of the container-based smart contract, through which the simulated execution of the transaction can be realized on the basis of the current blockchain account snapshot, and the read-write set of the transaction can be generated. The endorsement module is used to endorse the transaction execution result to ensure the validity and non-repudiation of the endorsement signature result.
[0121] From the above description, it can be seen that the blockchain-based batch transaction chain system provided by this application example can realize account-based batch transaction chain, and while ensuring transaction performance, it can reduce the long-term monopoly of system resources when processing large-scale transactions, and ensure that the batch processing process does not affect the online transactions during the period.
[0122] In conjunction with the above-mentioned blockchain-based batch transaction on-chain system, this application provides an application example of a blockchain-based batch transaction on-chain method, see Figure 6 , the method includes:
[0123] Step S11: receiving the transaction file from the application; that is, the application calls the client to upload the transaction file and initiate a batch transaction.
[0124] Step S12: Generate a batch ID; that is, the client generates a batch ID according to the hash of the transaction file and the current system timestamp.
[0125] Step S13: upload the transaction file, save the file and return the file path and identifier; that is, the client uploads the transaction file to the distributed file system and saves the storage path and file identifier of the file in the distributed file system.
[0126] Step S14: Initiate an endorsement request to the accounting node cluster; that is, the client uses the storage path, file identifier, and hash of the file in step S13 as the content of the endorsement proposal, and initiates an endorsement request to the accounting node cluster.
[0127] Step S15: Obtain the transaction file from the distributed file system according to the request content, and verify the integrity of the file according to the file hash in the request; that is, after the accounting node receives the endorsement request initiated by the client, it obtains the transaction file from the distributed file system according to the storage path and file identifier in the endorsement request, and verifies whether the hash value of the file is consistent with the hash value in the endorsement request. If the verification is successful, the transaction file is handed over to the file processing module for processing, and if the verification fails, the transaction ends.
[0128] Step S16: Construct a directed acyclic graph according to the transaction file; execute transactions in parallel according to the directed acyclic graph; when the sharding requirements are met, generate a sharding read-write set, update the account snapshot, and start executing the next shard until all transaction processing is completed; rebuild the directed acyclic graph according to the failed transaction and replay the transaction; that is, the file processing module constructs a directed acyclic graph according to the account involved in each transaction in the transaction file, and submits the batch transaction to the contract module for simulation execution according to the execution process of the directed acyclic graph, and generates a transaction read-write set. When the completed transaction meets the sharding requirements, merge the read-write set of the shard, and update the account snapshot according to the sharding read-write set, and start executing the transaction of the next shard until all transaction processing is completed. During the simulation execution, if the verification of the transaction block of the current batch fails, the subsequent dependent transactions of the failed transaction will be found in the directed acyclic graph according to the failed transactions contained in the block, and the failed transaction and its subsequent dependent transactions will be resent.
[0129] Step S17: endorse and sign the result and return it to the client; that is, the endorsement module endorses and signs the completed shard read-write set and returns the endorsement signature and the read-write set to the client.
[0130] Step S18: Receive enough endorsement results, encapsulate them into transactions and send them to the sorting node; that is, the client receives the endorsement results returned by the accounting node cluster. Assuming that the accounting node cluster has n accounting nodes, when the client receives n endorsement results of the same shard sequence number and the endorsement results are all consistent, the endorsement results and endorsement proposals can be assembled into partitioned transactions. The partitioned transaction is the result obtained by assembling the endorsement results and endorsement proposals, and is sent to the sorting node.
[0131] Step S19: Packing, sorting and block generation; that is, the sorting node sorts the received partition transactions and packs them into blocks, and reaches consensus among other sorting nodes, and finally synchronizes them to all accounting nodes through broadcasting.
[0132] Step S110: Synchronize block data, verify blocks, and update the ledger status; that is, after receiving the block, the accounting node verifies the read-write set and endorsement signature of each partition transaction. If the verification is successful, the ledger status is updated and the accounting is completed. If the verification fails, the ledger status is not updated, and the transaction is resent according to step S16.
[0133] Step S111: When all batch transactions are blocked and verified, the batch execution success is returned to the client; that is, when the accounting node receiving the endorsement request detects that all batch transactions of a batch number have been confirmed, it returns a message to the client that the batch number has been fully executed.
[0134] Step S112: Return batch completion information to the application; that is, after receiving the batch execution completion message, the client returns a batch execution success message to the application.
[0135] From the above description, it can be seen that the blockchain-based batch transaction on-chain method and system provided by this application specifically include the following beneficial effects:
[0136] 1. By introducing a distributed file system, it is used to transfer batch files between the client and the accounting node cluster, reducing the data transmission overhead of the client distributing batch files. At the same time, the integrity of the file is guaranteed by the hash value of the batch file.
[0137] 2. In order to solve the read-write set conflict problem caused by batch execution of account transactions in a blockchain system based on read-write sets, a directed acyclic graph is constructed for batch transactions to describe the dependency relationship between batch transactions, so as to guide transactions to be executed in the order of dependency while maximizing the concurrency of transaction execution.
[0138] 3. By sharding batch transactions, the system can reduce the long-term monopoly of system resources when processing large batch transactions, and avoid the system being unable to respond to other online transactions when processing batch transactions. At the same time, when some transactions in the batch transaction fail to be verified and need to be resent, the sharding technology combined with the directed acyclic graph can also find all subsequent transactions of the failed transaction, minimize the amount of resent transactions, and improve the overall efficiency and resource utilization of the system when processing batch transactions.
[0139] 4. By optimizing the generation method of read-write sets, the batch combination method is used to generate shard read-write sets for transactions on the same shard, and the shard read-write sets are generated by updating the ledger snapshot for different shards. This method can not only reduce the resource consumption of read-write sets during transmission and verification, but also avoid conflicts between read-write sets of different shards during verification.
[0140] From the hardware level, in order to avoid transaction failure caused by read-write set conflicts and thus improve the reliability of transactions, the present application provides an embodiment of an electronic device for implementing all or part of the content of the blockchain-based batch transaction on-chain method. The electronic device specifically includes the following content:
[0141] Processor, memory, communication interface and bus; wherein the processor, memory and communication interface communicate with each other through the bus; the communication interface is used to realize the information transmission between the block chain-based batch transaction chain system and related devices such as user terminals; the electronic device can be a desktop computer, a tablet computer and a mobile terminal, etc., but the present embodiment is not limited thereto. In the present embodiment, the electronic device can be implemented with reference to the embodiment for realizing the block chain-based batch transaction chain method and the embodiment for realizing the block chain-based batch transaction chain system, and the contents are incorporated herein, and the repeated parts are not repeated.
[0142] Figure 7 FIG. 9 is a schematic block diagram of the system structure of the electronic device 9600 according to an embodiment of the present application. Figure 7 As shown, the electronic device 9600 may include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. It is worth noting that Figure 7 is exemplary; other types of structures may also be used to supplement or replace this structure to implement telecommunication functions or other functions.
[0143] In one or more embodiments of the present application, the blockchain-based batch transaction on-chain function can be integrated into the central processor 9100. The central processor 9100 can be configured to perform the following control:
[0144] Step 101: Obtain a target transaction file, and construct a directed acyclic graph according to the target transaction file. The nodes in the directed acyclic graph are used to represent transactions, and the directed edges between two nodes are used to represent the dependency relationship between transactions.
[0145] Step 102: According to the directed acyclic graph, simulate the execution of batch transactions and generate shard read-write sets;
[0146] Step 103: Endorsing and signing the shard read / write set to obtain the endorsement signature result;
[0147] Step 104: Package the shard read-write set and the endorsement signature result into a block, and broadcast the block to each accounting node in the blockchain network to complete the batch transaction chain.
[0148] It can be seen from the above description that the electronic device provided by the embodiment of the present application can avoid transaction failure caused by read-write set conflicts, thereby improving the reliability of transactions.
[0149] In another embodiment, the blockchain-based batch transaction on-chain system can be configured separately from the central processor 9100. For example, the blockchain-based batch transaction on-chain system can be configured as a chip connected to the central processor 9100, and the blockchain-based batch transaction on-chain function can be realized through the control of the central processor.
[0150] like Figure 7 As shown, the electronic device 9600 may also include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is worth noting that the electronic device 9600 does not necessarily have to include Figure 7 In addition, the electronic device 9600 may also include Figure 7 For components not shown, reference may be made to the prior art.
[0151] like Figure 7 As shown, the central processing unit 9100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor device and / or logic device, which receives input and controls the operation of various components of the electronic device 9600.
[0152] The memory 9140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 9100 may execute the program stored in the memory 9140 to implement information storage or processing, etc.
[0153] The input unit 9120 provides input to the central processing unit 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to provide power to the electronic device 9600. The display 9160 is used to display display objects such as images and texts. The display may be, for example, an LCD display, but is not limited thereto.
[0154] The memory 9140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 9140 may also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application / function storage unit 9142, which is used to store application programs and function programs or processes for executing the operation of the electronic device 9600 through the central processor 9100.
[0155] The memory 9140 may also include a data storage unit 9143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 9144 of the memory 9140 may include various drivers for communication functions of the electronic device and / or for executing other functions of the electronic device (such as messaging applications, address book applications, etc.).
[0156] The communication module 9110 is a transmitter / receiver 9110 that sends and receives signals via an antenna 9111. The communication module (transmitter / receiver) 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.
[0157] Based on different communication technologies, multiple communication modules 9110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless LAN module, etc. The communication module (transmitter / receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide an audio output via the speaker 9131 and receive an audio input from the microphone 9132, thereby realizing a common telecommunication function. The audio processor 9130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 9130 is also coupled to the central processor 9100, so that recording can be performed on the local machine through the microphone 9132, and the sound stored on the local machine can be played through the speaker 9131.
[0158] It can be seen from the above description that the electronic device provided by the embodiment of the present application can avoid transaction failures caused by read-write set conflicts, thereby improving the reliability of transactions.
[0159] The embodiments of the present application also provide a computer-readable storage medium capable of implementing all the steps in the method for batch transaction on-chain based on blockchain in the above embodiments. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, all the steps in the method for batch transaction on-chain based on blockchain in the above embodiments are implemented. For example, when the processor executes the computer program, the following steps are implemented:
[0160] Step 101: Obtain a target transaction file, and construct a directed acyclic graph according to the target transaction file. The nodes in the directed acyclic graph are used to represent transactions, and the directed edges between two nodes are used to represent the dependency relationship between transactions.
[0161] Step 102: According to the directed acyclic graph, simulate the execution of batch transactions and generate shard read-write sets;
[0162] Step 103: Endorsing and signing the shard read / write set to obtain the endorsement signature result;
[0163] Step 104: Package the shard read-write set and the endorsement signature result into a block, and broadcast the block to each accounting node in the blockchain network to complete the batch transaction chain.
[0164] It can be seen from the above description that the computer-readable storage medium provided in the embodiment of the present application can avoid transaction failures caused by read-write set conflicts, thereby improving the reliability of transactions.
[0165] In this application, each embodiment of the above method is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. For relevant parts, refer to the partial description of the method embodiment.
[0166] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0167] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0168] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0169] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0170] Specific embodiments are used in this application to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core idea of this application. At the same time, for those skilled in the art, according to the idea of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on this application.
Claims
1. A method for batch transaction on-chain based on blockchain, characterized in that: include: Obtain a target transaction file, and construct a directed acyclic graph according to the target transaction file, wherein nodes in the directed acyclic graph are used to represent transactions, and directed edges between two nodes are used to represent dependency relationships between transactions; According to the directed acyclic graph, simulate the execution of batch transactions and generate shard read-write sets; Endorsing and signing the shard read-write set to obtain the endorsement signature result; Packing the shard read-write set and the endorsement signature result into a block, and broadcasting the block to each accounting node in the blockchain network to complete the batch transaction chain; The target transaction file includes batch transaction data, each transaction data corresponds to a different transaction, and each transaction data includes: a transaction timestamp, a first transaction status, and a second transaction status; Correspondingly, the step of constructing a directed acyclic graph according to the target transaction file includes: Each transaction corresponding to the target transaction file is used as a node; Establishing an edge between nodes that meet a dependency condition, the dependency condition comprising: at least one of the first transaction status of the transaction being the same, the second transaction status being the same, and the first transaction status and the second transaction status being the same; Determine the direction of each edge based on the order of transaction timestamps; Each node and the edges with directions form the directed acyclic graph.
2. The method for batch transaction on-chain based on blockchain according to claim 1, characterized in that: The step of obtaining a target transaction file and constructing a directed acyclic graph according to the target transaction file includes: receiving endorsement requests; Obtaining a target transaction file corresponding to the endorsement request from a distributed file system; A directed acyclic graph is constructed according to the target transaction file.
3. The method for batch transaction on-chain based on blockchain according to claim 1, characterized in that: The step of simulating and executing batch transactions and generating shard read / write sets according to the directed acyclic graph includes: Execute a sharding step, which includes: obtaining a node with an in-degree of 0 as a starting node from the current directed acyclic graph; concurrently simulating and executing transactions corresponding to the starting node, and if the number of the starting nodes is less than or equal to a shard number threshold, after the simulation is completed, taking the transaction corresponding to the starting node as a shard and generating a shard read-write set corresponding to the shard; deleting the starting node and the edge connected to the starting node from the current directed acyclic graph; Return to execute the sharding step until the directed acyclic graph is empty.
4. The method for batch transaction on-chain based on blockchain according to claim 2, characterized in that: The step of constructing a directed acyclic graph according to the target transaction file includes: Verify whether the file hash value in the endorsement request is consistent with the hash value of the target transaction file in the distributed file system, and if so, construct a directed acyclic graph based on the target transaction file.
5. The method for batch transaction on-chain based on blockchain according to claim 1, characterized in that: The block is broadcasted to each accounting node in the blockchain network to complete the batch transaction chain, including: If the shard read-write set and the endorsement signature results in the block are verified successfully, the ledgers in each accounting node are updated according to the block.
6. The method for batch transaction on-chain based on blockchain according to claim 1, characterized in that: The process of broadcasting the block to each accounting node in the blockchain network to complete the batch transaction chaining also includes: If there are transactions in the transactions corresponding to the block that fail to verify the shard read / write set and / or the endorsement signature result, then determine the subsequent transactions of the transactions that failed to verify according to the directed acyclic graph; According to the transaction that failed verification and its subsequent transactions, a directed acyclic graph is rebuilt and the transaction that failed verification and its subsequent transactions are resent.
7. A batch transaction on-chain system based on blockchain, characterized in that: include: Accounting nodes and sorting nodes; The accounting node is used to obtain a target transaction file, and construct a directed acyclic graph according to the target transaction file. The nodes in the directed acyclic graph are used to represent transactions, and the edges with directions between two nodes are used to represent the dependency relationship between transactions; according to the directed acyclic graph, batch transactions are simulated and a shard read-write set is generated; the shard read-write set is endorsed and signed to obtain an endorsement signature result; The sorting node is used to package the shard read-write set and the endorsement signature result into a block, and broadcast the block to each accounting node in the blockchain network to complete the batch transaction chain; The target transaction file includes batch transaction data, each transaction data corresponds to a different transaction, and each transaction data includes: a transaction timestamp, a first transaction status, and a second transaction status; Correspondingly, the step of constructing a directed acyclic graph according to the target transaction file includes: Each transaction corresponding to the target transaction file is used as a node; Establishing an edge between nodes that meet a dependency condition, the dependency condition comprising: at least one of the first transaction status of the transaction being the same, the second transaction status being the same, and the first transaction status and the second transaction status being the same; Determine the direction of each edge based on the order of transaction timestamps; Each node and the edges with directions form the directed acyclic graph.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the blockchain-based batch transaction on-chain method described in any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the instruction is executed, the blockchain-based batch transaction on-chain method described in any one of claims 1 to 6 is implemented.
