引用本文:黄静,王梦晓,韩红桂.基于代码控制流图的庞氏骗局合约检测.软件学报,2025,36(10):4628-4644
【打印本页】   【下载PDF全文】   查看/发表评论  【EndNote】   【RefMan】   【BibTex】
←前一篇|后一篇→ 过刊浏览    高级检索
本文已被:浏览 1006次   下载 1055 本文二维码信息
码上扫一扫!
分享到: 微信 更多
基于代码控制流图的庞氏骗局合约检测
黄静1,2, 王梦晓1,2, 韩红桂1,2
1.北京工业大学 信息学部, 北京 100124;2.计算智能与智能系统北京市重点实验室 (北京人工智能研究院), 北京 100124
摘要:
区块链在加密货币投资领域展现出强劲的生命力, 吸引了大量投资者的参与. 然而, 由于区块链的匿名性, 导致了许多欺诈行为, 其中庞氏骗局智能合约就是一种典型的欺诈性投资活动, 给投资者带来了巨大的经济损失. 因此, 对以太坊上的庞氏骗局合约进行检测变得尤为重要. 但是, 现有研究大都忽略了庞氏骗局合约源代码中的控制流信息. 为提取庞氏骗局合约更丰富的语义信息和结构信息, 提出一种基于代码控制流图的庞氏骗局合约检测模型. 首先, 该模型将获取的合约源代码构建成控制流图的形式. 然后, 使用Word2Vec算法提取了包括数据流信息和代码结构信息在内的关键特征. 考虑到每个智能合约的功能不同、代码篇幅差异明显, 导致提取的特征向量维度差异较大, 对不同智能合约生成的特征向量进行对齐操作, 使得所有的特征向量具有相同的维度, 便于之后处理. 其次, 利用基于图卷积和Transformer的特征学习模块, 引入多头注意力机制, 来学习节点特征的依赖关系. 最后, 使用多层感知机实现对庞氏骗局合约的识别. 通过在XBlock网站提供的数据集上将该模型与传统的图特征学习模型进行对比, 验证该模型引入的多头注意力机制的性能. 实验结果证明, 该模型有效地提升了对庞氏骗局合约的检测能力.
关键词:  智能合约  庞氏骗局  控制流图  图Transformer
DOI:10.13328/j.cnki.jos.007318
分类号:TP311
基金项目:国家重点研发计划 (2022YFB3305802)
Ponzi Scheme Contract Detection Based on Code Control Flow Graph
HUANG Jing1,2, WANG Meng-Xiao1,2, HAN Hong-Gui1,2
1.Faculty of Information Technology, Beijing University of Technology, Beijing 100124, China;2.Beijing Key Laboratory of Computational Intelligence and Intelligence System (Beijing Institute of Artificial Intelligence), Beijing 100124, China
Abstract:
Blockchain has shown strong vitality in the field of cryptocurrency investment, attracting the participation of a large number of investors. However, due to the anonymity of blockchain, it induces a lot of fraud, among which the Ponzi scheme smart contract is a typical fraudulent investment activity, causing huge economic losses for investors. Therefore, the detection of Ponzi scheme contracts on Ethereum becomes particularly important. Nevertheless, most existing studies have ignored control flow information in the source code of Ponzi scheme contracts. To extract more semantic and structural information from Ponzi scheme contracts, this study proposes a Ponzi scheme contract detection model based on code control flow graph. First, the model constructs the obtained contract source code in the form of a control flow diagram. Then, key features including data flow information and code structure information are extracted by the Word2Vec algorithm. Considering that the functions of each smart contract are different and the length of the code varies significantly, resulting in a large difference in the extracted feature vectors. In this study, feature vectors generated by different smart contracts are aligned so that all feature vectors have the same dimension, which is convenient for subsequent processing. Secondly, the feature learning module based on graph convolution and Transformer is utilized to introduce multi-head attention mechanism to learn the dependency of node features. Finally, the multilayer perceptron is used to identify the Ponzi scheme contract. By comparing the proposed model with the traditional graph feature learning model on the dataset provided by the XBlock website, the performance of the multi-head attention mechanism introduced by the model is verified. Experimental results demonstrate that this model effectively improves the ability to detect Ponzi scheme contracts.
Key words:  smart contract  Ponzi scheme  control flow graph  graph Transformer

引用本文:
【打印本页】   【下载PDF全文】   查看/发表评论  【EndNote】   【RefMan】   【BibTex】
←前一篇|后一篇→ 过刊浏览    高级检索
本文已被:浏览次   下载  
分享到: 微信 更多
摘要:
关键词:  
DOI:
分类号:
基金项目:
Abstract:
Key words: