Data processing method and apparatus based on blockchain, and device and readable storage medium
Through the collaborative work of core engine components and consensus components, the blockchain network is compatible with deterministic and non-deterministic scheduling algorithms, solving the problem of limited functional scenarios in the existing technology and achieving richer functional scenarios and flexibility.
Patent Information
- Application Number
- PCT/CN2023/134377
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-03
- Filing Date
- 2023-11-27
- Publication Date
- 2024-09-12
AI Technical Summary
Existing blockchain networks can only support one scheduling algorithm, resulting in limited functional scenarios and incompatibility with deterministic and non-deterministic scheduling algorithms.
Through the collaborative work of core engine components and consensus components, blockchain nodes can determine the transaction scheduling type based on chain configuration information and perform corresponding processing, supporting compatible deterministic and non-deterministic scheduling consensus processing.
It realizes the compatibility of the blockchain network with different scheduling algorithms, enriches the functional scenarios, and enhances the flexibility and adaptability of the blockchain network.
Smart Images

Figure CN2023134377_12092024_PF_FP_ABST
Abstract
Description
Blockchain-based data processing method, device, equipment, and readable storage medium
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on March 3, 2023, with application number 202310239564.X and application name “Blockchain-based data processing method, device, equipment and readable storage medium”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of computer technology, and in particular to a blockchain-based data processing method, apparatus, device, and readable storage medium. Background Art
[0003] Blocks need to be agreed upon before they can be written into the blockchain, which makes the blockchain tamper-proof and authentic. Therefore, more and more companies are beginning to use blockchain to store transaction data to ensure the security of transaction data.
[0004] There are two main types of existing transaction scheduling: deterministic scheduling, which determines the order in which transactions are executed for the same batch of transactions; and non-deterministic scheduling, which generates a random order in which transactions are executed for the same batch of transactions. Even running the scheduling algorithm twice consecutively on the same node for the same batch of transactions can produce different results. Because different scheduling algorithms produce different execution results, their corresponding consensus processes differ. As a result, existing blockchain networks typically only support a single scheduling algorithm, limiting the functional scenarios of a single blockchain network.
[0005] Summary of the Invention
[0006] The embodiments of the present application provide a blockchain-based data processing method, apparatus, device, and readable storage medium, which are compatible with deterministic scheduling algorithms and non-deterministic scheduling algorithms, and enrich the functional scenarios of blockchain.
[0007] On the one hand, an embodiment of the present application provides a data processing method based on blockchain, including:
[0008] When a blockchain node determines through the core engine component that the block generation conditions are met, it obtains the chain configuration information through the core engine component, packages the prepared block according to the chain configuration information, and determines the transaction scheduling type according to the chain configuration information. The block generation conditions refer to the conditions under which the blockchain node is selected as the proposal node for this round of blocks.
[0009] If the core engine component determines that the transaction scheduling type is a non-deterministic scheduling type, the core engine component executes the prepared block to obtain a first block to be on-chain; the first block to be on-chain includes the first transaction execution order and the first transaction execution result;
[0010] Send the first block to be chained in the core engine component to the consensus component, and perform non-deterministic scheduling consensus processing on the first block to be chained through the consensus component;
[0011] If the core engine component determines that the transaction scheduling type is a deterministic scheduling type, the prepared block in the core engine component is sent to the consensus component, and the consensus component and the core engine component perform deterministic scheduling consensus processing on the prepared block; during the deterministic scheduling consensus processing process, the core engine component is used to execute the transactions in the prepared block.
[0012] On the one hand, an embodiment of the present application provides a data processing device based on blockchain, including:
[0013] The packaging module is used to obtain chain configuration information through the core engine component when the core engine component determines that the block production conditions are met, package the prepared blocks according to the chain configuration information, and determine the transaction scheduling type according to the chain configuration information; the block production conditions refer to the conditions for the blockchain node to be selected as the proposal node for the current round of blocks;
[0014] A first execution module is configured to, if the core engine component determines that the transaction scheduling type is a non-deterministic scheduling type, execute the prepared block through the core engine component to obtain a first block to be on-chain; the first block to be on-chain includes a first transaction execution order and a first transaction execution result;
[0015] A first consensus module is configured to send the first block to be chained in the core engine component to the consensus component, and perform non-deterministic scheduling consensus processing on the first block to be chained through the consensus component;
[0016] The second consensus module is used to send the prepared block in the core engine component to the consensus component if the core engine component determines that the transaction scheduling type is a deterministic scheduling type, and perform deterministic scheduling consensus processing on the prepared block through the consensus component and the core engine component; during the deterministic scheduling consensus processing process, the core engine component is used to execute the transactions in the prepared block.
[0017] Among them, the chain configuration information includes block configuration information and transaction scheduling identifier;
[0018] Packaged modules, including:
[0019] An acquisition unit, used to obtain block configuration information and transaction scheduling identifiers through the core engine component;
[0020] The block packaging unit is used to obtain the transactions to be packaged from the transaction pool according to the block configuration information, and to package the transactions to be packaged into blocks according to the block configuration information to obtain the prepared blocks;
[0021] a scheduling determination unit, configured to determine the transaction scheduling type as a non-deterministic scheduling type if the transaction scheduling identifier is a non-deterministic scheduling identifier;
[0022] The scheduling determination unit is further configured to determine that the transaction scheduling type is a deterministic scheduling type if the transaction scheduling identifier is a deterministic scheduling identifier.
[0023] Among them, the first consensus module includes:
[0024] A first sending unit, configured to send the first to-be-chained block in the core engine component to the consensus component;
[0025] A first scheduling determination unit, configured to determine a transaction scheduling type through a consensus component;
[0026] A first pre-voting unit is configured to, if the consensus component determines that the transaction scheduling type is a non-deterministic scheduling type, perform a pre-voting process on the first block to be on-chain according to the first transaction execution order and the first transaction execution result in the first block to be on-chain, and obtain a first intermediate pre-voting result.
[0027] The first voting unit is used to perform result voting on the first block to be chained according to the first intermediate pre-voting result and the first block hash corresponding to the first block to be chained, so as to obtain a non-deterministic scheduling consensus result for the first block to be chained.
[0028] The first pre-voting unit includes:
[0029] A proposal broadcast subunit is configured to generate proposal information for the first block to be on-chain in the consensus component, and broadcast the proposal information to consensus nodes in the blockchain network, so that the consensus nodes in the blockchain network generate a second transaction execution result based on the proposal information, and generate first pre-voting information based on the first transaction execution result and the second transaction execution result; the second transaction execution result is obtained after the consensus nodes in the blockchain network execute the transactions in the first block to be on-chain according to the first transaction execution order;
[0030] a pre-voting subunit, configured to generate second pre-voting information for the first transaction execution result, and broadcast the second pre-voting information to consensus nodes in the blockchain network;
[0031] The pre-voting sub-unit is further configured to determine a first intermediate pre-voting result based on the acquired first pre-voting information and the acquired second pre-voting information.
[0032] Among them, the first voting unit includes:
[0033] a voting processing subunit, configured to generate first voting information for the first block to be on-chain based on the first intermediate pre-voting result and the first block hash corresponding to the first block to be on-chain; the first voting information includes the first intermediate pre-voting result and the first block hash;
[0034] The voting processing subunit is further configured to send the first voting information to a consensus node in the blockchain network;
[0035] The voting processing subunit is further configured to receive second voting information for the first block to be on-chain, sent by a consensus node in the blockchain network; the second voting information includes an intermediate pre-voting result determined by the consensus node in the blockchain network and a hash of the first block;
[0036] The result determination subunit is used to determine a non-deterministic scheduling consensus result for the first block to be chained based on the first voting information and the second voting information.
[0037] Among them, the second consensus module includes:
[0038] A second sending unit is used to send the prepared block in the core engine component to the consensus component;
[0039] A second scheduling determination unit, configured to determine a transaction scheduling type through a consensus component;
[0040] The second pre-voting unit is configured to generate proposal information for the prepared block in the consensus component if the consensus component determines that the transaction scheduling type is a deterministic scheduling type, and broadcast the proposal information to the consensus nodes in the blockchain network, so that the consensus nodes in the blockchain network execute the transactions in the prepared block in the proposal information according to the deterministic transaction execution order;
[0041] a first result receiving unit configured to, upon receiving, through the consensus component, a third transaction execution result sent by the core engine component, generate fourth pre-voting information for the third transaction execution result, and broadcast the fourth pre-voting information and the third transaction execution result to consensus nodes within the blockchain network, so that the consensus nodes within the blockchain network generate the third pre-voting information based on the third transaction execution result; the third transaction execution result is obtained after the core engine component, upon acquiring the preliminary block, begins executing transactions in the preliminary block according to the deterministic transaction execution order;
[0042] The second pre-voting unit is further configured to determine a second intermediate pre-voting result based on the acquired third pre-voting information and fourth pre-voting information;
[0043] A first block updating unit is configured to update the prepared block according to the third transaction execution result to obtain a second block to be on-chain;
[0044] The second voting unit is used to perform result voting on the second block to be chained according to the second intermediate pre-voting result and the second block hash corresponding to the second block to be chained, so as to obtain a deterministic scheduling consensus result for the second block to be chained.
[0045] Among them, the consensus component includes the consensus adaptation component and the consensus execution component;
[0046] The first consensus module includes:
[0047] A third sending unit is used to send the first block to be chained in the core engine component to the consensus adapter component;
[0048] A hash generation unit, configured to generate, in the consensus adapter component, a first voting hash for the first block to be on-chain based on a first block hash corresponding to the first block to be on-chain;
[0049] A fourth sending unit, configured to send the first to-be-chained block and the first voting hash in the consensus adapter component to the consensus execution component;
[0050] A third pre-voting unit is configured to, in the consensus execution component, perform a pre-voting process on the first block to be on-chain according to the first transaction execution order and the first transaction execution result in the first block to be on-chain, and obtain a third intermediate pre-voting result;
[0051] The third voting unit is used to perform result voting on the first block to be chained according to the first voting hash and the third intermediate pre-voting result, and obtain a non-deterministic scheduling consensus result for the first block to be chained.
[0052] Among them, the consensus component includes the consensus adaptation component and the consensus execution component;
[0053] The second consensus module includes:
[0054] a fifth sending unit, configured to send the prepared block in the core engine component to the consensus adapter component;
[0055] A fourth pre-voting unit is configured to send the prepared block to the consensus execution component via the consensus adapter component, and in the consensus execution component, generate proposal information for the prepared block and broadcast the proposal information to the consensus nodes in the blockchain network, so that the consensus nodes in the blockchain network execute the transactions in the prepared block in the proposal information according to the deterministic transaction execution order;
[0056] A second result receiving unit is configured to receive, through the consensus adapter component, a fourth transaction execution result sent by the core engine component; the fourth transaction execution result is obtained after the core engine component executes the transactions in the prepared block according to the deterministic transaction execution order;
[0057] A second block updating unit is configured to, in the consensus adapter component, update the preliminary block according to the fourth transaction execution result to obtain a third block to be on-chained, and generate a second voting hash for the third block to be on-chained according to a third block hash corresponding to the third block to be on-chained;
[0058] a sixth sending unit, configured to send the fourth transaction execution result and the second voting hash in the consensus adapter component to the consensus execution component;
[0059] The fourth pre-voting unit is further configured to generate, in the consensus execution component, fifth pre-voting information for the fourth transaction execution result, and broadcast the fifth pre-voting information and the fourth transaction execution result to consensus nodes in the blockchain network, so that the consensus nodes in the blockchain network generate sixth pre-voting information based on the fourth transaction execution result;
[0060] The fourth pre-voting unit is further configured to determine a fourth intermediate pre-voting result based on the acquired sixth pre-voting information and the acquired fifth pre-voting information;
[0061] The fourth voting unit is used to perform result voting on the third block to be chained according to the second voting hash and the fourth intermediate pre-voting result, and obtain a deterministic scheduling consensus result for the third block to be chained.
[0062] The data processing device further includes:
[0063] The third consensus module is used when a blockchain node receives proposal information for a block to be agreed upon through the consensus component. In the consensus component, the consensus component verifies the signature of the block to be agreed upon based on the proposal information and obtains a verification result. The block to be agreed upon is generated by the target blockchain node in the blockchain network when it determines that the block generation conditions are met.
[0064] The third consensus module is also used to determine the transaction scheduling type through the core engine component if the consensus component determines that the signature verification result is a passed result;
[0065] The third consensus module is further configured to, if the core engine component determines that the transaction scheduling type is a non-deterministic scheduling type, obtain a second transaction execution order from the block to be agreed upon, execute the block to be agreed upon according to the second transaction execution order, and obtain a fifth transaction execution result;
[0066] The third consensus module is further configured to send the fifth transaction execution result in the core engine component to the consensus component. In the consensus component, verification voting is performed on the consensus block based on the fifth transaction execution result to obtain a consensus result for the consensus block.
[0067] The third consensus module is further configured to execute the consensus block according to the deterministic transaction execution order to obtain a sixth transaction execution result if the core engine component determines that the transaction scheduling type is a deterministic scheduling type;
[0068] The third consensus module is further configured to send the sixth transaction execution result in the core engine component to the consensus component. In the consensus component, a verification voting process is performed on the block to be consensus based on the sixth transaction execution result to obtain a consensus result for the block to be consensus.
[0069] Among them, the consensus component includes the consensus adaptation component and the consensus execution component;
[0070] The above-mentioned data processing device further includes:
[0071] The fourth consensus module is used to verify the signature of the consensus block to be reached based on the proposal information received by the blockchain node through the consensus execution component, and obtain the verification result. The consensus block to be reached is generated by the target blockchain node in the blockchain network when the block generation conditions are met;
[0072] The fourth consensus module is further configured to, if the consensus execution component determines that the signature verification result is a passed signature verification result, send an execution request to the consensus adapter component through the consensus execution component, and send the execution request to the core engine component through the consensus adapter component;
[0073] The fourth consensus module is also used in the core engine component to determine the transaction scheduling type based on the execution request;
[0074] The fourth consensus module is further configured to, if the core engine component determines that the transaction scheduling type is a non-deterministic scheduling type, obtain a second transaction execution order from the block to be agreed upon, execute the block to be agreed upon according to the second transaction execution order, and obtain a seventh transaction execution result;
[0075] The fourth consensus module is further configured to send the seventh transaction execution result in the core engine component to the consensus adapter component, and in the consensus adapter component, generate a third voting hash based on the seventh transaction execution result;
[0076] The fourth consensus module is further configured to send the seventh transaction execution result and the third voting hash to the consensus execution component via the consensus adapter component. In the consensus execution component, verification and voting are performed on the block to be consensus based on the seventh transaction execution result and the third voting hash to obtain a consensus result for the block to be consensus.
[0077] The fourth consensus module is further configured to, if the core engine component determines that the transaction scheduling type is a deterministic scheduling type, execute the block to be agreed upon according to the deterministic transaction execution order to obtain an eighth transaction execution result;
[0078] The fourth consensus module is further configured to send the eighth transaction execution result from the core engine component to the consensus adapter component, and generate a fourth voting hash in the consensus adapter component based on the eighth transaction execution result;
[0079] The fourth consensus module is further used to send the eighth transaction execution result and the fourth voting hash to the consensus execution component through the consensus adapter component. In the consensus execution component, verification voting is performed on the consensus block according to the eighth transaction execution result and the fourth voting hash to obtain a consensus result for the consensus block.
[0080] The data processing device further includes:
[0081] A configuration update module is used to obtain a configuration information update transaction; the configuration information update transaction includes an update transaction scheduling identifier;
[0082] The configuration update module is also used to call the configuration information update contract according to the configuration information update transaction if it is determined that the configuration information update transaction consensus has passed, and update the transaction scheduling identifier through the configuration information update contract.
[0083] On one hand, an embodiment of the present application provides a computer device, including: a processor, a memory, and a network interface;
[0084] The above-mentioned processor is connected to the above-mentioned memory and the above-mentioned network interface, wherein the above-mentioned network interface is used to provide a data communication network element, the above-mentioned memory is used to store a computer program, and the above-mentioned processor is used to call the above-mentioned computer program to execute the method in the embodiment of the present application.
[0085] On one hand, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. The computer program is suitable for being loaded by a processor and executing the method in the embodiment of the present application.
[0086] On the one hand, an embodiment of the present application provides a computer program product or a computer program, which includes computer instructions, which are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method in the embodiment of the present application.
[0087] In the embodiment of the present application, when the blockchain node determines that the block generation conditions are met through the core engine component, it can obtain the chain configuration information through the core engine component, package the prepared block according to the chain configuration information, and determine the transaction scheduling type according to the chain configuration information; if the core engine component determines that the transaction scheduling type is a non-deterministic scheduling type, the prepared block is executed and processed by the core engine component to obtain the first block to be chained; the first block to be chained includes the first transaction execution order and the first transaction execution result; the first block to be chained in the core engine component is sent to the consensus component, and the first block to be chained is processed by the consensus component; if the core engine component determines that the transaction scheduling type is a deterministic scheduling type, the prepared block in the core engine component is sent to the consensus component, and the prepared block is processed by the consensus component and the core engine component. Through the method provided in the embodiment of the present application, the consensus component can adapt different consensus processing processes for scheduling algorithms of different transaction scheduling types, so that the blockchain node can be compatible with scheduling algorithms of deterministic scheduling types and scheduling algorithms of non-deterministic scheduling types, thereby enriching the functional scenarios of the blockchain network. BRIEF DESCRIPTION OF THE DRAWINGS
[0088] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0089] FIG1 is a schematic diagram of the structure of a blockchain network provided in an embodiment of the present application;
[0090] FIG2 is a schematic diagram of a scenario of a blockchain-based data processing method provided in an embodiment of the present application;
[0091] FIG3a is a schematic diagram of a flowchart of a blockchain-based data processing method provided in an embodiment of the present application;
[0092] FIG3b is a schematic diagram of a consensus process for proposal nodes to adapt to different scheduling algorithms provided by an embodiment of the present application;
[0093] FIG4a is a flow chart of a blockchain-based data processing method provided in an embodiment of the present application;
[0094] FIG4b is a schematic diagram of a consensus process for a proposal node to adapt to different scheduling algorithms provided by an embodiment of the present application;
[0095] FIG5a is a flow chart of a data processing method based on blockchain provided in an embodiment of the present application;
[0096] FIG5 b is a schematic diagram of a consensus process for a verification node to adapt to different scheduling algorithms provided by an embodiment of the present application;
[0097] FIG6a is a flow chart of a blockchain-based data processing method provided in an embodiment of the present application;
[0098] FIG6 b is a schematic diagram of a consensus process for a verification node to adapt to different scheduling algorithms provided by an embodiment of the present application;
[0099] FIG7 is a schematic diagram of the structure of a blockchain-based data processing device provided in an embodiment of the present application;
[0100] FIG8 is a schematic structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0101] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0102] To facilitate understanding, we first provide a brief explanation of some nouns:
[0103] 1. Blockchain: In a narrow sense, blockchain is a chain data structure with blocks as the basic unit. Digital summaries are used in blocks to verify previously acquired transaction histories, which is suitable for the tamper-proof and scalability requirements in distributed accounting scenarios. In a broad sense, blockchain also refers to the distributed accounting technology implemented by the blockchain structure, including distributed consensus, privacy and security protection, peer-to-peer communication technology, network protocols, smart contracts, etc.
[0104] The goal of blockchain is to create a distributed data record book that only allows additions, not deletions. The underlying structure of this ledger is a linear linked list. This linked list consists of a series of "blocks," with successive blocks recording the hash values of previous blocks. The legitimacy of each block (and the transactions within it) can be quickly verified by calculating the hash value. If a node in the network proposes to add a new block, the block must be confirmed through a consensus mechanism.
[0105] 2. Block: A data packet carrying transaction data on a blockchain network is a data structure marked with a timestamp and the hash value of the previous block. Blocks are verified and validated through the network's consensus mechanism, confirming the transactions within them. A block consists of a block header and a block body. The block header records metadata about the current block, including the current version number, the hash value of the previous block, a timestamp, a random number, and the hash value of the Merkle root. The block body records detailed data generated over a period of time, including all verified transactions within the current block and other information generated during the block creation process. It can be considered a form of ledger. Furthermore, detailed data in the block body can include a unique Merkle root generated through the Merkle tree hashing process, which is recorded in the block header.
[0106] The predecessor block, also known as the parent block, is sorted in time by recording the hash value corresponding to the block and the hash value corresponding to the parent block in the block header.
[0107] 3. Hash value: Also known as an information characteristic value or eigenvalue, a hash value is generated by converting input data of any length into a cryptographically encoded form and producing a fixed output using a hashing algorithm. The original input data cannot be retrieved by decrypting the hash value; it is a one-way encryption function. In a blockchain, each block (except the initial block) contains the hash value of the previous block. The hash value is the core foundation and most important aspect of the potential of blockchain technology, preserving the authenticity of recorded and accessed data, as well as the integrity of the blockchain as a whole.
[0108] 4. Smart Contract: The concept of a smart contract combines commitment, agreement, and digital form, extending the application of blockchain technology to all aspects of financial transactions, payments, settlement, and clearing. A smart contract executes contractual clauses immediately when a pre-programmed condition is triggered, similar to the "if-then" statements in a computer program.
[0109] 5. Deterministic Scheduling: This means that the execution order of the first transactions generated for the same batch of transactions is fixed. The advantage of this algorithm is that the execution order of the first transactions is stable and reproducible. Therefore, in theory, the information about the execution order of the first transactions can be excluded from the block, and each validator node can simply run a parallel scheduling algorithm to verify it.
[0110] 6. Non-deterministic scheduling: This means that the order of first transaction execution for the same batch of transactions is random. Even if the same node runs the scheduling algorithm twice for the same batch of transactions, the results may differ. This type of algorithm is often faster, but the difficulty lies in how the validating node can ensure that the execution order is consistent with the proposing node and that the execution results are the same. Therefore, the execution order of transactions must be packaged into blocks and verified by other nodes.
[0111] 7. Consensus Component: Also known as the consensus engine module, this is a module within the consensus node. This module primarily includes the consensus algorithm module and the peer-to-peer network module. The consensus algorithm module can include a variety of specific consensus algorithms, including the fault-tolerant Raft consensus algorithm and the Byzantine fault-tolerant PBFT, Tendermint, and HotStuff consensus algorithms. Different consensus algorithms have different application scenarios. The peer-to-peer network module is responsible for broadcasting and receiving proposal and voting messages.
[0112] 8. Core engine component: Also known as the core engine module, it is the core scheduling module in the consensus node. This module mainly plays the role of central scheduling. When the consensus node is a proposal node, the consensus engine module of the proposal node will notify the core engine module to construct blocks and execute transactions, and finally give the constructed blocks to the consensus engine module. The consensus engine module will then construct proposals based on the blocks and broadcast the proposals to other verification nodes. After receiving the proposal and verifying its validity, the verification node will let its core engine module verify the validity of the block and execute the transaction. If the transaction execution result of the verification node is consistent with that of the proposal node, the block is considered valid.
[0113] 9. Proposal Node: A consensus node in the blockchain, responsible for maintaining data consistency across the entire blockchain network. Proposal nodes are primarily responsible for packaging transactions into blocks within a consensus round and broadcasting these blocks to other validation nodes. Therefore, proposal nodes play a crucial role in a consensus round. If a proposal node acts maliciously, packaging invalid transactions or having errors in the block structure, consensus will not be reached on any blocks in that round.
[0114] 10. Verification Node: A role of consensus node in the blockchain. Its main function is to verify the validity of the block after receiving the block proposed by the proposal node and execute the transaction. If the verification block is invalid or the transaction execution result is inconsistent, it will not vote on the block or vote against it. If the block verification is valid and the transaction execution result is consistent, it will vote on the block.
[0115] Please refer to Figure 1, which is a schematic diagram of the structure of a blockchain network provided in an embodiment of the present application. The blockchain network shown in Figure 1 may include, but is not limited to, a blockchain network corresponding to a consortium chain. The blockchain network may include multiple blockchain nodes, which may specifically include blockchain node 10a, blockchain node 10b, blockchain node 10c, blockchain node 10d, ..., blockchain node 10n. Each blockchain node may receive data sent from the outside during normal operation, perform block chain processing based on the received data, and may also send data to the outside. To ensure data interoperability between the various blockchain nodes, data connections may exist between each blockchain node, for example, a data connection between blockchain node 10a and blockchain node 10b, a data connection between blockchain node 10a and blockchain node 10c, and a data connection between blockchain node 10b and blockchain node 10c.
[0116] It is understandable that data or blocks can be transferred between blockchain nodes through the above-mentioned data connection. The blockchain network can realize data connection between blockchain nodes based on node identification. Each blockchain node in the blockchain network has a corresponding node identification, and each of the above-mentioned blockchain nodes can store the node identifications of other blockchain nodes with which it is connected, so that the acquired data or generated blocks can be broadcast to other blockchain nodes based on the node identifications of other blockchain nodes. For example, the blockchain node 10a can maintain a node identification list as shown in Table 1, which stores the node names and node identifications of other nodes:
[0117] Table 1
[0118] The node identifier can be an Internet Protocol (IP) address or any other information that can be used to identify a node in a blockchain network. Table 1 uses the IP address as an example. For example, blockchain node 10a can send information (e.g., a block) to blockchain node 10b using the node identifier BBB.BBB.BBB.BBB, and blockchain node 10b can determine that the information was sent by blockchain node 10a using the node identifier AAA.AAA.AAA.AAA.
[0119] In a blockchain, before a block is uploaded to the blockchain, it must be agreed upon by consensus nodes within the blockchain network. Only after consensus is achieved can the block be added to the blockchain. It is understandable that when blockchain is used in certain government or commercial scenarios, not all participating nodes (i.e., the blockchain nodes in the aforementioned blockchain network) have sufficient resources or the necessary resources to serve as consensus nodes. For example, in the blockchain network shown in Figure 1, blockchain nodes 10a, 10b, 10c, and 10d can be considered consensus nodes. Consensus nodes in a blockchain network participate in consensus, i.e., reaching consensus on blocks (containing a batch of transactions) and voting on blocks. Non-consensus nodes, on the other hand, do not participate in consensus, but help propagate block and voting information and synchronize their status.
[0120] In the implementation of this application, when any blockchain node in the blockchain network shown in Figure 1 determines through the core engine component that the block generation conditions are met, it can obtain chain configuration information through the core engine component, package the prepared block according to the chain configuration information, and determine the transaction scheduling type according to the chain configuration information; if the blockchain node determines through the core engine component that the transaction scheduling type is a non-deterministic scheduling type, the core engine component executes the prepared block to obtain a first block to be chained; the first block to be chained includes a first transaction execution order and a first transaction execution result; the first block to be chained in the core engine component is sent to the consensus component, and the consensus component performs non-deterministic scheduling consensus processing on the first block to be chained; if the blockchain node determines through the core engine component that the transaction scheduling type is a deterministic scheduling type, the prepared block in the core engine component is sent to the consensus component, and the consensus component and the core engine component perform deterministic scheduling consensus processing on the prepared block.
[0121] It can be understood that the above-mentioned data connection does not limit the connection method. It can be directly or indirectly connected through wired communication, directly or indirectly connected through wireless communication, or through other connection methods. This application does not limit it here.
[0122] It is understood that the data processing method provided in the embodiments of the present application can be executed by a computer device, including but not limited to the above-mentioned blockchain node (which can be a terminal or a server). The above-mentioned server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The above-mentioned terminal can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this.
[0123] It is understood that the embodiments of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, etc. For example, a blockchain node system can reach a consensus on driving behavior data, road trajectory data, etc. sent by an in-vehicle terminal, and store the data on the blockchain after consensus is reached.
[0124] It is understandable that in the specific implementation of this application, the transaction data, status data and other related data involved, when the above embodiments of this application are applied to specific products or technologies, need to obtain user permission or consent, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of relevant countries and regions.
[0125] To facilitate understanding of the consensus process of the blockchain nodes under different scheduling algorithms, please refer to FIG. 2 , which is a schematic diagram of a scenario of a blockchain-based data processing method provided in an embodiment of the present application. The blockchain node 20 shown in FIG. 2 can be any blockchain node in the blockchain network shown in FIG. 1 , for example, blockchain node 20 is blockchain node 10. The blockchain node 20 can be integrated with a core engine component 201 and a consensus component 202.
[0126] As shown in Figure 2, when a blockchain node 20 determines through core engine component 201 that a block generation condition is met, where the block generation condition is met based on the consensus mechanism of the blockchain network, the blockchain node 20 is selected as the proposal node for the current round of blocks and can obtain the chain configuration information corresponding to the blockchain network. This chain configuration information may include block configuration information, which may include block-related configuration information, such as the fixed number of transactions that the block should contain. Based on the block configuration information, the blockchain node can obtain pending transactions from transaction pool 21, such as transaction 1, ..., transaction m, and package them to generate a preliminary block 22. The transaction pool 21 is used to store transactions that are known in the blockchain network but not yet included in the blockchain, such as transaction 1, transaction 2, ..., transaction n. It is understood that when packaging a block, all proposal nodes in the blockchain network obtain a fixed number of pending transactions from transaction pool 21 to generate a new block. Whenever consensus on a new block is reached, the new block can be inserted into the blockchain ledger, which in turn triggers a refresh operation of the transaction pool 21, i.e., deleting transactions already included in the blockchain. Then, the blockchain node 20 continues to determine the transaction scheduling type through the core engine component 201.
[0127] As shown in Figure 2, if the blockchain node 20 determines that the transaction scheduling type is a deterministic scheduling type, the blockchain node 20 sends the preliminary block 22 from the core engine component 201 to the consensus component 202. Then, the blockchain node 20 can perform deterministic scheduling consensus processing on the preliminary block 22 through the consensus component 22 and the core engine component 201.
[0128] As shown in Figure 2, if the blockchain node 20 determines that the transaction scheduling type is a non-deterministic scheduling type, the blockchain node 20 will execute the preliminary block 22 based on the non-deterministic scheduling algorithm to obtain the block 23 to be chained. It can be understood that in addition to including transactions 1, ..., and transaction m, the block 23 to be chained will also include transaction execution results 1, ..., corresponding to transaction 1, transaction execution result m corresponding to transaction m, and the first transaction execution order. The blockchain node 20 can then send the block 23 to be chained from the core engine component 201 to the consensus component 202. Then, the blockchain node 20 can perform non-deterministic scheduling consensus processing on the block 23 to be chained through the consensus component 202.
[0129] The implementation process of the deterministic scheduling consensus processing and the non-deterministic scheduling consensus processing can refer to the description of step S103 and step S104 in the embodiment corresponding to FIG3a below.
[0130] It can be seen that by adopting the method provided in the embodiment of the present application, different consensus processing can be adapted for transaction scheduling of deterministic scheduling type and non-deterministic scheduling type, so that blockchain nodes can be compatible with transaction scheduling of deterministic scheduling type and non-deterministic scheduling type, thereby enriching the functional scenarios of the blockchain network.
[0131] Further, please refer to Figure 3a, which is a flow chart of a data processing method based on blockchain provided in an embodiment of the present application. The data processing method can be executed by a blockchain node (for example, any blockchain node in the blockchain network in the embodiment corresponding to Figure 1 above). The following will be described using the data processing method executed by a blockchain node as an example. The data processing method based on blockchain can at least include the following steps S101-S104:
[0132] In step S101, when the blockchain node determines that the block generation conditions are met through the core engine component, it obtains the chain configuration information through the core engine component, packages the prepared block according to the chain configuration information, and determines the transaction scheduling type according to the chain configuration information.
[0133] Specifically, the chain configuration information may include block configuration information and a transaction scheduling identifier; a feasible implementation process for obtaining the chain configuration information through the core engine component, creating a preliminary block based on the chain configuration information, and determining the transaction scheduling type based on the chain configuration information may include: obtaining the block configuration information and the transaction scheduling identifier through the core engine component; obtaining pending transactions from the transaction pool based on the block configuration information, and performing block packaging processing on the pending transactions based on the block configuration information to obtain the preliminary block; if the transaction scheduling identifier is a non-deterministic scheduling identifier, determining the transaction scheduling type as a non-deterministic scheduling type; if the transaction scheduling identifier is a deterministic scheduling identifier, determining the transaction scheduling type as a deterministic scheduling type. The block configuration information may include block-related configuration information, such as the number of transactions that the block should contain. The transaction scheduling identifier may be a number, a letter, or a string of characters. For example, if the transaction scheduling identifier is a number, the deterministic scheduling identifier may be "0" and the non-deterministic scheduling identifier may be "1."
[0134] In step S102, if the core engine component determines that the transaction scheduling type is a non-deterministic scheduling type, the core engine component executes the prepared block to obtain a first block to be chained; the first block to be chained includes a first transaction execution order and a first transaction execution result.
[0135] Specifically, under a non-deterministic scheduling algorithm, the order in which blockchain nodes schedule and execute all transactions in a block may be inconsistent, that is, the order in which transactions are executed is random. Therefore, when a blockchain node executes transactions in a preparatory block, it records the first transaction execution order (DAG), and then writes the DAG into the first block to be put on the chain. Later, when other consensus nodes in the blockchain network perform consensus processing on the first block to be put on the chain, they need to execute the transactions in the first block to be put on the chain according to the DAG order. The first block to be put on the chain also includes the first transaction execution result obtained after executing the preparatory block. When other consensus nodes perform consensus processing on the first block to be put on the chain, they can compare the transaction execution results obtained by their own execution with the first transaction execution result to achieve consensus voting.
[0136] Step S103: Send the first block to be chained in the core engine component to the consensus component, and perform non-deterministic scheduling consensus processing on the first block to be chained through the consensus component.
[0137] Specifically, the blockchain node sends the first block to be chained from the core engine component to the consensus component, and a feasible implementation process of performing non-deterministic scheduling consensus processing on the first block to be chained through the consensus component can be: sending the first block to be chained in the core engine component to the consensus component; determining the transaction scheduling type through the consensus component; if the consensus component determines that the transaction scheduling type is a non-deterministic scheduling type, then in the consensus component, according to the first transaction execution order and the first transaction execution result in the first block to be chained, pre-voting processing is performed on the first block to be chained to obtain a first intermediate pre-voting result; according to the first intermediate pre-voting result and the first block hash corresponding to the first block to be chained, result voting processing is performed on the first block to be chained to obtain a non-deterministic scheduling consensus result for the first block to be chained.
[0138] Among them, in the consensus component, according to the first transaction execution order and the first transaction execution result, a feasible implementation process for performing pre-voting processing on the first block to be chained to obtain the first intermediate pre-voting result can be: in the consensus component, generating proposal information for the first block to be chained, broadcasting the proposal information to the consensus nodes in the blockchain network, so that the consensus nodes in the blockchain network generate the second transaction execution result according to the proposal information, and generate the first pre-voting information according to the first transaction execution result and the second transaction execution result; the second transaction execution result is obtained after the consensus nodes in the blockchain network execute the transactions in the first block to be chained according to the first transaction execution order; generating second pre-voting information for the first transaction execution result, broadcasting the second pre-voting information to the consensus nodes in the blockchain network; determining the first intermediate pre-voting result based on the obtained first pre-voting information and second pre-voting information. Among them, the consensus nodes in the blockchain network can be called verification nodes for the first block to be chained. The first pre-voting information may be an approval vote or a disapproval vote. The approval vote represents that the consensus node agrees to the inclusion of the first block to be on the chain, and the disapproval vote represents that the consensus node opposes the inclusion of the first block to be on the chain. In addition to the blockchain node being able to receive the first pre-voting information sent by these verification nodes, the blockchain node may also broadcast its own second pre-voting information to other verification nodes. A feasible implementation process for the consensus node within the blockchain network to generate the second transaction execution result based on the proposal information and to generate the first pre-voting information based on the first transaction execution result and the second transaction execution result may be as follows: the consensus node within the blockchain network performs a legitimacy verification on the first block to be on the chain and the second transaction execution result according to the verification rules set by the currently used consensus algorithm, and then generates the first pre-voting information based on the legitimacy verification result. That is, if the legitimacy verification result is a verification pass result, the first pre-voting information is determined to be an approval vote; if the legitimacy verification result is a verification fail result, the first pre-voting information is determined to be a disapproval vote. Among them, the legitimacy verification can further include transaction execution result verification (i.e. determining whether the second transaction execution result is the same as the first transaction execution result contained in the first block to be on the chain, if they are the same, it means that the verification is passed), block hash verification (the first block to be on the chain may contain a block hash, and the consensus node may generate a verification block hash based on the second transaction execution result. If the block hash and the verification block hash are the same, it means that the verification is passed), etc., which are generally determined based on the consensus algorithm used by the blockchain network. Among them, a feasible implementation process for determining the first intermediate pre-voting result based on the first pre-voting information and the second pre-voting information obtained can be: counting the approval vote information in the first pre-voting information and the second pre-voting information, and if the approval vote information exceeds the pre-approval threshold, determining the first intermediate pre-voting result as the first intermediate approval vote result. Among them, the pre-approval threshold can be half or two-thirds of the number of consensus nodes in the blockchain network.Similarly, other consensus nodes can also determine their own intermediate pre-voting results based on their own second pre-voting information and other collected pre-voting information (such as the first pre-voting information and the second pre-voting information of other consensus nodes).
[0139] Among them, according to the first intermediate pre-voting result and the first block hash corresponding to the first block to be chained, the first block to be chained is subjected to result voting processing to obtain a non-deterministic scheduling consensus result for the first block to be chained. A feasible implementation process can be: according to the first intermediate pre-voting result and the first block hash corresponding to the first block to be chained, first voting information for the first block to be chained is generated; the first voting information includes the first intermediate pre-voting result and the first block hash; the first voting information is sent to the consensus node in the blockchain network; the second voting information for the first block to be chained sent by the consensus node in the blockchain network is received; the second voting information includes the intermediate pre-voting result and the first block hash determined by the consensus node in the blockchain network; and the non-deterministic scheduling consensus result for the first block to be chained is determined based on the first voting information and the second voting information. In particular, based on the first intermediate pre-voting result and the first block hash corresponding to the first block to be put on the chain, the first voting information for the first block to be put on the chain is generated. In fact, the first intermediate pre-voting result and the first block hash are assembled to obtain the first voting information containing the first intermediate pre-voting result and the first block hash. When the consensus node in the blockchain network receives the first voting information, it can quickly determine based on the first block hash that the first intermediate pre-voting result in the first voting information is cast for the first block to be put on the chain. In particular, a feasible implementation process for determining the non-deterministic scheduling consensus result for the first block to be put on the chain based on the first voting information and the second voting information can be: counting the intermediate approval vote results in the first voting information and the second voting information (that is, the first intermediate pre-voting result can be an intermediate approval vote result or an intermediate disapproval vote result, and the intermediate pre-voting results of other consensus nodes can also be an intermediate approval vote result or an intermediate disapproval vote result). If the intermediate approval vote result exceeds the approval threshold, the non-deterministic scheduling consensus result is determined to be a consensus pass result. In particular, the approval threshold can be half or two-thirds of the number of consensus nodes in the blockchain network.
[0140] In step S104, if the core engine component determines that the transaction scheduling type is a deterministic scheduling type, the prepared block in the core engine component is sent to the consensus component, and the consensus component and the core engine component perform deterministic scheduling consensus processing on the prepared block; during the deterministic scheduling consensus processing process, the core engine component is used to execute the transaction in the prepared block.
[0141] Specifically, a feasible implementation process of sending the prepared block in the core engine component to the consensus component and performing deterministic scheduling consensus processing on the prepared block through the consensus component and the core engine component can be as follows: sending the prepared block in the core engine component to the consensus component; determining the transaction scheduling type through the consensus component; if the consensus component determines that the transaction scheduling type is a deterministic scheduling type, then generating proposal information for the prepared block in the consensus component, broadcasting the proposal information to the consensus nodes in the blockchain network, so that the consensus nodes in the blockchain network execute the transactions in the prepared block in the proposal information according to the deterministic transaction execution order; if the consensus component receives the third transaction execution result sent by the core engine component, then generating a fourth transaction execution result for the third transaction execution result. Pre-voting information, broadcasting the fourth pre-voting information and the third transaction execution result to the consensus nodes within the blockchain network, so that the consensus nodes within the blockchain network generate the third pre-voting information based on the third transaction execution result; the third transaction execution result is obtained after the core engine component begins executing the transactions in the pre-voting block according to the deterministic transaction execution order upon obtaining the pre-voting block; determining the second intermediate pre-voting result based on the obtained third and fourth pre-voting information; updating the pre-voting block based on the third transaction execution result to obtain the second block to be on the chain; performing a result voting process on the second block to be on the chain based on the second intermediate pre-voting result and the second block hash corresponding to the second block to be on the chain, and obtaining a deterministic scheduling consensus result for the second block to be on the chain. Among them, the entire process from broadcasting the proposal information to determining the second intermediate pre-voting result can be referred to as pre-voting processing.
[0142] Among them, after receiving the proposal information, the consensus node can obtain the preliminary block in the proposal information. Since the deterministic scheduling type is used at this time, the consensus node can generate a deterministic transaction execution order based on the deterministic scheduling algorithm, and then execute the transaction in the preliminary block in the deterministic transaction execution order to obtain the transaction execution result generated by the consensus node. Then, when the subsequent consensus node receives the fourth pre-voting information and the third transaction execution result, it can compare the transaction execution result generated by itself with the third transaction execution result to obtain the third pre-voting information (if the comparison is consistent, the third pre-voting information belongs to the approval vote information, otherwise it is the disapproval vote information). The consensus node can count the number of approval votes in the third pre-voting information generated by itself, the fourth pre-voting information received, and the third pre-voting information sent by other consensus nodes, and then determine the intermediate pre-voting result. The process of the blockchain node determining the second intermediate pre-voting result and the process of the consensus node determining the intermediate pre-voting result can refer to the process of determining the first intermediate pre-voting result in the above step S103, which will not be repeated here.
[0143] Among them, according to the second intermediate pre-voting result and the second block hash corresponding to the second block to be chained, the second block to be chained is subjected to result voting processing to obtain a deterministic scheduling consensus result for the second block to be chained. A feasible implementation process can be: according to the second intermediate pre-voting result and the second block hash corresponding to the second block to be chained, a third voting information for the first block to be chained is generated; the third voting information is sent to the consensus node in the blockchain network; the fourth voting information for the second block to be chained sent by the consensus node in the blockchain network is received; and the deterministic scheduling consensus result for the first block to be chained is determined based on the third voting information and the fourth voting information. It can be understood that the result voting processing for the second block to be chained can refer to the implementation process of the result voting processing for the first block to be chained in step S103 above, which will not be repeated here.
[0144] Optionally, the blockchain node obtains a configuration information update transaction, which includes an updated transaction scheduling identifier; if it is determined that the configuration information update transaction consensus is passed, the configuration information update contract is called according to the configuration information update transaction, and the transaction scheduling identifier is updated through the configuration information update contract.
[0145] Furthermore, to facilitate understanding of the adaptation process of the proposal node to the scheduling algorithms of the two transaction scheduling types in the consensus process, please refer to Figure 3b, which is a schematic diagram of the consensus process of a proposal node adapting to different scheduling algorithms provided by an embodiment of the present application. As shown in Figure 3b, the proposal node includes a consensus component and a core engine component. It can be understood that the consensus component and the core engine component can transmit signals and messages through MsgBus (Message Bud). As shown in Figure 3b, the entire consensus process mainly includes the following steps P101-P119:
[0146] Step P101: The consensus component determines whether the proposing node is the master node. If so, it sends the proposal correct information to the core engine component; if not, the consensus process ends.
[0147] Specifically, a masternode refers to the proposal node at the current block height in the blockchain network. Depending on the consensus algorithm, the masternode can be different at different block heights. The determination of the masternode can also be understood as the aforementioned determination of the block generation conditions. A correct proposal message refers to a message where MsgBus.ProposeState is true. ProposeState (proposal status) is a message type in MsgBus.
[0148] In step P102, after the core engine component receives the correct proposal information, it can determine that the proposal node is the current master node and query whether there are any unprocessed transactions in the transaction pool. If there are any unprocessed transactions in the transaction pool, step P103 is executed; if there are no unprocessed transactions in the transaction pool, the consensus process ends.
[0149] In step P103, the core engine component determines whether the proposal node adopts deterministic scheduling; if so, execute step P105; if not, execute step P104.
[0150] Specifically, whether the proposal node uses deterministic scheduling, that is, the transaction scheduling type of the proposal node is determined. If the transaction scheduling type is deterministic, deterministic scheduling is used; if the transaction scheduling type is non-deterministic, deterministic scheduling is not used. The specific implementation process of determining the transaction scheduling type can be found in the description of step S101 in the embodiment corresponding to Figure 3a above, and will not be repeated here.
[0151] Step P104: The core engine component constructs a chain block, schedules the execution of transactions when constructing the chain block, and then executes step P109.
[0152] Specifically, the core engine component schedules the execution of transactions when constructing a chain block, so the final chain block can be considered as a complete block that can be written to the blockchain (i.e., the first block to be on the chain in the embodiment corresponding to Figure 3a above). The chain block contains the first transaction execution order and the transaction execution result (i.e., the first transaction execution result in the embodiment corresponding to Figure 3a above). At this time, the hash corresponding to the chain block can be called the final hash of the block, expressed as FinalBlockHash.
[0153] In step P105, the core engine component constructs a pre-block, and then executes steps P106 and P109 in parallel.
[0154] Specifically, a pre-block refers to a block that contains transactions but does not contain transaction execution results, i.e., the pre-block in the embodiment corresponding to Figure 3a above. Under the deterministic scheduling algorithm, each consensus node schedules and executes all transactions in the block in a consistent order, that is, transaction execution is deterministic. Therefore, the core engine component can first generate a pre-block (PreBlock), directly send the pre-block to the consensus component to construct and broadcast the proposal, and then the proposal node can schedule and execute the transactions in the pre-block in parallel with other consensus nodes.
[0155] Step P106: The core engine component schedules the execution of transactions in the pre-block, obtains the execution results, and sends the execution results to the consensus component.
[0156] Specifically, the core engine component generates a deterministic transaction execution order based on a deterministic scheduling algorithm and executes the pre-block according to this order. The execution result at this point is the third transaction execution result in the embodiment corresponding to Figure 3a above. During step P106, other consensus nodes can execute the transactions in the pre-block in parallel based on the deterministic transaction execution order.
[0157] Step P107: The consensus component receives the execution result sent by the core engine component.
[0158] Step P108: The consensus component updates the pre-block according to the execution result to obtain the chain block.
[0159] Specifically, the chain block at this time is the second block to be chained in the embodiment corresponding to FIG. 3 a .
[0160] Step P109: The consensus component receives the block sent by the core engine component.
[0161] Specifically, the block received by the consensus component may be the chain block generated in step P104 or the pre-block generated in step P105.
[0162] In step P110, the consensus component constructs a proposal for the received block and broadcasts the proposal.
[0163] Specifically, it is understood that the consensus component does not need to distinguish whether the received block is a chain block or a pre-block at this time. It only needs to construct a consensus proposal for the block. If the proposal information constructed for the pre-block is broadcast, the consensus node that receives the proposal information can first execute the pre-block and wait for the execution results broadcast by the subsequent proposal node. The consensus node votes by comparing the execution results of the proposal node with the execution results generated by itself. If the proposal information constructed for the chain block is broadcast, the consensus node that receives the proposal information can execute the transactions in the chain block based on the execution order of the first transaction in the chain block, and then vote by comparing the execution results in the chain block with the execution results generated by itself.
[0164] In step P111, the consensus component pre-votes the received block. If the pre-vote passes, step P112 is executed. The pre-vote for the chain block can be found in the process for generating the first intermediate pre-vote result in the embodiment corresponding to FIG3a above, and will not be repeated here. The pre-vote for the pre-block can be found in the process for generating the second intermediate pre-vote result in the embodiment corresponding to FIG3a above, and will not be repeated here.
[0165] In step P112, the consensus component determines whether the proposal node adopts deterministic scheduling. If so, execute step P113; if not, execute step P115.
[0166] Specifically, the process by which the consensus component determines whether a proposal node adopts deterministic scheduling can refer to the process by which the core engine component determines whether a proposal node adopts deterministic scheduling.
[0167] In step P113, the consensus component determines whether the execution result has been received. If so, step P114 is executed; if not, step P113 is executed again.
[0168] Specifically, it can be understood that steps P106 to P108 and steps P109 to P113 are executed in parallel. Therefore, when step P113 is executed, step P107 may not be completed. The consensus component can periodically confirm whether the execution result has been received.
[0169] In step P114, the consensus component constructs a vote based on the final block hash and broadcasts the vote, and then executes step P116.
[0170] Specifically, after receiving the execution result, the consensus component can update the pre-block to the chain block, thereby using the hash corresponding to the chain block as the FinalBlockHash (final block hash). The consensus component can construct a vote based on the FinalBlockHash and broadcast the vote (the broadcasted vote can be the third voting information mentioned above).
[0171] In step P115, the consensus component constructs a vote based on the final block hash and broadcasts the vote, and then executes step P116.
[0172] Specifically, under non-deterministic scheduling, the block received by the consensus component is the chain block. The consensus component can directly use the hash corresponding to the received block as the FinalBlockHash (final block hash). The consensus component can construct a vote based on the FinalBlockHash and broadcast the vote (the broadcast vote can be the first voting information mentioned above).
[0173] In step P116, the consensus component determines whether consensus is reached based on the voting results (i.e., the voting results obtained by the above-mentioned voting processing). If consensus is reached, the correct submission information is sent to the core engine component and step P117 is executed. If consensus is not reached, step P119 is executed.
[0174] Specifically, submitting correct information refers to a message where MsgBus.CommitBlock is true. CommitBlock is a message type in MsgBus.
[0175] Step P117: The core engine component submits the chain block and notifies the consensus component after successful submission.
[0176] Specifically, the core engine component can send a message with MsgBus.BlockInfo being true to the consensus component, where BlockInfo (block chain) is a message type in MsgBus.
[0177] Step P118: After the consensus component receives the notification that the chain block has been successfully submitted, it will enter a new block height.
[0178] Specifically, the new block height refers to the consensus process for the next block.
[0179] In step P119, the consensus component enters a new round of consensus or a new round of view for the block at the current height.
[0180] As can be seen from the above steps P101 to P119, the core engine component in the proposal node performs different processing according to different scheduling algorithms when constructing blocks. Under non-deterministic scheduling, the core engine component constructs the chain block and executes the transactions in the block, and then passes the chain block containing FinalBlockHash to the consensus component. Under deterministic scheduling, the core engine component constructs the pre-block and directly passes the pre-block to the consensus component. Then, after the pre-block is executed, the execution result with FinalBlockHash is given to the consensus component. In addition, the consensus component in the proposal node also needs to perform different processing according to different scheduling algorithms. Under non-deterministic scheduling, because FinalBlockHash is already available, the vote can be directly constructed and broadcast. Under deterministic scheduling, it is necessary to wait until the core engine component executes the transactions in the pre-block, and then construct and broadcast the vote based on the FinalBlockHash generated by the execution.
[0181] Further, please refer to Figure 4a, which is a flow chart of a data processing method based on blockchain provided in an embodiment of the present application. The data processing method can be executed by a blockchain node (for example, any blockchain node in the blockchain network in the embodiment corresponding to Figure 1 above). The following will be described using the data processing method executed by a blockchain node as an example. The data processing method based on blockchain can at least include the following steps S201-S204:
[0182] In step S201, when the blockchain node determines that the block generation conditions are met through the core engine component, it obtains the chain configuration information through the core engine component, packages the prepared block according to the chain configuration information, and determines the transaction scheduling type according to the chain configuration information.
[0183] In step S202, if the core engine component determines that the transaction scheduling type is a non-deterministic scheduling type, the core engine component executes the prepared block to obtain a first block to be chained; the first block to be chained includes a first transaction execution order and a first transaction execution result.
[0184] Specifically, the implementation of step S201 - step S202 can refer to the detailed description of step S101 and step S102 in the embodiment corresponding to FIG3 a above, which will not be repeated here.
[0185] Step S203: Send the first block to be chained in the core engine component to the consensus adapter component, and perform non-deterministic scheduling consensus processing on the first block to be chained through the consensus adapter component and the consensus execution component.
[0186] Specifically, the combination of the consensus adapter component and the consensus execution component can be referred to as the above-mentioned consensus component. A feasible implementation process of sending the first block to be chained in the core engine component to the consensus adapter component, and performing non-deterministic scheduling consensus processing on the first block to be chained through the consensus adapter component and the consensus execution component can be as follows: sending the first block to be chained in the core engine component to the consensus adapter component, in the consensus adapter component, generating a first voting hash for the first block to be chained according to the first block hash corresponding to the first block to be chained; sending the first block to be chained and the first voting hash in the consensus adapter component from the consensus adapter component to the consensus execution component; in the consensus execution component, performing pre-voting processing on the first block to be chained according to the first transaction execution order and the first transaction execution result in the first block to be chained, and obtaining a third intermediate pre-voting result; performing result voting processing on the first block to be chained according to the first voting hash and the third intermediate pre-voting result, and obtaining a non-deterministic scheduling consensus result for the first block to be chained. Among them, the implementation of pre-voting and result voting on the first block to be chained can refer to the implementation process of pre-voting and result voting on the first block to be chained in step S103 in the embodiment corresponding to Figure 3a above. It should be noted that at this time, when the result voting is performed on the first block to be chained, it is based on the first voting hash. When the result voting is performed on the first block to be chained in the above step S103, it is directly based on the first block hash of the first block to be chained.
[0187] In step S204, if the core engine component determines that the transaction scheduling type is a deterministic scheduling type, the prepared block is sent from the core engine component to the consensus adapter component, and the consensus adapter component, the consensus execution component, and the core engine component perform deterministic scheduling consensus processing on the prepared block.
[0188] Specifically, a feasible implementation process of sending the prepared block in the core engine component to the consensus adapter component and performing deterministic scheduling consensus processing on the prepared block through the consensus adapter component, the consensus execution component and the core engine component can be: sending the prepared block in the core engine component to the consensus adapter component, sending the prepared block to the consensus execution component through the consensus adapter component, generating proposal information for the prepared block in the consensus execution component, broadcasting the proposal information to the consensus nodes in the blockchain network, so that the consensus nodes in the blockchain network execute the transactions in the prepared block in the proposal information according to the deterministic transaction execution order; receiving the fourth transaction execution result sent by the core engine component through the consensus adapter component; the fourth transaction execution result is obtained after the core engine component executes the transactions in the prepared block according to the deterministic transaction execution order (the deterministic transaction execution order is determined based on the deterministic scheduling algorithm); in the consensus adapter component, the prepared block is processed according to the fourth transaction execution result. The block is updated to obtain a third block to be on-chain, and a second voting hash for the third block to be on-chain is generated based on the third block hash corresponding to the third block to be on-chain; the fourth transaction execution result and the second voting hash in the consensus adapter component are sent to the consensus execution component; in the consensus execution component, fifth pre-voting information for the fourth transaction execution result is generated, and the fifth pre-voting information and the fourth transaction execution result are broadcast to the consensus nodes in the blockchain network, so that the consensus nodes in the blockchain network generate sixth pre-voting information based on the fourth transaction execution result (the consensus node can generate the sixth pre-voting information by comparing the transaction execution result generated by itself with the fourth transaction execution result to see if they are consistent); based on the obtained sixth pre-voting information and the fifth pre-voting information, a fourth intermediate pre-voting result is determined; based on the second voting hash and the fourth intermediate pre-voting result, a result voting process is performed on the third block to be on-chain to obtain a deterministic scheduling consensus result for the third block to be on-chain. Among them, the process of determining the fourth intermediate pre-voting result can refer to the specific process of determining the second intermediate pre-voting result in step S104 of the embodiment corresponding to Figure 3a above, and will not be repeated here. The entire process from broadcasting the proposal information to determining the fourth intermediate pre-voting result can be referred to as the pre-voting process. The implementation process of the result voting process for the third block to be on-chain can be similar to the process of the result voting process for the second block to be on-chain in step S104 of the embodiment corresponding to FIG. 3 a above.
[0189] Furthermore, in order to facilitate understanding of the adaptation process of the proposal node to the scheduling algorithms of the two transaction scheduling types in the consensus process after the consensus adapter component is added, please refer to Figure 4b. Figure 4b is a consensus process diagram of a proposal node adapted to different scheduling algorithms provided in an embodiment of the present application. As shown in Figure 4b, the proposal node includes a consensus adapter component, a consensus execution component and a core engine component. Among them, the consensus adapter component can also be called a consensus service layer, which is specifically used to adapt to different scheduling algorithms, so that the consensus process in the consensus execution component is unified and no separate processing is required. Among them, the consensus adapter component, the consensus execution component and the core engine component can all transmit signals and messages through MsgBus (Message Bud, message bus). As shown in Figure 4b, the entire consensus process mainly includes the following steps P201-P223:
[0190] Step P201: The consensus execution component determines whether the proposing node is the master node. If so, it sends the proposal validation information to the consensus adapter component. If not, the consensus process ends. The process of determining whether the proposing node is the master node is actually the process of determining whether the proposing node meets the block generation conditions.
[0191] In step P202, after the consensus adapter component receives the correct proposal information, it can notify the core engine component to construct the block.
[0192] In step P203, after the core engine component receives the notification information from the consensus adapter component, it can query whether there are any unprocessed transactions in the transaction pool. If there are unprocessed transactions in the transaction pool, step P204 is executed; if there are no unprocessed transactions in the transaction pool, the consensus process ends.
[0193] In step P204, the core engine component determines whether deterministic scheduling is adopted; if so, step P205 is executed; if not, step P206 is executed.
[0194] In step P205, the core engine component constructs a pre-block, and then executes steps P207 and P211 in parallel.
[0195] Specifically, a pre-block refers to a block that contains transactions but does not contain transaction execution results, i.e., the pre-block in the embodiment corresponding to Figure 4a above. Under the deterministic scheduling algorithm, each consensus node schedules and executes all transactions in the block in a consistent order, that is, the execution of transactions is deterministic. Therefore, the core engine component can first generate a pre-block (PreBlock) and directly send the pre-block to the consensus adapter component. The consensus adapter component then sends the pre-block to the consensus execution component, which constructs and broadcasts the proposal. Subsequently, the proposal node can schedule and execute the transactions in the pre-block in parallel with other consensus nodes.
[0196] In step P206, the core engine component constructs a chain block, schedules the execution of the transaction during the chain block construction, and then executes step P207. After the transaction is executed, the first transaction execution result can be added to the chain block. This chain block is now the first block to be on-chained.
[0197] In step P207, the consensus adapter component receives the block sent by the core engine component and sends the block to the consensus execution component. At the same time, if the received block is a chain block, step P214 is executed; if the received block is a pre-block, step P212 is executed.
[0198] In step P208, if the consensus execution component receives the block sent by the consensus adapter component, step P209 is executed.
[0199] In step P209, the consensus execution component constructs a proposal for the received block and broadcasts the proposal.
[0200] In step P210, the consensus execution component pre-votes the received block. If the pre-vote passes, step P215 is executed.
[0201] The pre-voting for the chain block can refer to the generation process of the third intermediate pre-voting result in the embodiment corresponding to FIG4a above, which will not be repeated here. The pre-voting for the pre-block can refer to the generation process of the fourth intermediate pre-voting result in the embodiment corresponding to FIG4a above, which will not be repeated here.
[0202] Step P211: The core engine component schedules the execution of transactions in the pre-block, obtains the execution results, and sends the execution results to the consensus adapter component.
[0203] Step P212: If the consensus adapter component receives the execution result sent by the core engine component, step P213 is executed.
[0204] In step P213, the consensus adapter component updates the pre-block according to the execution result to obtain the chain block.
[0205] In step P214, the consensus adapter component generates a voting hash and sends the voting hash to the consensus execution component.
[0206] Specifically, if the block initially received by the consensus adapter component is a chain block, the consensus adapter component can directly generate a voting hash based on the block hash of the chain block; if the block initially received by the consensus adapter component is a pre-block, the consensus adapter component will wait until it receives the execution result, update the pre-block, and then generate a voting hash based on the block hash of the updated chain block.
[0207] Step P215: If the consensus execution component receives the voting hash, it executes step P216.
[0208] In step P216, the consensus execution component determines whether the voting hash is received. If so, step P217 is executed; if not, step P216 is executed again.
[0209] In step P217, the consensus execution component constructs a vote based on the voting hash and broadcasts the vote, and then executes step P218.
[0210] Among them, in the case of non-deterministic scheduling, the process of constructing a vote and broadcasting the vote in step P217 can refer to the process of performing result voting on the first block to be chained in the corresponding embodiment of Figure 4a above; in the case of deterministic scheduling, the process of constructing a vote and broadcasting the vote in step P217 can refer to the process of performing result voting on the third block to be chained in the corresponding embodiment of Figure 4a above.
[0211] In step P218, the consensus execution component determines whether consensus is reached based on the voting results. If consensus is reached, the correct submission information is sent to the consensus adaptation component and step P219 is executed. If consensus is not reached, step P223 is executed.
[0212] Specifically, submitting correct information refers to a message where MsgBus.CommitBlock is true. CommitBlock is a message type in MsgBus.
[0213] Step P219: The consensus adapter component notifies the core engine component to submit the block.
[0214] Step P220: The core engine component submits the chain block and notifies the consensus adapter component after successful submission.
[0215] Step P221: The consensus adapter component notifies the consensus execution component that the block submission is successful.
[0216] Step P222: After the consensus execution component receives the notification message of successful submission of the chain block, it will enter a new level.
[0217] In step P223, the consensus execution component enters a new round of consensus or a new round of view for the block at the current height.
[0218] It can be understood that the above steps P201 to P223 are based on the implementation of steps P101 to P119 in the embodiment corresponding to Figure 3b above, and a consensus adaptation component is introduced to adapt to deterministic and non-deterministic scheduling. At this time, the internal processes in the consensus execution component are unified and no separate processing is required.
[0219] Thus, by using the method provided by the embodiment of the present application, the consensus execution component no longer needs to interact directly with the core engine component, but instead interacts with the core engine component through the intermediate consensus adapter component. The consensus adapter component can shield the differences brought about by deterministic scheduling and non-deterministic scheduling. The consensus execution component only needs to broadcast the proposal first, and then vote based on the execution result and voting hash obtained from the consensus adapter component, which can speed up the processing speed of the consensus execution component.
[0220] Further, please refer to Figure 5a, which is a flow chart of a data processing method based on blockchain provided in an embodiment of the present application. The data processing method can be executed by a blockchain node (for example, any blockchain node in the blockchain network in the embodiment corresponding to Figure 1 above). The following will be described using the data processing method executed by a blockchain node as an example. The data processing method based on blockchain can at least include the following steps S301-S306:
[0221] In step S301, when a blockchain node receives proposal information for a block to be agreed upon through a consensus component, the consensus component verifies the block to be agreed upon based on the proposal information and obtains a verification result. The block to be agreed upon is generated by the target blockchain node in the blockchain network when it determines that the block generation conditions are met.
[0222] Specifically, when a blockchain node acts as a validation node or consensus node in a blockchain network, upon receiving a proposal, it must perform consensus processing on the block to be agreed upon. The target blockchain node is the current proposal node or master node in the blockchain network. The signature verification process can include obtaining the target blockchain node's public key and verifying the signature corresponding to the proposal.
[0223] Step S302: If the consensus component determines that the signature verification result is a passed result, the core engine component determines the transaction scheduling type.
[0224] Specifically, the implementation of step S302 may refer to the process of determining the transaction scheduling type in step S101 in the embodiment corresponding to FIG. 3 a , and will not be described in detail here.
[0225] In step S303, if the core engine component determines that the transaction scheduling type is a non-deterministic scheduling type, a second transaction execution order is obtained from the block to be agreed upon, and the block to be agreed upon is executed according to the second transaction execution order to obtain a fifth transaction execution result.
[0226] Specifically, under non-deterministic scheduling, the target blockchain node executes the transactions in the block when constructing it. Therefore, the consensus block contains the target transaction execution results and the second transaction execution order. To ensure the correctness of the subsequent verification voting process, the blockchain node must execute the transactions in the consensus block according to the second transaction execution order.
[0227] Step S304: Send the fifth transaction execution result in the core engine component to the consensus component. In the consensus component, a verification voting process is performed on the consensus block according to the fifth transaction execution result to obtain a consensus result for the consensus block.
[0228] Specifically, the verification voting process refers to verifying the legitimacy of the consensus block, then voting on the consensus block based on the legitimacy verification results, and broadcasting them to other consensus nodes in the blockchain network. The consensus result of the consensus block is then determined based on the voting results of other consensus nodes and the blockchain node's own voting results. Legitimacy verification includes multiple verification methods, such as verifying whether the fifth transaction execution result is the same as the target transaction execution result included in the consensus block; or verifying whether the verification block hash calculated based on the fifth transaction execution result is the same as the block hash included in the consensus block. The verification voting process can also include pre-voting and result voting. Through pre-voting, the blockchain node can obtain the intermediate pre-voting results mentioned in the embodiment corresponding to FIG. 3a above. Through result voting, the blockchain node can obtain the consensus result under non-determinism. The process of determining the consensus result under non-determinism can refer to the process of determining the consensus result under non-determinism in the embodiment corresponding to FIG. 3a above.
[0229] In step S305, if the core engine component determines that the transaction scheduling type is a deterministic scheduling type, the consensus block is executed according to the deterministic transaction execution order to obtain a sixth transaction execution result.
[0230] Specifically, the deterministic transaction execution order is the order in which the target blockchain node packages the transaction into the block to be agreed upon. This deterministic transaction execution order can be determined by a deterministic scheduling algorithm.
[0231] Step S306: Send the sixth transaction execution result in the core engine component to the consensus component. In the consensus component, a verification voting process is performed on the consensus block according to the sixth transaction execution result to obtain a consensus result for the consensus block.
[0232] Among them, the verification voting process can also include pre-voting processing and result voting processing. The blockchain node can obtain the intermediate pre-voting result mentioned in the embodiment corresponding to Figure 3a through the pre-voting process. The blockchain node can obtain the consensus result under determinism through the result voting process. The determination process of the consensus result under determinism can refer to the determination process of the deterministic scheduling consensus result in the embodiment corresponding to Figure 3a above.
[0233] Furthermore, to facilitate understanding of the validation node's adaptation process to the scheduling algorithms of the two transaction scheduling types in the consensus process, please refer to Figure 5b, which is a schematic diagram of a consensus process of a validation node adapting to different scheduling algorithms provided by an embodiment of the present application. As shown in Figure 5b, the validation node includes a consensus component and a core engine component. It can be understood that signals and messages can be transmitted between the consensus component and the core engine component through MsgBus (Message Bud). As shown in Figure 5b, the entire consensus process of the validation node mainly includes the following steps P301-P312:
[0234] In step P301, the consensus component receives the block and the proposal for the block, verifies the proposal, and obtains the verification result.
[0235] Specifically, the implementation of step P301 may refer to the description of step S301 in the embodiment corresponding to FIG. 5 a .
[0236] In step P302, the consensus component determines whether the proposal is valid based on the signature verification result. If it is valid, step P303 is executed. If not, the consensus process ends.
[0237] In step P303, the core engine component receives the proposal validity information sent by the consensus component and further determines whether to adopt deterministic scheduling; if so, execute step P305; if not, execute step P304.
[0238] In step P304, the core engine component executes transactions according to the second transaction execution order in the block and verifies the block.
[0239] Specifically, the implementation of step P304 may refer to the description of step S303 above.
[0240] In step P305, the core engine component schedules the transactions in the block and verifies the block.
[0241] Specifically, the implementation of step P305 may refer to the description of step S305 in the embodiment corresponding to FIG. 5 a .
[0242] Step P306: The consensus component receives the verification / execution result sent by the core engine component.
[0243] Specifically, it can be understood that no matter whether the consensus component receives the verification / execution result obtained in step P304 or the verification / execution result obtained in step P305, the subsequent steps can be executed normally.
[0244] In step P307, the consensus component determines whether the block is valid based on the received verification / execution result; if it is valid, step P308 is executed; if not, the consensus process ends.
[0245] In step P308, the consensus component constructs a vote based on the final block hash and then broadcasts the vote.
[0246] Specifically, the process of constructing and broadcasting voting based on the final block hash can refer to the implementation process of step P114 or step P115 in the embodiment corresponding to Figure 3b above.
[0247] Step P309: The consensus component determines whether consensus is reached based on the voting results. If consensus is reached, the correct information is sent to the core engine component and step P310 is executed. If no consensus is reached, step P312 is executed.
[0248] Step P310: The core engine component submits the block and notifies the consensus component after successful submission.
[0249] Step P311: After the consensus component receives the notification message of successful chain block submission, it will enter a new height.
[0250] In step P312, the consensus component enters a new round of consensus or a new round of view for the block at the current height.
[0251] Specifically, the implementation process of steps P309 to P312 can refer to the description of steps P116 to P119 in Figure 3b above.
[0252] By adopting the method provided in the embodiments of the present application, the blockchain node serving as a verification node can adapt deterministic scheduling and non-deterministic scheduling through the core engine component, and then determine the execution method for the block to be consensused, thereby obtaining the transaction execution result of the block. The consensus component only needs to complete the verification voting process based on the transaction execution result sent by the core engine component. Therefore, the blockchain node can select different scheduling algorithms based on different functional scenarios, thereby improving the performance of the blockchain network.
[0253] Further, please refer to Figure 6a, which is a flow chart of a data processing method based on blockchain provided in an embodiment of the present application. The data processing method can be executed by a blockchain node (for example, any blockchain node in the blockchain network in the embodiment corresponding to Figure 1 above). The following will be described using the data processing method executed by a blockchain node as an example. The data processing method based on blockchain can at least include the following steps S401-S406:
[0254] In step S401, when a blockchain node receives proposal information for a block to be agreed upon through a consensus execution component, the consensus execution component verifies the block to be agreed upon based on the proposal information and obtains a verification result. The block to be agreed upon is generated by a target blockchain node in the blockchain network when the block generation conditions are met.
[0255] In step S402, if the consensus execution component determines that the signature verification result is a passed result, the consensus execution component sends an execution request to the consensus adapter component, and the consensus adapter component sends the execution request to the core engine component. In the core engine component, the transaction scheduling type is determined according to the execution request.
[0256] In step S403, if the core engine component determines that the transaction scheduling type is a non-deterministic scheduling type, the second transaction execution order is obtained from the block to be agreed upon, the block to be agreed upon is executed according to the second transaction execution order, and a seventh transaction execution result is obtained. The seventh transaction execution result in the core engine component is sent to the consensus adapter component. In the consensus adapter component, a third voting hash is generated according to the seventh transaction execution result.
[0257] In step S404, the seventh transaction execution result and the third voting hash are sent to the consensus execution component through the consensus adapter component. In the consensus execution component, verification and voting are performed on the block to be consensus based on the seventh transaction execution result and the third voting hash to obtain a consensus result for the block to be consensus.
[0258] In step S405, if the core engine component determines that the transaction scheduling type is a deterministic scheduling type, the block to be agreed upon is executed according to the deterministic transaction execution order to obtain an eighth transaction execution result. The eighth transaction execution result is sent from the core engine component to the consensus adapter component. In the consensus adapter component, a fourth voting hash is generated based on the eighth transaction execution result.
[0259] Step S406: The eighth transaction execution result and the fourth voting hash are sent to the consensus execution component through the consensus adapter component. In the consensus execution component, verification and voting are performed on the block to be consensus based on the eighth transaction execution result and the fourth voting hash to obtain a consensus result for the block to be consensus.
[0260] It can be understood that the above steps S401 to S406 are based on the implementation of steps S301 to S306 in the embodiment corresponding to Figure 5a above, and a consensus adaptation component is introduced to adapt to deterministic and non-deterministic scheduling. At this time, the internal processes in the consensus execution component are unified and no separate processing is required.
[0261] Furthermore, in order to facilitate understanding of the adaptation process of the verification node to the scheduling algorithms of the two transaction scheduling types in the consensus process after the consensus adapter component is added, please refer to Figure 6b. Figure 6b is a consensus process diagram of a verification node adapted to different scheduling algorithms provided in an embodiment of the present application. As shown in Figure 6b, the verification node includes a consensus adapter component, a consensus execution component and a core engine component, wherein the combination of the consensus adapter component and the consensus execution component can be referred to as a consensus component. Among them, the consensus adapter component can also be called a consensus service layer, which is specifically used to adapt to different scheduling algorithms, so that the consensus process in the consensus execution component is unified and no separate processing is required. Among them, the consensus adapter component, the consensus execution component and the core engine component can all transmit signals and messages through MsgBus (Message Bud, message bus). As shown in Figure 6b, the entire consensus process mainly includes the following steps P401-P417:
[0262] In step P401, the consensus execution component receives the block and the proposal for the block, verifies the proposal, and obtains the verification result.
[0263] In step P402, the consensus execution component determines whether the proposal is valid based on the signature verification result. If it is valid, step P403 is executed. If not, the consensus process ends.
[0264] Specifically, the implementation of steps P401 and P402 may refer to the implementation of steps P301 and P302 in the embodiment corresponding to FIG. 5 b .
[0265] Step P403: The consensus adapter component receives the signature validation information sent by the consensus execution component and notifies the core engine component to verify and execute the block.
[0266] In step P404, the core engine component receives the verification and execution block notification information sent by the consensus adapter component, and executes step P405.
[0267] In step P405, the core engine component determines whether deterministic scheduling is adopted; if so, step P407 is executed; if not, step P406 is executed.
[0268] Step P406: The core engine component executes transactions according to the second transaction execution order in the block and verifies the block.
[0269] Step P407: The core engine component schedules the transactions in the block and verifies the block.
[0270] Specifically, the implementation of steps P405 to P407 may refer to the implementation of steps P303 to P305 in the embodiment corresponding to FIG. 5 b .
[0271] Step P408: The consensus adapter component receives the verification / execution results sent by the core engine component and generates a voting hash.
[0272] Specifically, the implementation of step P408 may refer to the description of step P214 in the embodiment corresponding to FIG. 4 b .
[0273] Step P409: The consensus execution component receives the voting hash and verification / execution results.
[0274] In step P410, the consensus execution component determines whether the block is valid based on the received verification / execution result; if valid, step P411 is executed; if not, the consensus process ends.
[0275] In step P411, the consensus execution component constructs a vote based on the voting hash and then broadcasts the vote.
[0276] In step P412, the consensus component determines whether consensus is reached based on the voting results. If consensus is reached, step P413 is executed; if consensus is not reached, step P417 is executed.
[0277] Specifically, the implementation of steps P409 to P412 may refer to the implementation of steps P307 to P309 in the embodiment corresponding to FIG. 5 b .
[0278] Step P413: The consensus adapter component notifies the core engine component to submit the block.
[0279] Step P414: The core engine component submits the block and notifies the consensus adapter component after successful submission.
[0280] In step P415, the consensus adapter component notifies the consensus execution component that the block submission is complete.
[0281] Step P416: After the consensus execution component receives the notification message of successful block submission, it will enter a new level.
[0282] In step P417, the consensus execution component enters a new round of consensus or a new round of view for the block at the current height.
[0283] It can be seen that, by adopting the method provided in the embodiment of the present application, after the core engine component verifies and executes the block, the execution result with the voting hash is returned to the consensus execution component via the consensus adapter component, and then the consensus execution component constructs and broadcasts the vote. There is no need for the actual consensus execution component to perceive the different processes brought about by different scheduling algorithms. The functional logic of the consensus execution component is purer and simpler, and there is no need to consider the differences brought about by the different logics of other components.
[0284] Please refer to Figure 7, which is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. The data processing device can be a computer program (including program code) running on a computer device, for example, the data processing device is an application software; the device can be used to execute the corresponding steps of the data processing method provided in an embodiment of the present application. As shown in Figure 7, the data processing device 1 may include: a packaging module 11, a first execution module 12, a first consensus module 13, and a second consensus module 14.
[0285] The packaging module 11 is used to obtain chain configuration information through the core engine component when the core engine component determines that the block generation conditions are met, package the preliminary blocks according to the chain configuration information, and determine the transaction scheduling type according to the chain configuration information; the block generation conditions refer to the conditions for the blockchain node to be selected as the proposal node for the current round of blocks;
[0286] A first execution module 12 is configured to execute the prepared block through the core engine component to obtain a first block to be uploaded to the chain if the core engine component determines that the transaction scheduling type is a non-deterministic scheduling type; the first block to be uploaded to the chain includes a first transaction execution sequence and a first transaction execution result;
[0287] The first consensus module 13 is used to send the first block to be chained in the core engine component to the consensus component, and perform non-deterministic scheduling consensus processing on the first block to be chained through the consensus component;
[0288] The second consensus module 14 is used to send the prepared block in the core engine component to the consensus component if the core engine component determines that the transaction scheduling type is a deterministic scheduling type, and perform deterministic scheduling consensus processing on the prepared block through the consensus component and the core engine component; during the deterministic scheduling consensus processing process, the core engine component is used to execute the transaction in the prepared block.
[0289] The specific implementation of the packaging module 11, the first execution module 12, the first consensus module 13 and the second consensus module 14 can be found in the description of steps S101 to S104 in the embodiment corresponding to FIG3a above, and will not be repeated here.
[0290] Among them, the chain configuration information includes block configuration information and transaction scheduling identifier;
[0291] The packing module 11 includes: an acquisition unit 111 , a block packing unit 112 and a scheduling determination unit 113 .
[0292] An acquisition unit 111 is configured to acquire block configuration information and transaction scheduling identifiers through a core engine component;
[0293] The block packaging unit 112 is used to obtain transactions to be packaged from the transaction pool according to the block configuration information, and perform block packaging processing on the transactions to be packaged according to the block configuration information to obtain a preliminary block;
[0294] The scheduling determination unit 113 is configured to determine that the transaction scheduling type is a non-deterministic scheduling type if the transaction scheduling identifier is a non-deterministic scheduling identifier;
[0295] The scheduling determination unit 113 is further configured to determine that the transaction scheduling type is a deterministic scheduling type if the transaction scheduling identifier is a deterministic scheduling identifier.
[0296] The specific implementation of the acquisition unit 111, the block packaging unit 112 and the scheduling determination unit 113 can refer to the description of step S101 in the embodiment corresponding to FIG. 3a above, and will not be repeated here.
[0297] The first consensus module 13 includes: a first sending unit 131 , a first scheduling determination unit 132 , a first pre-voting unit 133 and a first voting unit 134 .
[0298] The first sending unit 131 is used to send the first block to be chained in the core engine component to the consensus component;
[0299] A first scheduling determination unit 132, configured to determine a transaction scheduling type through a consensus component;
[0300] The first pre-voting unit 133 is configured to, if the consensus component determines that the transaction scheduling type is a non-deterministic scheduling type, perform a pre-voting process on the first block to be on-chain based on the first transaction execution order and the first transaction execution result in the first block to be on-chain, and obtain a first intermediate pre-voting result.
[0301] The first voting unit 134 is configured to perform a result voting process on the first block to be chained based on the first intermediate pre-voting result and the first block hash corresponding to the first block to be chained, to obtain a non-deterministic scheduling consensus result for the first block to be chained.
[0302] The specific implementation of the first sending unit 131, the first scheduling determination unit 132, the first pre-voting unit 133 and the first voting unit 134 can refer to the description of step S103 in the embodiment corresponding to Figure 3a above, and will not be repeated here.
[0303] The first pre-voting unit 133 includes a proposal broadcasting sub-unit 1331 and a pre-voting sub-unit 1332 .
[0304] The proposal broadcast subunit 1331 is configured to generate proposal information for the first block to be on-chain in the consensus component, and broadcast the proposal information to consensus nodes in the blockchain network, so that the consensus nodes in the blockchain network generate a second transaction execution result based on the proposal information, and generate first pre-voting information based on the first transaction execution result and the second transaction execution result; the second transaction execution result is obtained after the consensus nodes in the blockchain network execute the transactions in the first block to be on-chain according to the first transaction execution order;
[0305] The pre-voting subunit 1332 is configured to generate second pre-voting information for the first transaction execution result, and broadcast the second pre-voting information to consensus nodes in the blockchain network;
[0306] The pre-voting subunit 1332 is further configured to determine a first intermediate pre-voting result based on the acquired first pre-voting information and the acquired second pre-voting information.
[0307] The specific implementation of the proposal broadcast subunit 1331 and the pre-voting subunit 1332 can be found in the description of step S103 in the embodiment corresponding to FIG3 a above, and will not be repeated here.
[0308] The first voting unit 134 includes a voting processing subunit 1341 and a result determination subunit 1342 .
[0309] The voting processing subunit 1341 is configured to generate first voting information for the first block to be chained based on the first intermediate pre-voting result and the first block hash corresponding to the first block to be chained; the first voting information includes the first intermediate pre-voting result and the first block hash;
[0310] The voting processing subunit 1341 is further configured to send the first voting information to a consensus node in the blockchain network;
[0311] The voting processing subunit 1341 is further configured to receive second voting information for the first block to be on-chain, sent by a consensus node in the blockchain network; the second voting information includes an intermediate pre-voting result determined by the consensus node in the blockchain network and a hash of the first block;
[0312] The result determination subunit 1342 is configured to determine a non-deterministic scheduling consensus result for the first block to be chained based on the first voting information and the second voting information.
[0313] The specific implementation of the voting processing subunit 1341 and the result determination subunit 1342 can refer to the description of step S103 in the embodiment corresponding to FIG. 3 a , and will not be repeated here.
[0314] Among them, the second consensus module 14 includes: a second sending unit 1401, a second scheduling determination unit 1402, a first result receiving unit 1403, a second pre-voting unit 1404, a first block updating unit 1405 and a second voting unit 1406.
[0315] The second sending unit 1401 is used to send the prepared block in the core engine component to the consensus component;
[0316] A second scheduling determination unit 1402 is configured to determine a transaction scheduling type through a consensus component;
[0317] The second pre-voting unit 1404 is configured to generate proposal information for the prepared block in the consensus component if the consensus component determines that the transaction scheduling type is a deterministic scheduling type, and broadcast the proposal information to the consensus nodes in the blockchain network, so that the consensus nodes in the blockchain network execute the transactions in the prepared block in the proposal information according to the deterministic transaction execution order;
[0318] The first result receiving unit 1403 is configured to, upon receiving the third transaction execution result sent by the core engine component through the consensus component, generate fourth pre-voting information for the third transaction execution result, and broadcast the fourth pre-voting information and the third transaction execution result to the consensus nodes in the blockchain network, so that the consensus nodes in the blockchain network generate the third pre-voting information based on the third transaction execution result; the third transaction execution result is obtained after the core engine component, upon obtaining the prepared block, begins executing the transactions in the prepared block according to the deterministic transaction execution order;
[0319] The second pre-voting unit 1404 is further configured to determine a second intermediate pre-voting result based on the acquired third pre-voting information and fourth pre-voting information;
[0320] The first block updating unit 1405 is configured to update the prepared block according to the third transaction execution result to obtain a second block to be uploaded to the chain;
[0321] The second voting unit 1406 is used to perform result voting on the second block to be chained according to the second intermediate pre-voting result and the second block hash corresponding to the second block to be chained, and obtain a deterministic scheduling consensus result for the second block to be chained.
[0322] Among them, the specific implementation methods of the second sending unit 1401, the second scheduling determination unit 1402, the first result receiving unit 1403, the second pre-voting unit 1404, the first block update unit 1405 and the second voting unit 1406 can be referred to the description of step S104 in the embodiment corresponding to Figure 3a above, and will not be repeated here.
[0323] Among them, the consensus component includes the consensus adaptation component and the consensus execution component;
[0324] The first consensus module 13 includes: a third sending unit 135 , a hash generation unit 136 , a fourth sending unit 137 , a third pre-voting unit 138 and a third voting unit 139 .
[0325] The third sending unit 135 is used to send the first to-be-uploaded block in the core engine component to the consensus adapter component;
[0326] A hash generation unit 136 is configured to generate, in the consensus adapter component, a first voting hash for the first block to be on-chain based on the first block hash corresponding to the first block to be on-chain;
[0327] The fourth sending unit 137 is configured to send the first to-be-chained block and the first voting hash in the consensus adapter component from the consensus adapter component to the consensus execution component;
[0328] A third pre-voting unit 138 is configured to, in the consensus execution component, perform a pre-voting process on the first block to be put on the chain according to the first transaction execution order and the first transaction execution result in the first block to be put on the chain, and obtain a third intermediate pre-voting result;
[0329] The third voting unit 139 is used to perform result voting on the first block to be chained according to the first voting hash and the third intermediate pre-voting result, and obtain a non-deterministic scheduling consensus result for the first block to be chained.
[0330] Among them, the specific implementation methods of the third sending unit 135, the hash generation unit 136, the fourth sending unit 137, the third pre-voting unit 138 and the third voting unit 139 can refer to the description of step S203 in the embodiment corresponding to Figure 4a above, and will not be repeated here.
[0331] Among them, the consensus component includes the consensus adaptation component and the consensus execution component;
[0332] The second consensus module 14 includes: a fifth sending unit 1407 , a second result receiving unit 1408 , a second block updating unit 1409 , a sixth sending unit 1410 , a fourth pre-voting unit 1411 , and a fourth voting unit 1412 .
[0333] The fifth sending unit 1407 is used to send the prepared block in the core engine component to the consensus adapter component;
[0334] The fourth pre-voting unit 1411 is configured to send the prepared block to the consensus execution component via the consensus adapter component. The consensus execution component generates proposal information for the prepared block and broadcasts the proposal information to the consensus nodes in the blockchain network, so that the consensus nodes in the blockchain network execute the transactions in the prepared block in the proposal information according to the deterministic transaction execution order.
[0335] The second result receiving unit 1408 is configured to receive, through the consensus adapter component, a fourth transaction execution result sent by the core engine component; the fourth transaction execution result is obtained after the core engine component executes the transactions in the prepared block according to the deterministic transaction execution order;
[0336] A second block updating unit 1409 is configured to, in the consensus adapter component, update the prepared block according to the fourth transaction execution result to obtain a third block to be on-chained, and generate a second voting hash for the third block to be on-chained according to a third block hash corresponding to the third block to be on-chained;
[0337] The sixth sending unit 1410 is configured to send the fourth transaction execution result and the second voting hash in the consensus adapter component to the consensus execution component;
[0338] The fourth pre-voting unit 1411 is further configured to generate, in the consensus execution component, fifth pre-voting information for the fourth transaction execution result, and broadcast the fifth pre-voting information and the fourth transaction execution result to consensus nodes in the blockchain network, so that the consensus nodes in the blockchain network generate sixth pre-voting information based on the fourth transaction execution result.
[0339] The fourth pre-voting unit 1411 is further configured to determine a fourth intermediate pre-voting result based on the acquired sixth pre-voting information and the acquired fifth pre-voting information;
[0340] The fourth voting unit 1412 is used to perform result voting on the third block to be chained according to the second voting hash and the fourth intermediate pre-voting result, and obtain a deterministic scheduling consensus result for the third block to be chained.
[0341] Among them, the specific implementation methods of the fifth sending unit 1407, the second result receiving unit 1408, the second block updating unit 1409, the sixth sending unit 1410, the fourth pre-voting unit 1411 and the fourth voting unit 1412 can be found in the description of step S204 in the embodiment corresponding to Figure 4a above, and will not be repeated here.
[0342] The data processing device 1 further includes a third consensus module 15 .
[0343] The third consensus module 15 is configured to, when a blockchain node receives proposal information for a block to be agreed upon through the consensus component, perform signature verification on the block to be agreed upon based on the proposal information in the consensus component to obtain a signature verification result. The block to be agreed upon is generated by the target blockchain node in the blockchain network when it determines that the block generation conditions are met.
[0344] The third consensus module 15 is further configured to determine the transaction scheduling type through the core engine component if the consensus component determines that the signature verification result is a passed result;
[0345] The third consensus module 15 is further configured to, if the core engine component determines that the transaction scheduling type is a non-deterministic scheduling type, obtain a second transaction execution order from the block to be agreed upon, execute the block to be agreed upon according to the second transaction execution order, and obtain a fifth transaction execution result;
[0346] The third consensus module 15 is further configured to send the fifth transaction execution result in the core engine component to the consensus component. In the consensus component, verification voting is performed on the consensus block based on the fifth transaction execution result to obtain a consensus result for the consensus block.
[0347] The third consensus module 15 is further configured to execute the consensus block according to the deterministic transaction execution order to obtain a sixth transaction execution result if the core engine component determines that the transaction scheduling type is a deterministic scheduling type;
[0348] The third consensus module 15 is further configured to send the sixth transaction execution result in the core engine component to the consensus component. In the consensus component, a verification voting process is performed on the block to be consensus based on the sixth transaction execution result to obtain a consensus result for the block to be consensus.
[0349] The specific implementation of the third consensus module 15 can be found in the description of steps S301 to S306 in the embodiment corresponding to FIG5 a above, and will not be repeated here.
[0350] Among them, the consensus component includes the consensus adaptation component and the consensus execution component;
[0351] The data processing device 1 further includes: a fourth consensus module 16 .
[0352] The fourth consensus module 16 is configured to, when a blockchain node receives proposal information for a block to be agreed upon through the consensus execution component, perform signature verification on the block to be agreed upon based on the proposal information in the consensus execution component to obtain a signature verification result. The block to be agreed upon is generated by a target blockchain node in the blockchain network when the block generation conditions are met.
[0353] The fourth consensus module 16 is further configured to, if the consensus execution component determines that the signature verification result is a passed signature verification result, send an execution request to the consensus adapter component through the consensus execution component, and send the execution request to the core engine component through the consensus adapter component;
[0354] The fourth consensus module 16 is further used to determine the transaction scheduling type according to the execution request in the core engine component;
[0355] The fourth consensus module 16 is further configured to, if the core engine component determines that the transaction scheduling type is a non-deterministic scheduling type, obtain a second transaction execution order from the block to be agreed upon, execute the block to be agreed upon according to the second transaction execution order, and obtain a seventh transaction execution result;
[0356] The fourth consensus module 16 is further configured to send the seventh transaction execution result in the core engine component to the consensus adapter component, and generate a third voting hash in the consensus adapter component based on the seventh transaction execution result;
[0357] The fourth consensus module 16 is further configured to send the seventh transaction execution result and the third voting hash to the consensus execution component via the consensus adapter component. In the consensus execution component, verification and voting are performed on the block to be consensus based on the seventh transaction execution result and the third voting hash to obtain a consensus result for the block to be consensus.
[0358] The fourth consensus module 16 is further configured to execute the block to be agreed upon according to the deterministic transaction execution order to obtain an eighth transaction execution result if the core engine component determines that the transaction scheduling type is a deterministic scheduling type;
[0359] The fourth consensus module 16 is further configured to send the eighth transaction execution result from the core engine component to the consensus adapter component, and generate a fourth voting hash in the consensus adapter component based on the eighth transaction execution result;
[0360] The fourth consensus module 16 is further configured to send the eighth transaction execution result and the fourth voting hash to the consensus execution component through the consensus adapter component. In the consensus execution component, verification and voting are performed on the block to be consensus based on the eighth transaction execution result and the fourth voting hash to obtain a consensus result for the block to be consensus.
[0361] The specific implementation of the fourth consensus module 16 can be found in the description of steps S401 to S406 in the embodiment corresponding to FIG6 a , which will not be described in detail here.
[0362] The data processing device 1 further includes a configuration updating module 17 .
[0363] Configuration update module 17, used to obtain configuration information update transaction; configuration information update transaction includes update transaction scheduling identifier;
[0364] The configuration update module 17 is further configured to, if it is determined that the configuration information update transaction consensus has passed, call the configuration information update contract according to the configuration information update transaction, and update the transaction scheduling identifier through the configuration information update contract.
[0365] The specific implementation of the configuration update module 17 can refer to the optional description of step S104 in the embodiment corresponding to FIG. 3 a , which will not be described in detail here.
[0366] Please refer to Figure 8, which is a structural diagram of a computer device provided in an embodiment of the present application. As shown in Figure 8, the data processing device 1 in the embodiment corresponding to Figure 7 above can be applied to a computer device 1000, which may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the computer device 1000 may further include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, the user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 1005 may also be at least one storage device located away from the aforementioned processor 1001. As shown in FIG8 , the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application program.
[0367] In the computer device 1000 shown in FIG8 , the network interface 1004 can provide a network communication element; the user interface 1003 is mainly used to provide an interface for user input; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:
[0368] When the core engine component determines that the block generation conditions are met, it obtains the chain configuration information through the core engine component, packages the prepared blocks according to the chain configuration information, and determines the transaction scheduling type according to the chain configuration information. The block generation conditions refer to the conditions under which the blockchain node is selected as the proposal node for this round of blocks.
[0369] If the core engine component determines that the transaction scheduling type is a non-deterministic scheduling type, the core engine component executes the prepared block to obtain a first block to be on-chain; the first block to be on-chain includes the first transaction execution order and the first transaction execution result;
[0370] Send the first block to be chained in the core engine component to the consensus component, and perform non-deterministic scheduling consensus processing on the first block to be chained through the consensus component;
[0371] If the core engine component determines that the transaction scheduling type is a deterministic scheduling type, the prepared block in the core engine component is sent to the consensus component, and the consensus component and the core engine component perform deterministic scheduling consensus processing on the prepared block; during the deterministic scheduling consensus processing process, the core engine component is used to execute the transactions in the prepared block.
[0372] It should be understood that the computer device 1000 described in the embodiments of the present application can execute the description of the data processing method in any of the embodiments corresponding to Figures 3a, 4a, 5a, and 6a above, and will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated.
[0373] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the data processing device 1 mentioned above, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the description of the data processing method in any of the embodiments corresponding to Figures 3a, 4a, 5a, and 6a above. Therefore, it will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0374] The computer-readable storage medium may be the data processing device provided in any of the aforementioned embodiments or the internal storage unit of the computer device, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Furthermore, the computer-readable storage medium may also include both the internal storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0375] In addition, it should be noted that embodiments of the present application also provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the method provided in any of the embodiments corresponding to Figures 3a, 4a, 5a, and 6a above.
[0376] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "comprising" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or device comprising a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules not listed, or may optionally include other step units inherent to these processes, methods, apparatuses, products, or devices.
[0377] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example in terms of network elements. Whether these network elements are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel may use different methods to implement the described network elements for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0378] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A data processing method based on blockchain, characterized in that: include: When the blockchain node determines that the block generation condition is met through the core engine component, the blockchain node obtains the chain configuration information through the core engine component, packages the prepared block according to the chain configuration information, and determines the transaction scheduling type according to the chain configuration information; the block generation condition refers to the condition for the blockchain node to be selected as the proposal node of the current round of blocks; If the core engine component determines that the transaction scheduling type is a non-deterministic scheduling type, the core engine component executes the prepared block to obtain a first block to be chained; the first block to be chained includes a first transaction execution order and a first transaction execution result; Sending the first block to be chained in the core engine component to the consensus component, and performing non-deterministic scheduling consensus processing on the first block to be chained by the consensus component; If the core engine component determines that the transaction scheduling type is a deterministic scheduling type, the prepared block in the core engine component is sent to the consensus component, and the consensus component and the core engine component perform deterministic scheduling consensus processing on the prepared block; During the deterministic scheduling consensus processing, the core engine component is used to execute transactions in the prepared block.
2. The method according to claim 1, characterized in that The chain configuration information includes block configuration information and transaction scheduling identification; The obtaining chain configuration information through the core engine component, creating a prepared block according to the chain configuration information, and determining a transaction scheduling type according to the chain configuration information includes: Acquire the block configuration information and the transaction scheduling identifier through the core engine component; Acquire the transactions to be packaged from the transaction pool according to the block configuration information, and perform block packaging processing on the transactions to be packaged according to the block configuration information to obtain a prepared block; If the transaction scheduling identifier is a non-deterministic scheduling identifier, determining the transaction scheduling type is a non-deterministic scheduling type; If the transaction scheduling identifier is a deterministic scheduling identifier, the transaction scheduling type is determined to be a deterministic scheduling type.
3. The method according to claim 1, characterized in that Sending the first block to be chained in the core engine component to the consensus component, and performing non-deterministic consensus processing on the first block to be chained by the consensus component, including: Sending the first to-be-chained block in the core engine component to the consensus component; Determining a transaction scheduling type through the consensus component; If the consensus component determines that the transaction scheduling type is a non-deterministic scheduling type, then in the consensus component, according to the first transaction execution order and the first transaction execution result in the first block to be chained, a pre-voting process is performed on the first block to be chained to obtain a first intermediate pre-voting result; According to the first intermediate pre-voting result and the first block hash corresponding to the first block to be chained, result voting processing is performed on the first block to be chained to obtain a non-deterministic scheduling consensus result for the first block to be chained.
4. The method according to claim 3, characterized in that In the consensus component, according to the first transaction execution order and the first transaction execution result, pre-voting the first block to be chained is performed to obtain a first intermediate pre-voting result, including: In the consensus component, proposal information for the first block to be chained is generated, and the proposal information is broadcast to the consensus nodes in the blockchain network, so that the consensus nodes in the blockchain network generate a second transaction execution result according to the proposal information, and generate first pre-voting information according to the first transaction execution result and the second transaction execution result; the second transaction execution result is obtained after the consensus nodes in the blockchain network execute the transactions in the first block to be chained according to the first transaction execution order; Generating second pre-voting information for the first transaction execution result, and broadcasting the second pre-voting information to consensus nodes in the blockchain network; A first intermediate pre-voting result is determined according to the acquired first pre-voting information and the second pre-voting information.
5. The method according to claim 3, characterized in that: The step of performing result voting processing on the first block to be chained according to the first intermediate pre-voting result and the first block hash corresponding to the first block to be chained, and obtaining a non-deterministic scheduling consensus result for the first block to be chained, includes: Generate first voting information for the first block to be chained according to the first intermediate pre-voting result and the first block hash corresponding to the first block to be chained; the first voting information includes the first intermediate pre-voting result and the first block hash; Sending the first voting information to a consensus node in the blockchain network; Receiving second voting information for the first to-be-chained block sent by a consensus node in the blockchain network; the second voting information includes an intermediate pre-voting result determined by the consensus node in the blockchain network and the first block hash; A non-deterministic scheduling consensus result for the first block to be chained is determined according to the first voting information and the second voting information.
6. The method according to claim 1, characterized in that The sending of the prepared block in the core engine component to the consensus component, and performing deterministic scheduling consensus processing on the prepared block through the consensus component and the core engine component, includes: Sending the prepared block in the core engine component to the consensus component; Determining a transaction scheduling type through the consensus component; If the consensus component determines that the transaction scheduling type is a deterministic scheduling type, then in the consensus component, proposal information for the prepared block is generated, and the proposal information is broadcast to the consensus nodes in the blockchain network, so that the consensus nodes in the blockchain network execute the transactions in the prepared block in the proposal information according to the deterministic transaction execution order; If the third transaction execution result sent by the core engine component is received through the consensus component, fourth pre-voting information for the third transaction execution result is generated, and the fourth pre-voting information and the third transaction execution result are broadcast to the consensus nodes in the blockchain network, so that the consensus nodes in the blockchain network generate the third pre-voting information according to the third transaction execution result; the third transaction execution result is obtained after the core engine component starts to execute the transactions in the prepared block according to the deterministic transaction execution order when the prepared block is obtained; Determining a second intermediate pre-voting result according to the acquired third pre-voting information and the fourth pre-voting information; According to the execution result of the third transaction, the prepared block is updated to obtain a second block to be uploaded to the chain; According to the second intermediate pre-voting result and the second block hash corresponding to the second block to be chained, the second block to be chained is subjected to result voting processing to obtain a deterministic scheduling consensus result for the second block to be chained.
7. The method according to claim 1, characterized in that The consensus component includes a consensus adaptation component and a consensus execution component; The sending of the first block to be chained in the core engine component to the consensus component, and performing non-deterministic scheduling consensus processing on the first block to be chained by the consensus component, includes: Sending the first block to be chained in the core engine component to the consensus adapter component, in which a first voting hash for the first block to be chained is generated according to a first block hash corresponding to the first block to be chained; Sending the first to-be-chained block and the first voting hash in the consensus adapter component to the consensus execution component; In the consensus execution component, according to the first transaction execution order in the first to-be-chained block and the first A transaction execution result, performing a pre-voting process on the first block to be put on the chain, and obtaining a third intermediate pre-voting result; According to the first voting hash and the third intermediate pre-voting result, a result voting process is performed on the first block to be chained to obtain a non-deterministic scheduling consensus result for the first block to be chained.
8. The method according to claim 1, characterized in that The consensus component includes a consensus adaptation component and a consensus execution component; The sending of the prepared block in the core engine component to the consensus component, and performing deterministic scheduling consensus processing on the prepared block through the consensus component and the core engine component, includes: Sending the prepared block in the core engine component to the consensus adapter component, sending the prepared block to the consensus execution component through the consensus adapter component, generating proposal information for the prepared block in the consensus execution component, broadcasting the proposal information to the consensus nodes in the blockchain network, so that the consensus nodes in the blockchain network execute the transactions in the prepared block in the proposal information according to the deterministic transaction execution order; Receiving, through the consensus adapter component, a fourth transaction execution result sent by the core engine component; the fourth transaction execution result is obtained after the core engine component executes the transaction in the prepared block according to the deterministic transaction execution order; In the consensus adapter component, the prepared block is updated according to the fourth transaction execution result to obtain a third block to be chained, and a second voting hash for the third block to be chained is generated according to a third block hash corresponding to the third block to be chained; Sending the fourth transaction execution result and the second voting hash in the consensus adapter component to the consensus execution component; In the consensus execution component, fifth pre-voting information for the fourth transaction execution result is generated, and the fifth pre-voting information and the fourth transaction execution result are broadcast to consensus nodes in the blockchain network, so that the consensus nodes in the blockchain network generate sixth pre-voting information according to the fourth transaction execution result; Determining a fourth intermediate preliminary voting result according to the acquired sixth preliminary voting information and the fifth preliminary voting information; According to the second voting hash and the fourth intermediate pre-voting result, a result voting process is performed on the third block to be chained to obtain a deterministic scheduling consensus result for the third block to be chained.
9. The method according to claim 1, characterized in that: Also includes: When the blockchain node receives proposal information for a block to be agreed upon through the consensus component, the consensus component performs signature verification on the block to be agreed upon according to the proposal information to obtain a signature verification result; the block to be agreed upon is generated by the target blockchain node in the blockchain network when it is determined that the block generation condition is met; If the consensus component determines that the signature verification result is a passed signature verification result, the transaction scheduling type is determined by the core engine component; If the core engine component determines that the transaction scheduling type is a non-deterministic scheduling type, a second transaction execution order is obtained from the block to be agreed upon, and the block to be agreed upon is executed according to the second transaction execution order to obtain a fifth transaction execution result; Sending the fifth transaction execution result in the core engine component to the consensus component, wherein the consensus component performs a verification voting process on the block to be agreed upon according to the fifth transaction execution result to obtain a consensus result for the block to be agreed upon; If the core engine component determines that the transaction scheduling type is a deterministic scheduling type, the block to be agreed upon is executed according to the deterministic transaction execution order to obtain a sixth transaction execution result; The sixth transaction execution result in the core engine component is sent to the consensus component. In the consensus component, the block to be agreed upon is subjected to verification and voting according to the sixth transaction execution result to obtain a consensus result for the block to be agreed upon.
10. The method according to claim 1, characterized in that The consensus component includes a consensus adaptation component and a consensus execution component; The method further comprises: When the blockchain node receives the proposal information for the block to be agreed upon through the consensus execution component, the consensus execution component performs a signature verification process on the block to be agreed upon according to the proposal information to obtain a signature verification result; the block to be agreed upon is generated by the target blockchain node in the blockchain network when the block generation condition is met; If the consensus execution component determines that the signature verification result is a signature verification passing result, the consensus execution component sends an execution request to the consensus adapter component, and the consensus adapter component sends the execution request to the core engine component; In the core engine component, determining a transaction scheduling type according to the execution request; If the core engine component determines that the transaction scheduling type is a non-deterministic scheduling type, a second transaction execution order is obtained from the block to be agreed upon, and the block to be agreed upon is executed according to the second transaction execution order to obtain a seventh transaction execution result; Sending the seventh transaction execution result in the core engine component to the consensus adapter component, where a third voting hash is generated according to the seventh transaction execution result; The seventh transaction execution result and the third voting hash are sent to the consensus execution component through the consensus adapter component. A consensus execution component is configured to perform a verification and voting process on the block to be agreed upon according to the seventh transaction execution result and the third voting hash to obtain a consensus result for the block to be agreed upon; If the core engine component determines that the transaction scheduling type is a deterministic scheduling type, the consensus block is executed according to the deterministic transaction execution order to obtain an eighth transaction execution result; sending the eighth transaction execution result from the core engine component to the consensus adapter component, where a fourth voting hash is generated according to the eighth transaction execution result; The eighth transaction execution result and the fourth voting hash are sent to the consensus execution component through the consensus adaptation component. In the consensus execution component, the block to be agreed upon is verified and voted on according to the eighth transaction execution result and the fourth voting hash to obtain a consensus result for the block to be agreed upon.
11. The method according to claim 2, characterized in that Also includes: Acquire a configuration information update transaction; the configuration information update transaction includes an update transaction scheduling identifier; If it is determined that the configuration information update transaction consensus is passed, the configuration information update contract is called according to the configuration information update transaction, and the transaction scheduling identifier is updated through the configuration information update contract.
12. A data processing device based on blockchain, characterized in that: include: A packaging module is used to obtain chain configuration information through the core engine component when determining that the block generation condition is met, package the prepared block according to the chain configuration information, and determine the transaction scheduling type according to the chain configuration information; the block generation condition refers to the condition under which the blockchain node is selected as the proposal node of the current round of blocks; A first execution module, configured to execute the prepared block through the core engine component to obtain a first block to be chained if the core engine component determines that the transaction scheduling type is a non-deterministic scheduling type; the first block to be chained includes a first transaction execution order and a first transaction execution result; A first consensus module, configured to send the first block to be chained in the core engine component to a consensus component, and perform non-deterministic scheduling consensus processing on the first block to be chained through the consensus component; A second consensus module is used for sending the prepared block in the core engine component to the consensus component if the core engine component determines that the transaction scheduling type is a deterministic scheduling type, and performing deterministic scheduling consensus processing on the prepared block through the consensus component and the core engine component; During the deterministic scheduling consensus processing, the core engine component is used to execute transactions in the prepared block.
13. A computer device, characterized in that: include: Processor, memory, and network interface; The processor is connected to the memory and the network interface, wherein the network interface is used to provide a data communication function, the memory is used to store program code, and the processor is used to call the program code to execute the method described in any one of claims 1-11.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the method according to any one of claims 1 to 11.
15. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 11 can be performed.
Citation Information
Patent Citations
Data consensus method and device based on block chain, electronic equipment and storage medium
CN112907369A
Block chain-based data processing method, device and equipment, and readable storage medium
CN113409047A
Deterministic transaction concurrent scheduling method and system of block chain
CN114564412A
Scheduling task processing method, system and equipment of block chain platform and medium
CN114896032A
Blockchain system and transaction processing method for blockchain system
WO2020177547A1
Cited By
Block chain consensus method and device based on directed acyclic graph, and computer equipment
CN119203257A
Byzantine fault-tolerant consensus method based on directed acyclic graph and computer equipment
CN119324931A
