| In recent years,smart contracts have received a lot of attention as executable programs deployed on the Ethereum blockchain platform,and everyone can develop and deploy smart contracts according to their needs.In order to prove their own reliability,many people choose to disclose the source code,which also leads to a large number of code clones on the blockchain platform.Smart contract code cloning has had widespread impact in many different applications,so it is necessary to continue to solve the problem of code cloning in smart contracts.This paper starts from two aspects of smart contract source code representation and clone detection method,and designs a smart contract code clone detection tool based on graph embedding,which uses a composite graph structure to fully express the source code semantic information of smart contracts,and A graph neural network is introduced for the task of smart contract code clone detection.The main research content of this paper is as follows:(1)Aiming at the problem of insufficient representation of smart contract source code information,this paper proposes a smart contract semantic representation method that integrates multi-dimensional code attribute graphs.This method extracts the unstructured and Structuring information and expressing it as a graph structure makes full use of the grammatical and semantic information in the source code.The results show that this representation method is currently the most advanced representation method for smart contract source code.(2)Aiming at the problem that the efficiency of smart contract code clone detection is not high at present,this paper proposes a smart contract code clone detection method based on graph embedding,which introduces a learnable embedding method to represent the nodes in the graph as vectors,and then A global attention mechanism is used to indicate the importance of each node,so as to assign corresponding weights to them,and the weighted average method is used to calculate the whole graph embedding representation,and the interaction between the graph embeddings is used to obtain the source code.similarity score.The method achieves an F1 score of 95.8%on our dataset.(3)This paper designs a blockchain smart contract code clone detection tool,which integrates the smart contract semantic representation of the multi-dimensional code attribute graph and the smart contract code clone detection technology based on graph embedding,and displays it through a graphical interface Code property graph representation and detection results of smart contract source code. |