CN111861465A - Detection method and device based on intelligent contract, storage medium and electronic device - Google Patents
Detection method and device based on intelligent contract, storage medium and electronic device Download PDFInfo
- Publication number
- CN111861465A CN111861465A CN202010706712.0A CN202010706712A CN111861465A CN 111861465 A CN111861465 A CN 111861465A CN 202010706712 A CN202010706712 A CN 202010706712A CN 111861465 A CN111861465 A CN 111861465A
- Authority
- CN
- China
- Prior art keywords
- digital asset
- detecting
- address
- digital
- contract
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 40
- 238000000034 method Methods 0.000 claims abstract description 26
- 230000006870 function Effects 0.000 claims description 58
- 238000012546 transfer Methods 0.000 claims description 28
- 230000006399 behavior Effects 0.000 claims description 15
- 238000004590 computer program Methods 0.000 claims description 11
- 238000005315 distribution function Methods 0.000 claims description 8
- 230000002547 anomalous effect Effects 0.000 claims description 4
- 230000008569 process Effects 0.000 abstract description 7
- 238000004891 communication Methods 0.000 description 8
- 230000000694 effects Effects 0.000 description 4
- 238000012544 monitoring process Methods 0.000 description 3
- 235000006679 Mentha X verticillata Nutrition 0.000 description 2
- 235000002899 Mentha suaveolens Nutrition 0.000 description 2
- 235000001636 Mentha x rotundifolia Nutrition 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 239000012530 fluid Substances 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 238000013475 authorization Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/382—Payment protocols; Details thereof insuring higher security of transaction
Landscapes
- Business, Economics & Management (AREA)
- Engineering & Computer Science (AREA)
- Accounting & Taxation (AREA)
- Computer Security & Cryptography (AREA)
- Finance (AREA)
- Strategic Management (AREA)
- Physics & Mathematics (AREA)
- General Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The application discloses a detection method and device based on an intelligent contract, a storage medium and an electronic device, wherein the method comprises the steps of determining the intelligent contract on a block chain, wherein the intelligent contract comprises the following steps: a digital asset on the blockchain; performing a detection operation on the smart contract according to the state of the digital asset, wherein the detection operation at least comprises one of the following operations: detecting an on-chain transaction of the smart contract, detecting a digital asset extracted in the smart contract, detecting a match condition of the digital asset. The method and the device solve the technical problems that whether the digital assets in the intelligent contracts are in compliance or not cannot be detected and potential risks exist in the transaction process.
Description
Technical Field
The application relates to the field of computer software, in particular to a detection method and device, a storage medium and an electronic device based on an intelligent contract.
Background
An intelligent contract is essentially a piece of code running in a blockchain to complete the corresponding business logic.
Digital assets have the characteristic that the total amount can be determined and can be transferred and destroyed due to the credibility and traceability of the blockchain.
An effective solution is not provided at present aiming at the problems that whether the digital assets in the intelligent contracts are in compliance or not cannot be detected and potential risks exist in the transaction process in the related art.
Disclosure of Invention
The application mainly aims to provide a detection method and device based on an intelligent contract, a storage medium and an electronic device so as to solve the problem of pairing.
In order to achieve the above object, according to one aspect of the present application, there is provided a smart contract-based detection method.
The intelligent contract-based detection method comprises the following steps: determining an intelligent contract on a blockchain, wherein the intelligent contract comprises: a digital asset on the blockchain; performing a detection operation on the smart contract according to the state of the digital asset, wherein the detection operation at least comprises one of the following operations: detecting an on-chain transaction of the smart contract, detecting a digital asset extracted in the smart contract, detecting a match condition of the digital asset.
Optionally, the detecting the smart contract according to the status of the digital asset includes: traversing a state of the digital asset associated with the smart contract; detecting an on-chain transaction of the smart contract based on the status of the digital asset.
Optionally, the detecting an on-chain transaction of the smart contract comprises: adding an address of a sender who creates a contract as an initial address into a first address list, wherein the first address list is empty initially; adding the address of a sender calling the digital asset distribution increasing function into the first address list; adding the address of a sender calling the digital asset support function into the first address list; in the event that the address of the sender invoking the transfer of the digital asset is in the first address list, adding the address of the transfer recipient to the first address list; in the event that the address of the sender invoking the transfer of the digital asset is not on the first list of addresses, treating the transfer of the digital asset as an anomalous transaction.
Optionally, the detecting the smart contract according to the status of the digital asset includes: extracting the characteristic quantity of the digital assets; wherein the characteristic quantity includes at least one of: the digital asset total amount, the initial account address and the information of the reissue function; and detecting the digital asset total amount extracted from the intelligent contract, the primary account address or the information of the distribution function.
Optionally, the extracting the feature quantity of the digital asset includes: traversing the transaction list of the intelligent contract, and extracting the total digital assets in the initialization function; and/or traversing the function list of the intelligent contract to match with a preset interface function, and extracting to obtain the information of the initial account address or the distribution function of the digital asset.
Optionally, the detecting the smart contract according to the status of the digital asset includes: detecting whether the matching condition of the digital assets meets a preset rule or not, wherein the preset rule describes the increasing vulnerability or behavior of the digital assets according to grammatical features or data stream features; and recording the state of the digital assets under the condition that the matching conditions of the digital assets are detected to meet the preset rules.
Optionally, the detecting the matching condition of the digital asset includes: determining a face value of the intelligent contract to obtain a face value dictionary; determining a function of digital asset distribution according to a function in the intelligent contract traversed by the literal dictionary; traversing statements in the function of the digital asset increment and determining an array assignment statement; and detecting the matching condition of the digital assets according to the array assignment statements.
In order to achieve the above object, according to another aspect of the present application, there is provided a smart contract-based detection apparatus.
The intelligent contract-based detection device comprises: a determining module, configured to determine an intelligent contract on a blockchain, where the intelligent contract includes: a digital asset on the blockchain; a detection module, configured to perform a detection operation on the smart contract according to the state of the digital asset, where the detection operation includes at least one of: detecting an on-chain transaction of the smart contract, detecting a digital asset extracted in the smart contract, detecting a match condition of the digital asset.
In the embodiment of the application, a mode of determining an intelligent contract on a block chain is adopted, and the intelligent contract is detected through the state of the digital asset, so that the purposes of detecting the chain transaction of the intelligent contract, detecting the digital asset extracted from the intelligent contract and detecting the matching condition of the digital asset are achieved, the technical effects of detecting the code compliance in the intelligent contract and early warning and monitoring the digital asset which does not meet the condition are achieved, and the technical problems that whether the digital asset in the intelligent contract is in compliance cannot be detected and potential risks exist in the transaction process are solved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this application, serve to provide a further understanding of the application and to enable other features, objects, and advantages of the application to be more apparent. The drawings and their description illustrate the embodiments of the invention and do not limit it. In the drawings:
FIG. 1 is a schematic flow chart of a smart contract-based detection method according to an embodiment of the application;
FIG. 2 is a schematic structural diagram of a smart contract-based detection device according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be used. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
According to the method and the device, backdoor and violation detection is performed on the intelligent contract issued by the digital assets. Meanwhile, the transaction behaviors of the digital assets are tracked, and abnormal transaction behaviors and illegal distribution increasing behaviors are found in time.
As shown in fig. 1, the method includes steps S101 to S102 as follows:
step S101, determining an intelligent contract on a block chain, wherein the intelligent contract comprises: a digital asset on the blockchain;
step S102, detecting operation is carried out on the intelligent contract according to the state of the digital assets, wherein the detecting operation at least comprises one of the following steps: detecting an on-chain transaction of the smart contract, detecting a digital asset extracted in the smart contract, detecting a match condition of the digital asset.
From the above description, it can be seen that the following technical effects are achieved by the present application:
the intelligent contract is detected through the state of the digital assets by adopting a mode of determining the intelligent contract on the block chain, so that the purposes of detecting the on-chain transaction of the intelligent contract, detecting the digital assets extracted from the intelligent contract and detecting the matching conditions of the digital assets are achieved, the technical effects of detecting the code compliance in the intelligent contract and early warning and monitoring the digital assets which do not meet the conditions are achieved, and the technical problems that whether the digital assets in the intelligent contract are in compliance cannot be detected and potential risks exist in the transaction process are solved.
In step S101, an intelligent contract in the blockchain is determined, and digital assets are included in the intelligent contract.
In step S102, compliance and validity of the intelligent contract may be correspondingly detected according to the state of the digital assets in the intelligent contract. For example, the compliance of contract codes is detected by extracting and analyzing the names of the digital assets of the intelligent contracts, the issuing amount of the digital assets and the information of the custom functions. Or, whether illegal distribution or contract vulnerability exists is analyzed by tracking detailed transaction behaviors of the digital assets.
Optionally, before the determining the intelligent contracts on the blockchain, the following steps of compiling the intelligent contracts of the digital assets in different versions are also included:
and compiling the code, namely compiling the code by using a correct compiling tool according to the version number of the code to obtain an intermediate language file.
Parsing, parsing the intermediate language file into an intermediate representation AST that can be used for parsing and processing in a relatively efficient format.
And semantic analysis, namely converting the intermediate representation into a data flow graph CFG (computational fluid graph), wherein the CFG can record and analyze properties in the program and is the basis for calculating the fixed point and other operations of the program.
In an alternative embodiment of the present application, the detecting the smart contract according to the status of the digital asset comprises: traversing a state of the digital asset associated with the smart contract; detecting an on-chain transaction of the smart contract based on the status of the digital asset.
And when the intelligent contract is specifically implemented, detecting whether the link transaction on the intelligent contract is legal or not according to the state of the digital asset by traversing the state of the digital asset related to the intelligent contract. And tracking and detecting the transaction behaviors of the digital assets, so as to discover abnormal transaction behaviors and non-compliant distribution behaviors of the digital assets. For example, if a digital asset is suddenly rolled out of an account address that did not appear before, the transaction will be detected.
In an optional embodiment of the present application, the detecting an on-chain transaction of the intelligent contract includes: adding an address of a sender who creates a contract as an initial address into a first address list, wherein the first address list is empty initially; adding the address of a sender calling the digital asset distribution increasing function into the first address list; adding the address of a sender calling the digital asset support function into the first address list; in the event that the address of the sender invoking the transfer of the digital asset is in the first address list, adding the address of the transfer recipient to the first address list; in the event that the address of the sender invoking the transfer of the digital asset is not on the first list of addresses, treating the transfer of the digital asset as an anomalous transaction.
In specific implementation, first, the known address list is initially empty. Then, the sender address of the created contract is used as an initial address and added into a known address list; adding the sender address for calling the digital asset forwarding function into a known address list; adding the sender address of the calling digital asset support function into a known address list; finally, judging whether the sender address for calling the digital asset transfer is in the known address list or not, and if so, adding the sent address into the known address list; otherwise, an anomaly is detected.
In an alternative embodiment of the present application, the detecting the smart contract according to the status of the digital asset includes: extracting the characteristic quantity of the digital assets; wherein the characteristic quantity includes at least one of: the digital asset total amount, the initial account address and the information of the reissue function; and detecting the digital asset total amount extracted from the intelligent contract, the primary account address or the information of the distribution function.
In specific implementation, the digital asset total amount, the primary account address, the information of the increasing function and other characteristic quantities of the digital asset are extracted and obtained, and the digital asset total amount, the primary account address, the information of the increasing function and other characteristic quantities are detected. The main characteristic values of the digital assets, including the information of the total digital assets, the initial account address and the reissue function, can be extracted through the static analysis of the digital assets.
In an alternative embodiment of the present application, the extracting the feature quantity of the digital asset includes: traversing the transaction list of the intelligent contract, and extracting the total digital assets in the initialization function; and/or traversing the function list of the intelligent contract to match with a preset interface function, and extracting to obtain the information of the initial account address or the distribution function of the digital asset.
In specific implementation, the detection of the characteristic quantity mainly comprises:
traversing a transaction list of the intelligent contract, finding an initialization function, and extracting information of digital asset total quantity _ total, digital asset name and digital asset name for short, symbol.
And traversing a function list of the intelligent contract, and matching interface functions of the ERC20Basic, including totalSupply, balanceOf, Transfer and Transfer events.
And traversing the function list of the intelligent contract, and matching the interface functions of the ERC20, wherein the interface functions comprise allowances, transfer from, apple and Approxal events.
And traversing the function list of the intelligent contract, and matching the interface functions of Pausable, including Pause and Unpause.
In an alternative embodiment of the present application, the detecting the smart contract according to the status of the digital asset includes: detecting whether the matching condition of the digital assets meets a preset rule or not, wherein the preset rule describes the increasing vulnerability or behavior of the digital assets according to grammatical features or data stream features; and recording the state of the digital assets under the condition that the matching conditions of the digital assets are detected to meet the preset rules.
And in specific implementation, detecting whether the matching condition of the digital asset meets a preset rule or not, and recording the state of the digital asset under the condition that the matching condition of the digital asset meets the preset rule according to the detection result. The matching condition of the digital assets means that a preset rule file is described in the format of an XML file, the digital asset distribution vulnerability or behavior is described according to the grammatical feature or the data stream feature of the digital asset distribution vulnerability or behavior, the preset rule is compared with the program property in the semantic analysis process, and the matching condition is recorded when the preset rule is matched with the program property.
In an alternative embodiment of the present application, the detecting the matching condition of the digital asset includes: determining a face value of the intelligent contract to obtain a face value dictionary; determining a function of digital asset distribution according to a function in the intelligent contract traversed by the literal dictionary; traversing statements in the function of the digital asset increment and determining an array assignment statement; and detecting the matching condition of the digital assets according to the array assignment statements.
In specific implementation, performing literal value analysis on the approximation to form a literal value dictionary; traversing all functions of the ERC20 contract, and finding out a function for increasing the digital assets, wherein the function name is _ mint, and the parameter is (address, uint 256); traversing all statements of the mint function, and finding out an array assignment statement, wherein the array is _ balances, and the array subscript is a literal value.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
According to an embodiment of the present application, there is also provided an intelligent contract-based detection apparatus for implementing the above method, as shown in fig. 2, the apparatus includes:
a determining module 20, configured to determine an intelligent contract on a blockchain, where the intelligent contract includes: a digital asset on the blockchain;
a detection module 21, configured to perform a detection operation on the smart contract according to the state of the digital asset, where the detection operation includes at least one of: detecting an on-chain transaction of the smart contract, detecting a digital asset extracted in the smart contract, detecting a match condition of the digital asset.
The intelligent contracts in the blockchain are determined in the determination module 20 and digital assets are included in the intelligent contracts.
In the detection module 21, compliance and legitimacy of the intelligent contract can be correspondingly detected according to the state of the digital assets in the intelligent contract. For example, the compliance of contract codes is detected by extracting and analyzing the names of the digital assets of the intelligent contracts, the issuing amount of the digital assets and the information of the custom functions. Or, whether illegal distribution or contract vulnerability exists is analyzed by tracking detailed transaction behaviors of the digital assets.
Optionally, before the determining the intelligent contracts on the blockchain, the following steps of compiling the intelligent contracts of the digital assets in different versions are also included:
and compiling the code, namely compiling the code by using a correct compiling tool according to the version number of the code to obtain an intermediate language file.
Parsing, parsing the intermediate language file into an intermediate representation AST that can be used for parsing and processing in a relatively efficient format.
And semantic analysis, namely converting the intermediate representation into a data flow graph CFG (computational fluid graph), wherein the CFG can record and analyze properties in the program and is the basis for calculating the fixed point and other operations of the program.
The detection module 21 is further configured to traverse the state of the digital asset related to the smart contract; detecting an on-chain transaction of the smart contract based on the status of the digital asset.
The detecting module 21 is further configured to add an address of a sender creating a contract, as an initial address, to a first address list, where the first address list is initially empty; adding the address of a sender calling the digital asset distribution increasing function into the first address list; adding the address of a sender calling the digital asset support function into the first address list; in the event that the address of the sender invoking the transfer of the digital asset is in the first address list, adding the address of the transfer recipient to the first address list; in the event that the address of the sender invoking the transfer of the digital asset is not on the first list of addresses, treating the transfer of the digital asset as an anomalous transaction.
The detection module 21 is further configured to extract a feature quantity of the digital asset; wherein the characteristic quantity includes at least one of: the digital asset total amount, the initial account address and the information of the reissue function; and detecting the digital asset total amount extracted from the intelligent contract, the primary account address or the information of the distribution function.
The detection module 21 is further configured to traverse the transaction list of the intelligent contract, and extract the total amount of digital assets in the initialization function; and/or traversing the function list of the intelligent contract to match with a preset interface function, and extracting to obtain the information of the initial account address or the distribution function of the digital asset.
The detection module 21 is further configured to detect whether a matching condition of the digital asset meets a preset rule, where the preset rule describes a vulnerability or behavior of the digital asset according to a grammatical feature or a data stream feature; and recording the state of the digital assets under the condition that the matching conditions of the digital assets are detected to meet the preset rules.
The detection module 21 is further configured to determine a face value of the intelligent contract to obtain a face value dictionary; determining a function of digital asset distribution according to a function in the intelligent contract traversed by the literal dictionary; traversing statements in the function of the digital asset increment and determining an array assignment statement; and detecting the matching condition of the digital assets according to the array assignment statements.
It will be apparent to those skilled in the art that the modules or steps of the present application described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and they may alternatively be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, or fabricated separately as individual integrated circuit modules, or fabricated as a single integrated circuit module from multiple modules or steps. Thus, the present application is not limited to any specific combination of hardware and software.
In order to better understand the flow of the configuration method of the data interface, the following explains the technical solutions with reference to the preferred embodiments, but the technical solutions of the embodiments of the present invention are not limited.
Therefore, the application proposes a code analysis tool aiming at intelligent contract backdoor vulnerabilities and transaction compliance. The compliance of contract codes is detected by extracting and analyzing the information of the digital asset name, the digital asset issuing total amount and the custom function of the intelligent contract. And whether illegal digital asset distribution and contract loopholes exist is analyzed by tracking detailed transaction behaviors of the digital assets, so that the effects of early warning and monitoring of illegal digital assets are achieved.
For the purposes of the example ERC20, the standard interface of ERC20 is as follows:
name returns the name of the ERC20 digital asset.
symbol returns an abbreviation for digital asset.
decimals returns a few bits after the decimal point used by token.
totalSupply returns the total supply of token.
balanceOf returns the account balance for a certain address (account).
Transfer transfers the number of _ values token to the address _ to from the caller address of the digital asset contract and must trigger a Transfer event.
Transfer from sends a number _ value of tokens from address _ from to address _ to, which must trigger a Transfer event.
the transferFrom method is used to allow someone in the contract agent to transfer a token. Provided that the from account must pass by the apple.
The advance allows the _ divider to use the _ owner account multiple times, up to the amount of _ value. If this function is called again, it will override the current margin with _ value.
allowance returns the amount that _ spender is still allowed to draw from _ owner.
The advance is the authorization of a third party (such as a service contract) to transfer digital assets from a sender's account and then perform a specific transfer operation through the transferFrom () function.
The embodiment of the application also provides computer equipment. As shown in fig. 3, the computer device 20 may include: the at least one processor 201, e.g., CPU, the at least one network interface 204, the user interface 203, the memory 205, the at least one communication bus 202, and optionally, a display 206. Wherein a communication bus 202 is used to enable the connection communication between these components. The user interface 203 may include a touch screen, a keyboard or a mouse, among others. The network interface 204 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), and a communication connection may be established with the server via the network interface 204. The memory 205 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk memory, and the memory 205 includes a flash in the embodiment of the present invention. The memory 205 may optionally be at least one memory system located remotely from the processor 201. As shown in fig. 3, memory 205, which is a type of computer storage medium, may include an operating system, a network communication module, a user interface module, and program instructions.
It should be noted that the network interface 204 may be connected to a receiver, a transmitter or other communication module, and the other communication module may include, but is not limited to, a WiFi module, a bluetooth module, etc., and it is understood that the computer device in the embodiment of the present invention may also include a receiver, a transmitter, other communication module, etc.
determining an intelligent contract on a blockchain, wherein the intelligent contract comprises: a digital asset on the blockchain;
performing a detection operation on the smart contract according to the state of the digital asset, wherein the detection operation at least comprises one of the following operations: detecting an on-chain transaction of the smart contract, detecting a digital asset extracted in the smart contract, detecting a match condition of the digital asset.
Embodiments of the present invention also provide a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
S1, determining an intelligent contract on the block chain, wherein the intelligent contract comprises: a digital asset on the blockchain;
s2, detecting the intelligent contract according to the state of the digital assets, wherein the detecting operation at least comprises one of the following operations: detecting an on-chain transaction of the smart contract, detecting a digital asset extracted in the smart contract, detecting a match condition of the digital asset.
Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, determining an intelligent contract on the block chain, wherein the intelligent contract comprises: a digital asset on the blockchain;
s2, detecting the intelligent contract according to the state of the digital assets, wherein the detecting operation at least comprises one of the following operations: detecting an on-chain transaction of the smart contract, detecting a digital asset extracted in the smart contract, detecting a match condition of the digital asset.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation manners, and this embodiment is not described herein again.
The above description is only a preferred embodiment of the present application and is not intended to limit the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims (10)
1. A detection method based on intelligent contracts is characterized by comprising the following steps:
Determining an intelligent contract on a blockchain, wherein the intelligent contract comprises: a digital asset on the blockchain;
performing a detection operation on the smart contract according to the state of the digital asset, wherein the detection operation at least comprises one of the following operations: detecting an on-chain transaction of the smart contract, detecting a digital asset extracted in the smart contract, detecting a match condition of the digital asset.
2. The method of claim 1, wherein detecting the smart contract based on the status of the digital asset comprises:
traversing a state of the digital asset associated with the smart contract;
detecting an on-chain transaction of the smart contract based on the status of the digital asset.
3. The method of claim 2, wherein the detecting an on-chain transaction of the smart contract comprises:
adding an address of a sender who creates a contract as an initial address into a first address list, wherein the first address list is empty initially;
adding the address of a sender calling the digital asset distribution increasing function into the first address list;
adding the address of a sender calling the digital asset support function into the first address list;
In the event that the address of the sender invoking the transfer of the digital asset is in the first address list, adding the address of the transfer recipient to the first address list;
in the event that the address of the sender invoking the transfer of the digital asset is not on the first list of addresses, treating the transfer of the digital asset as an anomalous transaction.
4. The method of claim 1, wherein the detecting the smart contract based on the status of the digital asset comprises:
extracting the characteristic quantity of the digital assets; wherein the characteristic quantity includes at least one of: the digital asset total amount, the initial account address and the information of the reissue function;
and detecting the digital asset total amount extracted from the intelligent contract, the primary account address or the information of the distribution function.
5. The method according to claim 4, wherein the extracting the feature quantity of the digital asset comprises:
traversing the transaction list of the intelligent contract, and extracting the total digital assets in the initialization function;
and/or traversing the function list of the intelligent contract to match with a preset interface function, and extracting to obtain the information of the initial account address or the distribution function of the digital asset.
6. The method of claim 1, wherein the detecting the smart contract based on the status of the digital asset comprises:
detecting whether the matching condition of the digital assets meets a preset rule or not, wherein the preset rule describes the increasing vulnerability or behavior of the digital assets according to grammatical features or data stream features;
and recording the state of the digital assets under the condition that the matching conditions of the digital assets are detected to meet the preset rules.
7. The method of claim 6, wherein the detecting the matching condition for the digital asset comprises:
determining a face value of the intelligent contract to obtain a face value dictionary;
determining a function of digital asset distribution according to a function in the intelligent contract traversed by the literal dictionary;
traversing statements in the function of the digital asset increment and determining an array assignment statement;
and detecting the matching condition of the digital assets according to the array assignment statements.
8. A detection device based on intelligent contracts is characterized by comprising:
a determining module, configured to determine an intelligent contract on a blockchain, where the intelligent contract includes: a digital asset on the blockchain;
A detection module, configured to perform a detection operation on the smart contract according to the state of the digital asset, where the detection operation includes at least one of: detecting an on-chain transaction of the smart contract, detecting a digital asset extracted in the smart contract, detecting a match condition of the digital asset.
9. A storage medium, in which a computer program is stored, wherein the computer program is arranged to perform the method of any of claims 1 to 7 when executed.
10. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and wherein the processor is arranged to execute the computer program to perform the method of any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010706712.0A CN111861465A (en) | 2020-07-21 | 2020-07-21 | Detection method and device based on intelligent contract, storage medium and electronic device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010706712.0A CN111861465A (en) | 2020-07-21 | 2020-07-21 | Detection method and device based on intelligent contract, storage medium and electronic device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111861465A true CN111861465A (en) | 2020-10-30 |
Family
ID=73002307
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010706712.0A Pending CN111861465A (en) | 2020-07-21 | 2020-07-21 | Detection method and device based on intelligent contract, storage medium and electronic device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111861465A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112507334A (en) * | 2021-02-02 | 2021-03-16 | 布比(北京)网络技术有限公司 | Illegal access detection method, device, system, electronic equipment and storage medium |
CN112862493A (en) * | 2021-01-27 | 2021-05-28 | 中山大学 | Intelligent Pompe deception detection method, device, terminal and storage medium |
CN113486357A (en) * | 2021-07-07 | 2021-10-08 | 东北大学 | Intelligent contract security detection method based on static analysis and deep learning |
CN115130139A (en) * | 2022-08-31 | 2022-09-30 | 杭州链城数字科技有限公司 | Digital asset examination method, device, system and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107945021A (en) * | 2017-12-07 | 2018-04-20 | 杭州趣链科技有限公司 | A kind of digital asset management method based on block chain intelligence contract |
CN108510389A (en) * | 2018-03-30 | 2018-09-07 | 深圳前海微众银行股份有限公司 | Intelligent contract call method, equipment and readable storage medium storing program for executing based on block chain |
CN111045892A (en) * | 2019-12-11 | 2020-04-21 | 北京菲林方德科技有限公司 | Method and device for detecting process state of intelligent contract execution |
CN111124421A (en) * | 2019-12-23 | 2020-05-08 | 卓尔智联(武汉)研究院有限公司 | Abnormal contract data detection method and device for intelligent contracts of block chains |
-
2020
- 2020-07-21 CN CN202010706712.0A patent/CN111861465A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107945021A (en) * | 2017-12-07 | 2018-04-20 | 杭州趣链科技有限公司 | A kind of digital asset management method based on block chain intelligence contract |
CN108510389A (en) * | 2018-03-30 | 2018-09-07 | 深圳前海微众银行股份有限公司 | Intelligent contract call method, equipment and readable storage medium storing program for executing based on block chain |
CN111045892A (en) * | 2019-12-11 | 2020-04-21 | 北京菲林方德科技有限公司 | Method and device for detecting process state of intelligent contract execution |
CN111124421A (en) * | 2019-12-23 | 2020-05-08 | 卓尔智联(武汉)研究院有限公司 | Abnormal contract data detection method and device for intelligent contracts of block chains |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112862493A (en) * | 2021-01-27 | 2021-05-28 | 中山大学 | Intelligent Pompe deception detection method, device, terminal and storage medium |
CN112507334A (en) * | 2021-02-02 | 2021-03-16 | 布比(北京)网络技术有限公司 | Illegal access detection method, device, system, electronic equipment and storage medium |
CN113486357A (en) * | 2021-07-07 | 2021-10-08 | 东北大学 | Intelligent contract security detection method based on static analysis and deep learning |
CN113486357B (en) * | 2021-07-07 | 2024-02-13 | 东北大学 | Intelligent contract security detection method based on static analysis and deep learning |
CN115130139A (en) * | 2022-08-31 | 2022-09-30 | 杭州链城数字科技有限公司 | Digital asset examination method, device, system and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111861465A (en) | Detection method and device based on intelligent contract, storage medium and electronic device | |
Fröwis et al. | In code we trust? Measuring the control flow immutability of all smart contracts deployed on Ethereum | |
CN106030528B (en) | Agent data service | |
JP7073343B2 (en) | Security vulnerabilities and intrusion detection and repair in obfuscated website content | |
CN103679031B (en) | A kind of immune method and apparatus of file virus | |
CN109344611B (en) | Application access control method, terminal equipment and medium | |
Demir et al. | Security smells in smart contracts | |
Di Angelo et al. | Identification of token contracts on Ethereum: standard compliance and beyond | |
US11765116B2 (en) | Method for electronic impersonation detection and remediation | |
US12074912B2 (en) | Dynamic, runtime application programming interface parameter labeling, flow parameter tracking and security policy enforcement | |
CN110113315A (en) | A kind of processing method and equipment of business datum | |
CN109753808A (en) | A kind of privacy compromise methods of risk assessment and device | |
US20240232350A1 (en) | Detection of suspicious objects in customer premises equipment (cpe) | |
CN104994219A (en) | Data processing method and system | |
CN112685774B (en) | Payment data processing method based on big data and block chain finance and cloud server | |
CN109002733A (en) | A kind of pair of equipment carries out the method and device of reliability evaluation | |
CN110598996A (en) | Risk processing method and device, electronic equipment and storage medium | |
CN104994220A (en) | Data processing method and system | |
Barati et al. | Design and verification of privacy patterns for business process models | |
KR101327530B1 (en) | Apparatus and method for blocking illegal uploading in intermediate server | |
CN108965108A (en) | A kind of information push method and relevant device | |
CN114662097A (en) | CSV file injection attack detection method and device, electronic equipment and storage medium | |
CN113254837A (en) | Application program evaluation method, device, system, equipment and medium | |
CN112686742A (en) | Sales invoice risk early warning method and device, storage medium and electronic equipment | |
US20240249012A1 (en) | Systems and methods for detection of toxic access combinations |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20201030 |