Current limiting method, device, electronic device and computer program product for building blocks

Through the method of dynamically adapting the current limiting standard, the current limiting problem caused by excessive instantaneous traffic in the blockchain transaction on-chain process is solved, and high-value blocks are built while limiting the current, protecting user interests.

CN119402503BActive Publication Date: 2025-04-01HANGZHOU HIGH-TECH ZONE (BINJIANG) INSTITUTE OF BLOCKCHAIN & DATA SECURITY
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510002645.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-02
Publication Date
2025-04-01
Estimated Expiration
2045-01-02

AI Technical Summary

Technical Problem

In the blockchain transaction on-chain process, when the block builder collects the searcher's transaction bundle, the instantaneous traffic is too large, which easily triggers the current limiting mechanism, resulting in the loss of the high-value transaction bundle, which in turn damages the overall value of the block.

Method used

By obtaining the transaction bundle submitted by the searcher, dynamically adapting the current limiting standards based on the value information of user transactions and strategic transactions, the transaction bundle is built into a block to be put on, thereby controlling the order of the transaction bundle to be turned on, and realizing current limiting while protecting the block value.

Benefits of technology

While limiting flow, it has built a maximum value block with fully protected user interests, which has improved the value judgment and flexibility of transactions in the blockchain network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119402503B_ABST
    Figure CN119402503B_ABST
Patent Text Reader

Abstract

The present application provides a flow limiting method, device, electronic device and computer program product for building blocks; it relates to the field of blockchain technology. The method includes: obtaining a transaction bundle submitted by a searcher, the transaction bundle includes user transactions and policy transactions; based on the user transactions and the policy transactions, determining the transaction value information corresponding to the transaction bundle; according to the value level to which the transaction value information belongs, determining the flow limiting standard corresponding to the transaction bundle; based on the flow limiting standard, constructing the transaction bundle into a block to be chained; the embodiment of the present application can dynamically limit the flow of the transaction bundle to build a block based on the value of the transaction bundle, and ensure that the constructed block has a high value while achieving flow limiting.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology, and in particular to a method, device, electronic device and computer program product for limiting the flow of building blocks. Background Art

[0002] In the blockchain transaction on-chain process, the block builder, as the node responsible for building new blocks in the blockchain network, can collect transactions from different sources, such as transaction bundles from searchers and public transactions from the memory pool mempool; the block builder builds a block with the greatest value based on the above transactions, and submits it to the validator for verification and broadcasting to complete the on-chain process.

[0003] When block builders collect transaction bundles from searchers, the flow limiting mechanism may be triggered during the block building process due to excessive instantaneous flow of transaction bundles; and indiscriminate flow limiting methods may lose high-value transaction bundles, resulting in damage to the overall value of the block. Summary of the invention

[0004] According to various embodiments of the present application, a method, device, electronic device and computer program product for limiting the flow of a building block are provided, which can ensure that the built block has a higher value while achieving the flow limiting.

[0005] In a first aspect, the present application provides a method for limiting the flow of a building block, the method comprising:

[0006] Obtain the transaction bundle submitted by the searcher, which includes user transactions and policy transactions; determine the transaction value information corresponding to the transaction bundle based on the user transactions and policy transactions; determine the flow limiting standard corresponding to the transaction bundle according to the value level to which the transaction value information belongs; and construct the transaction bundle into a block to be uploaded to the chain based on the flow limiting standard.

[0007] Through the above method, based on the user transactions and strategy transactions in the transaction bundle, the transaction value information is evaluated, and based on the value level corresponding to the transaction value information, the flow limiting standard of the transaction bundle is dynamically adapted. Based on the flow limiting standard, the transaction bundle is constructed as a block to be chained. Therefore, based on the value judgment of the transaction bundle, the order of chaining the transaction bundle is controlled, and the purpose of flow limiting is achieved. At the same time, the maximum value block with user interests fully protected is constructed; it has strong ease of use and practicality.

[0008] In a possible implementation manner of the first aspect, determining transaction value information corresponding to the transaction bundle based on the user transaction and the policy transaction includes:

[0009] Determine the transaction fee information and transaction loss information of the transaction bundle by simulating the execution of user transactions and strategy transactions;

[0010] Transaction value information is determined based on the transaction cost information and the transaction loss information.

[0011] In a possible implementation of the first aspect, determining the transaction value information based on the transaction fee information and the transaction loss information includes:

[0012] Based on the transaction cost information, a positive score of the transaction bundle is determined; based on the transaction loss information, a negative score of the transaction bundle is determined; and based on the positive score and the negative score, the transaction value information is determined.

[0013] In a possible implementation of the first aspect, determining the transaction value information according to the positive score and the negative score includes:

[0014] Multiply the positive score by the first value coefficient to obtain a first result; multiply the negative score by the second value coefficient to obtain a second result; and use the difference between the first result and the second result as transaction value information.

[0015] In a possible implementation manner of the first aspect, the method further includes:

[0016] The first value coefficient is adjusted based on the average transaction cost information of a preset historical time period; the second value coefficient is adjusted based on the average transaction loss information of a preset historical time period.

[0017] In a possible implementation manner of the first aspect, after determining the current limiting standard corresponding to the transaction bundle, the method further includes:

[0018] Based on the flow limiting standard, the target transaction queue to which the transaction bundle belongs is allocated; for the transaction bundle of the target transaction queue, blocks are constructed according to the flow limiting standard.

[0019] In a possible implementation manner of the first aspect, the method further includes:

[0020] After the transaction bundle is built into a block based on the current limiting standard, the block is sent to the block validator; after the block validator verifies the block, it broadcasts the block and completes the block chain.

[0021] In a second aspect, the present application provides a current limiting device for a building block, comprising:

[0022] A transaction acquisition unit, used to acquire a transaction bundle submitted by a searcher, wherein the transaction bundle includes a user transaction and a policy transaction;

[0023] A transaction simulation unit, used for determining transaction value information corresponding to a transaction bundle based on user transactions and policy transactions;

[0024] A standard adaptation unit, used to determine a flow limiting standard corresponding to a transaction bundle according to the value level to which the transaction value information belongs;

[0025] The block building unit is used to build transaction bundles into blocks to be uploaded to the chain based on the current limiting criteria.

[0026] In a third aspect, the present application provides an electronic device, comprising at least one processor and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute any one of the methods described in the first aspect.

[0027] In a fourth aspect, the present application provides a chip system, which is applied to an electronic device, and the chip system includes one or more processors, and the one or more processors are used to call computer instructions so that the electronic device executes the method described in the first aspect.

[0028] In a fifth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method described in the first aspect is implemented.

[0029] In a sixth aspect, the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device executes the method described in the first aspect above.

[0030] It can be understood that the beneficial effects of the second to sixth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0032] Figure 1 A schematic diagram of the process architecture of on-chain transactions provided in an embodiment of the present application;

[0033] Figure 2 A flow chart of a current limiting method for a building block provided in an embodiment of the present application;

[0034] Figure 3 A schematic diagram of the architecture of a transaction queue provided in an embodiment of the present application;

[0035] Figure 4 A schematic diagram of the structure of a current limiting device of a building block provided in an embodiment of the present application;

[0036] Figure 5 A structural schematic diagram of an electronic device is provided for an embodiment of the present application. DETAILED DESCRIPTION

[0037] The following embodiments of the technical solution of the present application are described in detail in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present application, and are therefore only used as examples, and cannot be used to limit the scope of protection of the present application.

[0038] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by technicians in the technical field to which this application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" in the specification and claims of this application and the above-mentioned figure descriptions and any variations thereof are intended to cover non-exclusive inclusions.

[0039] In the description of the embodiments of the present application, the technical terms "first", "second", etc. are only used to distinguish different objects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number, specific order or primary and secondary relationship of the indicated technical features. In the description of the embodiments of the present application, the meaning of "multiple" is more than two, unless otherwise clearly and specifically defined.

[0040] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0041] In the description of the embodiments of the present application, the term "and / or" is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0042] In the transaction on-chain process of blockchain (such as Ethereum and other public blockchains), block builders collect transaction bundles from searchers to build blocks. Due to the excessive instantaneous flow of transaction bundles, the flow limiting mechanism is easily triggered during the block building process. The current indiscriminate flow limiting method may lose high-value transaction bundles, resulting in damage to the overall value of the block.

[0043] At present, in order to achieve flow control of transaction bundles, flow limiting is performed based on the Internet Protocol (IP) address. If the number of transactions per second (TPS) of the same IP address exceeds the limit, it will prompt that the request failed due to triggering flow limiting; however, this method is easy to circumvent, and the client can bypass the limit based on multiple IP addresses, thereby continuing to initiate a large number of requests, and the flow limiting method is too single and lacks flexibility, which may lead to the loss of high-value transaction bundles. Alternatively, an authentication token (Token) is set in the request structure of the bundle to be sent, forcing the client to authenticate before sending the bundle; however, the client's request can be limited by setting a threshold, which loses the neutral position of the block builder on the blockchain network. Malicious searchers can submit transaction bundles that harm the interests of users through flow limiting measures by registering or purchasing tokens.

[0044] In response to the above problems, an embodiment of the present application provides a flow limiting method for building blocks, which can achieve the purpose of flow limiting and at the same time build a maximum value block in which user interests are fully protected.

[0045] Before introducing the implementation process of the cloud resource configuration method provided in the embodiment of the present application, the professional terms involved in the embodiment of the present application are introduced below.

[0046] 1. Transaction bundle: an atomic transaction sequence consisting of a batch of transactions.

[0047] 2. Seeker: An electronic device that executes automated programs, such as robots, that can subscribe to publicly broadcast transactions and execute trading strategies.

[0048] 3. Sandwich attack: A malicious attack method in which the attacker inserts attack transactions before and after the user's transaction to profit from the price difference of buying low and selling high; at the same time, the user is forced to redeem the target at a higher value than expected, resulting in damage to the user's interests.

[0049] 4. Slippage: Slippage in a blockchain-based trading platform refers to the difference between the actual transaction price and the expected price when a user trades. Slippage usually occurs during the execution of a trading order. Due to price fluctuations and insufficient liquidity, the final transaction price is different from the price at the time of placing the order. Slippage data can be positive or negative.

[0050] 5. Block builder: responsible for simulating the execution of transactions and packaging them into blocks, and adding blocks to nodes on the blockchain.

[0051] See also Figure 1, the process architecture diagram of transaction chaining provided by the embodiment of the present application, in the process of blockchain transaction chaining, involves searchers, block builders and block verifiers. Among them, searchers (such as searchers 1, searchers 2, searchers 3) can search and judge the transactions of the memory pool mempool, determine the profit space information corresponding to the transaction, and the execution strategy corresponding to the transaction, and then submit the user transaction and strategy transaction to the block builder in the form of a transaction bundle. The block builder simulates the transaction bundle to determine its corresponding value, allocates a queue to the transaction bundle based on the determined value, and builds a block based on the allocated queue. After completing the block construction, the block builder sends the block to the block verifier, and the block verifier verifies the block, and adds the block to the blockchain after the verification is passed, completing the transaction chaining process.

[0052] In the embodiment of the present application, the block builder makes a value judgment on the transaction bundle submitted by the searcher, and allocates the transaction bundle to queues of different levels based on the value of the transaction bundle. For queues of different levels, appropriate flow limiting standards are used to construct blocks, thereby ensuring the value of the block while achieving the purpose of flow limiting.

[0053] The specific implementation process of the current limiting method of the building block is further introduced below through an embodiment.

[0054] See also Figure 2 , a flow chart of the flow limiting method for building blocks provided in the embodiment of the present application. The execution subject of the method can be Figure 1 The block builder shown in is the node used to build the block. Figure 2 As shown, the method may include the following process:

[0055] S201, obtaining a transaction bundle submitted by a searcher, where the transaction bundle includes a user transaction and a policy transaction.

[0056] In an embodiment of the present application, the searcher may be a node that executes an automated program in a blockchain network, and the block builder is a node that performs block construction in the blockchain network; the searcher establishes a communication connection with the block builder.

[0057] For example, each blockchain node has its own memory pool mempool, which can store unconfirmed transactions. By subscribing to transactions in the memory pool, the searcher can obtain transaction information in real time, and through analysis of the transaction information, identify transactions with profit space information, and package the identified transactions into transaction bundles, and submit the transaction bundles to the block builder based on the communication connection.

[0058] The transactions in the memory pool may include user transactions and strategy transactions. User transactions are transactions initiated or participated in by users, and strategy transactions are strategies for executing transactions. Strategy transactions may also be strategy transactions formed by the searcher's own execution strategy (such as the way to execute transactions according to preset rules and conditions) after determining the user transactions in the memory pool.

[0059] For example, after the searcher determines the profit margin information of the user's transaction, the searcher executes the strategy and attaches a strategy transaction (or its own transaction) after the user's transaction. The strategy transaction is a transaction executed immediately after the user's transaction. In addition, the strategy transaction can also be a strategy transaction associated with the user's transaction obtained by the searcher from the memory pool. After determining the user's transaction, the searcher attaches the strategy transaction after the user's transaction and sends the two transactions as a bundle to the block builder.

[0060] Among them, the transaction order in the transaction bundle is user transaction, policy transaction; in some problem nodes, the transaction order in the searcher's transaction bundle may be policy transaction, user transaction, policy transaction, thus forming a transaction bundle with sandwich attack.

[0061] S202, determining transaction value information corresponding to the transaction bundle based on the user transaction and the policy transaction.

[0062] In an embodiment of the present application, after receiving the transaction bundle, the block builder simulates the transactions in the transaction bundle to determine the transaction value information of the transaction bundle.

[0063] When simulating transactions in a transaction bundle, the block builder can also verify the transactions in the transaction bundle to ensure the legality, validity and order of the transactions. The block builder verifies each transaction in the transaction bundle to ensure that it complies with the rules and protocols of the blockchain network, such as the legality of the transaction signature, account balance and other information.

[0064] Exemplarily, after verifying the legitimacy of the transaction, the block builder can generate transaction value information by simulating the transaction bundle and evaluating the transactions in the transaction bundle; for example, by simulating the transaction execution process of user transactions and policy transactions, the transaction fee information and / or transaction loss information that may be generated is evaluated, thereby determining the transaction value information of the transaction bundle based on the generated transaction fee information and / or transaction loss information.

[0065] In some embodiments, based on the user transaction and the policy transaction, determining transaction value information corresponding to the transaction bundle includes:

[0066] By simulating the execution of user transactions and strategy transactions, the transaction cost information and transaction loss information of the transaction bundle are determined; based on the transaction cost information and transaction loss information, the transaction value information is determined.

[0067] Exemplarily, transaction fee information refers to fee information that needs to be paid when conducting a transaction, that is, when completing a transaction, various fee information related to the transaction incurred by both parties before and after the transaction. The transaction fee information can be represented based on the set subject matter; among them, the transaction fees generated during the transaction execution process can motivate traders to participate in the transaction more actively, so that the higher the transaction fee, the higher the value of the corresponding transaction bundle.

[0068] Exemplarily, the transaction loss information is the loss incurred when there is a transaction attack in the transaction bundle, which causes the price information in the transaction process to differ from the expected price information due to the transaction attack between the two parties during the transaction. The transaction attack can be a sandwich attack, that is, inserting additional transactions before and after the transaction in the transaction bundle to affect the price information in the transaction process, resulting in the value information in the transaction process being manipulated by the attacker, causing the users participating in the transaction to suffer slippage losses, thereby generating transaction loss information. The size of the slippage loss reflects the degree of adverse impact on the transaction, so the higher the transaction loss information, the lower the value of the transaction bundle.

[0069] For example, if there are three types of transactions in a transaction bundle, namely, policy transactions, user transactions, and policy transactions, then it is confirmed that a sandwich attack exists in the transaction bundle; by simulating the execution of transactions in the transaction bundle, the corresponding transaction loss information is calculated.

[0070] Accordingly, the block builder simulates the execution of user transactions and policy transactions in the transaction bundle, calculates the transaction fee information and transaction loss information generated during the simulation execution process, and thus determines the transaction value information of the transaction bundle based on the transaction fee information and transaction loss information.

[0071] It should be noted that the block construction model does not involve the actual transaction process when simulating the execution of user transactions and strategy transactions, and only serves as a basis for evaluating transaction value information.

[0072] In some embodiments, determining transaction value information based on the transaction fee information and the transaction loss information includes:

[0073] Based on the transaction cost information, a positive score of the transaction bundle is determined; based on the transaction loss information, a negative score of the transaction bundle is determined; and based on the positive score and the negative score, the transaction value information is determined.

[0074] Exemplarily, after calculating the transaction fee information of the transaction bundle, the positive score corresponding to the transaction fee information is determined based on the proportional relationship between the transaction fee information and the positive score; for example, the proportional relationship between the transaction fee information and the positive score is a geometric relationship with a proportional coefficient of 1, then based on this geometric relationship, the numerical size of the calculated transaction fee information is used as the size of the positive score.

[0075] Exemplarily, after calculating the transaction loss information of the transaction bundle, the negative score corresponding to the transaction loss information is determined based on the proportional relationship between the transaction loss information and the negative score; for example, the proportional relationship between the transaction loss information and the negative score is a geometric relationship with a proportional coefficient of 1, then based on this geometric relationship, the numerical size of the calculated transaction loss information is used as the size of the negative score.

[0076] Among them, when the block builder simulates the execution of transactions in the transaction bundle, if there is no transaction attack in the transaction bundle, the negative score is zero; thus, the transaction value information is determined based on the positive score. Correspondingly, when there is a transaction attack in the transaction bundle, the transaction value information is determined based on the positive score and the negative score.

[0077] In some embodiments, determining transaction value information based on the positive score and the negative score includes:

[0078] Multiply the positive score by the first value coefficient to obtain a first result; multiply the negative score by the second value coefficient to obtain a second result; and use the difference between the first result and the second result as transaction value information.

[0079] Exemplarily, in order to reduce the impact of transaction congestion on the value of blocks on the blockchain, when determining the transaction value information based on the positive score and negative score of the transaction bundle, the corresponding value coefficients are added to the positive score and the negative score respectively; for example, the first value coefficient corresponding to the positive score and the second value coefficient corresponding to the negative score. The positive score and the negative score of the transaction bundle are adjusted by the value coefficient, so as to obtain more reasonable transaction value information of the transaction bundle.

[0080] For example, the block builder can calculate the transaction value information corresponding to the transaction bundle through the following expression:

[0081] Transaction value information = a*transaction fee information-b*transaction loss information; where a is the first value coefficient and b is the second value coefficient.

[0082] For example, when the network is congested or the block space is limited, the transaction processing speed slows down and the transaction confirmation time is prolonged. In order to confirm the transactions in their own transaction bundles as soon as possible, traders may increase the transaction fees so that the block builders can process them first. When the block builders simulate the execution of transactions, the calculated transaction fee information will increase, and the corresponding positive score will increase. In order to balance the transaction value information of the transaction bundle, the value of the first value coefficient a will be reduced. For example, when the slippage loss increases, the corresponding negative score will increase, and the value of the second value coefficient b will be increased, thereby reducing the transaction value information of the transaction bundle.

[0083] Exemplarily, the block builder monitors the network congestion and block space conditions. When it is confirmed based on the monitoring results that the transaction fee information becomes high due to network congestion or limited block space, the transaction value information of the transaction bundle is balanced by reducing the value of the first value coefficient.

[0084] In some embodiments, the method further comprises:

[0085] The first value coefficient is adjusted based on the average transaction cost information of a preset historical time period; the second value coefficient is adjusted based on the average transaction loss information of a preset historical time period.

[0086] Exemplarily, when evaluating the transaction value information of a transaction bundle, the block builder may also adjust the above-mentioned value coefficient based on a sliding window dynamic algorithm, thereby dynamically evaluating the transaction value information of the transaction bundle; for example, based on the average transaction fee information corresponding to historical transaction bundles, the first value coefficient is adjusted with unit time as the adjustment period; based on the average transaction loss information corresponding to historical transaction bundles, the second value coefficient is adjusted with unit time as the adjustment period.

[0087] Among them, the adjustment period can be one hour, and the historical transaction bundle can be a transaction bundle within a fixed historical time period from the current moment. The fixed historical time period can be six hours, that is, the fixed historical time period is used as the sliding window of the sliding window dynamic algorithm, and the average transaction cost information and average transaction loss information corresponding to the historical transaction bundle in the window are calculated once every hour.

[0088] For example, the block builder can set a first average transaction fee information threshold. When the calculated average transaction fee information in the historical time period is lower than the first average transaction fee information threshold, the average transaction fee in the recent period is relatively low, indicating that the current transaction environment is relatively stable and the transaction cost is low. The value of the first value coefficient a can be increased, thereby accelerating the speed at which the transaction bundle is packaged into blocks and put on the chain, and improving the activity of the transaction scene. The block builder can set a second average transaction fee information threshold. When the calculated average transaction fee information in the historical time period is higher than the second average transaction fee information threshold, the average transaction fee in the recent period is relatively high, which may be caused by network congestion or limited block space. The value of the first value coefficient a can be reduced to balance the transaction value information of the transaction bundle to be packaged, thereby reducing the speed at which the transaction bundle is packaged into blocks and put on the chain, and reducing the probability of user interests being damaged. Among them, the first average transaction fee information threshold is less than the second average transaction fee information threshold. When the average transaction fee information in the historical time period is between the first average transaction fee information threshold and the second average transaction fee information threshold, the size of the first value coefficient can be kept unchanged.

[0089] For another example, the block builder can set a first average transaction loss information threshold. When the calculated average transaction loss information in the historical time is lower than the first average transaction loss information threshold, the average transaction loss information in the recent period is relatively low, indicating that the transaction security is high and the user is less at risk of being attacked, then the value of the second value coefficient b can be reduced; the block builder can set a second average transaction loss information threshold. When the calculated average transaction loss information in the historical time is higher than the second average transaction loss information threshold, the average transaction loss information in the recent period is relatively high, indicating that there may be a transaction attack, then the value of the second value coefficient b is increased. Among them, the first average transaction loss information threshold is less than the second average transaction loss information threshold. When the average transaction loss information in the historical time period is between the first average transaction loss information threshold and the second average transaction loss information threshold, the size of the second value coefficient can be kept unchanged.

[0090] The above process of adjusting the value coefficient is only an example. Block builders can also comprehensively evaluate the method and direction of adjusting the value coefficient based on other factors in the actual application scenario.

[0091] S203, determining a flow limiting standard corresponding to the transaction bundle according to the value level to which the transaction value information belongs.

[0092] In an embodiment of the present application, the block builder divides the value levels based on the transaction value information of the transaction bundle, and different value levels correspond to different flow limiting standards.

[0093] For example, the block builder can configure the corresponding relationship between the value level and the flow limiting standard, so that the flow limiting standard corresponding to the transaction bundle can be determined based on the value level to which the transaction value information belongs. The corresponding relationship between the value level and the flow limiting standard is shown in Table 1.

[0094]

[0095] Table 1

[0096] The correspondence and division method between the above-mentioned value levels and flow limiting standards are only illustrative. More detailed value levels and corresponding flow limiting standards can also be divided based on actual application scenarios.

[0097] The current limiting standard is used to indicate the rate at which the transaction bundle is constructed into a block to be put on the chain. If the transaction value information of the transaction bundle is higher, then a higher current limiting standard corresponds to the transaction bundle being constructed into a block at a faster rate; correspondingly, if the transaction value information of the transaction bundle is lower, then a lower current limiting standard corresponds to the transaction bundle being constructed into a block at a slower rate.

[0098] S204, based on the current limiting standard, construct the transaction bundle into a block to be uploaded to the chain.

[0099] In an embodiment of the present application, based on the rate indicated by the current limiting standard, the block builder constructs the transaction bundle into a block to be uploaded to the chain.

[0100] For example, a block may include dozens or hundreds of transactions, while a transaction bundle includes 2 to 3 transactions, so the construction of a block requires multiple transaction bundles; thus, after determining the flow limiting standard, the rate at which the transaction bundle is constructed into a block is controlled based on the flow limiting standard.

[0101] For example, when the value level to which the transaction value information belongs is high, the transaction bundle is transmitted to the block construction unit at a rate of 10bundle / s (i.e., a rate of processing 10 transaction bundles per second), and the block construction unit constructs the block.

[0102] In some embodiments, after determining the current limiting standard corresponding to the transaction bundle, the method further includes:

[0103] Based on the flow limiting standard, the target transaction queue to which the transaction bundle belongs is allocated; for the transaction bundle of the target transaction queue, blocks are constructed according to the flow limiting standard.

[0104] Exemplarily, by evaluating the transaction value information of the transaction bundle and adapting the value level to which the transaction value information belongs, the block builder can also assign the transaction bundle to the target transaction queue corresponding to the value level; for the transaction bundle of the target transaction queue, the transaction bundle is transmitted to the block construction unit at a rate corresponding to the adapted current limiting standard to perform block construction.

[0105] like Figure 3 As shown, after determining the transaction value information of the transaction bundle and its value level, the transaction bundle is allocated to transaction queues corresponding to different value levels, such as a first transaction queue corresponding to a high value level, a second transaction queue corresponding to a medium value level, a third transaction queue corresponding to a low value level, and a fourth transaction queue corresponding to an extremely low value level.

[0106] Exemplarily, in each transaction queue, the transaction bundles are queued and transmitted to the block construction unit according to the corresponding flow limiting standard for block construction; for example, the transaction bundles of the first transaction queue are transmitted to the block construction unit according to the first flow limiting standard (10bundle / s), and the transaction bundles of the second transaction queue are transmitted to the block construction unit according to the second flow limiting standard (5bundle / s). The transaction bundles of the third transaction queue are transmitted to the block construction unit according to the third flow limiting standard (3bundle / s), and the transaction bundles of the fourth transaction queue are transmitted to the block construction unit according to the fourth flow limiting standard (1bundle / s). This delays the progress of constructing transaction bundles with lower transaction value information into blocks, reduces the probability of user interests being damaged, and increases the rate at which transaction bundles with higher transaction value information are constructed into blocks. While achieving flow limiting, it ensures that the maximum value block with full protection of user interests is constructed.

[0107] The above-mentioned transaction queues are divided based on the value levels and flow-limiting standards. More transaction queues can be divided based on actual application scenarios.

[0108] In some embodiments, after constructing the transaction bundle as a block to be uploaded to the chain based on the current limiting standard, the method further includes:

[0109] Send the block to the block validator; after the block is verified by the block validator, it will broadcast the block and complete the block chain.

[0110] Exemplarily, the block builder sends the constructed block to the verifier, which verifies the transactions in the block and broadcasts the block in the blockchain network after the verification, completing the block chaining, so that the searcher's transaction record is on the blockchain, realizing the transaction chaining.

[0111] Based on the implementation principle of the above embodiment, the implementation process of current limiting in the process of building blocks is introduced below by way of example. The process may include the following steps:

[0112] 1. The searcher subscribes to the transactions of the memory pool mempool to determine the profit space information of user transactions (user tx).

[0113] 2. The searcher executes the strategy and appends a transaction of its own (searcher tx) after the user tx, such as the strategy transaction, forming a transaction bundle bundle[user tx, searcher tx], and sends the transaction bundle to the block builder.

[0114] 3. Based on the value judgment logic, the block builder dynamically calculated the first value coefficient a of the past 6 hours to be 0.7 and the second value coefficient b to be 0.5.

[0115] 4. The block builder receives the transaction bundle [user tx, searcher tx] and calculates that there is no sandwich attack in the bundle and the user has no slippage loss. The transaction value information of the transaction bundle is 0.7*(user transaction fee information user tx.transaction fee + strategy transaction fee information searcher tx.transactionfee) + 0.5 * 0 = 0.7(user transaction fee information user tx.transaction fee + strategy transaction fee information searcher tx.transaction fee).

[0116] 5. The block builder calculates that the transaction value information of the transaction bundle is at the medium value level, determines the flow limit standard to be 5 bundles / 1s, and the block building unit of the block builder receives the transaction bundle at a TPS of 5 bundles / 1s.

[0117] Through the embodiment of the present application, based on the user transactions and policy transactions in the transaction bundle, the transaction value information is evaluated, based on the value level corresponding to the transaction value information, the flow limiting standard of the transaction bundle is dynamically adapted, and based on the flow limiting standard, the transaction bundle is constructed as a block to be put on the chain, so as to control the order of the transaction bundle on the chain based on the value judgment of the transaction bundle, and at the same time, the maximum value block with full protection of user interests is constructed while achieving the purpose of flow limiting. The flow limiting standard is dynamically slid and calculated according to the value judgment logic, and the transaction value information of the transaction bundle is dynamically adjusted based on the impact of transaction congestion on the value of the block on the blockchain to balance the transaction value information of the transaction bundle; in the judgment logic of the transaction value information, the negative impact of transaction attacks on the transaction bundle is implicit, which indirectly prevents the occurrence of attack behaviors and protects the interests of users; the value coefficient is dynamically adjusted according to the transaction congestion on the chain, while avoiding bundles with transaction attacks, it promotes the circulation of high-value transaction bundles.

[0118] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0119] Corresponding to the current limiting method of the building blocks provided in the above embodiment, such as Figure 4 As shown, the embodiment of the present application provides a current limiting device for a building block. For ease of explanation, only the parts related to the embodiment of the present application are shown.

[0120] The device includes:

[0121] The transaction acquisition unit 41 is used to acquire the transaction bundle submitted by the searcher, and the transaction bundle includes user transactions and policy transactions;

[0122] A transaction simulation unit 42, configured to determine transaction value information corresponding to the transaction bundle based on the user transaction and the policy transaction;

[0123] A standard adaptation unit 43, configured to determine a flow limiting standard corresponding to the transaction bundle according to the value level to which the transaction value information belongs;

[0124] The block construction unit 44 is used to construct the transaction bundle into a block to be uploaded to the chain based on the current limiting standard.

[0125] In a possible implementation, the transaction simulation unit 42 is further used to determine the transaction cost information and transaction loss information of the transaction bundle by simulating the execution of user transactions and policy transactions; and determine the transaction value information based on the transaction cost information and transaction loss information.

[0126] In a possible implementation, the transaction simulation unit 42 is further used to determine a positive score of the transaction bundle based on the transaction cost information; determine a negative score of the transaction bundle based on the transaction loss information; and determine transaction value information based on the positive score and the negative score.

[0127] In a possible implementation, the transaction simulation unit 42 is further used to multiply the positive score by the first value coefficient to obtain a first result; multiply the negative score by the second value coefficient to obtain a second result; and use the difference between the first result and the second result as transaction value information.

[0128] In a possible implementation, the transaction simulation unit 42 is further used to adjust the first value coefficient based on average transaction cost information of a preset historical time period; and to adjust the second value coefficient based on average transaction loss information of a preset historical time period.

[0129] In a possible implementation, the standard adaptation unit 43 is further used to allocate the target transaction queue to which the transaction bundle belongs based on the current limiting standard; the block construction unit 44 is further used to construct blocks for the transaction bundle of the target transaction queue according to the current limiting standard.

[0130] In a possible implementation, the device further includes a sending unit, which is used to send the block to a block verifier; after the block verifier verifies the block, it broadcasts the block and completes the block chaining.

[0131] Through the embodiment of the present application, based on the user transactions and policy transactions in the transaction bundle, the transaction value information is evaluated, based on the value level corresponding to the transaction value information, the flow limiting standard of the transaction bundle is dynamically adapted, and based on the flow limiting standard, the transaction bundle is constructed as a block to be put on the chain, so as to control the order of the transaction bundle on the chain based on the value judgment of the transaction bundle, and at the same time, the maximum value block with full protection of user interests is constructed while achieving the purpose of flow limiting. The flow limiting standard is dynamically slid and calculated according to the value judgment logic, and the transaction value information of the transaction bundle is dynamically adjusted based on the impact of transaction congestion on the value of the block on the blockchain to balance the transaction value information of the transaction bundle; in the judgment logic of the transaction value information, the negative impact of transaction attacks on the transaction bundle is implicit, which indirectly prevents the occurrence of attack behaviors and protects the interests of users; the value coefficient is dynamically adjusted according to the transaction congestion on the chain, while avoiding bundles with transaction attacks, it promotes the circulation of high-value transaction bundles.

[0132] Figure 5 A schematic diagram of the hardware structure of the electronic device 5 is shown.

[0133] like Figure 5 As shown, the electronic device 5 of this embodiment includes: at least one processor 50 ( Figure 5 Only one is shown in the figure), a memory 51, in which a computer program 52 that can be run on the processor 50 is stored. When the processor 50 executes the computer program 52, the steps in the above method embodiment are implemented, such as Figure 2 Alternatively, when the processor 50 executes the computer program 52, the functions of the modules / units in the above-mentioned device embodiments are realized.

[0134] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 5. In other embodiments of the present application, the electronic device 5 may include more or fewer components than shown in the figure, or combine certain components, or separate certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0135] The electronic device 5 may include, but is not limited to, a processor 50 and a memory 51. Those skilled in the art will appreciate that Figure 5 It is only an example of the electronic device 5 and does not constitute a limitation of the electronic device 5. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device may also include an input sending device, a network access device, a bus, etc.

[0136] The processor 50 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.

[0137] The processor 50 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 50 is a cache memory. The memory may store instructions or data that the processor 50 has just used or cyclically used. If the processor 50 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 50, and thus improves the efficiency of the system.

[0138] In some embodiments, the memory 51 may be an internal storage unit of the electronic device 5, such as a hard disk or memory of the electronic device 5. The memory 51 may also be an external storage device of the electronic device 5, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 5. Further, the memory 51 may include both an internal storage unit and an external storage device of the electronic device 5. The memory 51 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as program codes of a computer program. The memory 51 may also be used to temporarily store data that has been sent or is to be sent.

[0139] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0140] It should be noted that the structure of the above-mentioned electronic device is only illustrative, and based on different application scenarios, it may also include other physical structures, and the physical structure of the electronic device is not limited here.

[0141] 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.

[0142] An embodiment of the present application also provides a chip system, which is applied to an electronic device. The chip system includes one or more processors, and the one or more processors are used to call computer instructions so that the electronic device implements the steps in the above-mentioned method embodiments.

[0143] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

[0144] An embodiment of the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device can implement the steps in the above-mentioned method embodiments when executing the computer program product.

[0145] If the integrated module / 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, and can also 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. Computer-readable media may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium, etc.

[0146] The devices, electronic devices, chip systems, computer storage media, and computer program products provided in the above-mentioned embodiments of the present application are all used to execute the methods provided above. Therefore, the beneficial effects that can be achieved can refer to the corresponding beneficial effects of the methods provided above, and will not be repeated here.

[0147] It should be understood that the above is only to help those skilled in the art to better understand the embodiments of the present application, rather than to limit the scope of the embodiments of the present application. According to the above examples given, those skilled in the art can obviously make various equivalent modifications or changes. For example, some steps in each embodiment of the above detection method may be unnecessary, or some steps may be newly added. Or a combination of any two or any multiple embodiments of the above. Such modifications, changes or combined schemes also fall within the scope of the embodiments of the present application.

[0148] It should also be understood that the division of the methods, situations, categories and embodiments in the embodiments of the present application is only for the convenience of description and should not constitute a special limitation. The features of various methods, categories, situations and embodiments can be combined without contradiction.

[0149] It should also be understood that in the various embodiments of the present application, unless otherwise specified or there is a logical conflict, the terms and / or descriptions between different embodiments are consistent and can be referenced to each other, and the technical features in different embodiments can be combined to form new embodiments according to their internal logical relationships.

[0150] 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.

[0151] 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.

[0152] 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.

[0153] 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.

[0154] Finally, it should be noted that the above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for limiting current in a building block, characterized in that: The method comprises: Acquire a transaction bundle submitted by a searcher, wherein the transaction bundle includes a user transaction and a policy transaction; Based on the user transactions and the policy transactions, simulating transactions in the transaction bundle to determine transaction value information corresponding to the transaction bundle; Determining a flow limiting standard corresponding to the transaction bundle according to the value level to which the transaction value information belongs; Based on the current limiting criteria, controlling the rate at which the transaction bundle is constructed into a block to be uploaded to the blockchain; Among them, when the transaction value information of the first transaction bundle is greater than the transaction value information of the second transaction bundle, the flow limiting standard corresponding to the first transaction bundle is higher than the flow limiting standard corresponding to the second transaction bundle, and the rate at which the first transaction bundle is constructed into blocks is greater than the rate at which the second transaction bundle is constructed into blocks; the transaction bundle includes the first transaction bundle and the second transaction bundle.

2. The method according to claim 1, characterized in that The determining, based on the user transaction and the policy transaction, transaction value information corresponding to the transaction bundle includes: Determine transaction fee information and transaction loss information of the transaction bundle by simulating and executing the user transaction and the strategy transaction; The transaction value information is determined based on the transaction cost information and the transaction loss information.

3. The method according to claim 2, characterized in that The determining the transaction value information based on the transaction fee information and the transaction loss information includes: determining a positive score for the transaction bundle based on the transaction fee information; Determining a negative score of the transaction bundle based on the transaction loss information; The transaction value information is determined according to the positive score and the negative score.

4. The method according to claim 3, characterized in that The determining the transaction value information according to the positive score and the negative score includes: Multiplying the positive score by a first value coefficient to obtain a first result; Multiplying the negative score by a second value coefficient to obtain a second result; The difference between the first result and the second result is used as the transaction value information.

5. The method according to claim 4, characterized in that The method further comprises: Adjusting the first value coefficient based on average transaction fee information for a preset historical time period; The second value coefficient is adjusted based on the average transaction loss information of a preset historical time period.

6. The method according to claim 1, characterized in that After determining the current limiting standard corresponding to the transaction bundle, the method further includes: Based on the current limiting standard, allocating a target transaction queue to which the transaction bundle belongs; The step of constructing the transaction bundle into a block to be put on the chain based on the current limiting standard includes: The transaction bundle of the target transaction queue is constructed into blocks according to the current limiting standard.

7. The method according to any one of claims 1 to 6, characterized in that: After constructing the transaction bundle as a block to be uploaded to the chain based on the current limiting standard, the method further includes: The block is sent to the block verifier; after the block verifier verifies the block, it broadcasts the block and completes the block chain.

8. A current limiting device for building a block, characterized in that: include: A transaction acquisition unit, used to acquire a transaction bundle submitted by a searcher, wherein the transaction bundle includes a user transaction and a policy transaction; a transaction simulation unit, configured to simulate transactions in a transaction bundle based on the user transactions and the policy transactions, and determine transaction value information corresponding to the transaction bundle; A standard adaptation unit, configured to determine a flow limiting standard corresponding to the transaction bundle according to the value level to which the transaction value information belongs; A block construction unit, configured to control a rate of constructing the transaction bundle into a block to be uploaded to the chain based on the current limiting standard; Among them, when the transaction value information of the first transaction bundle is greater than the transaction value information of the second transaction bundle, the flow limiting standard corresponding to the first transaction bundle is higher than the flow limiting standard corresponding to the second transaction bundle, and the rate at which the first transaction bundle is constructed into blocks is greater than the rate at which the second transaction bundle is constructed into blocks; the transaction bundle includes the first transaction bundle and the second transaction bundle.

9. An electronic device, characterized in that: The electronic device includes at least one processor and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method described in any one of claims 1 to 7.

10. A computer program product, characterized in that When the computer program product runs on an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Resource request flow limiting method and device, electronic equipment and storage medium

    CN118827799A