Block processing method and device of block chain system, equipment, medium and product
By grouping and sorting proposals in the blockchain system, the problem of low block construction efficiency is solved, parallel sorting and efficient block construction are realized, and system performance is improved.
Patent Information
- Application Number
- CN202411948267.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-05-23
AI Technical Summary
The block construction efficiency in existing blockchain systems is low, making it difficult to quickly deal with complex and large number of proposals, affecting system performance.
By obtaining proposal data in the blockchain system, determine the data conflict type for each proposal and group the proposals based on this. Then, sort the proposals in each group, merge the groups, and directly generate blocks to avoid fill operations and conflict judgments.
The parallel sorting of multiple proposals is realized, which reduces the sorting delay time, improves the efficiency of block construction, avoids the number of conflict judgments, and improves the performance of the blockchain system.
Smart Images

Figure CN120034546A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of blockchain technology, and in particular, relates to block processing methods, devices, equipment, media and products of blockchain systems. Background Art
[0002] In the blockchain system, miner nodes (also called mining nodes) are responsible for processing and verifying proposals, and packaging these proposals into blocks (i.e. creating blocks). The created blocks are then added to the blockchain, which ensures the integrity and immutability of the data in the entire blockchain system while obtaining their own benefits, so that the blockchain system meets the application scenarios of decentralization.
[0003] At present, the scheme for miner nodes to create blocks is often to determine the value of the collected proposals through a search algorithm, and sort the proposals according to their value based on the search algorithm, and then fill the sorted proposals into the block one by one, and verify whether the proposal conflicts with the proposals already filled in the block during the filling process to determine whether to fill the proposal into the block and whether to process the next proposal, and so on until the block is filled or there is no suitable proposal to complete the construction of a block. However, the current block construction scheme is often difficult to quickly respond to complex and large-scale proposal situations and needs to be operated in sequence, which seriously affects the efficiency of block construction.
[0004] Therefore, how to improve the efficiency of block construction in the blockchain system has become a technical problem that needs to be solved urgently. Summary of the invention
[0005] The embodiments of the present application provide a block processing method, device, equipment, medium and product in a blockchain system, which can solve the problem of how to improve the efficiency of building blocks in a blockchain system.
[0006] In a first aspect, an embodiment of the present application provides a block processing method of a blockchain system, comprising:
[0007] Obtain proposal data in the blockchain system. Proposal data includes access data of multiple proposals and the detection order of each proposal. The access data of each proposal is used to indicate the data required to execute the proposal.
[0008] According to the access data of multiple proposals and the detection order of each proposal, the data conflict type corresponding to each proposal is determined, and based on the data conflict type corresponding to each proposal, the group corresponding to each proposal is determined. The data conflict type corresponding to each proposal is used to indicate the overlap of access data between the proposal and other proposals;
[0009] Sort the proposals in each group to get the execution order within the group corresponding to each proposal;
[0010] Based on the execution order within the group corresponding to each proposal, the groups corresponding to each proposal are merged to obtain the merged groups, and blocks are generated based on the proposals in the merged groups.
[0011] In some embodiments, the multiple proposals include a first proposal, the first proposal is any proposal among the multiple proposals, and the data conflict type includes no conflict, single conflict, or multiple conflicts;
[0012] Based on the data conflict type corresponding to each proposal, determine the grouping corresponding to each proposal, including:
[0013] When the data conflict type corresponding to the first proposal is no conflict, a first group is generated, and the first proposal is added to the first group;
[0014] In the case where the data conflict type corresponding to the first proposal is a single conflict, a second proposal that conflicts with the first proposal is determined from multiple proposals based on the access data of each proposal, and the first proposal is added to the second group where the second proposal is located;
[0015] When the data conflict type corresponding to the first proposal is multiple conflicts, the first proposal is added to the third group.
[0016] In some embodiments, the proposals in each group are sorted to obtain the execution order within the group corresponding to each proposal, including:
[0017] Get the total number of proposals in each group;
[0018] According to the total number of proposals in each group, the proposals in each group are sorted to obtain the execution order within the group corresponding to each proposal.
[0019] In some embodiments, based on the execution order within the group corresponding to each proposal, the groups corresponding to each proposal are merged to obtain the merged groups, including:
[0020] When the group corresponding to each proposal does not include the third group, based on the execution order within the group corresponding to each proposal, the proposals in each group are merged to obtain a merged group, and the data conflict type corresponding to the proposal in the third group is multiple conflicts;
[0021] In the case where the group corresponding to each proposal includes the third group, at least one target group is determined from the group corresponding to each proposal, and the data conflict type corresponding to the proposal in the target group is no conflict or single conflict;
[0022] Based on the execution order of each proposal in each target group, the proposals in each target group are merged to obtain a fourth group.
[0023] Based on the access data corresponding to each proposal in the third group and the execution order within the group, at least one proposal in the multiple conflicting groups is merged into the fourth group, and the merged fourth group is used as the merged group.
[0024] In some embodiments, the third group includes a third proposal, and the third proposal is any one of the proposals in the third group;
[0025] Based on the access data corresponding to each proposal in the third group and the execution order within the group, at least one proposal in the multiple conflicting groups is merged into the fourth group, including:
[0026] Determine the execution result corresponding to the third proposal based on the fourth group and the access data corresponding to the third proposal and the execution order within the group;
[0027] When the execution result corresponding to the third proposal is that execution is allowed, based on the execution order within the group corresponding to the third proposal, the third proposal is added to the fourth group;
[0028] When the execution result corresponding to the third proposal is that execution is not allowed, the third proposal is deleted from the third group.
[0029] In some embodiments, the plurality of proposals includes a k-th proposal, k ≥ 2, and k is a positive integer;
[0030] According to the access data of multiple proposals and the detection order of each proposal, the data conflict type corresponding to each proposal is determined, including:
[0031] When the access data of the k-th proposal satisfies the first condition, the data conflict type of the k-th proposal is determined as no conflict, where the first condition is used to indicate that there is no overlap between the access data of the k-th proposal and the access data of the previous proposal, and the previous proposal is a proposal with a determined data conflict type among multiple proposals;
[0032] When the access data of the k-th proposal satisfies the second condition, the data conflict type of the k-th proposal is determined to be a multiple data conflict type, the second condition is used to indicate that there is an overlapping part between the access data of the k-th proposal and the first preceding access data, the first preceding access data at least includes the access data of the ith proposal and the j-th proposal, the proposals with the determined data conflict type include the ith proposal and the j-th proposal, the ith proposal and the j-th proposal belong to different groups, i≥1 and i is a positive integer, j≥1 and j is a positive integer;
[0033] When the access data of the kth proposal satisfies the third condition, the data conflict type of the kth proposal is determined as a single data conflict type, and the third condition is used to indicate that there is an overlapping part between the access data of the kth proposal and the second preceding access data, and the second preceding access data only includes the access data of the preceding proposal in one group.
[0034] In a second aspect, an embodiment of the present application provides a block processing device of a blockchain system, comprising:
[0035] The acquisition module is used to obtain the proposal data in the blockchain system. The proposal data includes the access data of multiple proposals and the detection order of each proposal. The access data of each proposal is used to indicate the data required to execute the proposal;
[0036] A determination module, used to determine the data conflict type corresponding to each proposal according to the access data of multiple proposals and the detection order of each proposal, and determine the group corresponding to each proposal based on the data conflict type corresponding to each proposal, and the data conflict type corresponding to each proposal is used to indicate the data overlap between the proposal and other proposals;
[0037] The sorting module is used to sort the proposals in each group and obtain the execution order within the group corresponding to each proposal;
[0038] The merge generation module is used to merge the groups corresponding to each proposal based on the execution order within the group corresponding to each proposal, obtain the merged group, and generate blocks based on the proposals in the merged group.
[0039] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the electronic device implements a block processing method of a blockchain system as in any embodiment of the first aspect.
[0040] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the block processing method of the blockchain system in any embodiment of the first aspect.
[0041] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program is run, the block processing method of the blockchain system in any embodiment of the first aspect is executed.
[0042] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0043] Based on the access data of multiple proposals and the detection order of each proposal, the data conflict type corresponding to each proposal is determined, and the group corresponding to each proposal is determined based on the data conflict type corresponding to each proposal, so as to achieve the purpose of grouping and isolating different proposals based on the overlap of access data between different proposals. The proposals in each group are sorted at the same time, and independent groups can be processed at the same time, so as to achieve parallel sorting of multiple proposals, thereby reducing the delay time of sorting multiple proposals as a whole through the search algorithm and improving sorting efficiency. Based on the execution order within the group corresponding to each proposal, multiple groups are merged, so as to generate blocks directly based on the proposals in the merged group, avoiding the filling operation of the block, and there is no need to judge whether there will be conflicts between proposals one by one, which improves the efficiency of block creation. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0045] Figure 1 It is a flowchart of a block processing method of a blockchain system provided by an embodiment of the present application;
[0046] Figure 2 It is a flowchart of processing proposals A to D using the block processing method of the blockchain system in an application scenario;
[0047] Figure 3 It is a flowchart of processing Proposal E to Proposal I using the block processing method of the blockchain system in an application scenario;
[0048] Figure 4 It is a flowchart of a block processing method of another blockchain system provided in an embodiment of the present application;
[0049] Figure 5 is a structural schematic diagram of an electronic device provided in an embodiment of the present application;
[0050] Figure 6 It is a structural diagram of a block processing device of a blockchain system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0051] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0052] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0053] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0054] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0055] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0056] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0057] First, the terms involved in this application are introduced:
[0058] Proposal: includes one or more transactions, also referred to as transaction opportunities in this application. A transaction refers to a data exchange or operation performed in a blockchain network, generally including the account address and digital signature of the initiator of the transaction and the account address of the recipient of the transaction.
[0059] Miner node: also known as mining node, or miner for short, is a node in the blockchain system that is mainly responsible for transaction verification and processing, block construction and packaging, and blockchain maintenance and updates.
[0060] In the blockchain system, for example, in public chains such as Bitcoin and Ethereum, miner nodes can improve their own profits by optimizing block construction. In the process of building blocks, miner nodes can improve their own profits by optimizing the order of proposals, such as giving priority to packaging proposals with high handling fees, thereby maximizing profits. In decentralized trading scenarios, miner nodes can also charge users priority fees by helping to successfully execute transactions such as arbitrage and liquidation. In this way, miner nodes can not only obtain their own profits, but also store proposals on the chain to maintain the normal operation of the blockchain system.
[0061] However, since different users may initiate related transactions for the same arbitrage or liquidation opportunity, the same user may also initiate multiple related transactions to increase his chances of success. At the same time, during the period of block generation, there may be many arbitrage or liquidation opportunities, which poses a great challenge to the block construction efficiency of miner nodes.
[0062] At present, the mainstream block construction scheme of miner nodes is serial greedy construction. Specifically, miner nodes will execute greedy algorithms and give priority to those proposals that are most beneficial to them. For example, miner nodes usually sort proposals according to the level of handling fees, and give priority to proposals with high handling fees, because this can enable miners to obtain more benefits after successfully building blocks. During the execution of the greedy algorithm, the miner node first compares all the collected proposals and sorts them in order from large to small according to the benefits brought to the miner node. Then fill the block in order. If a proposal has no conflict with the proposal already filled in the block, the transactions contained in the proposal will continue to be filled into the block; if there is a conflict, the proposal will be discarded. Conflict means that after the transactions in the proposals already filled in the block are executed, the transactions in the proposal cannot be fulfilled. However, the execution efficiency of sorting proposals through the greedy algorithm and filling the sorted proposals into the block through serial execution is relatively low, which seriously affects the efficiency of building blocks in the blockchain system. On the other hand, the greedy algorithm is a general algorithm that does not distinguish between different proposals, resulting in the value of the constructed blocks still having room for improvement.
[0063] In response to the above problems, the present application provides a block processing method, device, equipment, medium and product for a blockchain system. For multiple proposals in a blockchain system, based on the overlap of access data between each proposal and other proposals, multiple proposals are divided into different groups, so as to ensure that each group contains proposals with overlapping access data, that is, proposals that may conflict during execution. And the proposals are sorted for each independent group, and different sorting results can be generated for different groups while achieving parallel sorting, thereby increasing the value of the blocks constructed subsequently. And after sorting, based on the execution order within the group corresponding to each proposal, multiple groups are merged, and then the proposals in the group are directly merged to generate blocks. Compared with the traditional block construction scheme of sorting first, filling and judging conflicts at the same time, the block processing method of the blockchain system of the present application achieves the purpose of parallel sorting for multiple proposals by grouping first and then sorting, and based on the fact that there is no need to judge conflicts for proposals in the sorted group, the number of conflict judgments when merging groups is reduced, and the efficiency of block construction is improved.
[0064] The block processing method of the blockchain system of the present application is described in detail below. Figure 1 : is a flowchart of a block processing method of a blockchain system in an embodiment of the present application, such as Figure 1 As shown, the method comprises the following steps:
[0065] Step S101, obtaining proposal data in the blockchain system.
[0066] The block processing method of the blockchain system of the present application is executed by a miner node in the blockchain system. The miner node is an electronic device in the blockchain system. The electronic device can be a server, a desktop computer, a laptop computer, an ultra-mobile personal computer (UMPC) or an application-specific integrated circuit (ASIC), etc. The present application does not limit the specific type of the electronic device.
[0067] In this embodiment, each proposal includes one or more transactions. The proposal data includes access data of multiple proposals and the detection order of each proposal. The access data of each proposal is used to indicate the data required to execute the proposal. The detection order of each proposal can be the order in which the miner node receives each proposal, or it can be the order obtained by sorting multiple proposals from small to large according to the amount of access data, or it can be the order obtained by sorting multiple proposals from early to late according to the transaction time of specific transactions in each proposal. The specific transaction is the transaction with the earliest or latest transaction time in the proposal. In the embodiment of the present application, the detection order of each proposal is taken as the order in which the miner node receives each proposal.
[0068] In one example, a proposal includes a transaction, which is to exchange item Y1 on blockchain 1 for item Y2 on blockchain 2. The miner node determines that the transaction needs to be completed through a cross-chain bridge contract, and also needs to verify the user's asset balance and permissions. At this time, the access data of the proposal includes the remaining quantity of item Y1 of the transaction initiator, the remaining quantity of item Y2 of the transaction recipient, the smart contract code and status, the price of item Y1, and the price of item Y2.
[0069] Users will submit proposals in the blockchain system, and the miner nodes will receive multiple proposals in the blockchain system and determine the data that each proposal needs to access in the blockchain system, that is, determine the data required to execute each proposal to obtain the access data of each proposal, and determine the order of receiving multiple proposals as the detection order of each proposal to obtain the proposal data.
[0070] Step S102, determining the data conflict type corresponding to each proposal according to the access data of the multiple proposals and the detection order of each proposal, and determining the group corresponding to each proposal based on the data conflict type corresponding to each proposal.
[0071] In this embodiment, the data conflict type corresponding to each proposal is used to indicate the overlap of access data between the proposal and other proposals.
[0072] The miner node will determine whether the access data of each proposal overlaps with the access data of the previous proposal one by one according to the detection order of each proposal. If there is no overlap with the access data of the previous proposal, the data conflict type corresponding to the proposal is determined to be no conflict; if there is overlap with the access data of the previous proposal, the number of groups in which the previous proposals with the access data of the proposal overlap is determined; if the number is greater than one, the data conflict type corresponding to the proposal is determined to be multiple conflicts; if the number is equal to one, the data conflict type corresponding to the proposal is determined to be single conflict. The previous proposal is a proposal with a determined data conflict type among multiple proposals.
[0073] When determining the data conflict type corresponding to the proposal, the miner node will add the proposal to the corresponding group based on the access data of the previous proposal and the data conflict type corresponding to the proposal. The preset grouping rules are used to indicate that proposals with different data conflict types should be isolated into different groups.
[0074] In one implementation, the multiple proposals include a first proposal, the first proposal is any one of the multiple proposals, and the data conflict type includes no conflict, single conflict, or multiple conflicts;
[0075] Based on the data conflict type corresponding to each proposal, determine the grouping corresponding to each proposal, including:
[0076] When the data conflict type corresponding to the first proposal is no conflict, a first group is generated, and the first proposal is added to the first group;
[0077] In the case where the data conflict type corresponding to the first proposal is a single conflict, a second proposal that conflicts with the first proposal is determined from multiple proposals based on the access data of each proposal, and the first proposal is added to the second group where the second proposal is located;
[0078] When the data conflict type corresponding to the first proposal is multiple conflicts, the first proposal is added to the third group.
[0079] In this embodiment, the second proposal that conflicts with the first proposal refers to a proposal whose access data overlaps with the access data of the first proposal, and the second proposal is a proposal among multiple proposals whose data conflict type has been determined, that is, the second proposal is a previous proposal.
[0080] In the above technical solution, proposals with data conflict types of no conflict are grouped by themselves. Proposals with a single conflict will only be added to the group where the conflicting proposals are located, and proposals with multiple conflicts will be grouped into the same third group. Proposals with different data conflict types are isolated in different groups, resulting in independent groups.
[0081] When sorting proposals later, for groups with only one data conflict type, there is no need to sort them. This can reduce the usage of computing resources in the blockchain system and save sorting time. For each group with multiple conflicts and single conflicts, there is no need to consider other proposals that are not in the group when sorting. Proposals in the group can also be sorted at the same time, which improves the efficiency of proposal sorting.
[0082] Below through Figure 2 Take step S102 as an example. Figure 2 As shown, the miner node receives proposals A, B, C and D in sequence, where the access data of proposal A is a, the access data of proposal B is a, the access data of proposal C is b, and the access data of proposal D is a and b.
[0083] The miner node determines the data conflict type corresponding to each proposal in the order of Proposal A-Proposal B-Proposal C-Proposal D. For Proposal A, which is the first proposal and there is no other proposal before Proposal A, the data conflict type corresponding to Proposal A is determined to be no conflict, and Group 1 is generated, and Proposal A is added to Group 1.
[0084] For proposal B, the access data of proposal B overlaps with the access data of proposal A. The data conflict type corresponding to proposal B is determined to be a single conflict, and proposal B is added to group 1.
[0085] For Proposal C, the access data of Proposal C does not overlap with the access data of Proposal A, nor does it overlap with the access data of Proposal B. The data conflict type corresponding to Proposal C is determined to be no conflict, and Group 2 is generated, and Proposal C is added to Group 2.
[0086] For Proposal D, the access data of Proposal D overlaps with the access data of proposals in Group 1 and Group 2. The data conflict type corresponding to Proposal D is determined to be multiple conflicts, and Proposal D is added to the multiple conflict group, that is, Group 3 (an example of the third group). The final grouping result is that Group 1 contains Proposal A and Proposal B, Group 2 contains Proposal C, and Group 3 contains Proposal D.
[0087] Step S103, sorting the proposals in each group to obtain the execution order within the group corresponding to each proposal.
[0088] The miner nodes sort the proposals in each group in parallel. A specific miner node can generate multiple sorting tasks based on its own computing resources, and configure each sorting task to be responsible for sorting the proposals in a group. Through each sorting task, the miner node sorts the proposals in each group with the goal of maximizing its own profit.
[0089] In one implementation, the miner nodes can also assign different sorting algorithms in the sorting tasks to sort the proposals in different groups in different ways, thereby achieving different treatments of different proposals. Compared with the traditional solution of using a unified search algorithm to sort multiple proposals at one time, the optimal sorting of the proposals in each group can be considered, thereby adjusting the sorting between multiple proposals, which can increase the benefits brought by the constructed blocks to the miner nodes.
[0090] In one implementation, for a group with only one proposal, the miner node will assume that the proposals in the group have been sorted, and will skip sorting for the group, and distribute the sorting task to the group including multiple proposals; when the total number of multiple sorting tasks is less than the total number of groups corresponding to each proposal, the miner node will also assign any sorting task to the unsorted group when it detects that the sorting of proposals in the group for which any sorting task is responsible has been completed, thereby achieving efficient utilization of limited computing resources, improving the efficiency of proposal sorting and thus the efficiency of proposal block construction.
[0091] Continue to refer Figure 2, assuming that the miner node has two idle servers, two sorting tasks (Task 1 and Task 2) are generated. Group 1 and Group 2 are assigned to Task 1 and Task 2 respectively. For Group 1, the miner node determines that the execution order of the two proposals in Group 1 can be Proposal A-Proposal B and Proposal B-Proposal A based on the enumeration algorithm through Task 1. With the goal of maximizing its own profit, the execution order within the group with the highest profit in Group 1 is determined to be Proposal A-Proposal B. There is only one Proposal C in Group 2. Task 2 can directly determine that the proposals in Group 2 have been sorted, and Task 2 is assigned to Group 3. At this time, there is only one Proposal D in Group 3. Task 2 can directly determine that the proposals in Group 3 have been sorted. The sorting results of Groups 1 to 3 are (Proposal A, Proposal B), (Proposal C), and (Proposal D).
[0092] Step S104, based on the execution order within the group corresponding to each proposal, merge the groups corresponding to each proposal to obtain a merged group, and generate a block based on the proposals in the merged group.
[0093] It should be noted that after determining each proposal group, the miner node will assign proposals with overlapping access data to the same group, ensuring that proposals with conflicting access data are in the same group. Each group is independent of other groups, so when sorting the proposals in each group, the sorting results of each group will not affect the sorting results of other groups.
[0094] In this way, when merging the groups corresponding to each proposal based on the execution order within the group corresponding to each proposal, it is only necessary to consider whether the proposals with multiple data conflicts conflict with the proposals in other groups. The proposals with no conflict or single conflict data conflicts can be directly merged. There is no need to judge whether each proposal will conflict with the proposals already filled in the block, as in the traditional block construction scheme of sorting first, filling and judging conflicts at the same time, thereby improving the efficiency of block construction.
[0095] The miner node will give priority to merging the groups where the proposals with data conflict type of no conflict or single conflict are located, and determine whether the proposals in the third group (that is, the group where the proposals with data conflict type of multiple conflicts are located) can be merged into the merged group. If so, the proposals will be merged into the merged group. If not, the proposals will not be merged into the merged group to obtain the merged group.
[0096] Continue to refer Figure 2, the miner node will merge the proposals in group 1 to group 3, and merge group 1 with group 2. The result is (Proposal A, Proposal B, Proposal C). There is an overlap in the access data of Proposal D, Proposal A, Proposal B and Proposal C. The miner node will determine whether Proposal D can be fulfilled after Proposals A to C are executed. If it cannot be fulfilled, Proposal D will be ignored and a block (Proposal A, Proposal B, Proposal C) will be generated. The order in which Proposals A to C are arranged in the block is the execution order; if it can be fulfilled, block 1 (Proposal A, Proposal B, Proposal C, Proposal D) will be generated.
[0097] It can be understood that by merging Group 1 and Group 2, the result can also be (Proposal C, Proposal A, Proposal B). The miner node only needs to ensure that the execution order of each proposal in the merged group corresponds to the execution order within its corresponding group.
[0098] In the embodiment of the present application, based on the access data of multiple proposals and the detection order of each proposal, the data conflict type corresponding to each proposal is determined, and the group corresponding to each proposal is determined based on the data conflict type corresponding to each proposal, so as to achieve the purpose of grouping and isolating different proposals based on the overlap between the access data of different proposals. The proposals in each group are sorted at the same time, and the independent groups can be processed at the same time, so as to achieve the parallel sorting of multiple proposals, thereby reducing the delay time of sorting multiple proposals as a whole through the search algorithm, and improving the sorting efficiency. Based on the execution order within the group corresponding to each proposal, multiple groups are merged, so as to directly generate blocks based on the proposals in the merged group, avoid the filling operation of the block, and do not need to judge whether there will be conflicts between proposals one by one, thereby improving the efficiency of block creation. Compared with the traditional block construction scheme of sorting first and then filling conflict judgment and merging, the block processing method of the blockchain system of the present application achieves the purpose of parallel sorting for multiple proposals by grouping first and then sorting, and based on the proposals in the sorted group without conflict judgment, the number of conflict judgments when merging groups is reduced, and the efficiency of block construction is further improved.
[0099] Figure 4 is a flowchart of another block processing method of a blockchain system provided in an embodiment of the present application, such as Figure 4 The method shown comprises the following steps:
[0100] Step S201, obtaining proposal data in the blockchain system.
[0101] Step S202, determining the data conflict type corresponding to each proposal according to the access data of the multiple proposals and the detection order of each proposal, and determining the group corresponding to each proposal based on the data conflict type corresponding to each proposal.
[0102] For details of steps S201 to S202, please refer to Figure 1 steps S101 to S102 in the illustrated embodiment, which will not be elaborated here.
[0103] In one implementation, among multiple proposals, there is a k-th proposal, where k≥2 and k is a positive integer; according to the access data of multiple proposals and the detection order of each proposal, determine the data conflict type corresponding to each proposal, including:
[0104] According to the access data of multiple proposals and the detection order of each proposal, determine the data conflict type corresponding to each proposal, including:
[0105] When the access data of the k-th proposal meets the first condition, determine the data conflict type of the k-th proposal as no conflict. The first condition is used to indicate that there is no overlapping part between the access data of the k-th proposal and the access data of the previous proposal, and the previous proposal is the proposal for which the data conflict type has been determined among multiple proposals;
[0106] When the access data of the k-th proposal meets the second condition, determine the data conflict type of the k-th proposal as a multi-data conflict type. The second condition is used to indicate that there is an overlapping part between the access data of the k-th proposal and the first previous access data. The first previous access data includes at least the access data of the i-th proposal and the j-th proposal. Among the proposals for which the data conflict type has been determined, there are the i-th proposal and the j-th proposal, and the i-th proposal and the j-th proposal belong to different groups, where i≥1 and i is a positive integer, and j≥1 and j is a positive integer;
[0107] When the access data of the k-th proposal meets the third condition, determine the data conflict type of the k-th proposal as a single-data conflict type. The third condition is used to indicate that there is an overlapping part between the access data of the k-th proposal and the second previous access data, and the second previous access data only includes the access data of the previous proposal in one group.
[0108] In the above technical solution, when determining the data conflict type corresponding to each proposal, consider the overlapping situation between the access data of each proposal and the access data of the previous proposal in different groups, and divide the data conflict type corresponding to the proposal into three situations: no conflict, single conflict, and multi-conflict, which provides convenience for subsequent grouping. It can be understood that when the miner node determines the data conflict type corresponding to each proposal one by one based on the detection order of each proposal, for the first proposal among multiple proposals, since there is no other proposal for which the data conflict type has been determined before this first proposal, the miner node will determine the data conflict type corresponding to this first proposal as no conflict. For the second proposal among multiple proposals, only the first proposal has been determined to have a data conflict type before this second proposal, so the data conflict type corresponding to the second proposal can only be no conflict or single conflict.
[0109] Combination Figure 2 refer to Figure 3 In the example in , when the miner node merges groups 1 to 3 and generates a block, it also receives proposals E, F, G, H, I, and J in sequence, where the access data of proposal E is j and k, the access data of proposal F is j, the access data of proposal G is k and f, the access data of proposal H is e, the access data of proposal I is k, j, and e, and the access data of proposal J is e and j.
[0110] The miner node determines the data conflict type and grouping corresponding to each proposal received one by one according to the order in which the proposals are received. The specific process is as follows:
[0111] (1) Process proposal E. There is no other proposal with a confirmed data conflict type before proposal E. The data conflict type corresponding to proposal E is no conflict. Generate group 4 and add proposal E to group 4.
[0112] (2) Processing Proposal F. The access data of Proposal F overlaps with the access data of Proposal E (also called the access data conflict between Proposal F and Proposal E). The data conflict type corresponding to Proposal F is single conflict. Proposal F is added to Group 4.
[0113] (3) Processing Proposal G. The access data of Proposal G conflicts with that of Proposal E. The data conflict type corresponding to Proposal G is single conflict. Proposal G is added to Group 4.
[0114] (4) Process proposal H. There is no overlap between the access data of proposal H and the access data of the previous proposals (proposals E to F) (also called no conflict between the access data of proposal H and the previous proposals). The data conflict type corresponding to proposal H is no conflict. Generate group 5 and add proposal H to group 5.
[0115] (5) Process Proposal I. Proposal I conflicts with the access data of Proposals E to G in Group 4, and also conflicts with the access data of Proposal H in Group 5. The data conflict type corresponding to Proposal I is multiple conflicts. Proposal I is added to Group 3.
[0116] (6) Process proposal J. Proposal J conflicts with the access data of proposals E to F in group 4, and also conflicts with the access data of proposal H in group 5. The data conflict type corresponding to proposal J is multiple conflicts. Proposal J is added to group 3.
[0117] The final grouping results are: Group 4 contains Proposal E, Proposal F and Proposal G, Group 5 contains Proposal H, and Group 3 contains Proposal J and Proposal I.
[0118] In one implementation, the proposals in each group are sorted to obtain the execution order within the group corresponding to each proposal, including the following steps S203 to S204:
[0119] Step S203, obtaining the total number of proposals in each group.
[0120] Miner nodes will count the total number of proposals in each group.
[0121] Step S204, sorting the proposals in each group according to the total number of proposals in each group, and obtaining the execution order within the group corresponding to each proposal.
[0122] For each group, when the total number of proposals in the group is less than or equal to the preset number, the miner node uses an enumeration algorithm to sort the proposals in the group with the highest profit of the miner node as the goal, and obtains the execution order within the group corresponding to the proposal; when the total number of proposals in the group is greater than the preset number, the miner node uses a greedy algorithm to sort the proposals in the group with the highest profit of the miner node as the goal, and obtains the execution order within the group corresponding to the proposal. The preset number can be 2, 3, 4, etc., which can be set based on the computing resources of the miner node, and the embodiment of the present application does not make specific restrictions.
[0123] In one implementation, the sorting algorithm corresponding to each group can also be determined based on the transaction opportunities corresponding to the proposals in each group; and the proposals in each group can be sorted based on the sorting algorithm corresponding to each group. For example, when the transaction opportunity corresponding to the proposal in a group is an arbitrage opportunity, the miner node can sort the proposals in the group by a greedy algorithm. When the transaction opportunity corresponding to the proposal in a group is an asset transfer transaction opportunity, the miner node can sort the proposals in the group by an enumeration algorithm with the highest handling fee collected as the goal (that is, the lowest profit as the goal). It can be understood that the miner node can also sort the proposals in the group by algorithms such as genetic algorithms, simulated annealing algorithms, and dynamic programming algorithms. When the miner node determines the sorting algorithm corresponding to each group, it can assign different sorting algorithms to different sorting tasks, and schedule different sorting tasks to the corresponding groups to sort the proposals in the group.
[0124] Continue to refer Figure 3, taking the preset number as 2, and the miner node still generates Task 1 and Task 2 as an example, there is only one proposal H in Group 5, and the sorting of Group 5 can be skipped. The miner node assigns Task 1 and Task 2 to Group 4 and Group 3 respectively. The total number of proposals in Group 4 is greater than 2. Through Task 1, the greedy algorithm is executed on Group 4, and the execution order with the highest benefit in Group 4 is determined to be Proposal G-Proposal E-Proposal F. The total number of proposals in Group 3 is equal to 2. Through Task 2, the enumeration algorithm is executed on Group 3, and Proposal I-Proposal J and Proposal J-Proposal I are executed respectively, and the order with the highest benefit is selected. It is determined that the execution order with the highest benefit in Group 3 is Proposal I-Proposal J, and the sorting results of Groups 3 to 5 are (Proposal I, Proposal J), (Proposal G, Proposal E, Proposal F), (Proposal H).
[0125] In the technical solution shown in step S203 to step S204, the proposals in each group are sorted based on the total number of proposals in each group, so that different sorting of proposals for different groups can be achieved. Multiple sorting methods can be tried in parallel without applying a single algorithm to the entire blockchain system. Groups with different benefits can be obtained after sorting, thereby increasing the value of subsequently constructed blocks.
[0126] In one implementation, based on the execution order within the group corresponding to each proposal, the groups corresponding to each proposal are merged to obtain the merged groups, including the following steps S205 to S208:
[0127] Step S205, when the group corresponding to each proposal does not include the third group, based on the execution order within the group corresponding to each proposal, the proposals in each group are merged to obtain a merged group.
[0128] In this embodiment, the data conflict type corresponding to the proposals in the third group is multiple conflicts.
[0129] Step S206: When the groups corresponding to each proposal include the third group, at least one target group is determined from the groups corresponding to each proposal.
[0130] In this embodiment, the data conflict type corresponding to the proposals in the target group is no conflict or single conflict;
[0131] Step S207: Based on the in-group execution order corresponding to each proposal in each target group, the proposals in each target group are merged to obtain a fourth group.
[0132] Step S208: Based on the access data corresponding to each proposal in the third group and the execution order within the group, at least one proposal in the multiple conflicting groups is merged into the fourth group, and the merged fourth group is used as the merged group.
[0133] Based on the access data corresponding to each proposal in the third group and the execution order within the group, the miner node will judge each proposal in the third group one by one to see whether the proposal can be fulfilled in the blockchain system after the execution of each proposal in the fourth group. If so, the proposal will be merged into the fourth group. If not, the proposal will be ignored and the next proposal in the third group will be judged until all proposals in the third group are judged, and the final fourth group will be determined as the merged group.
[0134] In one implementation, the third group includes a third proposal, which is any one of the proposals in the third group; based on the access data corresponding to each proposal in the third group and the execution order within the group, merging at least one proposal in the multiple conflicting groups into the fourth group includes:
[0135] Determine the execution result corresponding to the third proposal based on the fourth group and the access data corresponding to the third proposal and the execution order within the group;
[0136] When the execution result corresponding to the third proposal is that execution is allowed, based on the execution order within the group corresponding to the third proposal, the third proposal is added to the fourth group;
[0137] When the execution result corresponding to the third proposal is that execution is not allowed, the third proposal is deleted from the third group.
[0138] In the above technical solution, if the execution result of a proposal in the third group is that execution is allowed, that is, the proposal can be redeemed in the blockchain system, the proposal will be merged into the fourth group; if the execution result of the proposal is that execution is not allowed, the proposal will be deleted from the third group and will not be merged into the fourth group, so as to determine that only the proposals that can be redeemed exist in the merged proposals, so as to facilitate the subsequent generation of reliable blocks.
[0139] In the technical solution of steps S205 to S208, when merging the groups corresponding to each proposal, it is only necessary to include the third group in the group corresponding to each proposal, that is, when the data conflict type is the group where the proposal with multiple conflicts is located, based on the access data corresponding to each proposal in the third group and the execution order within the group, determine whether to merge the proposals in the third group into the fourth group for subsequent block generation. This does not require judging for each proposal whether it will conflict with the proposals already filled in the block, as in the traditional block construction scheme of sorting first, filling later and judging conflicts at the same time, thereby improving the block construction efficiency.
[0140] Step S209, generating blocks based on the proposals in the merged group.
[0141] Continue to refer Figure 3After sorting the proposals in groups 3 to 5, the miner node first merges group 4 with group 5, and the proposals in the resulting group (an example of the fourth group) are arranged in sequence as (Proposal G, Proposal E, Proposal F, Proposal H). Then, based on the order of Proposal I-Proposal J, it is determined in turn whether Proposal I and Proposal J can be fulfilled after Proposal G, Proposal E, Proposal F, and Proposal H. If Proposal I cannot be fulfilled but Proposal J can be fulfilled, then Proposal J is added to the group (Proposal G, Proposal E, Proposal F, Proposal H) and block 2 (Proposal G, Proposal E, Proposal F, Proposal H, Proposal J) is generated.
[0142] In the embodiment of the present application, the group corresponding to each proposal is determined based on the data conflict type corresponding to each proposal, so as to achieve the purpose of isolating different proposals by grouping based on the overlap between the access data of different proposals. The proposals in each group are sorted at the same time, and different groups are sorted in different ways based on the total number of proposals in the group, so as to achieve parallel sorting based on multiple sorting methods. There is no need to apply a single algorithm to the entire blockchain system, and groups with different benefits can be obtained after sorting, thereby increasing the value of the blocks constructed subsequently. When merging the groups corresponding to each proposal, it is only necessary to determine whether to merge the proposals of the third group into the fourth group based on the access data corresponding to each proposal in the third group and the execution order within the group, so as to generate blocks subsequently. There is no need to judge whether the proposal will conflict with the proposals filled in the block for each proposal, as in the traditional block construction scheme of sorting first, filling and judging conflicts at the same time, so as to improve the construction efficiency of the block.
[0143] An embodiment of the present application also provides a block processing method of a blockchain system that is applicable to a structural schematic diagram of a parallel block construction architecture, wherein the parallel block construction architecture is applied to a miner node in the blockchain system, and the parallel block construction architecture includes a conflict detection component, a conflict resolution component, and a block construction component, and the conflict detection component, the conflict resolution component, and the block construction component are all integrated in the miner node.
[0144] A conflict detection component is used to obtain proposal data in the blockchain system. The proposal data includes access data of multiple proposals and the detection order of each proposal. The access data of each proposal is used to indicate the data required to execute the proposal. According to the access data of multiple proposals and the detection order of each proposal, the data conflict type corresponding to each proposal is determined, and based on the data conflict type corresponding to each proposal, the group corresponding to each proposal is determined. The data conflict type corresponding to each proposal is used to indicate the overlap of access data between the proposal and other proposals.
[0145] The conflict resolution component is used to sort the proposals in each group and obtain the execution order within the group corresponding to each proposal;
[0146] The block building component is used to merge the groups corresponding to each proposal based on the execution order within the group corresponding to each proposal, obtain the merged group, and generate blocks based on the proposals in the merged group.
[0147] The specific process of the above components performing the above steps can be found in Figures 1 to 4 The introduction of the corresponding steps in the illustrated embodiment will not be repeated here.
[0148] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device is a mining node, such as Figure 5 As shown, the electronic device 6 of this embodiment includes: at least one processor 60 ( Figure 5 Only one is shown in the figure) a processor, a memory 61, and a computer program 62 stored in the memory 61 and executable on the at least one processor 60, and when the processor 60 executes the computer program 62, the steps in the block processing method embodiment of any of the above-mentioned blockchain systems are implemented.
[0149] The electronic device 6 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The electronic device may include, but is not limited to, a processor 60 and a memory 61. Those skilled in the art will appreciate that Figure 5 It is only an example of the electronic device 6 and does not constitute a limitation on the electronic device 6. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.
[0150] The processor 60 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0151] In some embodiments, the memory 61 may be an internal storage unit of the electronic device 6, such as a hard disk or memory of the electronic device 6. In other embodiments, the memory 61 may also be an external storage device of the electronic device 6, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 6. Further, the memory 61 may also include both an internal storage unit of the electronic device 6 and an external storage device. The memory 61 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory 61 may also be used to temporarily store data that has been output or is to be output.
[0152] Corresponding to the block processing method of the blockchain system described in the above embodiment, Figure 6 A structural block diagram of a block processing device of a blockchain system provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0153] Reference Figure 6 , the device comprises:
[0154] The acquisition module 110 is used to acquire proposal data in the blockchain system. The proposal data includes access data of multiple proposals and the detection order of each proposal. The access data of each proposal is used to indicate the data required to execute the proposal.
[0155] Determination module 120 is used to determine the data conflict type corresponding to each proposal according to the access data of multiple proposals and the detection order of each proposal, and determine the group corresponding to each proposal based on the data conflict type corresponding to each proposal. The data conflict type corresponding to each proposal is used to indicate the data overlap between the proposal and other proposals.
[0156] The sorting module 130 is used to sort the proposals in each group to obtain the execution order within the group corresponding to each proposal.
[0157] The merge generation module 140 is used to merge the groups corresponding to each proposal based on the execution order within the group corresponding to each proposal to obtain a merged group, and generate a block based on the proposals in the merged group.
[0158] The acquisition module and the determination module are integrated into the aforementioned conflict detection component, the sorting module is integrated into the aforementioned conflict resolution component, and the merge generation module is integrated into the aforementioned block construction component.
[0159] In some embodiments, the multiple proposals include a first proposal, the first proposal is any one of the multiple proposals, and the data conflict type includes no conflict, single conflict, or multiple conflicts; the determination module is further used to:
[0160] When the data conflict type corresponding to the first proposal is no conflict, a first group is generated, and the first proposal is added to the first group;
[0161] In the case where the data conflict type corresponding to the first proposal is a single conflict, a second proposal that conflicts with the first proposal is determined from multiple proposals based on the access data of each proposal, and the first proposal is added to the second group where the second proposal is located;
[0162] When the data conflict type corresponding to the first proposal is multiple conflicts, the first proposal is added to the third group.
[0163] In some embodiments, the sorting module is further configured to:
[0164] Get the total number of proposals in each group;
[0165] According to the total number of proposals in each group, the proposals in each group are sorted to obtain the execution order within the group corresponding to each proposal.
[0166] In some embodiments, the merge generation module is further configured to:
[0167] When the group corresponding to each proposal does not include the third group, based on the execution order within the group corresponding to each proposal, the proposals in each group are merged to obtain a merged group, and the data conflict type corresponding to the proposal in the third group is multiple conflicts;
[0168] In the case where the group corresponding to each proposal includes the third group, at least one target group is determined from the group corresponding to each proposal, and the data conflict type corresponding to the proposal in the target group is no conflict or single conflict;
[0169] Based on the execution order of each proposal in each target group, the proposals in each target group are merged to obtain a fourth group.
[0170] Based on the access data corresponding to each proposal in the third group and the execution order within the group, at least one proposal in the multiple conflicting groups is merged into the fourth group, and the merged fourth group is used as the merged group.
[0171] In some embodiments, the third group includes a third proposal, and the third proposal is any one of the proposals in the third group; the merging generation module is further used to:
[0172] Determine the execution result corresponding to the third proposal based on the fourth group and the access data corresponding to the third proposal and the execution order within the group;
[0173] When the execution result corresponding to the third proposal is that execution is allowed, based on the execution order within the group corresponding to the third proposal, the third proposal is added to the fourth group;
[0174] When the execution result corresponding to the third proposal is that execution is not allowed, the third proposal is deleted from the third group.
[0175] In some embodiments, the multiple proposals include a k-th proposal, k≥2, and k is a positive integer; the determining module is further configured to:
[0176] When the access data of the k-th proposal satisfies the first condition, the data conflict type of the k-th proposal is determined as no conflict, where the first condition is used to indicate that there is no overlap between the access data of the k-th proposal and the access data of the previous proposal, and the previous proposal is a proposal with a determined data conflict type among multiple proposals;
[0177] When the access data of the k-th proposal satisfies the second condition, the data conflict type of the k-th proposal is determined to be a multiple data conflict type, the second condition is used to indicate that there is an overlapping part between the access data of the k-th proposal and the first preceding access data, the first preceding access data at least includes the access data of the ith proposal and the j-th proposal, the proposals with the determined data conflict type include the ith proposal and the j-th proposal, the ith proposal and the j-th proposal belong to different groups, i≥1 and i is a positive integer, j≥1 and j is a positive integer;
[0178] When the access data of the kth proposal satisfies the third condition, the data conflict type of the kth proposal is determined as a single data conflict type, and the third condition is used to indicate that there is an overlapping part between the access data of the kth proposal and the second preceding access data, and the second preceding access data only includes the access data of the preceding proposal in one group.
[0179] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0180] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0181] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0182] An embodiment of the present application provides a computer program product. When the computer program product runs on a mobile terminal, the mobile terminal can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0183] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0184] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0185] Those of ordinary skill 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, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0186] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0187] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0188] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A block processing method of a blockchain system, characterized in that: include: Acquire proposal data in the blockchain system, the proposal data including access data of multiple proposals and a detection order of each proposal, the access data of each proposal being used to indicate data required to execute the proposal; According to the access data of multiple proposals and the detection order of each proposal, determine the data conflict type corresponding to each proposal, and based on the data conflict type corresponding to each proposal, determine the group corresponding to each proposal, and the data conflict type corresponding to each proposal is used to indicate the overlap of access data between the proposal and other proposals; Sorting the proposals in each of the groups to obtain the execution order within the group corresponding to each of the proposals; Based on the execution order within the group corresponding to each of the proposals, the groups corresponding to each of the proposals are merged to obtain a merged group, and a block is generated based on the proposals in the merged group.
2. The method according to claim 1, characterized in that The multiple proposals include a first proposal, the first proposal is any one of the multiple proposals, and the data conflict type includes no conflict, single conflict or multiple conflicts; The determining, based on the data conflict type corresponding to each of the proposals, a group corresponding to each of the proposals, includes: When the data conflict type corresponding to the first proposal is the non-conflict, generating a first group, and adding the first proposal to the first group; In a case where the data conflict type corresponding to the first proposal is the single conflict, determining a second proposal that conflicts with the first proposal from among the multiple proposals based on the access data of each of the proposals, and adding the first proposal to a second group where the second proposal is located; When the data conflict type corresponding to the first proposal is the multiple conflicts, the first proposal is added to the third group.
3. The method according to claim 1 or 2, characterized in that The sorting of the proposals in each of the groups to obtain the execution order within the group corresponding to each of the proposals includes: Get the total number of proposals in each of the groups; According to the total number of proposals in each of the groups, the proposals in each of the groups are sorted to obtain the execution order within the group corresponding to each of the proposals.
4. The method according to claim 2, characterized in that The step of merging the groups corresponding to each proposal based on the execution order within the group corresponding to each proposal to obtain a merged group includes: In a case where the group corresponding to each of the proposals does not include the third group, based on the execution order within the group corresponding to each of the proposals, the proposals in each group are merged to obtain the merged group, and the data conflict type corresponding to the proposals in the third group is multiple conflicts; In a case where the groups corresponding to each of the proposals include the third group, at least one target group is determined from the groups corresponding to each of the proposals, and the data conflict type corresponding to the proposals in the target group is no conflict or single conflict; Based on the in-group execution order corresponding to each proposal in each of the target groups, the proposals in each of the target groups are merged to obtain a fourth group; Based on the access data corresponding to each proposal in the third group and the execution order within the group, at least one proposal in the multiple conflicting groups is merged into the fourth group, and the merged fourth group is used as the merged group.
5. The method according to claim 4, characterized in that The third group includes a third proposal, and the third proposal is any one of the proposals in the third group; Based on the access data corresponding to each proposal in the third group and the execution order within the group, merging at least one proposal in the multiple conflicting groups into the fourth group includes: Determine an execution result corresponding to the third proposal based on the fourth group and the access data corresponding to the third proposal and the execution order within the group; When the execution result corresponding to the third proposal is that execution is allowed, based on the execution order within the group corresponding to the third proposal, the third proposal is added to the fourth group; When the execution result corresponding to the third proposal is that execution is not allowed, the third proposal is deleted from the third group.
6. The method according to claim 1, characterized in that The multiple proposals include a k-th proposal, k≥2, and k is a positive integer; The step of determining the data conflict type corresponding to each proposal according to the access data of the plurality of proposals and the detection order of the proposals includes: If the access data of the k-th proposal satisfies a first condition, determining the data conflict type of the k-th proposal as no conflict, wherein the first condition is used to indicate that there is no overlap between the access data of the k-th proposal and the access data of a previous proposal, and the previous proposal is a proposal of which the data conflict type has been determined among the multiple proposals; In the case where the access data of the k-th proposal satisfies the second condition, the data conflict type of the k-th proposal is determined to be a multiple data conflict type, wherein the second condition is used to indicate that there is an overlapping portion between the access data of the k-th proposal and the first preceding access data, the first preceding access data at least includes the access data of the ith proposal and the j-th proposal, the proposals with the determined data conflict type include the ith proposal and the j-th proposal, the ith proposal and the j-th proposal belong to different groups, i≥1 and i is a positive integer, and j≥1 and j is a positive integer; When the access data of the k-th proposal satisfies the third condition, the data conflict type of the k-th proposal is determined as a single data conflict type, and the third condition is used to indicate that there is an overlapping part between the access data of the k-th proposal and the second preceding access data, and the second preceding access data only includes the access data of the preceding proposal in one group.
7. A block processing device of a blockchain system, characterized in that: include: An acquisition module, used to acquire proposal data in the blockchain system, wherein the proposal data includes access data of multiple proposals and a detection order of each proposal, and the access data of each proposal is used to indicate data required to execute the proposal; A determination module, used to determine the data conflict type corresponding to each of the proposals according to the access data of the multiple proposals and the detection order of each of the proposals, and based on the data conflict type corresponding to each of the proposals, determine the group corresponding to each of the proposals, the data conflict type corresponding to each of the proposals is used to indicate the data overlap between the proposal and other proposals; A sorting module, used to sort the proposals in each of the groups to obtain the execution order within the group corresponding to each of the proposals; The merging generation module is used to merge the groups corresponding to each of the proposals based on the execution order within the group corresponding to each of the proposals to obtain a merged group, and generate a block based on the proposals in the merged group.
8. An electronic device, characterized in that: The electronic device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the electronic device implements the block processing method of the blockchain system as described in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the block processing method of the blockchain system according to any one of claims 1 to 6 is implemented.
10. A computer program product, characterized in that It includes a computer program, which, when executed, enables the block processing method of the blockchain system as described in any one of claims 1 to 6 to be executed.