Transaction screening method, computer device, and storage medium

CN114140237B8Active Publication Date: 2026-04-28蓝谷创服(北京)科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
蓝谷创服(北京)科技有限公司
Filing Date
2021-12-02
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

When a bug occurs in a contract in the blockchain, the transaction calling the contract before upgrading and fixing the bug will fail, resulting in loss of handling fees and poor user experience.

Method used

Provide a transaction screening method that receives transactions to be repaired generated by the administrator, executes the repair contract and updates the list of contracts to be repaired, and determines whether the contract called by the transaction is in the list. If it is, it will be deleted from the transaction pool to avoid execution failure. And reduce handling fee losses.

Benefits of technology

It effectively reduces the loss of handling fees caused by contract bugs, improves user experience, reduces the waste of computing power in blockchain nodes, and delays the number of emergency bug fixes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114140237B8_ABST
    Figure CN114140237B8_ABST
Patent Text Reader

Abstract

The application provides a transaction screening method, a computer device and a storage medium. The method comprises the following steps: receiving a first to-be-repaired transaction generated by a first client of an administrator; executing the first to-be-repaired transaction through a repair contract; when the execution is successful, adding a to-be-repaired contract name to a to-be-repaired contract list through the repair contract to update the to-be-repaired contract list; obtaining a first transaction; judging whether a first contract name of a contract called by the first transaction is in the to-be-repaired contract list; and if yes, deleting the first transaction from a transaction pool. The application reduces the loss of a service charge and improves user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of blockchain technology, specifically to a transaction screening method, computer equipment, and storage medium. Background Technology

[0002] In existing technologies, if a bug appears in a blockchain contract, transactions executed by calling that contract will fail until the bug is fixed in an upgraded version of the blockchain, resulting in wasted transaction fees and a poor user experience. Summary of the Invention

[0003] In view of the above-mentioned defects or deficiencies in the prior art, it is desirable to provide a transaction screening method, computer equipment and storage medium that reduces transaction fee losses and improves user experience.

[0004] In a first aspect, the present invention provides a transaction screening method applicable to blockchain nodes, wherein a repair contract is configured on the blockchain, and the method includes:

[0005] The first repair transaction is generated by the first client of the administrator; wherein, the first repair transaction includes the name of the contract to be repaired;

[0006] The first transaction to be repaired is executed by repairing the contract. Upon successful execution, the name of the contract to be repaired is added to the list of contracts to be repaired to update the list of contracts to be repaired.

[0007] Securing the first transaction;

[0008] Determine if the name of the first contract called by the first exchange is in the list of contracts to be repaired:

[0009] If yes, then the first transaction will be removed from the transaction pool.

[0010] In a second aspect, the present invention also provides an apparatus comprising one or more processors and a memory, wherein the memory contains instructions executable by the one or more processors to cause the one or more processors to perform a transaction screening method provided according to various embodiments of the present invention.

[0011] Thirdly, the present invention also provides a storage medium storing a computer program that causes a computer to execute a transaction screening method provided according to various embodiments of the present invention.

[0012] The transaction filtering method, computer device, and storage medium provided by various embodiments of the present invention reduce transaction fee losses and improve user experience by receiving a first transaction to be repaired generated by a first client of an administrator; executing the first transaction to be repaired through a repair contract; adding the name of the contract to be repaired to the list of contracts to be repaired to update the list of contracts to be repaired upon successful execution; obtaining the first transaction; determining whether the name of the first contract called by the first exchange is in the list of contracts to be repaired; and deleting the first transaction from the transaction pool if yes. Attached Figure Description

[0013] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:

[0014] Figure 1 This is a flowchart of a transaction screening method provided in an embodiment of the present invention.

[0015] Figure 2 for Figure 1 A flowchart of step S11 in a preferred embodiment of the method shown.

[0016] Figure 3 for Figure 1 A flowchart of a preferred embodiment of the method shown.

[0017] Figure 4 for Figure 3 A flowchart of a preferred embodiment of the method shown.

[0018] Figure 5 for Figure 4 A flowchart of a preferred embodiment of the method shown.

[0019] Figure 6 This is a schematic diagram of the structure of a device provided in an embodiment of the present invention. Detailed Implementation

[0020] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.

[0021] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0022] Figure 1 This is a flowchart of a transaction screening method provided in an embodiment of the present invention.

[0023] like Figure 1 As shown, in this embodiment, the present invention provides a transaction filtering method suitable for blockchain nodes, wherein a repair contract is configured on the blockchain, and the method includes:

[0024] S11: Receive the first repair transaction generated by the administrator's first client; wherein, the first repair transaction includes the name of the contract to be repaired;

[0025] S12: Execute the first transaction to be repaired through the repair contract. Upon successful execution, add the name of the contract to be repaired to the list of contracts to be repaired through the repair contract to update the list of contracts to be repaired.

[0026] S13: Obtain the first transaction;

[0027] S141: Determine if the name of the first contract called by the first exchange is in the list of contracts to be repaired:

[0028] If yes, then proceed to step S142: remove the first transaction from the transaction pool.

[0029] For example, the first repair transaction includes the name of the repaired method body of the contract to be repaired, and S12 includes "execute the first repair transaction through the repair contract, and when the execution is successful, add the name of the repaired method body to the list of contracts to be repaired through the repair contract to update the list of contracts to be repaired", and S141 includes "determine whether the name of the first method body of the method of the contract called by the first transaction is in the list of contracts to be repaired".

[0030] Suppose the administrator discovers a bug in the PropRule method of the economy contract;

[0031] The administrator's client generates a transaction tx1 to be repaired, tx1 including the autonomy-PropRule;

[0032] The blockchain node executes step S11 and receives tx1;

[0033] The blockchain node executes step S12, which involves executing tx1 by repairing the contract. Upon successful execution, the autonomy-PropRule is added to the list of contracts to be repaired by repairing the contract to update the list of contracts to be repaired.

[0034] Assume that the list of contracts to be repaired at this time includes autonomy-PropRule, execr-actionName1, and execr-actionName2;

[0035] The blockchain node executes step S13, obtains transaction tx2, and tx2 calls the autonomy method of the contract autonomy.

[0036] The blockchain node executes step S141 to determine whether autonomy-PropRule is in the list of contracts to be repaired:

[0037] Since the autonomy-PropRule is in the list of contracts to be repaired, the blockchain node executes step S142 to remove tx2 from the transaction pool.

[0038] Those skilled in the art should understand that the aforementioned administrator can be the administrator set during initialization, or an administrator elected by vote;

[0039] The above embodiments can reduce transaction fee losses from calling contracts that generate bugs, thereby improving user experience. At the same time, blockchain nodes do not need to execute the transactions that call contracts that generate bugs, but can allocate more computing power to executing other transactions, broadcasting transactions, and other tasks.

[0040] If a bug is identified as an urgent bug (hereinafter referred to as an urgent bug), it is generally addressed through an emergency fix and version upgrade, which takes a considerable amount of time. In extreme cases, if multiple urgent bugs are discovered consecutively, the blockchain may be in a state of continuous upgrade. The method described above can delay the fixing of urgent bugs by upgrading multiple urgent bugs together, so that blockchain nodes only need to be upgraded once, reducing the number of node upgrades. The method of upgrading multiple urgent bugs together can be configured according to actual needs. For example, after discovering the first urgent bug, observe whether there are other urgent bugs in 100 blocks. If so, fix all urgent bugs together to upgrade the blockchain in one go.

[0041] Figure 2 for Figure 1 A flowchart of step S11 in a preferred embodiment of the method shown.

[0042] like Figure 2 As shown, in a preferred embodiment, step S11 includes:

[0043] S111: Receive the first transaction to be repaired generated by the administrator's first client;

[0044] S112: When it is determined that the first transaction to be repaired is a first-class transaction that needs to trigger the execution of the repair contract, the first transaction to be repaired is placed in the transaction priority packaging queue;

[0045] Transactions in the priority packaging queue will be packaged first.

[0046] The above embodiment configures priority packaging permission for the first type of transactions that need to trigger the execution of the repair contract, so that the first type of transactions can be packaged first.

[0047] Generally, transactions in the transaction priority packing queue are packed in the order they entered the queue.

[0048] Figure 3 for Figure 1 A flowchart of a preferred embodiment of the method shown. (See attached flowchart.) Figure 3 As shown, in a preferred embodiment, the above method further includes:

[0049] S15: Receive the first repaired transaction generated by the first client; wherein the first repaired transaction includes the name of the repaired contract;

[0050] S16: When it is determined that the first repaired transaction is a first-type transaction that needs to trigger the execution of the repair contract, the first repaired transaction is placed in the transaction priority packaging queue; among them, transactions in the transaction priority packaging queue will be packaged first;

[0051] S17: Execute the first repaired transaction through the repair contract. Upon successful execution, remove the name of the repaired contract from the list of contracts to be repaired to update the list of contracts to be repaired.

[0052] Suppose the administrator discovers that the PropRule method of the economy contract has been fixed;

[0053] The administrator's client generates a fixed transaction tx4, which includes the autonomy-PropRule;

[0054] The blockchain node executes step S15 and receives tx4;

[0055] In step S16, when the blockchain node determines that tx4 is a first-class transaction that needs to trigger the execution of the repair contract, it places tx4 in the transaction priority packaging queue.

[0056] The blockchain node executes step S17, which involves executing tx4 by repairing the contract. Upon successful execution, the autonomy-PropRule is removed from the list of contracts to be repaired by repairing the contract. At this point, the list of contracts to be repaired contains execr-actionName1 and execr-actionName2.

[0057] Figure 4 for Figure 3 A flowchart of a preferred embodiment of the method shown. (See attached flowchart.) Figure 4As shown, in a preferred embodiment, step S142 includes:

[0058] S1421: Store the first transaction locally;

[0059] S1422: Remove the first transaction from the transaction pool;

[0060] The above methods also include:

[0061] S18: When the first contract name is detected to have been removed from the list of contracts to be repaired, the first transaction will be re-stored into the transaction pool.

[0062] The above embodiments enable the first transaction to be executed by the blockchain node as soon as the first contract is repaired.

[0063] Figure 5 for Figure 4 A flowchart of a preferred embodiment of the method shown. (See attached flowchart.) Figure 5 As shown, in a preferred embodiment, the above method further includes:

[0064] S19: When the first transaction is stored locally for the duration of the first timeout, if the first contract name has not yet been deleted from the list of contracts to be repaired, the first transaction will be deleted from the local storage.

[0065] The above embodiments free up local memory.

[0066] Preferably, removing the first transaction from the transaction pool includes:

[0067] Cache the hash of the first transaction in the list of unexecuted transactions in the contract to be repaired;

[0068] Remove the first transaction from the transaction pool;

[0069] The above methods also include:

[0070] The second transaction is received from the second client of the first user; wherein, the second transaction includes a third transaction hash, and the second transaction is generated by the second client after the name of the second contract that executes the second transaction call is removed from the list of contracts to be repaired on the blockchain;

[0071] When the third transaction hash is included in the list of unexecuted transactions for a contract to be repaired, the second transaction is placed in the transaction priority packing queue.

[0072] Since the blockchain nodes cache the transaction hash hash(tx2) in the list of unexecuted transactions of the contract to be repaired, assuming tx2 is generated by user A's client; since tx2 is deleted from the transaction pool, only user A knows hash(tx2); therefore, after user A detects that the autonomy-PropRule has been deleted from the list of contracts to be repaired, user A can generate tx3 (including hash(tx2)); if the blockchain nodes find hash(tx2) in the list of unexecuted transactions of the contract to be repaired, they will execute tx3 first.

[0073] The above embodiments also have the following problems: User A can generate tx3 that is completely unrelated to tx2, and tx3 can still get priority; or, User A can even inform other users of hash(tx2), and tx3 that is completely unrelated to other users can still get priority.

[0074] Blockchain nodes can address the above issues through the following mechanism:

[0075] When caching hash(tx2), the other parameters in the payload of tx2, excluding the timestamp, can be hashed to obtain the first hash value; and when hash(tx2) is found in the list of unexecuted transactions of the contract to be repaired, the other parameters in the payload of tx3, excluding the timestamp, can be hashed to obtain the second hash value. If the first hash value is the same as the second hash value, then tx3 is placed in the transaction priority packaging queue.

[0076] Furthermore, the above methods also include:

[0077] When the first transaction hash is cached in the list of unexecuted transactions of the contract to be repaired for a period of time that reaches the second timeout period, the first transaction hash will be removed from the list of unexecuted transactions of the contract to be repaired.

[0078] The above embodiments release a list of unexecuted transactions in contracts awaiting repair.

[0079] Preferably, the first transaction to be repaired is executed through the repair contract. Upon successful execution, the name of the contract to be repaired is added to the list of contracts to be repaired to update the list, including:

[0080] The first transaction to be repaired is executed by repairing the contract. Upon successful execution, the name of the contract to be repaired is recorded on the blockchain.

[0081] If no first report transaction is received within the first time period, the name of the contract to be repaired is added to the list of contracts to be repaired to update the list of contracts to be repaired; wherein, the first report transaction is generated by other clients when they determine that the contract to be repaired does not need to be repaired;

[0082] If the first reported transaction is received within the first time period, and it is determined that the contract to be repaired does not need to be repaired, then the administrator will be punished according to the pre-configured penalty rules.

[0083] Suppose there are two similar competing contracts, and the administrator is in collusion with the deployer of one of the contracts. The administrator can generate transactions that need to be fixed in the other contract to reduce the user experience of the other contract's users, thus creating an unfair competitive relationship.

[0084] The above problems can be solved using the methods described in the above embodiments.

[0085] The other clients mentioned above can be clients of another contract's deployer or clients of ordinary users; no specific limitations are made here.

[0086] The above-mentioned penalty rules can be configured according to actual needs. For example, if the administrator has previously paid part of the deposit, part of the administrator's deposit can be forfeited. In this case, the execution of the first transaction to be repaired through the repair contract should also include: checking whether the administrator has paid enough deposit. For another example, if there are other administrators to replace the administrator, the administrator's qualification can be revoked and a new administrator can be elected from the other administrators to achieve the same technical effect.

[0087] Figure 6 This is a schematic diagram of the structure of a device provided in an embodiment of the present invention.

[0088] like Figure 6 As shown, in another aspect, this application also provides a device including one or more central processing units (CPUs) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage portion 608 into a random access memory (RAM) 603. The RAM 603 also stores various programs and data required for the operation of the device 600. The CPU 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0089] The following components are connected to I / O interface 605: an input section 606 including a keyboard, mouse, etc.; an output section 607 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to I / O interface 605 as needed. A removable medium 611, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 610 as needed so that computer programs read from it can be installed into storage section 608 as needed.

[0090] In particular, according to embodiments of this disclosure, the methods described in any of the above embodiments can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program containing program code for performing any of the above methods. In such embodiments, the computer program can be downloaded and installed from a network via communication section 609, and / or installed from removable medium 611.

[0091] In another aspect, this application also provides a computer-readable storage medium, which may be a computer-readable storage medium included in the apparatus of the above embodiments; or it may be a standalone computer-readable storage medium not assembled into the device. The computer-readable storage medium stores one or more programs that are used by one or more processors to perform the methods described in this application.

[0092] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified function or operation, or by a combination of dedicated hardware and computer instructions.

[0093] The units or modules described in the embodiments of this application can be implemented in software or hardware. The described units or modules can also be located in a processor; for example, each unit can be a software program located in a computer or mobile smart device, or a separately configured hardware device. The names of these units or modules do not, in some cases, constitute a limitation on the unit or module itself.

[0094] The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the concept of this application. For example, technical solutions formed by substituting the above features with (but not limited to) technical features with similar functions disclosed in this application.

Claims

1. A transaction screening method, characterized in that, A repair contract is configured on the blockchain, and the method is applicable to blockchain nodes. The method includes: The system receives a first repair transaction generated by the administrator's first client; wherein the first repair transaction includes the name of the contract to be repaired. The first transaction to be repaired is executed through the repair contract. Upon successful execution, the name of the transaction to be repaired is added to the list of transactions to be repaired through the repair contract to update the list of transactions to be repaired. Securing the first transaction; Determine if the first contract name of the contract invoked by the first exchange is in the list of contracts to be repaired: If yes, then the first transaction will be removed from the transaction pool.

2. The method according to claim 1, characterized in that, The first transaction to be repaired generated by the first client of the receiving administrator includes: Receive the first transaction to be repaired generated by the administrator's first client; When it is determined that the first transaction to be repaired is a first type of transaction that requires the execution of the repair contract, the first transaction to be repaired is placed in the transaction priority packaging queue; Transactions in the priority packaging queue will be packaged first.

3. The method according to claim 1, characterized in that, Also includes: Receive the first repaired transaction generated by the first client; wherein the first repaired transaction includes the name of the repaired contract; When it is determined that the first repaired transaction is a first type of transaction that needs to trigger the execution of the repair contract, the first repaired transaction is placed in the transaction priority packaging queue; wherein, transactions in the transaction priority packaging queue will be packaged with priority. The first repaired transaction is executed through the repair contract. Upon successful execution, the name of the repaired contract is removed from the list of contracts to be repaired to update the list of contracts to be repaired.

4. The method according to claim 3, characterized in that, Deleting the first transaction from the transaction pool includes: Store the first transaction locally; Remove the first transaction from the transaction pool; The method further includes: When the first contract name is detected to have been removed from the list of contracts to be repaired, the first transaction is re-stored into the transaction pool.

5. The method according to claim 4, characterized in that, Also includes: If the first contract name has not been deleted from the list of contracts to be repaired when the first transaction has been stored locally for a period of time exceeding the first timeout period, the first transaction will be deleted from local storage.

6. The method according to claim 3, characterized in that, Deleting the first transaction from the transaction pool includes: Cache the first transaction hash of the first transaction in the list of unexecuted transactions of the contract to be repaired; Remove the first transaction from the transaction pool; The method further includes: The second transaction is received from the second client of the first user; wherein the second transaction includes a third transaction hash, and the second transaction is generated by the second client after the name of the second contract executing the second transaction call is removed from the list of contracts to be repaired, as monitored on the blockchain; When the third transaction hash is included in the list of unexecuted transactions in the contract to be repaired, the second transaction is placed in the transaction priority packing queue.

7. The method according to claim 6, characterized in that, Also includes: When the first transaction hash is cached in the list of unexecuted transactions of the contract to be repaired for a period of time that reaches the second timeout period, the first transaction hash is deleted from the list of unexecuted transactions of the contract to be repaired.

8. The method according to any one of claims 1-7, characterized in that, The first repair transaction includes the name of the method body to be repaired in the contract to be repaired; The step of adding the name of the contract to be repaired to the list of contracts to be repaired to update the list of contracts to be repaired includes: The repair contract adds the name of the method body to be repaired to the list of contracts to be repaired to update the list of contracts to be repaired. The determination of whether the first contract name of the contract invoked by the first exchange is included in the list of contracts to be repaired: Determine whether the first method body name of the contract method called by the first exchange is in the list of contracts to be repaired.

9. The method according to any one of claims 1-7, characterized in that, The step of executing the first transaction to be repaired through the repair contract, and upon successful execution, adding the name of the transaction to be repaired to the list of transactions to be repaired to update the list of transactions to be repaired through the repair contract, includes: The first transaction to be repaired is executed through the repair contract, and upon successful execution, the name of the contract to be repaired is recorded on the blockchain; If no first report transaction is received within the first time period, the name of the contract to be repaired is added to the list of contracts to be repaired through the repair contract to update the list of contracts to be repaired; wherein, the first report transaction is generated by other clients when they determine that the contract to be repaired does not need to be repaired; If the first reported transaction is received within the first time period, and it is determined that the contract to be repaired does not need to be repaired, then the administrator will be punished according to the pre-configured penalty rules.

10. A computer device, characterized in that, The device includes: One or more processors; Memory, used to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors perform the method as described in any one of claims 1-9.

11. A storage medium storing a computer program, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Intelligent contract bookkeeping method, computer device and readable storage medium

    CN109064334A

  • Transaction information processing method and device for block chain, medium and electronic equipment

    CN112926981A