Transaction processing method and device based on block chain, equipment and medium
By separating transaction broadcasting and consensus networks in the blockchain system, the problem of low transaction processing efficiency is solved, and more efficient and flexible transaction processing is achieved.
Patent Information
- Application Number
- CN202410146272.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-01
- Publication Date
- 2025-08-01
AI Technical Summary
In blockchain transaction processing, the coupling between transaction broadcasting and transaction consensus is high, resulting in low transaction processing efficiency.
By deploying blockchain nodes in an independent transaction broadcast network and a transaction consensus network, the separation and decoupling of transaction broadcast and transaction consensus are achieved, and transaction broadcast network is used for transaction broadcasting, and transaction consensus network is used for transaction consensus.
It reduces the coupling between transaction broadcasting and transaction consensus, ensures that transaction consensus can still be executed when transaction broadcasting is abnormal, improves transaction processing efficiency, and allows transaction broadcasting and consensus to be executed in parallel, improving the performance of the blockchain system.
Smart Images

Figure CN120407219A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of blockchain technology, and in particular, to a transaction processing method based on blockchain, a transaction processing device based on blockchain, an electronic device, and a computer-readable medium. Background Art
[0002] A blockchain system is a database system that can store data on different blockchain nodes respectively and access it through network connection. In this type of database, each blockchain node jointly maintains the data by reaching a consensus with each other.
[0003] It can be understood that the blockchain transaction process usually includes transaction broadcasting and transaction consensus. Among them, transaction broadcasting means that the client sends a transaction request to a certain blockchain node in the blockchain system, and then this blockchain node will send the transaction request to other blockchain nodes in the blockchain system by broadcasting, so that each blockchain node in the blockchain system can obtain the transaction request; transaction consensus means that each blockchain node in the blockchain system reaches a consensus on the transaction data corresponding to the transaction request.
[0004] It can be seen that in the related art, the coupling between transaction broadcasting and transaction consensus is high. The failure of transaction broadcasting will affect the execution of transaction consensus, and the transaction processing efficiency is low. Therefore, how to improve the transaction processing efficiency is an urgent problem to be solved. Summary of the Invention
[0005] Embodiments of the present application provide a transaction processing method, device, equipment, and medium based on blockchain, which improve the transaction processing efficiency.
[0006] In a first aspect, an embodiment of the present application provides a transaction processing method based on blockchain. The method includes: receiving a transaction request to be added sent by a blockchain node through a transaction broadcasting network, where the transaction request to be added is received by the blockchain node from a client; adding the transaction request to be added to a transaction pool, and extracting a transaction request to be consensus from the transaction pool; performing consensus on the transaction data corresponding to the transaction request to be consensus through a transaction consensus network, where the transaction consensus network and the transaction broadcasting network are different networks.
[0007] In a second aspect, an embodiment of the present application provides a transaction processing device based on a blockchain. The device includes: a receiving module configured to receive a transaction request to be added sent by a blockchain node through a transaction broadcast network, where the transaction request to be added is received by the blockchain node from a client; an adding and extracting module configured to add the transaction request to be added to a transaction pool and extract a transaction request to be consensus from the transaction pool; a consensus module configured to perform consensus on the transaction data corresponding to the transaction request to be consensus through a transaction consensus network, where the transaction consensus network and the transaction broadcast network are different networks.
[0008] In an embodiment of the present application, based on the foregoing solution, the receiving module is specifically configured to: receive a plurality of transaction requests to be added sent by a blockchain node through a transaction broadcast network; the adding and extracting module is specifically configured to: combine the plurality of transaction requests to be added to obtain a transaction request group; add the transaction request group to the transaction pool, and use each transaction request to be added in the transaction request group as a transaction request to be consensus.
[0009] In an embodiment of the present application, based on the foregoing solution, the device may further include: a construction module configured to construct a transaction broadcast network and a transaction consensus network; a deployment module configured to deploy a plurality of blockchain nodes included in the blockchain system in the transaction broadcast network and the transaction consensus network.
[0010] In an embodiment of the present application, based on the foregoing solution, the adding and extracting module is specifically configured to: determine a first target blockchain node that has received the transaction request to be added through the transaction broadcast network from the plurality of blockchain nodes; if the number of the first target blockchain nodes reaches a first preset quantity threshold, add the transaction request to be added to the transaction pool.
[0011] In an embodiment of the present application, based on the foregoing solution, the adding and extracting module is further specifically configured to: in the transaction broadcast network, receive response information sent by each blockchain node for indicating that the transaction request to be added has been received; determine, from the plurality of blockchain nodes, the blockchain nodes corresponding to the response information for indicating that the transaction request to be added has been received, and use the determined blockchain nodes as the first target blockchain nodes.
[0012] In one embodiment of the present application, based on the foregoing solution, the transaction requests to be consensus include multiple ones; the consensus module is specifically configured to: determine, from the multiple blockchain nodes, second target blockchain nodes that have passed the verification of the transaction execution order among the multiple transaction requests to be consensus through the transaction consensus network; if the number of the second target blockchain nodes reaches a second preset number threshold, determine that the transaction data corresponding to the multiple transaction requests to be consensus has passed the consensus.
[0013] In one embodiment of the present application, based on the foregoing solution, the consensus module is further specifically configured to: in the transaction consensus network, receive response information sent by each blockchain node for indicating that the verification of the transaction execution order among the multiple transaction requests to be consensus has passed; determine, from the multiple blockchain nodes, the blockchain nodes corresponding to the response information for indicating that the verification of the transaction execution order among the multiple transaction requests to be consensus has passed, and use the determined blockchain nodes as the second target blockchain nodes.
[0014] In one embodiment of the present application, based on the foregoing solution, the multiple transaction requests to be consensus include each to-be-added transaction request in multiple transaction request groups, and different transaction request groups come from different blockchain nodes; the device may further include: an acquisition module configured to acquire, in the transaction consensus network, the broadcast credential information of each transaction request group; wherein the broadcast credential information is generated based on the voting information of the transaction request group, and the voting information is generated in response to the reception situation of the transaction request group when the transaction request group is broadcast; a generation module configured to generate proposal data based on the broadcast credential information of the multiple transaction request groups; a sending module configured to send the proposal data to each blockchain node, so that each blockchain node responds to the transaction execution order among the multiple transaction requests to be consensus based on the proposal data.
[0015] In one embodiment of the present application, based on the foregoing solution, the transaction requests to be consensus include multiple ones; the consensus module is specifically configured to: determine, from the multiple blockchain nodes, third target blockchain nodes that have passed the verification of the transaction execution result through the transaction consensus network; wherein the transaction execution result is obtained by executing the multiple transaction requests to be consensus; if the number of the third target blockchain nodes reaches a third preset number threshold, determine that the transaction data corresponding to the multiple transaction requests to be consensus has passed the consensus.
[0016] In one embodiment of the present application, based on the foregoing solution, the consensus module is further specifically configured to: in the transaction consensus network, receive response information sent by each blockchain node indicating that the verification of the transaction execution result has passed; determine, from the multiple blockchain nodes, the blockchain nodes corresponding to the response information indicating that the verification of the transaction execution result has passed, and use the determined blockchain nodes as the third target blockchain nodes.
[0017] In one embodiment of the present application, based on the foregoing solution, the device may further include: a storage module configured to obtain a block generated based on the transaction execution results corresponding to the multiple transaction requests to be consensus and store the block on the blockchain.
[0018] In one embodiment of the present application, based on the foregoing solution, the consensus module is specifically configured to: obtain a network quality indicator of the transaction consensus network; if it is detected based on the network quality indicator that the current network quality of the transaction consensus network is greater than a preset network quality threshold, perform consensus on the transaction data corresponding to the transaction request to be consensus through the transaction consensus network.
[0019] In a third aspect, an embodiment of the present application provides an electronic device, including one or more processors; a memory for storing one or more programs, and when the one or more programs are executed by the one or more processors, the electronic device implements the blockchain-based transaction processing method as described above.
[0020] In a fourth aspect, an embodiment of the present application provides a computer-readable medium, on which a computer program is stored, and when the computer program is executed by a processor, the blockchain-based transaction processing method as described above is implemented.
[0021] In a fifth aspect, an embodiment of the present application provides a computer program product, including computer instructions, and when the computer instructions are executed by a processor, the blockchain-based transaction processing method as described above is implemented.
[0022] In the technical solution provided by the embodiment of the present application: blockchain nodes are simultaneously deployed in the transaction broadcast network and the transaction consensus network, whereby transaction broadcast can be realized through the transaction broadcast network and transaction consensus can be realized through the transaction consensus network; wherein:
[0023] On the one hand, through the transaction broadcast network and the transaction consensus network, transaction broadcast and transaction consensus are separated / decoupled, reducing the coupling between the two. Even if the transaction broadcast network fails, transaction consensus can still be executed. Correspondingly, even if the transaction consensus network fails, transaction broadcast can still be executed, thus avoiding the phenomenon that transaction broadcast and transaction consensus are executed in the same network and affect each other, and improving the transaction processing efficiency.
[0024] On the other hand, according to actual requirements, transaction broadcasting and transaction consensus can be executed in parallel, further improving the transaction processing efficiency, and the transaction process is more flexible, enhancing the performance of the blockchain system.
[0025] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit this application. Brief Description of the Drawings
[0026] Figure 1A It is a schematic structural diagram of a data sharing system.
[0027] Figure 1B It is a schematic diagram of the connection relationship between blocks in the blockchain.
[0028] Figure 1C It is a schematic diagram of the generation of blocks in the blockchain.
[0029] Figure 2 It is a schematic diagram of the broadcasting of a transaction shown in another exemplary embodiment of this application.
[0030] Figure 3 It is a schematic diagram of the consensus of a transaction shown in another exemplary embodiment of this application.
[0031] Figure 4 It is a schematic diagram of an exemplary implementation environment to which the technical solution of the embodiment of this application can be applied.
[0032] Figure 5 It is a flowchart of a blockchain-based transaction processing method shown in an exemplary embodiment of this application.
[0033] Figure 6 It is a flowchart of a blockchain-based transaction processing method shown in another exemplary embodiment of this application.
[0034] Figure 7 It is a flowchart of a blockchain-based transaction processing method shown in another exemplary embodiment of this application.
[0035] Figure 8 It is a flowchart of a blockchain-based transaction processing method shown in another exemplary embodiment of this application.
[0036] Figure 9 It is a schematic diagram of broadcasting a voucher information group shown in another exemplary embodiment of this application.
[0037] Figure 10 It is a flowchart of a blockchain-based transaction processing method shown in another exemplary embodiment of this application.
[0038] Figure 11It is a flowchart of a blockchain-based transaction processing method shown in another exemplary embodiment of the present application.
[0039] Figure 12 It is a schematic diagram of a blockchain-based transaction processing method shown in another exemplary embodiment of the present application.
[0040] Figure 13 It is a block diagram of a blockchain-based transaction processing apparatus shown in an exemplary embodiment of the present application.
[0041] Figure 14 It is a schematic diagram of the structure of a computer system of an electronic device suitable for implementing the embodiments of the present application. Detailed implementation manners
[0042] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners of the present application. On the contrary, they are merely examples of the devices and methods that are the same as some aspects of the present application as detailed in the appended claims.
[0043] In the embodiments of the present application, the term "module" or "unit" refers to a computer program with a predetermined function or a part of a computer program, which works together with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of the overall module or unit that includes the function of the module or unit.
[0044] The block diagrams shown in the drawings are only functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0045] The flowcharts shown in the drawings are only exemplary illustrations, and do not necessarily include all the content and operations / steps, nor do they necessarily need to be executed in the described order. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined. Therefore, the actual execution order may change according to the actual situation.
[0046] It should be noted that "multiple" mentioned in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after.
[0047] Before introducing the technical solutions of the embodiments of this application, first, the nouns and terms involved in the embodiments of this application are described. The nouns and terms involved in the embodiments of this application are applicable to the following explanations.
[0048] Blockchain: A distributed ledger technology in the field of information technology, generally composed of consensus, transaction blocks and state data storage, cryptographic identity security, etc. Since the ledger is distributedly stored and the blocks are consensus-based, it has characteristics such as immutability, traceability, and joint maintenance.
[0049] Smart contract: A computer protocol designed to spread, verify, or execute contracts in an information-based manner, which allows for trusted transactions without a third party. The specific form of a smart contract is code deployed on the blockchain to complete specific functions.
[0050] Transaction pool: A pool in the blockchain that temporarily stores block transactions. Each transaction to be included in a block will first reach the transaction pool for temporary storage and be sorted in a certain priority order. When generating a new block, transactions are retrieved from the transaction pool in order, and then the blockchain executes and verifies the transactions. Finally, after all nodes verify and pass, the transactions in the block are deleted from the transaction pool.
[0051] Signature data: Also known as digital signature or public key digital signature, it is a digital string generated by the sender of the information that cannot be forged by others, and it is an effective proof of the authenticity of the information sent by the sender of the information.
[0052] Signature verification: The receiving party needs to confirm whether the ciphertext file it receives is really sent by the sender and whether it has been tampered with (different from decryption). Signature verification is ultimately based on a comparison of the message digest.
[0053] Secondly, the blockchain technology used in the embodiments of this application is introduced in detail.
[0054] See Figure 1AThe data sharing system (also known as the blockchain system) 100 shown is a system for data sharing between nodes (also known as blockchain nodes, the same below). The blockchain system may include multiple nodes 101, and each node can be a server or a terminal device. When each node is operating normally, it can receive input information and maintain the shared data within the blockchain system based on the received input information. To ensure information interconnection within the blockchain system, there can be information connections between each pair of nodes in the blockchain system, and nodes can transmit information through the above-mentioned information connections. For example, when any node in the blockchain system receives input information, other nodes in the blockchain system obtain the input information according to the consensus algorithm and store the input information as data in the shared data, so that the data stored on all nodes in the blockchain system is consistent.
[0055] For each node in the blockchain system, it has a corresponding node identifier, and each node in the blockchain system can store the node identifiers of other nodes in the blockchain system, so that later, according to the node identifiers of other nodes, the generated block can be broadcast to other nodes in the blockchain system. Each node can maintain a node identifier list as shown in the following table, and store the node name and node identifier corresponding to each other in the node identifier list. Among them, the node identifier can be the Internet Protocol (IP) address for interconnection between networks and any other information that can be used to identify the node. Only the IP address is used as an example in Table 1 for illustration.
[0056] Node Name Node Identification Node 1 xxx.xxx.xxx.xxx Node 2 xxx.xxx.xxx.xxx … … Node N xxx.xxx.xxx.xxx
[0057] Table 1
[0058] Each node in the blockchain system stores an identical blockchain. The blockchain consists of multiple blocks. Refer to Figure 1B , the blockchain consists of multiple blocks. The genesis block includes a block header and a block body. The block header stores the input information feature value, version number, timestamp, and difficulty value, and the block body stores the input information; the next block after the genesis block uses the genesis block as the parent block. The next block also includes a block header and a block body. The block header stores the input information feature value of the current block, the block header feature value of the parent block, version number, timestamp, and difficulty value, and so on. In this way, the block data stored in each block in the blockchain is associated with the block data stored in the parent block, ensuring the security of the input information in the block.
[0059] When generating each block in the blockchain, refer to Figure 1CWhen the node where the blockchain is located receives the input information, it verifies the input information. After the verification is completed, the input information is stored in the memory pool, and its hash tree for recording the input information is updated. Then, the update timestamp is updated to the time when the input information is received, and different random numbers are tried, and the eigenvalue calculation is performed multiple times so that the calculated eigenvalue can satisfy the following formula:
[0060] SHA256(SHA256(version + prev_hash + merkle_root + ntime + nbits + x)) < TARGET
[0061] Among them, SHA256 is the eigenvalue algorithm used to calculate the eigenvalue; version (version number) is the version information of the relevant block protocol in the blockchain; prev_hash is the block header eigenvalue of the parent block of the current block; merkle_root is the eigenvalue of the input information; ntime is the update time of the update timestamp; nbits is the current difficulty, which is a fixed value within a period of time and is determined again after exceeding the fixed time period; x is a random number; TARGET is the eigenvalue threshold, and this eigenvalue threshold can be determined according to nbits.
[0062] In this way, when a random number that satisfies the above formula is calculated, the information can be stored correspondingly, the block header and the block body are generated, and the current block is obtained. Subsequently, the node where the blockchain is located sends the newly generated block to other nodes in its blockchain system according to the node identifiers of other nodes in the blockchain system, and other nodes verify the newly generated block and add the newly generated block to the blockchain they store after the verification is completed.
[0063] The aforementioned blockchain is generally divided into three types: public blockchain, private blockchain, and consortium blockchain. In addition, there can also be combinations of the above multiple types, such as private blockchain + consortium blockchain, consortium blockchain + public blockchain, etc.
[0064] Among them, the public blockchain has the highest degree of decentralization. Among them, the participants (also called nodes) who join the public blockchain can read the data records on the chain, participate in transactions, and compete for the right to record new blocks, etc. Moreover, each node can freely join or exit the blockchain system and perform relevant operations.
[0065] In contrast, for a private blockchain, the write permission of the blockchain system is controlled by a certain organization or institution, and the data read permission is subject to the organization's regulations. Simply put, a private blockchain can be a weakly centralized system with strict restrictions on nodes and a small number of nodes. This type of blockchain is more suitable for internal use within a specific institution.
[0066] A consortium blockchain is a blockchain that lies between a public blockchain and a private blockchain and can achieve "partial decentralization". Each node in a consortium blockchain usually corresponds to a corresponding entity organization; nodes join the network through authorization and form an interest-related consortium to jointly maintain the operation of the blockchain system.
[0067] It can be understood that the blockchain transaction process usually includes transaction broadcasting and transaction consensus; among them:
[0068] Transaction broadcasting means that the client sends a transaction request to a certain node in the blockchain system, and then this node will send the transaction request to other nodes in the blockchain system through broadcasting, so that each node in the blockchain system can obtain the transaction request.
[0069] See Figure 2 , in the related technology, a round of broadcasting process can be sequentially divided into three broadcasting stages according to the execution order, namely the batch processing stage (Batch), the pre-confirmation stage (Echo), and the pre-preparation stage (Ready). Among the multiple blockchain nodes participating in the same round of broadcasting process, there are two types: broadcasting nodes and non-broadcasting nodes. A so-called broadcasting node is a node that is responsible for packing the transaction requests to be added (which can be one or more) in the batch processing stage of the current round of broadcasting process, and broadcasting the transaction requests to be added to other blockchain nodes participating in the broadcast for broadcast processing; at the same time, it is also responsible for performing broadcast processing on the transaction requests to be added. A non-broadcasting node only performs broadcast processing on the transaction requests to be added.
[0070] Broadcast processing includes pre-confirmation processing and pre-preparation processing. Pre-confirmation processing occurs in the pre-confirmation stage, while pre-preparation processing occurs in the pre-preparation stage. Pre-confirmation processing is a process of whether to agree to pre-confirm the transaction request to be added. If it is agreed to pre-confirm the transaction request to be added, it means that the transaction request to be added has been received. Pre-preparation processing is a process of whether to agree to pre-prepare the transaction request to be added. If it is agreed to pre-prepare the transaction request to be added, it means that it is confirmed that the transaction request to be added has been received. In multiple rounds of broadcasting process, for different rounds of broadcasting process, the blockchain nodes participating in the broadcast may change, that is, the blockchain nodes participating in the broadcast process in each round may change, and the broadcasting nodes may change, and the transaction requests to be added may also change.
[0071] Transaction consensus means that each node in the blockchain system reaches a consensus on the transaction data corresponding to a transaction request. Consensus is usually achieved based on a consensus algorithm. Each node participating in the consensus executes the corresponding processes of the consensus process by running the consensus algorithm. Optional consensus algorithms can include, for example, the Proof of Work (PoW), Proof of Stake (PoS), Delegated Proof of Stake (DPoS), Practical Byzantine Fault Tolerance (PBFT), etc.
[0072] Generally, at a certain block height in the blockchain, one or more rounds of consensus processes are required to reach an agreement among all the nodes participating in the consensus. The block height is used to represent the number of blocks connected to the blockchain. The block height is the identifier of the block and can be used to indicate the position of the block in the blockchain. For example, the block height of the genesis block in the blockchain is defaulted to 0. The block height of the first block after the genesis block is 1 (this first block can be simply referred to as block 1), the block height of the second block after the genesis block is 2 (this second block can be simply referred to as block 2), and so on.
[0073] For example, if the block height of the current block of a certain blockchain is 300 (simply referred to as block 300), this means that 300 blocks have been stacked on top of the genesis block, that is, the number of blocks on the blockchain formed from the genesis block to block 300 is 301. The consensus process carried out at a certain block height in the blockchain refers to the process of reaching a consensus on the block to be added to the blockchain when the blockchain is at that certain block height. If the consensus of the block to be added to the blockchain is successful, the block is added to the blockchain, and the block height of the blockchain is incremented by 1. For example: The consensus process at block height 10 of the blockchain refers to the process of reaching a consensus on the block to be added to the blockchain when the blockchain is at block height 10. If the consensus of this block is successful, the block is added to the blockchain, and the block height of the blockchain changes from 10 to 11.
[0074] See Figure 3, in the related art, a round of consensus process can be sequentially divided into three consensus stages according to the execution order, namely the proposal stage (Pre-prepare), the pre-vote stage (Prepare), and the pre-commit stage (Commit). Among the multiple nodes participating in the same round of consensus process, there are two types: the proposal node (also called the primary node, the same below) and the non-proposal node (also called the secondary node, the same below). The so-called proposal node refers to a node elected by multiple nodes participating in the consensus. As the proposal node, it is responsible for generating the block to be consensus in the proposal stage of this round of consensus process, and broadcasting the block to be consensus to other nodes participating in the consensus for consensus processing; at the same time, it is also responsible for consensus processing of the block to be consensus. The non-proposal node only performs consensus processing on the block to be consensus.
[0075] Consensus processing includes pre-vote processing and pre-commit processing. Pre-vote processing occurs in the pre-vote stage, and pre-commit processing occurs in the pre-commit stage. Pre-vote processing refers to the process of whether to agree to pre-vote on the block to be consensus. If agreeing to pre-vote on the block to be consensus, it means agreeing to add the block to the blockchain. Pre-commit processing refers to the process of whether to agree to pre-commit on the block to be consensus. If agreeing to pre-commit on the block to be consensus, it means confirming to agree to add the block to the blockchain. In multiple rounds of consensus processes at the same block height, for different rounds of consensus processes, the nodes participating in the consensus may change, that is, the nodes participating in each round of consensus process may change, and the proposal node may change, and the block to be consensus may also change.
[0076] It can be understood that since transaction broadcasting and transaction consensus are serially executed based on the same network in the related art, the coupling between transaction broadcasting and transaction consensus is high. The failure of transaction broadcasting will affect the execution of transaction consensus. Thus, the transaction processing efficiency is greatly reduced.
[0077] Therefore, in order to improve the transaction processing efficiency, this application provides a transaction processing solution based on blockchain. See Figure 4 , Figure 4 is a schematic diagram of an implementation environment involved in this application. This implementation environment mainly includes blockchain nodes 401, blockchain nodes 402, and blockchain nodes 403 that can communicate with each other. It can be understood that blockchain nodes 401, blockchain nodes 402, and blockchain nodes 403 are simultaneously located / deployed in two networks. Specifically, these two networks can be a transaction broadcasting network and a transaction consensus network. The transaction broadcasting network is mainly used to implement transaction broadcasting, and the transaction consensus network is mainly used to implement transaction consensus.
[0078] Exemplarily, any one or more of blockchain node 401, blockchain node 402, and blockchain node 403 may be a server providing various services; the servers providing various services include, but are not limited to, independent physical servers, a server cluster or a distributed system composed of multiple physical servers, and cloud servers providing 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, content delivery networks, and big data and artificial intelligence platforms.
[0079] Exemplarily, any one or more of blockchain node 401, blockchain node 402, and blockchain node 403 may be a terminal device; the terminal devices include, but are not limited to, smartphones, tablets, laptop computers, computers, intelligent voice interaction devices, smart home appliances, smart wearable devices, aircraft, etc.
[0080] It should be noted that Figure 4 the number of blockchain nodes in
[0081] In an embodiment of the present application, the blockchain-based transaction processing method is executed by any blockchain node (i.e., blockchain node 401, blockchain node 402, or blockchain node 403).
[0082] Exemplarily, any blockchain node receives a transaction request sent by other blockchain nodes through a transaction broadcast network, and the transaction request is received by other blockchain nodes from a client; then the transaction request is added to a transaction pool, and a transaction request to be consensus is extracted from the transaction pool; then the transaction data corresponding to the extracted transaction request is consensus through a transaction consensus network.
[0083] It should be noted that in the specific implementation manner of the present application, when it comes to user-related data, when the embodiments of the present application are applied to specific products or technologies, user permission or consent needs to be obtained, and the collection, use, and processing of relevant data need to comply with relevant laws, regulations, and standards of relevant countries and regions.
[0084] The following elaborates in detail on various implementation details of the technical solutions of the embodiments of the present application:
[0085] Please refer to Figure 5 , Figure 5 which is a flowchart of a blockchain-based transaction processing method shown in an embodiment of the present application, and the blockchain-based transaction processing method may be executed by any blockchain node. As Figure 5 shown, the blockchain-based transaction processing method at least includes S501 to S503, which are introduced in detail as follows:
[0086] S501, receiving a transaction request to be added sent by a blockchain node through a transaction broadcast network, where the transaction request to be added is received by the blockchain node from a client.
[0087] It is understood that, for ease of distinction, in the embodiments of this application, the blockchain node corresponding to the execution subject of the blockchain-based transaction processing method is referred to as the first blockchain node, and the blockchain node communicating and interacting with it is referred to as the second blockchain node. The first blockchain node can be any blockchain node in the blockchain system, and the second blockchain node can be any blockchain node other than the first blockchain node in the blockchain system.
[0088] In the embodiments of this application, the client refers to a software application running on the second blockchain node, through which a user can initiate a transaction request. The transaction request may include information related to the transaction request entered by the user through the client; illustratively, the information related to the transaction request includes, but is not limited to, at least one of the following: the transaction content, the transaction object, and authentication information (e.g., the user's identity information).
[0089] In the embodiment of the present application, the second blockchain node receives the transaction request sent by the client, and then can send the transaction request to the first blockchain node through the transaction broadcast network; accordingly, the first blockchain node receives the transaction request sent by the second blockchain node through the transaction broadcast network.
[0090] It should be noted that when the second blockchain node receives the transaction request sent by the client and sends the transaction request to the first blockchain node through the transaction broadcast network, it will also send the transaction request to other blockchain nodes in the blockchain system except the first blockchain node and the second blockchain node through the transaction broadcast network, thereby realizing the broadcast of the transaction request, so that each blockchain node in the blockchain system can obtain the transaction request, that is, complete the transaction broadcast.
[0091] For example, assume that the first blockchain node is blockchain node 401 described in the previous embodiment, and the second blockchain node is blockchain node 402 described in the previous embodiment. Then, blockchain node 402 sends the transaction request sent by the client to blockchain node 401 and blockchain node 403 (i.e., other blockchain nodes) via the transaction broadcast network.
[0092] Alternatively, assuming that the first blockchain node is blockchain node 401 described in the aforementioned embodiment, and the second blockchain node is blockchain node 403 described in the aforementioned embodiment, blockchain node 403 then transmits the transaction request sent by the client to blockchain node 401 and blockchain node 402 (i.e., other blockchain nodes) via the transaction broadcast network.
[0093] It can be understood that, for the convenience of distinction, in the embodiments of the present application, the transaction request sent by the second blockchain node received by the first blockchain node through the transaction broadcast network (i.e., the transaction request initiated by the user through the client) is referred to as a transaction request to be added, and the transaction request extracted from the transaction pool (see the introduction below) is referred to as a transaction request to be consensus. Among them, the transaction request to be added refers to the transaction that needs to be added to the transaction pool currently, and the transaction request to be consensus refers to the transaction that needs to be consensus currently.
[0094] For example, let the first blockchain node be the blockchain node 401 introduced in the foregoing embodiment, and the second blockchain node be the blockchain node 402 introduced in the foregoing embodiment. The transaction request to be added sent by the client received by the blockchain node 402 is denoted as tx 402-1 . Then the blockchain node 402 sends the transaction request to be added tx 402-1 to the blockchain node 401. Correspondingly, the blockchain node 401 receives the transaction request to be added tx 402-1 sent by the blockchain node 402 through the transaction broadcast network.
[0095] Or, let the first blockchain node be the blockchain node 401 introduced in the foregoing embodiment, and the second blockchain node be the blockchain node 403 introduced in the foregoing embodiment. The transaction request to be added sent by the client received by the blockchain node 403 is denoted as tx 403-1 . Then the blockchain node 403 sends the transaction request to be added tx 403-1 to the blockchain node 401. Correspondingly, the blockchain node 401 receives the transaction request to be added tx 403-1 sent by the blockchain node 403 through the transaction broadcast network.
[0096] S502, Add the transaction request to be added to the transaction pool, and extract the transaction request to be consensus from the transaction pool.
[0097] In the embodiments of the present application, the first blockchain node receives the transaction request to be added sent by the second blockchain node through the transaction broadcast network, and then can add the transaction request to be added to the transaction pool corresponding to the first blockchain node.
[0098] For example, continuing with the foregoing example, if the blockchain node 401 receives the transaction request to be added tx 402-1 sent by the blockchain node 402 through the transaction broadcast network, then the blockchain node 401 adds the transaction request to be added tx 402-1 to the transaction pool corresponding to the blockchain node 401.
[0099] If blockchain node 401 receives the pending addition transaction request tx sent by blockchain node 403 through the transaction broadcast network 403-1 , then blockchain node 401 adds the pending addition transaction request tx 403-1 to the transaction pool corresponding to blockchain node 401.
[0100] In the embodiment of the present application, when the first blockchain node adds the pending addition transaction request to the transaction pool corresponding to the first blockchain node, it can also extract the pending consensus transaction request from the transaction pool.
[0101] For example, continuing with the foregoing example, blockchain node 401 can extract the pending addition transaction request tx 402-1 and the pending addition transaction request tx 403-1 from the transaction pool and jointly use them as the pending consensus transaction request.
[0102] It should be clear that the pending consensus transaction request and the pending addition transaction request in the embodiment of the present application can be the same or different. In practical applications, the pending consensus transaction request can be flexibly adjusted according to specific application scenarios.
[0103] S503. Perform consensus on the transaction data corresponding to the pending consensus transaction request through the transaction consensus network. The transaction consensus network and the transaction broadcast network are different networks.
[0104] In the embodiment of the present application, the first blockchain node extracts the pending consensus transaction request from the transaction pool, and then can perform consensus on the transaction data corresponding to the pending consensus transaction request through the transaction consensus network.
[0105] In the embodiment of the present application, the transaction data corresponding to the pending consensus transaction request refers to the data related to the pending consensus transaction request; exemplarily, the data related to the pending consensus transaction request includes but is not limited to at least one of the transaction execution order, the transaction execution result, the transaction content, the transaction object, and the identity authentication information (such as the identity information of the blockchain node), etc.
[0106] For example, continuing with the foregoing example, blockchain node 401 performs consensus on the transaction data jointly corresponding to the pending consensus transaction request tx 402-1 and the pending consensus transaction request tx 403-1
[0107] It should be noted that in the embodiment of the present application, each blockchain node in the blockchain system is simultaneously deployed in two different networks, namely the transaction broadcast network and the transaction consensus network.
[0108] Therefore, in one embodiment of the present application, before the process of receiving the pending addition transaction request sent by the blockchain node through the transaction broadcast network in S501, it may further include:
[0109] Construct a transaction broadcast network and a transaction consensus network;
[0110] Deploy multiple blockchain nodes included in the blockchain system in the transaction broadcast network and the transaction consensus network.
[0111] Among them, the transaction broadcast network is mainly used to implement the broadcast of the transaction corresponding to the transaction request to be added. Therefore, as introduced in the foregoing embodiments, the first blockchain node receives the transaction request to be added sent by the second blockchain node through the transaction broadcast network; the transaction consensus network is mainly used to implement the consensus of the transaction corresponding to the transaction request to be consensus. Therefore, as introduced in the foregoing embodiments, the first blockchain node conducts consensus on the transaction data of the transaction request to be consensus through the transaction consensus network.
[0112] In this way, by implementing the optional embodiment, a transaction broadcast network and a transaction consensus network are constructed. Thus, each blockchain node in the blockchain system can be deployed in the transaction broadcast network and the transaction consensus network at the same time, providing strong support for realizing transaction broadcast based on the transaction broadcast network and realizing transaction consensus based on the transaction consensus network, thereby realizing the separation / decoupling of transaction broadcast and transaction consensus, reducing the coupling between the two, and improving the transaction processing efficiency.
[0113] In an embodiment of the present application, the process of conducting consensus on the transaction data corresponding to the transaction request to be consensus through the transaction consensus network in S503 may include:
[0114] Obtain the network quality index of the transaction consensus network;
[0115] If it is detected based on the network quality index that the current network quality of the transaction consensus network is greater than the preset network quality threshold, conduct consensus on the transaction data corresponding to the transaction request to be consensus through the transaction consensus network.
[0116] That is, in the optional embodiment, the network quality of the transaction consensus network is detected in real time. When the network quality is relatively good, the step of conducting consensus on the transaction data corresponding to the transaction request to be consensus through the transaction consensus network is triggered.
[0117] In this way, by implementing the optional embodiment, transaction consensus is only performed when the current network quality of the transaction consensus network is relatively good, avoiding the phenomenon of transaction consensus failure caused by network quality problems, improving the success rate and efficiency of transaction consensus, and being applicable to many extensive scenarios.
[0118] Among them, in the optional embodiment, the network quality index refers to an index used to characterize the network quality situation, which includes but is not limited to at least one of bandwidth, delay, packet loss rate, throughput, and jitter rate, etc.
[0119] Among them, in an optional embodiment, if multiple network quality indicators are obtained, the current network quality of the transaction consensus network can be determined based on the multiple network quality indicators together.
[0120] Exemplarily, the process of jointly determining the current network quality of the transaction consensus network based on multiple network quality indicators may include: obtaining the indicator values corresponding to each network quality indicator respectively; if there are a preset number of indicator values among the multiple indicator values that characterize better network quality, determining that the current network quality of the transaction consensus network is greater than the preset network quality threshold, and if there are no preset number of indicator values among the multiple indicator values that characterize better network quality, determining that the current network quality of the transaction consensus network is less than or equal to the preset network quality threshold.
[0121] It can be understood that the indicator value characterizing better network quality can be to compare the indicator value corresponding to the same network quality indicator with the preset indicator threshold. Specifically, the situations where the indicator values corresponding to different network quality indicators characterize better network quality may be different. For example, when the indicator value corresponding to some network quality indicators is greater than the preset indicator threshold, it characterizes better network quality, and when the indicator value corresponding to some other network quality indicators is less than or equal to the preset indicator threshold, it characterizes better network quality. In practical applications, it can be flexibly adjusted according to the specific application scenario.
[0122] In this way, by implementing the optional embodiment, when there are a preset number of indicator values corresponding to the network quality indicators that all characterize better network quality, it is determined that the current network quality of the transaction consensus network is better, and the determination accuracy is high.
[0123] Exemplarily, the process of jointly determining the current network quality of the transaction consensus network based on multiple network quality indicators may include: obtaining the indicator values and weight values corresponding to each network quality indicator respectively; performing a summation operation on the indicator value and weight value corresponding to the same network quality indicator to obtain multiple predicted values, and performing unit normalization processing on the multiple predicted values, and then performing a summation operation on the multiple predicted values after unit normalization processing to obtain a final predicted value; determining the current network quality of the transaction consensus network based on the magnitude relationship between the final predicted value and the preset prediction threshold.
[0124] In this way, by implementing the optional embodiment, the final predicted value used to characterize the network quality is calculated based on the indicator values and weight values corresponding to the multiple network quality indicators, and the current network quality of the transaction consensus network is determined. The process is simple and easy to implement.
[0125] In the embodiments of the present application, blockchain nodes are deployed in both the transaction broadcasting network and the transaction consensus network. Thus, transaction broadcasting can be achieved through the transaction broadcasting network, and transaction consensus can be achieved through the transaction consensus network. In this way, transaction broadcasting and transaction consensus are separated / decoupled, reducing the coupling between the two. Even if the transaction broadcasting network malfunctions, transaction consensus can still be executed. Correspondingly, even if the transaction consensus network malfunctions, transaction broadcasting can still be executed, thereby avoiding the phenomenon that transaction broadcasting and transaction consensus are executed in the same network and affect each other, improving the transaction processing efficiency. At the same time, according to actual needs, transaction broadcasting and transaction consensus can also be executed in parallel, further improving the transaction processing efficiency, and the transaction process is more flexible, enhancing the performance of the blockchain system.
[0126] In one embodiment of the present application, another blockchain-based transaction processing method is provided. This blockchain-based transaction processing method can be executed by any blockchain node. As Figure 6 shown, this blockchain-based transaction processing method may include S601 to S603, S503.
[0127] S601 to S603 are introduced in detail as follows:
[0128] S601, receiving multiple pending transaction requests sent by blockchain nodes through the transaction broadcasting network.
[0129] In the embodiments of the present application, the second blockchain node can receive multiple transaction requests sent by the same blockchain node through the transaction broadcasting network, or the second blockchain node can receive transaction requests sent by different blockchain nodes respectively through the transaction broadcasting network. That is, the second blockchain node can receive multiple pending transaction requests through the transaction broadcasting network and send the multiple pending transaction requests to the first blockchain node. Correspondingly, the first blockchain node receives multiple pending transaction requests sent by the second blockchain node through the transaction broadcasting network.
[0130] For example, assume that the first blockchain node is the blockchain node 401 introduced in the foregoing embodiment, and the second blockchain node is the blockchain node 402 introduced in the foregoing embodiment. At the same time, assume that the multiple pending transaction requests sent by the client received by the blockchain node 402 are denoted as tx 402-1 , tx 402-2 , tx 402-3 . Then the blockchain node 402 sends the pending transaction requests tx 402-1 , tx 402-2 , tx 402-3 to the blockchain node 401 through the transaction broadcasting network. Correspondingly, the blockchain node 401 receives the pending transaction request tx sent by the blockchain node 402 through the transaction broadcasting network402-1 , tx 402-2 , tx 402-3 .
[0131] Alternatively, let the first blockchain node be the blockchain node 401 introduced in the foregoing embodiment, and the second blockchain node be the blockchain node 403 introduced in the foregoing embodiment. At the same time, let the multiple pending transaction requests sent by the client received by the blockchain node 403 be denoted as tx 403-1 , tx 403-2 , tx 403-3 . Then, the blockchain node 403 sends the pending transaction requests tx 403-1 , tx 403-2 , tx 403-3 to the blockchain node 401 through the transaction broadcast network. Correspondingly, the blockchain node 401 receives the pending transaction requests tx 403-1 , tx 403-2 , tx 403-3 .
[0132] It should be clear that the number of pending transaction requests included in different transaction request groups can be the same or different, and in practical applications, it can be flexibly adjusted according to specific application scenarios.
[0133] Among them, if there are multiple second blockchain nodes, in one embodiment of the present application, the process of receiving multiple pending transaction requests sent by blockchain nodes through the transaction broadcast network in S601 may include:
[0134] Receiving multiple pending transaction requests sent by each blockchain node through the transaction broadcast network.
[0135] That is, in an alternative embodiment, when there are multiple second blockchain nodes, each second blockchain node can receive multiple pending transaction requests and send the multiple pending transaction requests to the first blockchain node respectively; correspondingly, the first blockchain node receives the multiple pending transaction requests sent by each second blockchain node respectively.
[0136] For example, let the first blockchain node be the blockchain node 401 introduced in the foregoing embodiment, and the multiple second blockchain nodes be the blockchain node 402 and the blockchain node 403 introduced in the foregoing embodiment respectively. At the same time, let the multiple pending transaction requests sent by the client received by the blockchain node 402 be denoted as tx 402-1 , tx 402-2 , tx 402-3 , and the multiple pending transaction requests sent by the client received by the blockchain node 403 be denoted as tx 403-1 , tx 403-2 , tx403-3 Then, blockchain node 402 sends the transaction request to be added tx 402-1 , tx 402-2 , tx 402-3 to blockchain node 401. Blockchain node 403 sends the transaction request to be added tx 403-1 , tx 403-2 , tx 403-3 to blockchain node 401. Correspondingly, blockchain node 401 receives the transaction request to be added tx 402-1 , tx 402-2 , tx 402-3 sent by blockchain node 402 through the transaction broadcast network, and blockchain node 401 receives the transaction request to be added tx 403-1 , tx 403-2 , tx 403-3 .
[0137] In this way, through the implementation of the optional embodiment, each blockchain node can achieve transaction broadcasting and is applicable to many extensive scenarios.
[0138] S602. Combine multiple transaction requests to be added to obtain a transaction request group.
[0139] In the embodiment of the present application, after the first blockchain node receives multiple transaction requests to be added sent by the second blockchain node, it can then combine the multiple transaction requests to be added to obtain a transaction request group.
[0140] For example, continuing with the previous example, if the second blockchain node is blockchain node 402 introduced in the previous embodiment, then blockchain node 401 combines multiple transaction requests to be added tx 402-1 , tx 402-2 , tx 402-3 to obtain a transaction request group TX 402 , that is, the transaction request group TX 402 ={tx 402-1 , tx 402-2 , tx 402-3}.
[0141] Alternatively, if the second blockchain node is blockchain node 403 introduced in the previous embodiment, then blockchain node 401 combines multiple transaction requests to be added tx 403-1 , tx 403-2 , tx 403-3 to obtain a transaction request group TX 403 , that is, the transaction request group TX 403 ={tx 403-1 , tx 403-2 , tx403-3}.
[0142] It can be understood that since the transaction request group includes multiple to-be-added transaction requests, the transaction request group can be regarded as a transaction batch or a transaction shard (relative to all the transactions broadcast in the blockchain system).
[0143] As introduced in the foregoing embodiments, if the first blockchain node receives multiple to-be-added transaction requests respectively sent by each blockchain node through a transaction broadcast network, then in an embodiment of the present application, the process of combining multiple to-be-added transaction requests in S602 to obtain a transaction request group may include:
[0144] Combining multiple to-be-added transaction requests corresponding to the same blockchain node to obtain multiple transaction request groups.
[0145] That is, in an alternative embodiment, multiple to-be-added transaction requests corresponding to the same second blockchain node are combined to obtain multiple transaction request groups.
[0146] For example, continuing with the foregoing example, if multiple second blockchain nodes are respectively the blockchain node 402 and the blockchain node 403 introduced in the foregoing embodiments, then the blockchain node 401 combines multiple to-be-added transaction requests tx 402-1 , tx 402-2 , tx 402-3 to obtain a transaction request group TX 402 , that is, the transaction request group TX 402 ={tx 402-1 , tx 402-2 , tx 402-3}, and at the same time combines multiple to-be-added transaction requests tx 403-1 , tx 403-2 , tx 403-3 to obtain a transaction request group TX 403 , that is, the transaction request group TX 403 ={tx 403-1 , tx 403-2 , tx 403-3}, thereby obtaining the transaction request group TX 402 and the transaction request group TX 403 .
[0147] In this way, by implementing the alternative embodiment, multiple to-be-added transaction requests broadcast by each blockchain node are classified and combined, which is convenient for the management and consensus of to-be-added transaction requests and is applicable to many extensive scenarios.
[0148] S603, Add the transaction request group to the transaction pool and use each to-be-added transaction request in the transaction request group as a to-be-consensus transaction request.
[0149] In the embodiment of the present application, the first blockchain node obtains a transaction request group, and then can add the transaction request group to the transaction pool, and at the same time, each transaction request to be added in the transaction request group can be used as a transaction request to be consensus.
[0150] For example, if the blockchain node 401 obtains the transaction request group TX 402 , then the transaction request group TX 402 is added to the transaction pool corresponding to the blockchain node 401, and each transaction request to be added in the transaction request group TX 402 (that is, tx 402-1 , tx 402-2 , tx 402-3 ) is used as a transaction request to be consensus.
[0151] If the blockchain node 401 obtains the transaction request group TX 403 , then the transaction request group TX 403 is added to the transaction pool corresponding to the blockchain node 401, and each transaction request to be added in the transaction request group TX 403 (that is, tx 403-1 , tx 403-2 , tx 403-3 ) is used as a transaction request to be consensus.
[0152] That is, in the embodiment of the present application, the transaction request to be consensus and the transaction request to be added are the same.
[0153] In an embodiment of the present application, the transaction request to be consensus and the transaction request to be added are different.
[0154] For example, assume that the blockchain node 401 obtains the transaction request group TX 402 and the transaction request group TX 403 , and extracts the transaction request group TX 401 from the transaction pool. At this time, each transaction request to be added in the transaction request group TX 401 (for example, including tx 401-1 , tx 401-2 , tx 401-3 , tx 401-4 ), each transaction request to be added in the transaction request group TX 402 (that is, tx 402-1 , tx 402-2 , tx 402-3 ), and each transaction request to be added in the transaction request group TX 403 (that is, tx 403-1 , tx 403-2 , tx 403-3Collectively serve as the transaction requests to be consensus.
[0155] It should be noted that Figure 6 For the detailed introduction of S503 shown, please refer to Figure 5 S503 shown, which will not be elaborated here.
[0156] In the embodiment of the present application, multiple transaction requests to be added are received through the transaction broadcast network, and the multiple transaction requests to be added are added to the transaction pool. At the same time, the multiple transaction requests to be added are used as transaction requests to be consensus for corresponding consensus, realizing the broadcast and consensus of batch transactions (i.e., transaction batches / transaction shards), and further improving the transaction processing efficiency.
[0157] In an embodiment of the present application, another blockchain-based transaction processing method is provided. This blockchain-based transaction processing method can be executed by any blockchain node. As Figure 7 shown, this blockchain-based transaction processing method may include S701 to S702, S501, and S503.
[0158] In the embodiment of the present application, the blockchain system includes multiple blockchain nodes. For example, as introduced in the foregoing embodiment, the multiple blockchain nodes are respectively blockchain node 401, blockchain node 402, and blockchain node 403.
[0159] The detailed introduction of S701 to S702 is as follows:
[0160] S701, determine a first target blockchain node that has received a transaction request to be added through the transaction broadcast network from multiple blockchain nodes.
[0161] In the embodiment of the present application, the first target blockchain node refers to the blockchain node that has received a transaction request to be added through the transaction broadcast network among multiple blockchain nodes.
[0162] For example, continuing with the foregoing example, if blockchain node 402 sends the transaction requests to be added from the client (for example, multiple transaction requests to be added, denoted as TX S ) to blockchain node 401 and blockchain node 403 respectively through the transaction broadcast network; then the first target blockchain node that has received the transaction request to be added TX S is determined from blockchain node 401, blockchain node 402, and blockchain node 403.
[0163] Or, if blockchain node 403 sends the transaction requests to be added from the client (for example, multiple transaction requests to be added, also denoted as TX S)Send them to blockchain node 401 and blockchain node 402 respectively; then determine the first target blockchain node that receives the to-be-added transaction request TX through the transaction broadcast network from blockchain node 401, blockchain node 402, and blockchain node 403 S of the first target blockchain node.
[0164] In an embodiment of the present application, the process of determining the first target blockchain node that receives the to-be-added transaction request through the transaction broadcast network from multiple blockchain nodes in S701 may include:
[0165] In the transaction broadcast network, receive response information sent by each blockchain node for indicating that the to-be-added transaction request is received;
[0166] Determine the blockchain node corresponding to the response information for indicating that the to-be-added transaction request is received from multiple blockchain nodes, and use the determined blockchain node as the first target blockchain node.
[0167] That is, in an alternative embodiment, the first blockchain node receives, in the transaction broadcast network, response information sent by other blockchain nodes in the blockchain system except the first blockchain node for indicating that the to-be-added transaction request is received, and then determines the blockchain node corresponding to the response information for indicating that the to-be-added transaction request is received from multiple blockchain nodes. At this time, the determined blockchain node is the first target blockchain node.
[0168] For example, continuing with the foregoing example, assume that blockchain node 401 receives, in the transaction broadcast network, response information sent by blockchain node 402 and blockchain node 403 for indicating that the to-be-added transaction request TX S is received. At the same time, blockchain node 401 also sends, through the transaction broadcast network, response information for indicating that the to-be-added transaction request TX S is received to blockchain node 402 and blockchain node 403. Then at this time, blockchain node 401, blockchain node 402, and blockchain node 403 are all first target blockchain nodes.
[0169] S702, if the number of first target blockchain nodes reaches the first preset quantity threshold, add the to-be-added transaction request to the transaction pool.
[0170] In the embodiment of the present application, the first target blockchain node that receives the to-be-added transaction request through the transaction broadcast network is determined from multiple blockchain nodes, and then it can be determined whether to add the to-be-added transaction request to the transaction pool according to the number of first target blockchain nodes.
[0171] In the embodiments of the present application, determining whether to add a transaction request to be added to the transaction pool based on the number of first target blockchain nodes may include two cases:
[0172] Case 1: If the number of first target blockchain nodes reaches a first preset number threshold, add the transaction request to be added to the transaction pool.
[0173] Case 2: If the number of first target blockchain nodes does not reach the first preset number threshold, do not process it, that is, there is no need to add the transaction request to be added to the transaction pool.
[0174] It should be clear that in practical applications, the first preset number threshold can be flexibly adjusted according to specific application scenarios.
[0175] It should be noted that Figure 7 For the detailed introduction of S501 and S503 shown, please refer to Figure 5 S501 and S503 shown, which will not be elaborated here.
[0176] In the embodiments of the present application, when most blockchain nodes in the blockchain system receive a transaction request to be added through the transaction broadcast network, the transaction request to be added is added to the transaction pool, ensuring the consistency of the transaction pool, thereby improving the accuracy and efficiency of transaction consensus to a certain extent.
[0177] In an embodiment of the present application, another blockchain-based transaction processing method is provided, and this blockchain-based transaction processing method can be executed by any blockchain node. As Figure 8 shown, this blockchain-based transaction processing method may include S801 to S802, S501 to S502.
[0178] In the embodiments of the present application, there are multiple transaction requests to be consensus.
[0179] For example, continuing with the foregoing example, multiple transaction requests to be consensus may include transaction request group TX 401 (TX 401 ={tx 401-1 , tx 401-2 , tx 401-3 , tx 401-4}), transaction request group TX 402 (TX 402 ={tx 402-1 , tx 402-2 , tx 402-3}), and transaction request group TX 403 (TX 403 ={tx 403-1 , tx 403-2 , tx 403-3)。
[0180] Details of S801 to S802 are introduced as follows:
[0181] S801 determines, from multiple blockchain nodes, a second target blockchain node that has passed the verification of the transaction execution order among multiple to-be-consensus transaction requests through a transaction consensus network.
[0182] In the embodiment of the present application, the second target blockchain node refers to a blockchain node among multiple blockchain nodes that has passed the verification of the transaction execution order among multiple to-be-consensus transaction requests through a transaction consensus network.
[0183] For example, continuing with the previous example, for ease of description, assume there is a transaction request group TX 401 , transaction request group TX 402 , and transaction request group TX 403 . Denote the to-be-consensus transaction requests as TX S . Then, the second target blockchain node is determined from blockchain node 401, blockchain node 402, and blockchain node 403, which has passed the verification of the transaction execution order among multiple to-be-consensus transaction requests TX S through a transaction consensus network.
[0184] In an embodiment of the present application, the process of determining, in S801, a second target blockchain node that has passed the verification of the transaction execution order among multiple to-be-consensus transaction requests from multiple blockchain nodes may include:
[0185] In the transaction consensus network, receive response information sent by each blockchain node indicating that the verification of the transaction execution order among multiple to-be-consensus transaction requests has passed;
[0186] Determine, from multiple blockchain nodes, the blockchain node corresponding to the response information indicating that the verification of the transaction execution order among multiple to-be-consensus transaction requests has passed, and use the determined blockchain node as the second target blockchain node.
[0187] That is, in an alternative embodiment, the first blockchain node receives, in the transaction consensus network, response information sent by each blockchain node indicating that the verification of the transaction execution order among multiple to-be-consensus transaction requests has passed, and then determines, from multiple blockchain nodes, the blockchain node corresponding to the response information indicating that the verification of the transaction execution order among multiple to-be-consensus transaction requests has passed. At this time, the determined blockchain node is the second target blockchain node.
[0188] For example, continuing with the previous example, assume that blockchain node 401 in the transaction consensus network receives response information sent by blockchain node 402 and blockchain node 403 indicating that the verification of the transaction execution order among multiple transaction requests to be consensus-approved TX S has passed. At the same time, blockchain node 401 also sends, through the transaction consensus network, response information to blockchain node 402 and blockchain node 403 indicating that the verification of the transaction execution order among multiple transaction requests to be consensus-approved TX S has passed. Then, at this time, blockchain node 401, blockchain node 402, and blockchain node 403 are all second target blockchain nodes.
[0189] In an embodiment of the present application, the multiple transaction requests to be consensus-approved include each transaction request to be added in multiple transaction request groups, and different transaction request groups come from different blockchain nodes.
[0190] That is to say, in an alternative embodiment, the transaction requests to be consensus-approved and the transaction requests to be added are the same. When there are multiple transaction requests to be consensus-approved, the multiple transaction requests to be consensus-approved come from each transaction request to be added in multiple transaction request groups, where different transaction request groups come from different blockchain nodes.
[0191] For example, as introduced in the previous embodiment, the multiple transaction requests to be consensus-approved include transaction request group TX 401 (TX 401 ={tx 401-1 , tx 401-2 , tx 401-3 , tx 401-4}), transaction request group TX 402 (TX 402 ={tx 402-1 , tx 402-2 , tx 402-3}), and transaction request group TX 403 (TX 403 ={tx 403-1 , tx 403-2 , tx 403-3}). Among them, transaction request group TX 401 comes from blockchain node 401. Specifically, blockchain node 401 receives multiple transaction requests to be added sent by the client; transaction request group TX 402 comes from blockchain node 402. Specifically, blockchain node 402 receives multiple transaction requests to be added sent by the client; transaction request group TX 403 comes from blockchain node 403. Specifically, blockchain node 403 receives multiple transaction requests to be added sent by the client.
[0192] Accordingly, before the process of receiving, in the transaction consensus network, response information sent by each blockchain node to represent that the verification of the transaction execution order among multiple transaction requests to be consensus is passed, the following steps may also be included:
[0193] In the transaction consensus network, obtain the broadcast credential information of each transaction request group; wherein, the broadcast credential information is generated based on the voting information of the transaction request group, and the voting information is generated in response to the reception situation of the transaction request group when broadcasting the transaction request group.
[0194] Generate proposal data based on the broadcast credential information of multiple transaction request groups.
[0195] Send the proposal data to each blockchain node, so that each blockchain node responds to the transaction execution order among multiple transaction requests to be consensus based on the proposal data.
[0196] That is to say, in an alternative embodiment, the first blockchain node obtains the broadcast credential information of each transaction request group in the transaction consensus network, generates proposal information based on the broadcast credential information of multiple transaction request groups, and sends the proposal data to other blockchain nodes in the blockchain system except the first blockchain node; accordingly, other blockchain nodes can respond to the transaction execution order among multiple transaction requests to be consensus based on the received proposal data.
[0197] Among them, in an alternative embodiment, the broadcast credential information for a transaction request group is also called a quorum certificate (qc), which is generated based on the voting information of the transaction request group, and the voting information is generated in response to the reception situation of the transaction request group when broadcasting the transaction request group. It can be understood that, as introduced in the foregoing embodiments, the broadcast credential information includes 2f + 1 Ready voting information.
[0198] Among them, in an alternative embodiment, the process of generating proposal data based on the broadcast credential information of multiple transaction request groups may include: combining the broadcast credential information of multiple transaction request groups to obtain a group of broadcast credential information; generating proposal data based on the group of broadcast credential information.
[0199] For example, continuing with the foregoing example, assume that the broadcast credential information corresponding to the transaction request group TX 401 is denoted as qc 401 , the broadcast credential information corresponding to the transaction request group TX 402 is denoted as qc 402 , and the broadcast credential information corresponding to the transaction request group TX 403 is denoted as qc 403 . Referring to Figure 9 , the broadcast credential information qc 401, qc 402 , qc 403 are combined to obtain a broadcast credential information group QC, that is, the broadcast credential information group QC = {qc 401 , qc 402 , qc 403}}. Correspondingly, proposal data can be generated based on the broadcast credential information group QC later.
[0200] In this way, by implementing the optional embodiment, proposal data is generated based on the broadcast credential information of multiple transaction request groups, and the proposal data is sent to each blockchain node, so that each blockchain node can respond to the transaction execution order among multiple transaction requests to be consensus based on the proposal data, thereby achieving transaction consensus.
[0201] S802, if the number of second target blockchain nodes reaches the second preset number threshold, it is determined that the transaction data corresponding to multiple transaction requests to be consensus passes.
[0202] In the embodiment of the present application, the second target blockchain nodes that receive the transaction requests to be added through the transaction consensus network are determined from multiple blockchain nodes, and then it can be determined whether the transaction data corresponding to multiple transaction requests to be consensus passes according to the number of second target blockchain nodes.
[0203] In the embodiment of the present application, determining whether the consensus on the transaction data corresponding to multiple transaction requests to be consensus passes according to the number of second target blockchain nodes may include two cases:
[0204] Case 1, if the number of second target blockchain nodes reaches the second preset number threshold, it indicates that the consensus on the transaction execution order among multiple transaction requests to be consensus passes, and at this time, it is determined that the consensus on the transaction data corresponding to multiple transaction requests to be consensus passes.
[0205] Case 2, if the number of second target blockchain nodes does not reach the second preset number threshold, it indicates that the consensus on the transaction execution order among multiple transaction requests to be consensus does not pass, and at this time, it is determined that the consensus on the transaction data corresponding to multiple transaction requests to be consensus does not pass.
[0206] It should be clear that in practical applications, the second preset number threshold can be flexibly adjusted according to specific application scenarios, and the second preset number threshold may be the same as or different from the first preset number threshold in the foregoing embodiment.
[0207] In an embodiment of the present application, after the process of determining that the consensus on the transaction data corresponding to multiple transaction requests to be consensus passes in S802, the following may further be included:
[0208] Obtain a block generated based on the transaction execution results corresponding to multiple transaction requests to be consensus;
[0209] Store the block on the blockchain.
[0210] That is, in an alternative embodiment, if the transaction data corresponding to multiple transaction requests to be consensus is consensus-passed, which indicates that the transaction is consensus-passed at this time, then a block generated based on the transaction execution results corresponding to multiple transaction requests to be consensus can be obtained. At this time, this block is the block to be uploaded to the chain, and the block to be uploaded to the chain is stored on the blockchain to achieve transaction uploading to the chain.
[0211] Among them, in an alternative embodiment, the process of obtaining a block generated based on the transaction execution results corresponding to multiple transaction requests to be consensus may include: obtaining the transaction execution order among multiple transaction requests to be consensus; executing the multiple transaction requests to be consensus based on the transaction execution order among the multiple transaction requests to be consensus to obtain transaction data; generating a block based on the transaction data.
[0212] In this way, by implementing the alternative embodiment, after the transaction execution order corresponding to multiple transaction requests to be consensus is consensus-passed, the corresponding block is stored on the blockchain, simply and accurately realizing transaction uploading to the chain, which is applicable to many extensive scenarios.
[0213] It can be understood that after the transaction execution order corresponding to multiple transaction requests to be consensus is consensus-passed, the usually obtained transaction execution results will also be consensus-passed; therefore, in order to save the transaction consensus duration and improve the transaction consensus efficiency, in the embodiments of the present application, after the transaction execution order is consensus-passed, the corresponding block is stored on the blockchain.
[0214] It should be noted that Figure 8 For the detailed introduction of S501 to S502 shown, please refer to Figure 5 S501 to S502 shown, which will not be elaborated here.
[0215] In the embodiments of the present application, when there are multiple transaction requests to be consensus, by performing consensus on the execution order among the multiple transaction requests to be consensus, transaction consensus is simply and accurately realized, which is applicable to many extensive scenarios.
[0216] In an embodiment of the present application, another blockchain-based transaction processing method is provided, and this blockchain-based transaction processing method can be executed by any blockchain node. As Figure 10 shown, this blockchain-based transaction processing method may include S1001 to S1002, S501 to S502.
[0217] In the embodiments of the present application, the transaction requests to be consensus include multiple.
[0218] For example, continuing with the previous example, multiple transaction requests to be consensus can include a transaction request group TX 401 (TX 401 ={tx 401-1 , tx 401-2 , tx 401-3 , tx 401-4}), the transaction request group TX 402 (TX 402 ={tx 402-1 , tx 402-2 , tx 402-3}), and the transaction request group TX 403 (TX 403 ={tx 403-1 , tx 403-2 , tx 403-3}).
[0219] S1001 to S1002 are introduced in detail as follows:
[0220] S1001, determine a third target blockchain node from multiple blockchain nodes that has passed the verification of the transaction execution result through the transaction consensus network; wherein, the transaction execution result is obtained by executing multiple transaction requests to be consensus.
[0221] In the embodiment of the present application, the third target blockchain node refers to a blockchain node among multiple blockchain nodes that has passed the verification of the transaction execution result through the transaction consensus network.
[0222] For example, continuing with the previous example, for ease of description, the transaction requests to be consensus including the transaction request group TX 401 , the transaction request group TX 402 , and the transaction request group TX 403 are denoted as TX S ; then a third target blockchain node that has passed the verification of the transaction execution result through the transaction consensus network is determined from the blockchain node 401, the blockchain node 402, and the blockchain node 403.
[0223] In the embodiment of the present application, the transaction execution result is obtained by executing multiple transaction requests to be consensus. Exemplarily, it can be obtained by obtaining the transaction execution order among multiple transaction requests to be consensus and executing the multiple transaction requests to be consensus based on the transaction execution order among them.
[0224] In an embodiment of the present application, the process of determining a third target blockchain node that has passed the verification of the transaction execution result through the transaction consensus network in S1001 may include:
[0225] In the transaction consensus network, receive response information sent by each blockchain node, which is used to represent that the verification of the transaction execution result has passed;
[0226] Determine, from multiple blockchain nodes, the blockchain nodes corresponding to the response information used to represent that the verification of the transaction execution result has passed, and use the determined blockchain nodes as the third target blockchain nodes.
[0227] That is, in an alternative embodiment, the first blockchain node is in the transaction consensus network, receives response information sent by each blockchain node, which is used to represent that the verification of the transaction execution result has passed, and then determines, from multiple blockchain nodes, the blockchain nodes corresponding to the response information used to represent that the verification of the transaction execution result has passed. At this time, the determined blockchain nodes are the third target blockchain nodes.
[0228] For example, continuing with the previous example, assume that in the transaction consensus network, blockchain node 401 receives response information sent by blockchain nodes 402 and 403, which is used to represent that the verification of the transaction execution result has passed. At the same time, blockchain node 401 also sends response information used to represent that the verification of the transaction execution result has passed to blockchain nodes 402 and 403 through the transaction consensus network. Then, at this time, blockchain node 401, blockchain node 402, and blockchain node 403 are all third target blockchain nodes.
[0229] In an embodiment of the present application, the multiple transaction requests to be consensus include each to-be-added transaction request in multiple transaction request groups, and different transaction request groups come from different blockchain nodes.
[0230] That is, in an alternative embodiment, the transaction requests to be consensus and the to-be-added transaction requests are the same. When there are multiple transaction requests to be consensus, the multiple transaction requests to be consensus come from each to-be-added transaction request in multiple transaction request groups, where different transaction request groups come from different blockchain nodes.
[0231] For example, as introduced in the previous embodiment, the multiple transaction requests to be consensus include transaction request group TX 401 (TX 401 ={tx 401-1 , tx 401-2 , tx 401-3 , tx 401-4}), transaction request group TX 402 (TX 402 ={tx 402-1 , tx 402-2 , tx 402-3}), and transaction request group TX 403 (TX 403 ={tx 403-1 , tx403-2 , tx 403-3}); Among them, the transaction request group TX 401 comes from blockchain node 401. Specifically, blockchain node 401 receives multiple transaction requests to be added sent by the client, and the transaction request group TX 402 comes from blockchain node 402. Specifically, blockchain node 402 receives multiple transaction requests to be added sent by the client, and the transaction request group TX 403 comes from blockchain node 403. Specifically, blockchain node 403 receives multiple transaction requests to be added sent by the client.
[0232] Correspondingly, in the transaction consensus network, before the process of receiving the response information sent by each blockchain node to represent that the verification of the transaction execution result has passed, it may further include:
[0233] In the transaction consensus network, obtain the broadcast credential information of each transaction request group; among them, the broadcast credential information is generated based on the voting information of the transaction request group, and the voting information is generated in response to the reception situation of the transaction request group when broadcasting the transaction request group;
[0234] Generate proposal data based on the broadcast credential information of multiple transaction request groups;
[0235] Send the proposal data to each blockchain node so that each blockchain node responds to the transaction execution result based on the proposal data.
[0236] That is, in an alternative embodiment, the first blockchain node obtains the broadcast credential information of each transaction request group in the transaction consensus network, generates proposal information based on the broadcast credential information of multiple transaction request groups, and sends the proposal data to other blockchain nodes in the blockchain system except the first blockchain node; correspondingly, other blockchain nodes receive the proposal data sent by the first blockchain node and can respond to the transaction execution result based on the proposal data.
[0237] Among them, in an alternative embodiment, the broadcast credential information for the transaction request group is also called a quorum credential, which is generated based on the voting information of the transaction request group, and the voting information is generated in response to the reception situation of the transaction request group when broadcasting the transaction request group. It can be understood that, as introduced in the foregoing embodiment, the broadcast credential information includes 2f + 1 Ready voting information.
[0238] Among them, in an alternative embodiment, the process of generating proposal data based on the broadcast credential information of multiple transaction request groups may include: combining the broadcast credential information of multiple transaction request groups to obtain a broadcast credential information group; generating proposal data based on the broadcast credential information group.
[0239] For example, continuing with the previous example, assume a transaction request group TX 401 The corresponding broadcast credential information is denoted as qc 401 , for the transaction request group TX 402 The corresponding broadcast credential information is denoted as qc 402 , for the transaction request group TX 403 The corresponding broadcast credential information is denoted as qc 403 . Referring again to Figure 9 , the broadcast credential information qc 401 , qc 402 , qc 403 can be combined to obtain a broadcast credential information group QC, i.e., the broadcast credential information group QC = {qc 401 , qc 402 , qc 403}. Correspondingly, proposal data can then be generated based on the broadcast credential information group QC.
[0240] In this way, by implementing the optional embodiment, proposal data is generated based on the broadcast credential information of multiple transaction request groups, and the proposal data is sent to each blockchain node, so that each blockchain node can respond to the transaction execution result based on the proposal data, thereby achieving transaction consensus.
[0241] S1002, if the number of third target blockchain nodes reaches the third preset quantity threshold, it is determined that the consensus on the transaction data corresponding to multiple transaction requests to be consensus is passed.
[0242] In the embodiments of the present application, the third target blockchain nodes that receive the transaction requests to be added through the transaction consensus network are determined from multiple blockchain nodes, and then it can be determined whether the consensus on the transaction data corresponding to multiple transaction requests to be consensus is passed according to the number of the third target blockchain nodes.
[0243] In the embodiments of the present application, determining whether the consensus on the transaction data corresponding to multiple transaction requests to be consensus is passed according to the number of the third target blockchain nodes may include two cases:
[0244] Case 1, if the number of the third target blockchain nodes reaches the third preset quantity threshold, it indicates that the consensus on the current transaction execution result is passed, and at this time, it is determined that the consensus on the transaction data corresponding to multiple transaction requests to be consensus is passed.
[0245] Case 2, if the number of the third target blockchain nodes does not reach the third preset quantity threshold, it indicates that the consensus on the current transaction execution result is not passed, and at this time, it is determined that the consensus on the transaction data corresponding to multiple transaction requests to be consensus is not passed.
[0246] It should be clear that in practical applications, the third preset quantity threshold can be flexibly adjusted according to specific application scenarios, and the third preset quantity threshold can be the same as or different from the first preset quantity threshold and / or the second preset quantity threshold in the foregoing embodiments.
[0247] In an embodiment of the present application, after the process of determining that the transaction data corresponding to multiple to-be-consensus transaction requests passes the consensus in S1002, the following may further be included:
[0248] Obtain a block generated based on the transaction execution results corresponding to multiple to-be-consensus transaction requests;
[0249] Store the block on the blockchain.
[0250] That is, in an alternative embodiment, if the transaction data corresponding to multiple to-be-consensus transaction requests passes the consensus, which means that the transaction consensus passes at this time, then a block generated based on the transaction execution results corresponding to multiple to-be-consensus transaction requests can be obtained. At this time, this block is the block to be uploaded to the chain, and the block to be uploaded to the chain is stored on the blockchain to achieve transaction on-chain.
[0251] Among them, in the alternative embodiment, the process of obtaining a block generated based on the transaction execution results corresponding to multiple to-be-consensus transaction requests may include: obtaining the transaction execution order among multiple to-be-consensus transaction requests; executing the multiple to-be-consensus transaction requests based on the transaction execution order among the multiple to-be-consensus transaction requests to obtain transaction data; generating a block based on the transaction data.
[0252] In this way, by implementing the alternative embodiment, after the transaction execution results corresponding to multiple to-be-consensus transaction requests pass the consensus, the corresponding block is stored on the blockchain, simply and accurately realizing transaction on-chain, which is applicable to many extensive scenarios.
[0253] It can be understood that in the alternative embodiment, the transaction execution results corresponding to multiple to-be-consensus transaction requests are subject to consensus, so that after the transaction execution results pass the consensus, the corresponding block is stored on the blockchain.
[0254] In other embodiments, the transaction execution order corresponding to multiple to-be-consensus transaction requests may be subject to consensus first, and after the transaction execution order passes the consensus, the transaction execution results corresponding to multiple to-be-consensus transaction requests are subject to consensus, so that after the transaction execution results pass the consensus, the corresponding block is stored on the blockchain. It should be clear that when the transaction execution order and the transaction execution results are subject to consensus simultaneously, it may occur in the same round of consensus process or in different rounds of consensus processes. In practical applications, it can be flexibly adjusted according to specific application scenarios.
[0255] It should be noted that Figure 10For a detailed introduction to S501 to S502 shown, please refer to Figure 5 S501 to S502 shown, which will not be elaborated here.
[0256] In the embodiments of the present application, when there are multiple to-be-consensus transaction requests, by performing consensus on the execution results between the multiple to-be-consensus transaction requests, transaction consensus is simply and accurately achieved, which is applicable to many extensive scenarios.
[0257] The following details a specific scenario of the embodiments of the present application:
[0258] Refer to Figure 11 , Figure 11 is a flowchart of a blockchain-based transaction processing method shown in an embodiment of the present application. As Figure 11 shown, the blockchain-based transaction processing method at least includes S1101 to S1110, and the detailed introduction is as follows:
[0259] S1101, construct a transaction broadcast network and a transaction consensus network, and deploy multiple blockchain nodes included in the blockchain system in the transaction broadcast network and the transaction consensus network.
[0260] In the embodiments of the present application, two networks (i.e., a transaction broadcast network and a transaction consensus network) are first constructed, and then multiple blockchain nodes included in the blockchain system are simultaneously deployed in these two networks.
[0261] S1102, receive multiple to-be-added transaction requests respectively sent by each blockchain node through the transaction broadcast network.
[0262] In the embodiments of the present application, transaction broadcast can be achieved by using the transaction broadcast network. Specifically, multiple to-be-added transaction requests sent by blockchain nodes are received through the transaction broadcast network, where the blockchain nodes receive multiple to-be-added transaction requests from the client, thereby realizing the broadcast of batch transactions (i.e., transaction batches / transaction shards).
[0263] S1103, combine multiple to-be-added transaction requests sent by the same blockchain node to obtain multiple transaction request groups.
[0264] In the embodiments of the present application, multiple to-be-added transaction requests sent by the same blockchain node can be combined through the transaction broadcast network to obtain multiple transaction request groups.
[0265] S1104, determine a first target blockchain node that has received multiple transaction request groups through the transaction broadcast network from multiple blockchain nodes.
[0266] S1105, if the number of the first target blockchain nodes reaches a first preset quantity threshold, add the multiple transaction request groups to the transaction pool.
[0267] It can be understood that S1104 to S1105 involve three stages of broadcasting multiple transaction request groups. For specific details, please refer to the foregoing embodiments and will not be elaborated here.
[0268] S1106, use multiple transaction request groups as multiple transaction consensus groups respectively.
[0269] In the embodiments of the present application, multiple transaction request groups can be used as multiple transaction consensus groups respectively.
[0270] In an embodiment of the present application, the network quality of the transaction consensus network can be detected in real time. When the network quality of the transaction consensus network is relatively good, trigger the execution of S1107; Exemplarily, it can be to obtain the network quality index of the transaction consensus network. If it is detected based on the network quality index that the current network quality of the transaction consensus network is greater than the preset network quality threshold, then trigger the execution of S1107.
[0271] S1107, determine, from multiple blockchain nodes, second target blockchain nodes that have passed the verification of the transaction execution order among the to-be-consensus transaction requests corresponding to multiple transaction consensus groups through the transaction consensus network.
[0272] S1108, if the number of second target blockchain nodes reaches the second preset number threshold, determine that the transaction data corresponding to multiple transaction consensus groups has passed the consensus.
[0273] It can be understood that S1107 to S1108 involve three stages of consensus for multiple transaction consensus groups. For specific details, please refer to the foregoing embodiments and will not be elaborated here.
[0274] S1109, execute the to-be-consensus transaction requests corresponding to multiple transaction consensus groups based on the transaction execution order among the to-be-consensus transaction requests corresponding to multiple transaction consensus groups to obtain a transaction execution result.
[0275] As introduced in the foregoing embodiments, proposal data is generated based on the broadcast credential information group QC. Then, when executing a transaction, the broadcast credential information qc corresponding to multiple transaction request groups can be obtained based on the broadcast credential information group QC (i.e., qc 401 , qc 402 , qc 403 ), and then the to-be-consensus transaction requests in the broadcast credential information qc corresponding to each transaction request group can be obtained, and then corresponding execution can be performed.
[0276] For ease of understanding, refer to Figure 12, at height 2, assuming that the current blockchain node 1 is the proposing node, the consensus process is completed based on the batch transaction QC constructed by blockchain node 1, blockchain node 2, and blockchain node 3 at height 2. At this time, each blockchain node (i.e., blockchain node 1, blockchain node 2, and blockchain node 3) finds the corresponding transaction requests b2’, b2”, b2”’ based on the constructed QC; then each blockchain node conducts a new round of consensus process on the batch transaction QC constructed by each blockchain node at the previous height (i.e., height 1) in these three blocks. Assuming that the current blockchain node 2 is the proposing node, at this time, b1”, b1”’, b1”” will be submitted. And so on, when the block whose source has not been submitted is found, the transactions in each transaction batch are executed from front to back, and the transaction execution results are stored and submitted, thus finally forming a DAG tree.
[0277] S1110, store the block corresponding to the transaction execution result on the blockchain.
[0278] It should be noted that Figure 11 For the detailed introduction of S1101 to S1110 shown, please refer to the foregoing embodiments and will not be elaborated here.
[0279] In the embodiments of the present application, blockchain nodes are simultaneously deployed in the transaction broadcast network and the transaction consensus network. Thus, transaction broadcasting can be achieved through the transaction broadcast network, and transaction consensus can be achieved through the transaction consensus network. In this way, transaction broadcasting and transaction consensus are separated / decoupled, reducing the coupling between the two. Even if the transaction broadcast network has an abnormality, transaction consensus can still be executed. Correspondingly, even if the transaction consensus network has an abnormality, transaction broadcasting can still be executed, thus avoiding the phenomenon that transaction broadcasting and transaction consensus are executed in the same network and affect each other. To a great extent, the transaction processing efficiency is improved. At the same time, according to actual needs, transaction broadcasting and transaction consensus can also be executed in parallel, further improving the transaction processing efficiency, and the transaction process is more flexible, enhancing the performance of the blockchain system.
[0280] Figure 13 is a block diagram of a blockchain-based transaction processing device shown in an embodiment of the present application. As Figure 13 shown, the blockchain-based transaction processing device includes:
[0281] A receiving module 1301, configured to receive a transaction request to be added sent by a blockchain node through the transaction broadcast network, where the transaction request to be added is received by the blockchain node from a client;
[0282] An adding and extracting module 1302, configured to add the transaction request to be added to the transaction pool and extract a transaction request to be consensus from the transaction pool;
[0283] The consensus module 1303 is configured to conduct consensus on the transaction data corresponding to the to-be-consensus transaction request through a transaction consensus network, where the transaction consensus network and the transaction broadcast network are different networks.
[0284] In one embodiment of the present application, based on the foregoing solution, the receiving module 1301 is specifically configured to:
[0285] Receive multiple to-be-added transaction requests sent by blockchain nodes through a transaction broadcast network.
[0286] In one embodiment of the present application, based on the foregoing solution, the adding and extracting module 1302 is specifically configured to:
[0287] Combine the multiple to-be-added transaction requests to obtain a transaction request group;
[0288] Add the transaction request group to the transaction pool and use each to-be-added transaction request in the transaction request group as a to-be-consensus transaction request.
[0289] In one embodiment of the present application, based on the foregoing solution, the device may further include:
[0290] A construction module configured to construct a transaction broadcast network and a transaction consensus network;
[0291] A deployment module configured to deploy multiple blockchain nodes included in the blockchain system in the transaction broadcast network and the transaction consensus network.
[0292] In one embodiment of the present application, based on the foregoing solution, the adding and extracting module 1302 is specifically configured to:
[0293] Determine, from the multiple blockchain nodes, first target blockchain nodes that have received the to-be-added transaction request through the transaction broadcast network;
[0294] If the number of the first target blockchain nodes reaches a first preset quantity threshold, add the to-be-added transaction request to the transaction pool.
[0295] In one embodiment of the present application, based on the foregoing solution, the adding and extracting module 1302 is further specifically configured to:
[0296] In the transaction broadcast network, receive response information sent by each blockchain node for indicating that the to-be-added transaction request has been received;
[0297] Determine, from the multiple blockchain nodes, blockchain nodes corresponding to the response information for indicating that the to-be-added transaction request has been received, and use the determined blockchain nodes as the first target blockchain nodes.
[0298] In one embodiment of the present application, based on the foregoing solution, the transaction requests to be consensus include multiple; the consensus module 1303 is specifically configured as follows:
[0299] Determine, from the multiple blockchain nodes, second target blockchain nodes that have passed the verification of the transaction execution order among the multiple transaction requests to be consensus through the transaction consensus network;
[0300] If the number of the second target blockchain nodes reaches a second preset quantity threshold, it is determined that the transaction data corresponding to the multiple transaction requests to be consensus has passed the consensus.
[0301] In one embodiment of the present application, based on the foregoing solution, the consensus module 1303 is further specifically configured as follows:
[0302] In the transaction consensus network, receive response information sent by each blockchain node, which is used to represent that the verification of the transaction execution order among the multiple transaction requests to be consensus has passed;
[0303] Determine, from the multiple blockchain nodes, the blockchain nodes corresponding to the response information indicating that the verification of the transaction execution order among the multiple transaction requests to be consensus has passed, and use the determined blockchain nodes as the second target blockchain nodes.
[0304] In one embodiment of the present application, based on the foregoing solution, the multiple transaction requests to be consensus include each to-be-added transaction request in multiple transaction request groups, and different transaction request groups come from different blockchain nodes; the apparatus may further include:
[0305] An acquisition module, configured to acquire the broadcast credential information of each transaction request group in the transaction consensus network; wherein, the broadcast credential information is generated based on the voting information of the transaction request group, and the voting information is generated in response to the reception situation of the transaction request group when the transaction request group is broadcast;
[0306] A generation module, configured to generate proposal data based on the broadcast credential information of the multiple transaction request groups;
[0307] A sending module, configured to send the proposal data to each blockchain node, so that each blockchain node responds to the transaction execution order among the multiple transaction requests to be consensus based on the proposal data.
[0308] In one embodiment of the present application, based on the foregoing solution, the transaction requests to be consensus include multiple; the consensus module 1303 is specifically configured as follows:
[0309] Determine a third target blockchain node from the multiple blockchain nodes that has verified and passed the transaction execution result through the transaction consensus network; wherein, the transaction execution result is obtained by executing multiple transaction requests to be consensus
[0310] If the number of the third target blockchain nodes reaches a third preset quantity threshold, it is determined that the transaction data corresponding to the multiple transaction requests to be consensus has passed the consensus.
[0311] In an embodiment of the present application, based on the foregoing solution, the consensus module 1303 is further specifically configured to:
[0312] In the transaction consensus network, receive response information sent by each blockchain node for indicating that the verification of the transaction execution result has passed;
[0313] Determine the blockchain nodes corresponding to the response information for indicating that the verification of the transaction execution result has passed from the multiple blockchain nodes, and use the determined blockchain nodes as the third target blockchain nodes.
[0314] In an embodiment of the present application, based on the foregoing solution, the apparatus may further include:
[0315] A storage module, configured to obtain a block generated based on the transaction execution result corresponding to the multiple transaction requests to be consensus, and store the block on the blockchain.
[0316] In an embodiment of the present application, based on the foregoing solution, the consensus module 1303 is specifically configured to:
[0317] Obtain the network quality index of the transaction consensus network;
[0318] If it is detected based on the network quality index that the current network quality of the transaction consensus network is greater than a preset network quality threshold, perform consensus on the transaction data corresponding to the transaction request to be consensus through the transaction consensus network.
[0319] It should be noted that the apparatus provided in the foregoing embodiment and the method provided in the foregoing embodiment belong to the same concept, and the specific manners in which each module and unit perform operations have been described in detail in the method embodiment.
[0320] An embodiment of the present application further provides an electronic device, including: one or more processors; a memory for storing one or more programs, and when the one or more programs are executed by the one or more processors, enabling the electronic device to implement the foregoing blockchain-based transaction processing method.
[0321] Figure 14 It is a schematic structural diagram of a computer system of an electronic device suitable for implementing the embodiments of the present application.
[0322] It should be noted that Figure 14 The computer system 1400 of the illustrated electronic device is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present application.
[0323] As Figure 14 shown, the computer system 1400 includes a central processing unit (CPU) 1401, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1402 or the program loaded from the storage section 1408 into the random access memory (RAM) 1403, such as executing the method in the above embodiments. In the RAM 1403, various programs and data required for system operation are also stored. The CPU 1401, ROM 1402, and RAM 1403 are connected to each other via a bus 1404. An input / output (I / O) interface 1405 is also connected to the bus 1404.
[0324] The following components are connected to the I / O interface 1405: an input section 1406 including a keyboard, a mouse, etc.; an output section 1407 including such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 1408 including a hard disk, etc.; and a communication section 1409 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1409 performs communication processing via a network such as the Internet. A drive 1410 is also connected to the I / O interface 1405 as required. A removable medium 1411, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1410 as required so that the computer program read from it can be installed into the storage section 1408 as required.
[0325] Specifically, according to the embodiments of the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments of the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication section 1409, and / or installed from the removable medium 1411. When the computer program is executed by the central processing unit (CPU) 1401, various functions defined in the system of the present application are executed.
[0326] It should be noted that the computer-readable medium shown in the embodiments of the present application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. The computer-readable medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable medium include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer-readable medium can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, apparatus, or device. In the present application, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable computer program. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, and this computer-readable medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted by any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0327] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. Among them, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in an order different from that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0328] The units involved in the embodiments of the present application can be implemented in software or in hardware, and the described units can also be provided in a processor. Among them, the names of these units do not, in some cases, constitute a limitation on the units themselves.
[0329] Another aspect of the present application further provides a computer-readable medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the blockchain-based transaction processing method as described above. The computer-readable medium may be included in the electronic device described in the above embodiments, or may exist alone without being assembled into the electronic device.
[0330] Another aspect of the present application further provides a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable medium. The processor of the computer device reads the computer instructions from the computer-readable medium, and the processor executes the computer instructions, so that the computer device executes the blockchain-based transaction processing methods provided in the above various embodiments.
[0331] The above content is only a preferred exemplary embodiment of the present application and is not used to limit the implementation of the present application. Those of ordinary skill in the art can easily make corresponding adaptations or modifications according to the main concept and spirit of the present application. Therefore, the protection scope of the present application should be subject to the protection scope required by the claims.
Claims
1. A blockchain-based transaction processing method, characterized in that including: Receiving a transaction request to be added sent by a blockchain node through a transaction broadcast network, where the transaction request to be added is received by the blockchain node from a client; Adding the transaction request to be added to a transaction pool, and extracting a transaction request to be consensus from the transaction pool; Performing consensus on the transaction data corresponding to the transaction request to be consensus through a transaction consensus network, where the transaction consensus network and the transaction broadcast network are different networks.
2. The method according to claim 1, characterized in that, The receiving, through the transaction broadcast network, the transaction request to be added sent by the blockchain node includes: Receiving multiple transaction requests to be added sent by the blockchain node through the transaction broadcast network; The adding the transaction request to be added to the transaction pool and extracting the transaction request to be consensus from the transaction pool includes: Combining the multiple transaction requests to be added to obtain a transaction request group; Adding the transaction request group to the transaction pool, and using each transaction request to be added in the transaction request group as a transaction request to be consensus.
3. The method according to claim 1, characterized in that Before the receiving, through the transaction broadcast network, the transaction request to be added sent by the blockchain node, the method further includes: Constructing a transaction broadcast network and a transaction consensus network; Deploying multiple blockchain nodes included in the blockchain system in the transaction broadcast network and the transaction consensus network.
4. The method according to claim 3, wherein The adding the transaction request to be added to the transaction pool includes: Determining, from the multiple blockchain nodes, a first target blockchain node that has received the transaction request to be added through the transaction broadcast network; If the number of the first target blockchain nodes reaches a first preset quantity threshold, adding the transaction request to be added to the transaction pool.
5. The method according to claim 4, characterized in that, The determining, from the multiple blockchain nodes, the first target blockchain node that has received the transaction request to be added through the transaction broadcast network includes: In the transaction broadcast network, receiving response information sent by each blockchain node for indicating that the transaction request to be added has been received; Determining, from the multiple blockchain nodes, the blockchain node corresponding to the response information for indicating that the transaction request to be added has been received, and using the determined blockchain node as the first target blockchain node.
6. The method according to claim 3, wherein There are multiple transaction requests to be consensus; the performing consensus on the transaction data corresponding to the transaction request to be consensus through the transaction consensus network includes: Determining, from the multiple blockchain nodes, a second target blockchain node that has passed the verification of the transaction execution order among multiple transaction requests to be consensus through the transaction consensus network; If the number of the second target blockchain nodes reaches a second preset quantity threshold, determining that the consensus on the transaction data corresponding to the multiple transaction requests to be consensus has passed.
7. The method according to claim 6, wherein The determining, from the multiple blockchain nodes, the second target blockchain node that has passed the verification of the transaction execution order among multiple transaction requests to be consensus through the transaction consensus network includes: In the transaction consensus network, receiving response information sent by each blockchain node for indicating that the verification of the transaction execution order among multiple transaction requests to be consensus has passed; Determine, from the multiple blockchain nodes, the blockchain node corresponding to the response information indicating that the verification of the transaction execution order among the multiple transaction requests to be consensus is passed, and use the determined blockchain node as the second target blockchain node.
8. The method according to claim 7, wherein The multiple transaction requests to be consensus include each pending addition transaction request in multiple transaction request groups, and different transaction request groups come from different blockchain nodes; before receiving, in the transaction consensus network, the response information sent by each blockchain node indicating that the verification of the transaction execution order among the multiple transaction requests to be consensus is passed, the method further includes: In the transaction consensus network, obtain the broadcast credential information of each transaction request group; wherein, the broadcast credential information is generated based on the voting information of the transaction request group, and the voting information is generated in response to the reception situation of the transaction request group when broadcasting the transaction request group; Generate proposal data based on the broadcast credential information of the multiple transaction request groups; Send the proposal data to each blockchain node, so that each blockchain node responds to the transaction execution order among the multiple transaction requests to be consensus based on the proposal data.
9. The method according to claim 3, wherein There are multiple transaction requests to be consensus; the consensus on the transaction data corresponding to the transaction requests to be consensus through the transaction consensus network includes: Determine, from the multiple blockchain nodes, the third target blockchain node that passes the verification of the transaction execution result through the transaction consensus network; wherein, the transaction execution result is obtained by executing the multiple transaction requests to be consensus. If the number of the third target blockchain nodes reaches the third preset quantity threshold, determine that the consensus on the transaction data corresponding to the multiple transaction requests to be consensus is passed.
10. The method according to claim 9, wherein The determining, from the multiple blockchain nodes, the third target blockchain node that passes the verification of the transaction execution result through the transaction consensus network includes: In the transaction consensus network, receive the response information sent by each blockchain node indicating that the verification of the transaction execution result is passed; Determine, from the multiple blockchain nodes, the blockchain node corresponding to the response information indicating that the verification of the transaction execution result is passed, and use the determined blockchain node as the third target blockchain node.
11. The method according to claim 6 or 9, characterized in that, After determining that the consensus on the transaction data corresponding to the multiple transaction requests to be consensus is passed, the method further includes: Obtain the block generated based on the transaction execution results corresponding to the multiple transaction requests to be consensus; Store the block on the blockchain.
12. The method according to any one of claims 1 to 10, characterized in that, The consensus on the transaction data corresponding to the transaction requests to be consensus through the transaction consensus network includes: Obtain the network quality index of the transaction consensus network; If it is detected, based on the network quality index, that the current network quality of the transaction consensus network is greater than the preset network quality threshold, perform consensus on the transaction data corresponding to the transaction requests to be consensus through the transaction consensus network.
13. A transaction processing device based on blockchain, characterized in that, Includes: A receiving module, configured to receive, through the transaction broadcast network, the pending addition transaction requests sent by the blockchain nodes, where the pending addition transaction requests are received by the blockchain nodes from the client; An addition and extraction module, configured to add the to-be-added transaction request to a transaction pool and extract a to-be-consensus transaction request from the transaction pool; A consensus module, configured to perform consensus on transaction data corresponding to the to-be-consensus transaction request through a transaction consensus network, where the transaction consensus network and the transaction broadcast network are different networks.
14. An electronic device, characterized in that, Comprising: One or more processors; A memory for storing one or more programs, which, when executed by the electronic device, cause the electronic device to implement the blockchain-based transaction processing method according to any one of claims 1 to 12.
15. A computer-readable medium having a computer program stored thereon, characterized in that, The computer program, when executed by a processor, implements the blockchain-based transaction processing method according to any one of claims 1 to 12.
16. A computer program product comprising computer instructions, characterized in that, The computer instruction, when executed by a processor, implements the blockchain-based transaction processing method according to any one of claims 1 to 12.