Unlock instant, AI-driven research and patent intelligence for your innovation.

A Smart Contract Similarity Detection Method Based on Syntax Tree Matching

A technology of smart contracts and detection methods, applied in unstructured text data retrieval, text database query, instruments, etc., to achieve good expansibility and reference significance, improve accuracy and efficiency, good versatility and practical value

Active Publication Date: 2022-05-27
ZHEJIANG GONGSHANG UNIVERSITY
View PDF3 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

Traditional detection methods usually only consider code similarity detection at the grammatical level, so they can only reach the detection level of type (1) and type (2). Existing similarity detection methods combine multi-dimensional analysis methods such as vocabulary, grammar, and semantics. , which implements code similarity detection at the level of type (3) and type (4)

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • A Smart Contract Similarity Detection Method Based on Syntax Tree Matching
  • A Smart Contract Similarity Detection Method Based on Syntax Tree Matching
  • A Smart Contract Similarity Detection Method Based on Syntax Tree Matching

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0037] In order to describe the present invention more specifically, the technical solutions of the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0038] The invention detects the similarity of smart contract source code based on syntax tree matching, captures the syntax information of smart contracts by means of an abstract syntax tree extraction tool, uses the attention mechanism of the encoder to obtain the semantic information of each node in the syntax tree, and finally extracts the syntax of the smart contract The high semantic feature vector of the tree, the feature vector is used as the input of the similarity calculation function to obtain the similarity value between different syntax trees, and the similarity detection result of the two pieces of smart contract source code is obtained by the method of averaging. The process is as follows figure 1 shown.

[0039] like figure 2 As shown, the...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a smart contract similarity detection method based on syntactic tree matching, which captures the grammatical information of the smart contract by means of an abstract syntax tree extraction tool, uses the attention mechanism of the encoder to obtain the semantic information of each node in the syntactic tree, and finally extracts The high-semantic feature vector of the syntax tree of the smart contract uses the feature vector as the input of the similarity calculation function to obtain the similarity value between different syntax trees, and obtains the similarity detection results of the two smart contract source codes by averaging. The invention effectively solves the similarity detection problem of the Ethereum smart contract. Compared with the traditional code cloning detection method, the method of the invention achieves a more accurate detection effect, and at the same time has a similarity detection interpretation accurate to the code line, and has a good versatility and practical value.

Description

technical field [0001] The invention belongs to the technical field of program similarity detection, in particular to a method for detecting similarity of smart contracts based on syntax tree matching. Background technique [0002] In recent years, in order to improve the efficiency of software development, more and more developers have begun to use code reuse technology, such as reuse of existing program code, reuse of common software frameworks, and reuse of common design patterns. However, blindly reusing existing program codes may cause many problems, such as increased project extra cost, software vulnerability risks, and software copyright infringement. [0003] Code similarity detection is one of the effective techniques for checking code reuse, also known as code clone detection, which can determine whether there are identical or similar code fragments in two programs. According to the different degrees of code similarity, code similarity detection is generally divid...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Patents(China)
IPC IPC(8): G06F16/33G06F40/211G06F40/253G06F40/30
CPCG06F16/3344G06F40/211G06F40/253G06F40/30
Inventor 刘振广徐小俊钱鹏刘灵凤武思凡
Owner ZHEJIANG GONGSHANG UNIVERSITY