Smart contract active defense method, storage medium and electronic device

By obtaining and analyzing blockchain transaction information, building behavioral portraits of transaction-initiating accounts, identifying and blocking potential attack transactions in real time, solving the problem that existing technology cannot effectively identify and handle smart contract attacks, and real-time protection of smart contracts is achieved .

CN115426190BActive Publication Date: 2024-11-08XIAMEN SLOWMIST TECHNOLOGY CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202211084646.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-06
Publication Date
2024-11-08
Estimated Expiration
2042-09-06

AI Technical Summary

Technical Problem

The existing technology cannot effectively identify and process potential attack transactions of smart contracts in real time, resulting in loss of smart contract assets, and relying on the known vulnerability feature library, unknown attack transactions cannot be identified.

Method used

By obtaining the transaction information list of block nodes, comparing transaction parameters, pre-execute transactions, analyzing the asset changes and transaction paths of the account address, building a behavioral portrait, and processing potential attack transactions according to the predetermined strategy, including attacks to block transactions Construct and execute.

Benefits of technology

Real-time attack transaction identification and processing of smart contracts is realized, reducing asset losses caused by hacker attacks, covering unknown attack transactions, and providing more comprehensive protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115426190B_ABST
    Figure CN115426190B_ABST
Patent Text Reader

Abstract

The present invention provides a smart contract active defense method, storage medium and electronic device, the method comprising the following steps: obtaining a transaction information list of a block node; the transaction information list includes at least one transaction parameter; comparing the transaction parameter with a preset transaction parameter, and if the condition is met, pre-executing the current transaction information, and outputting the change amount of assets of the account address involved in the current transaction before and after the pre-execution of the transaction information and the transaction execution path; determining the behavior portrait of the transaction initiating account address according to the change amount of assets of the account address involved in the current transaction before and after the pre-execution of the transaction information and the transaction execution path; processing the current transaction according to a predetermined processing strategy based on the behavior portrait of the transaction initiating account address. The above technical solution can identify potential attack transactions of smart contracts in real time, effectively reducing the losses of smart contracts caused by hacker attacks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular to a smart contract active defense method, storage medium and electronic device. Background Art

[0002] A smart contract is a program that runs on a blockchain. It is a series of codes and data located at a specific address on the blockchain. With the development of blockchain, more and more smart contracts are deployed on different blockchains, and the number of users who process their digital assets through smart contracts is also increasing day by day. With the increase in digital assets hosted by smart contracts, the losses caused by hackers' attacks on smart contracts are also increasing. Therefore, how to ensure the security of smart contracts to the greatest extent has become one of the most important issues in the field of blockchain transactions.

[0003] Usually, hackers launch transactions to attack smart contracts. Transactions refer to instructions with cryptographic signatures issued by accounts. Each transaction is executed by the block node in the blockchain. The successful execution of the transaction will change the state of the blockchain (such as the transfer of assets). Each transaction requires a certain fee, which means that a certain amount of digital assets of the hacker needs to be consumed. Therefore, before launching an attack, hackers need to deposit a certain amount of digital assets into the initiating account. In order to cover up the source of the initial assets, hackers mostly use asset mixing platforms to withdraw initial funds. The asset mixing platform can cover up the initial source of funds of hackers to a certain extent to avoid being traced. When hackers attack, they will make a series of calls to the target smart contract through their accounts or smart contracts created by the accounts to complete the attack. After the attack is completed, the hacker will obtain a large amount of digital assets from the smart contract. Therefore, the block node draws a transaction behavior portrait by analyzing the initial source of funds of each transaction caller, transaction trace, and the funds after the transaction is completed. This is an effective way to block malicious transactions.

[0004] The Chinese patent "CN114491508A Intelligent Contract Malicious Transaction Detection and Analysis System and Method Based on Dynamic Data Storage" provides a method for replaying blockchain historical transaction data to check whether known vulnerabilities are exploited during its execution. The patent crawls blockchain historical transactions and replays the transaction trace to construct its specific behavior, and matches it with known vulnerability behaviors to detect malicious transactions.

[0005] However, the technical solution described in this patent relies on the known vulnerability feature library of its attack identification module to identify transactions. If the malicious transaction is not in its feature library, it cannot be effectively identified. Since this technical solution can only identify attacks, it will not be able to effectively handle the identified attack transactions, and smart contracts will inevitably suffer asset losses. In addition, this technical solution only detects historical data in the blockchain and cannot effectively detect transactions in the next block in real time, which will make it unable to effectively provide protection for smart contracts. Summary of the invention

[0006] To this end, it is necessary to provide a technical solution for active defense of smart contracts to solve the technical problem that existing technologies cannot effectively provide protection for smart contracts.

[0007] To achieve the above objectives, in a first aspect, the present invention provides a smart contract active defense method, the method comprising the following steps:

[0008] S1: Obtain a transaction information list of a block-producing node; the transaction information list includes at least one transaction parameter;

[0009] S2: Compare the transaction parameters with the preset transaction parameters. If the conditions are met, pre-execute the transaction information and output the change in the assets of the account address involved in the transaction before and after the pre-execution of the transaction information and the transaction execution path;

[0010] S3: Determine the behavior profile of the transaction initiating account address based on the change in the assets of the account address involved in the transaction before and after the pre-execution of the transaction information and the transaction execution path;

[0011] S4: Based on the behavioral profile of the transaction initiating account address, the transaction is processed according to a predetermined processing strategy.

[0012] In some embodiments, the transaction parameters include any one or more of the time when the transaction initiating account address initiates the first transaction information, the initial source of funds for the transaction initiated by the transaction initiating account address, the deployment time of the smart contract called by the transaction initiating account address, and the open source characteristics of the smart contract called by the transaction initiating account address.

[0013] In some embodiments, comparing the transaction parameters with preset transaction parameters and pre-executing the transaction information if the conditions are met includes:

[0014] S21: Determine whether the time when the transaction initiating account address initiates the first transaction information is less than a first preset time difference from the current time;

[0015] and / or S22: determining whether the initial source of funds for the transaction initiated by the transaction initiating account address is from the asset mixing platform;

[0016] and / or S23: determining whether the smart contract called by the transaction initiating account address is open source;

[0017] And / or S24: determining whether the deployment time of the smart contract called by the transaction initiating account address is less than a second preset time difference from the current time;

[0018] If the judgment result of step S21 and / or S22 and / or S23 and / or S24 is yes, it is deemed that the conditions are met.

[0019] In some embodiments, step S3 includes:

[0020] If the asset increment of the transaction initiating account address exceeds the first preset value after the transaction pre-execution and the asset of the account address on the transaction execution path of the smart contract decreases by more than the second preset value, the behavior profile of the transaction initiating account address is listed as a potential attack behavior;

[0021] Step S5 includes:

[0022] The potential attack behavior is blocked.

[0023] In some embodiments, step S3 further includes:

[0024] If it is determined that the behavior profile of the account address initiating this transaction is not a potential attack behavior, step S5 includes: transferring this transaction to the notification queue and the list to be packaged and executed.

[0025] In some embodiments, blocking the potential attack behavior includes:

[0026] Determine the addresses and call order of each transaction account to be called when executing this transaction according to the transaction execution path;

[0027] According to the calling sequence, each transaction account address called when executing this transaction is replaced and filled in turn, so that the block-producing node is separated from each transaction account address called when executing this transaction, and an attack blocking transaction controlled by the node program is constructed.

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

[0029] The attack blocking transaction is executed by the receiving node program and the result is analyzed. If the result of the attack blocking transaction is a net increase in assets of account addresses other than the transaction initiator, the attack blocking transaction is included in the list to be packaged and executed and its execution order is arranged before the transaction initiated by the transaction initiating account address.

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

[0031] Send the processing result of this transaction to the user terminal.

[0032] In a second aspect, the present invention provides a storage medium having a computer program stored therein, and when the computer program is executed, the method as described in the first aspect of the present invention is implemented.

[0033] In a third aspect, the present invention further provides an electronic device, comprising:

[0034] A storage medium, which is the storage medium as described in the second aspect of the present invention;

[0035] A processor is electrically connected to the storage medium and is used to execute the computer program stored in the storage medium to implement the method as described in the first aspect of the present invention.

[0036] Different from the prior art, the present invention has the following characteristics:

[0037] The present invention provides a smart contract active defense method, storage medium and electronic device, the method comprising the following steps: obtaining a transaction information list of a block node; the transaction information list includes at least one transaction parameter; comparing the transaction parameter with a preset transaction parameter, and if the condition is met, pre-executing the current transaction information, and outputting the change amount of assets of the account address involved in the current transaction before and after the pre-execution of the transaction information and the transaction execution path; determining the behavior portrait of the transaction initiating account address according to the change amount of assets of the account address involved in the current transaction before and after the pre-execution of the transaction information and the transaction execution path; processing the current transaction according to a predetermined processing strategy based on the behavior portrait of the transaction initiating account address. The above technical solution can identify potential attack transactions of smart contracts in real time, effectively reducing the losses of smart contracts caused by hacker attacks. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 This is a flow chart of the smart contract active defense method involved in the first embodiment of the present invention;

[0039] Figure 2 This is a flow chart of the smart contract active defense method involved in the second embodiment of the present invention;

[0040] Figure 3 This is a flow chart of the smart contract active defense method involved in the third embodiment of the present invention;

[0041] Figure 4 This is a flow chart of the smart contract active defense method involved in the fourth embodiment of the present invention;

[0042] Figure 5 This is a flow chart of a smart contract active defense method according to a fifth embodiment of the present invention;

[0043] Figure 6 This is a flow chart of a smart contract active defense method according to a sixth embodiment of the present invention;

[0044] Figure 7 It is a schematic diagram of an electronic device involved in one embodiment of the present invention. DETAILED DESCRIPTION

[0045] In order to explain in detail the possible application scenarios, technical principles, specific schemes that can be implemented, and the purposes and effects that can be achieved, the following is a detailed description of the specific embodiments listed in conjunction with the accompanying drawings. The embodiments described herein are only used to more clearly illustrate the technical solutions 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.

[0046] Reference to "embodiment" herein means that the specific features, structures or characteristics described in conjunction with the embodiment may be included in at least one embodiment of the present application. The term "embodiment" appearing in various places in the specification does not necessarily refer to the same embodiment, nor does it particularly limit its independence or association with other embodiments. In principle, in the present application, as long as there is no technical contradiction or conflict, the various technical features mentioned in the embodiments can be combined in any way to form a corresponding implementable technical solution.

[0047] Unless otherwise defined, the technical terms used in this document have the same meanings as those generally understood by those skilled in the art to which this application belongs; the use of relevant terms in this document is only for describing specific embodiments and is not intended to limit this application.

[0048] In the description of this application, the term "and / or" is an expression used to describe the logical relationship between objects, indicating that three relationships may exist, for example, A and / or B, which means: A exists, B exists, and A and B exist at the same time. In addition, the character " / " in this article generally indicates that the objects before and after are in an "or" logical relationship.

[0049] In the present application, terms such as “first” and “second” are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship of quantity, priority or sequence between these entities or operations.

[0050] Without further limitations, in this application, the words "include", "comprises", "has" or other similar expressions used in sentences are intended to cover non-exclusive inclusion. These expressions do not exclude the presence of additional elements in the process, method or product including the elements, so that the process, method or product including a series of elements may include not only those limited elements, but also other elements not explicitly listed, or also include elements inherent to such process, method or product.

[0051] In this application, expressions such as "greater than", "less than", "exceed" and the like are understood to exclude the number itself; expressions such as "above", "below", "within" and the like are understood to include the number itself. In addition, in the description of the embodiments of this application, "multiple" means more than two (including two), and similar expressions related to "multiple" are also understood in this way, such as "multiple groups", "multiple times", etc., unless otherwise clearly and specifically limited.

[0052] like Figure 1 As shown, in a first aspect, the present invention provides a smart contract active defense method, the method comprising the following steps:

[0053] S1: Obtain a transaction information list of a block-producing node; the transaction information list includes at least one transaction parameter;

[0054] S2: Compare the transaction parameters with the preset transaction parameters. If the conditions are met, pre-execute the transaction information and output the change in the assets of the account address involved in the transaction before and after the pre-execution of the transaction information and the transaction execution path;

[0055] S3: Determine the behavior profile of the transaction initiating account address based on the change in the assets of the account address involved in the transaction before and after the pre-execution of the transaction information and the transaction execution path;

[0056] S4: Based on the behavioral profile of the transaction initiating account address, the transaction is processed according to a predetermined processing strategy.

[0057] In the blockchain network, each transaction information is executed by the block node in the blockchain. The successful execution of the transaction information will change the state of the blockchain (such as the transfer of assets). Therefore, by obtaining the transaction information list of the block node, the transaction parameters of this transaction information can be known.

[0058] Preferably, the transaction parameters include any one or more of the time when the transaction initiating account address initiates the first transaction information, the initial source of funds for the transaction initiated by the transaction initiating account address, the deployment time of the smart contract called by the transaction initiating account address, and the open source characteristics of the smart contract called by the transaction initiating account address.

[0059] Usually, in order to hide their identities, hackers will make preparations in advance when launching an attack transaction, such as deploying attack smart contracts in advance, using new addresses to launch attacks, etc. Therefore, by comparing the transaction parameters with the preset transaction parameters, it is possible to make a preliminary judgment on whether there is a potential attack threat in this transaction.

[0060] In this embodiment, the change in the assets of the account address involved in this transaction is the increase or decrease in the funds of the account address involved in this transaction caused by the pre-execution of this transaction. Usually, if there is a potential attack threat in this transaction, the account where the transaction initiating account address is located will make a substantial profit after the completion of this transaction, which is manifested as a large increase in the account funds of the transaction initiating account address in a short period of time. On the contrary, the funds of other related account addresses involved in the smart contract (other account addresses related to the completion of this transaction) will be greatly reduced. Therefore, by combing the execution path of this transaction and the changes in the funds of the account addresses on the transaction execution path, the behavior portrait of the transaction initiating account address can be determined, that is, whether there is a potential attack threat in this transaction. If there is a potential attack threat, this transaction can be processed according to a predetermined processing strategy, such as blocking the progress of this transaction.

[0061] Through the above scheme, it is possible to identify potential attacks in the blockchain and effectively process transaction information that poses a potential attack threat before it is executed, thereby avoiding asset losses in smart contracts due to the execution of transaction information that poses a potential attack, and effectively providing protection for smart contracts.

[0062] like Figure 2 As shown, the transaction parameters are compared with the preset transaction parameters, and if the conditions are met, the transaction information is pre-executed, including:

[0063] S21: Determine whether the time when the transaction initiating account address initiates the first transaction information is less than a first preset time difference from the current time;

[0064] and / or S22: determining whether the initial source of funds for the transaction initiated by the transaction initiating account address is from the asset mixing platform;

[0065] and / or S23: determining whether the smart contract called by the transaction initiating account address is open source;

[0066] And / or S24: determining whether the deployment time of the smart contract called by the transaction initiating account address is less than a second preset time difference from the current time;

[0067] If the judgment result of step S21 and / or S22 and / or S23 and / or S24 is yes, it is deemed that the conditions are met.

[0068] like Figure 6 As shown in the figure, in actual application scenarios, first of all, hackers generally use brand new addresses to initiate attack transactions in order to hide their identities. Therefore, checking the first transaction time of the transaction initiator (i.e., the transaction initiator account address) can quickly determine whether this account is a newly enabled address. Secondly, in order to avoid being traced, hackers generally withdraw initial funds through digital asset hybrid platforms. Therefore, checking the initial source of funds of the transaction initiator can determine whether this account intends to avoid tracking. Third, hackers generally deploy a smart contract for attack when they attack. Therefore, checking the deployment time of the smart contract they call can determine whether this account has potential attack intentions. Fourth, hackers generally deploy a smart contract for attack when they attack, and in order to hide their attack payload, they generally do not open source this malicious smart contract. Therefore, checking whether the smart contract they call is open source can determine whether this account has potential attack intentions.

[0069] The first preset time difference and the second preset time difference can be set according to actual needs, preferably 48 hours. When the judgment results of steps S21, S22, S23 and S24 are all yes, it is deemed to meet the conditions. That is, if it is determined that the time from the current transaction initiation account address to initiate the first transaction information is less than 48 hours from the current time, the initial source of funds for the transaction initiated by the transaction initiation account address is from the asset mixing platform, the smart contract called by the transaction initiation account address is open source code, and the deployment time of the smart contract called by the transaction initiation account address is less than 48 hours from the current time, then the transaction initiated by the transaction initiation account address is deemed to have potential attack threats after preliminary screening, and then it can be further evaluated after pre-execution.

[0070] In some embodiments, step S3 includes: if the asset increment of the transaction initiating account address exceeds a first preset value after the transaction pre-execution and the asset of the account address on the transaction execution path of the smart contract decreases by more than a second preset value, the behavior profile of the transaction initiating account address is listed as a potential attack behavior; step S5 includes: blocking the potential attack behavior. If it is determined that the behavior profile of the transaction initiating account address is not a potential attack behavior, step S5 includes: transferring the transaction to the notification queue and the list to be packaged and executed.

[0071] Transaction pre-execution is a simulated execution performed locally on the block-producing node using the current blockchain state, so the state of the blockchain will not be changed. After the pre-execution of this transaction, the transaction trace is analyzed to clarify the role attribution of each sub-call level (that is, which account addresses participated in the completion of this transaction information) and sort out the transaction call path. Combining the above two aspects of analysis, we can get a specific transaction behavior portrait of the transaction initiating account address of this transaction, including fund transfer behavior and smart contract call behavior path. If the behavior portrait shows that the transaction initiating account address obtains a large amount of assets and the smart contract unexpectedly reduces a large amount of assets, it can be considered that there is a potential attack behavior in this transaction, which can be combined with the transaction trace analysis to enter the specific attack blocking process. Otherwise, the transaction will not be processed later and will be transferred to the notification queue and the list to be packaged and executed.

[0072] like Figure 3 As shown, blocking the potential attack behavior includes:

[0073] First, proceed to step S301 to determine the addresses and call order of each transaction account called when executing this transaction according to the transaction execution path;

[0074] Then, step S302 is entered to replace and fill each transaction account address called when executing this transaction in turn according to the calling sequence, so that the block-producing node is separated from each transaction account address called when executing this transaction, and an attack blocking transaction controlled by the node program is constructed.

[0075] Furthermore, the method further comprises:

[0076] The attack blocking transaction is executed by the receiving node program and the result is analyzed. If the result of the attack blocking transaction is a net increase in assets of account addresses other than the transaction initiator, the attack blocking transaction is included in the list to be packaged and executed and its execution order is placed before this transaction.

[0077] In this embodiment, if the controlled attack blocking transaction is successfully executed and the trusted node program benefits, it means that the attack transaction executed after the controlled attack blocking transaction will fail or only cause acceptable damage. By constructing an attack blocking transaction controlled by the node program and placing it in the list to be packaged and executed before this transaction, the possibility of asset loss caused by this transaction with potential attack threats can be minimized.

[0078] In some embodiments, the method further includes: sending the processing result of the transaction to a user terminal. Preferably, the user terminal is a terminal controlled by an emergency personnel, which may be a personal computer, a mobile terminal, etc. The controlled attack blocking transaction will inform the emergency personnel's control terminal through a notification program whether it succeeds or fails, so as to facilitate further processing.

[0079] In a second aspect, the present invention further provides a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed, the method described in the first aspect of the present invention is implemented.

[0080] In the third aspect, Figure 7 As shown, the present invention also provides an electronic device 10, including a storage medium 102 and a processor 101, the storage medium 102 is the storage medium as described in the second aspect; the processor 101 is electrically connected to the storage medium 102, and is used to execute a computer program stored in the storage medium to implement the method as described in the first aspect.

[0081] Preferably, the electronic device may be a computer device, including but not limited to: personal computers, servers, general-purpose computers, special-purpose computers, network devices, embedded devices, programmable devices, smart mobile terminals, smart home devices, wearable smart devices, in-vehicle smart devices, etc. Storage media include but are not limited to: RAM, ROM, disks, tapes, optical disks, flash memory, USB flash drives, mobile hard disks, memory cards, memory sticks, network server storage, network cloud storage, etc. Processors include but are not limited to CPU (central processing unit), GPU (graphics processing unit), MCU (microprocessor), etc.

[0082] like Figure 4 As shown, the present invention first obtains a list of transactions to be packaged and executed through a block-producing node, and then detects the transaction information according to the execution order, and pre-executes the transaction information when it is detected that the transaction information meets the initial detection condition (i.e., it is determined that there is a preliminary attack threat), performs a behavior profile analysis according to the pre-execution structure, and performs processing according to the behavior profile analysis result.

[0083] like Figure 5As shown in the figure, the analysis of the pre-execution results mainly includes the detection of asset distribution before and after execution and the analysis of transaction tarce. If the detection result of asset distribution shows that the transaction initiator has not made a lot of profit, it means that there is no actual attack threat in this transaction, then the transaction list can be notified for packaging and execution. On the contrary, if the detection result of asset distribution shows that the transaction initiator has made a lot of profit, then the construction of blocking transaction can be started. The analysis of transaction tarce can construct blocking transaction. Blocking transaction is to replace the other transaction nodes called in the original transaction execution path with virtual transaction nodes controlled by node program for logical replacement, so that the transaction initiator account address of this transaction is separated from the other transaction account addresses called in the original transaction execution path. By placing the constructed blocking transaction before this transaction, the loss caused by the threat of this transaction can be minimized.

[0084] The present invention proposes a method of drawing a transaction behavior portrait based on the initial funding source of the transaction caller, the transaction trace, and the funding situation after the transaction is completed, outputting malicious transaction information to the block-producing node, and constructing a controlled attack transaction by the block-producing node to preemptively execute before the malicious transaction to protect the asset security of the smart contract, thereby realizing the identification of most potential attack transactions and timely blocking of attack transactions.

[0085] Compared with the prior art, the technical solution proposed in the present invention can realize real-time identification of potential attack transactions of smart contracts, and the identification is not limited to known vulnerabilities. While identifying potential attack transactions, attack blocking transactions are constructed, and the block nodes are used to execute attack blocking transactions before attack transactions, so as to effectively reduce the losses of smart contracts caused by hacker attacks.

[0086] Although the above embodiments have been described, once those skilled in the art know the basic creative concepts, they can make additional changes and modifications to these embodiments. Therefore, the above are only embodiments of the present invention and do not limit the patent protection scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the specification and drawings of the present invention, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A smart contract active defense method, characterized in that: The method comprises the following steps: S1: Obtain a transaction information list of a block-producing node; the transaction information list includes at least one transaction parameter; S2: Compare the transaction parameters with the preset transaction parameters. If the conditions are met, pre-execute the transaction information and output the change in the assets of the account address involved in the transaction before and after the pre-execution of the transaction information and the transaction execution path; S3: Determine the behavior profile of the transaction initiating account address based on the change in the assets of the account address involved in the transaction before and after the pre-execution of the transaction information and the transaction execution path; S4: Process the transaction according to a predetermined processing strategy based on the behavior profile of the transaction initiating account address; The transaction parameters are compared with the preset transaction parameters, and if they meet the conditions, the transaction information is pre-executed, including: S21: Determine whether the time when the transaction initiating account address initiates the first transaction information is less than a first preset time difference from the current time; and / or S22: determining whether the initial source of funds for the transaction initiated by the transaction initiating account address is from the asset mixing platform; and / or S23: determining whether the smart contract called by the transaction initiating account address is open source; And / or S24: determining whether the deployment time of the smart contract called by the transaction initiating account address is less than a second preset time difference from the current time; If the judgment result of step S21 and / or S22 and / or S23 and / or S24 is yes, it is deemed to meet the conditions; step S3 includes: if the asset increment of the transaction initiating account address exceeds the first preset value after the transaction pre-execution and the asset of the account address on the transaction execution path of the smart contract decreases by more than the second preset value, the behavior profile of the transaction initiating account address is listed as a potential attack behavior; Step S5 includes: blocking the potential attack behavior; Blocking the potential attack behavior includes: Determine the addresses and call order of each transaction account to be called when executing this transaction according to the transaction execution path; The addresses of each transaction account called when executing this transaction are replaced and filled in turn according to the calling sequence, so that the block-producing node is separated from the addresses of each transaction account called when executing this transaction, and an attack blocking transaction controlled by the node program is constructed; The method also includes: executing the attack blocking transaction through the receiving node program and analyzing the result. If the result of the attack blocking transaction is a net increase in assets of account addresses other than the transaction initiator, the attack blocking transaction is included in the list to be packaged and executed and its execution order is arranged before the transaction initiated by the transaction initiating account address.

2. The smart contract active defense method according to claim 1, characterized in that: The transaction parameters include any one or more of the time when the transaction initiating account address initiates the first transaction information, the initial source of funds for the transaction initiated by the transaction initiating account address, the deployment time of the smart contract called by the transaction initiating account address, and the open source features of the smart contract called by the transaction initiating account address.

3. The smart contract active defense method according to claim 1, characterized in that: Step S3 also includes: If it is determined that the behavior profile of the transaction initiating account address is not a potential attack behavior, step S5 includes: transferring the transaction to the notification queue and the list to be packaged and executed.

4. The smart contract active defense method according to claim 1, characterized in that: The method further comprises: Send the processing result of this transaction to the user terminal.

5. A storage medium, characterized in that: The storage medium stores a computer program, which implements the method according to any one of claims 1 to 4 when executed.

6. An electronic device, characterized in that: include: The storage medium is the storage medium as claimed in claim 5; A processor, electrically connected to the storage medium, and configured to execute a computer program stored in the storage medium to implement the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Intelligent contract malicious transaction detection and analysis system and method based on data dynamic storage

    CN114491508A

  • Method and device for acquiring image data of block chain node and computing device

    CN108564469A

  • Information processing method and device, server and information processing system

    CN109685551A

  • Operation record checking method and device based on block chain smart contract

    CN110009350A

  • User group feature analysis method and system based on block chain

    CN110060095A