Smart contract security detection method and system, equipment, terminal and application

A technology of smart contracts and security detection, applied in neural learning methods, computer security devices, special data processing applications, etc., can solve the problems of increasing difficulty, difficulty in obtaining, and increasing the difficulty of model training, so as to reduce cumbersomeness and improve efficiency. Effect

CN113626826APending Publication Date: 2021-11-09XIDIAN UNIV
0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Current Assignee / Owner
Publication Date
2021-11-09

Smart Images

  • Figure 1
    Figure 1
  • Figure 2
    Figure 2
  • Figure 3
    Figure 3
Patent Text Reader

Abstract

The invention belongs to the technical field of block chain security, and discloses a smart contract security detection method and system, equipment, a terminal and application, the smart contract security detection method comprises the following steps: using an open source code to train a word2vec model; packaging the open source code into an intelligent contract function according to an intelligent contract grammar; converting the packaged function into an abstract syntax tree, and extracting data flow and control flow information; converting data flow and control flow information of the smart contract into a graph model; using a trained word2vec model to convert the graph nodes into vectors; training the graph model by using a graph neural network; reading all node information, and converting the intelligent contract function graph model into vectors; and judging whether the function vector contains the intelligent contract vulnerability information or not by using the classification model. According to the invention, the security detection efficiency of the smart contract is improved, and a good effect is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

technical field

[0001] The invention belongs to the technical field of block chain security, and in particular relates to a smart contract security detection method, system, equipment, terminal and application. Background technique

[0002] At present, most of the smart contracts on the blockchain platform involve the transaction and processing of digital assets or cryptocurrencies, so the loopholes in smart contracts may be exploited to expose users to malicious attacks. For this reason, in recent years, more and more researchers have begun to study the security detection methods for smart contracts, but the existing research is mainly carried out around the Ethereum platform, and the smart contracts of the alliance chain platform represented by Hyperledger Fabric However, there is a lack of targeted detection methods for security detection. The main reasons are as follows:

[0003] (1) Smart contracts on the Fabric platform are mainly deployed within the organization and...

Examples

Embodiment 1

[0066] 1) The experiment uses TensorFlow-2.1.0 to implement the Fabric smart contract security detection model.

[0067] 2) Construct the AST graph of the source code with the help of the Go language ast package, and extract different edge relationships from it. That is, AST nodes of all source codes are traversed. When traversing, all nodes are sequentially numbered, and the relationship between different edges is obtained according to specific rules, and variable names are rewritten using a unified naming scheme. This step ensures that semantic differences such as variable names in the program do not affect the choice of token embedding.

[0068] 3) Create a directory, and then create a train.py training file.

[0069] 4) Write the GGNN model training code in this file. The code starts with the following package loading code.

[0070]

[0071] 5) In the same directory, create a test.py test file.

[0072] 6) Write the GGNN model test code in this file. The code star...