US 11,769,125 B2
Method and apparatus for processing transaction requests in blockchain, device and medium
Bo Jing, Beijing (CN)
Assigned to Baidu Online Network Technology (Beijing) Co., Ltd, Beijing (CN)
Filed by Baidu Online Network Technology (Beijing) Co., Ltd., Beijing (CN)
Filed on Mar. 24, 2021, as Appl. No. 17/211,472.
Claims priority of application No. 202010443579.4 (CN), filed on May 22, 2020.
Prior Publication US 2021/0209567 A1, Jul. 8, 2021
Int. Cl. G06Q 20/10 (2012.01); G06Q 20/38 (2012.01); G06F 17/18 (2006.01); H04L 9/00 (2022.01)
CPC G06Q 20/102 (2013.01) [G06F 17/18 (2013.01); G06Q 20/382 (2013.01); H04L 9/50 (2022.05); H04L 2209/56 (2013.01)] 7 Claims
OG exemplary drawing
 
1. A method for processing transaction requests in a blockchain, comprising:
judging, by a blockchain node, whether an execution of each transaction request to be selected of transaction requests to be selected in a blockchain network depends on a processing result of at least one transaction request to be selected of the transaction requests to be selected except the corresponding transaction request to be selected;
in a case where the execution of the corresponding transaction request to be selected depends on the processing result of the at least one transaction request to be selected, determining, by the blockchain node, that the corresponding transaction request to be selected and the at least one transaction request to be selected has a dependency relationship, so as to obtain dependency relationships between the transaction requests to be selected;
constructing, by the blockchain node, a directed acyclic graph between the transaction requests to be selected according to the dependency relationships between the transaction requests to be selected;
aggregating, by the blockchain node, the transaction requests to be selected with dependency relationships by using the directed acyclic graph, to obtain transaction request sets;
determining, by the blockchain node, a quotient value between a sum of payment vouchers of transaction requests to be selected in each transaction request set of the transaction request sets and a space occupancy of the corresponding transaction request set as an incentive factor of the corresponding transaction request set, wherein the space occupancy of the corresponding transaction request set is a sum of space occupancies of transaction requests to be selected in the corresponding transaction request set;
determining, by the blockchain node, a candidate factor interval to which each transaction request set of the transaction request sets belongs by traversing upper limits and lower limits of candidate factor intervals, based on the incentive factor of the corresponding transaction request set, wherein the candidate factor intervals are pre-created, each candidate factor interval comprises an upper limit and a lower limit, upper limits of the candidate factor intervals do not overlap, and lower limits of the candidate factor intervals do not overlap;
if the candidate factor interval to which the corresponding transaction request set is not determined, creating, by the blockchain node, a new candidate factor interval to which the corresponding transaction request set belongs;
wherein the incentive factor of each transaction request set of the transaction request sets is used to represent a reward obtained by the blockchain node executing transaction requests to be selected in the corresponding transaction request set;
wherein each candidate factor interval is used to evaluate a probability that a transaction request set in the corresponding candidate factor participates in a block generation process, and the larger the upper limit or the lower limit of the corresponding candidate factor interval, the larger the probability that the transaction request set in the corresponding candidate factor interval is selected to participate in the block generation process;
selecting, by the blockchain node, a candidate factor interval with a largest upper limit or a largest lower limit from the candidate factor intervals as a current factor interval;
selecting, by the blockchain node, a transaction request set with a largest space occupancy from transaction request sets corresponding to the current factor interval as a current transaction request set;
calculating, by the blockchain node, a total space occupancy of the current transaction request set and a target transaction request set selected in a current block generation cycle;
in a case where the total space occupancy does not exceed a block space threshold, using, by the blockchain node, the current factor interval as a current target factor interval and using, by the blockchain node, the current transaction request set as a current target transaction request set removing, by the blockchain node, transaction requests to be selected in the current target transaction request set from the transaction requests to be selected in the blockchain network, and returning to the step of constructing, by the blockchain node, a directed acyclic graph between the transaction requests to be selected according to the dependency relationships between the transaction requests to be selected;
in a case where the total space occupancy exceeds the block space threshold, determining, by the blockchain node, whether there is at least one transaction request set in the transaction request sets corresponding to the current factor interval, wherein a space occupancy of each transaction request set of the at least one transaction request set is less than a space occupancy of the current transaction request set in a case where there is the at least one transaction request set, determining, by the blockchain node, a transaction request set with a largest space occupancy from the at least one transaction request set as the current transaction request set, and returning to the step of calculating, by the blockchain node, the total space occupancy of the current transaction request set and the target transaction request set selected in the current block generation cycle; in a case where there is not the at least one transaction request set, selecting, by the blockchain node, a candidate factor interval with a largest upper limit or a largest lower limit from at least one candidate factor interval in which each candidate factor interval has an upper limit or a lower limit less than the current factor interval and each candidate factor interval is in the candidate factor intervals as the current factor interval, and returning to the step of selecting, by the blockchain node, the transaction request set with the largest space occupancy from transaction request sets corresponding to the current factor interval as the current transaction request set; and
in a case where the total space occupancy reaches the block space threshold, generating, by the blockchain node, a block by executing all current target transaction request sets.