基于代码控制流图的庞氏骗局合约检测
作者:
中图分类号:

TP311

基金项目:

国家重点研发计划 (2022YFB3305802)


Ponzi Scheme Contract Detection Based on Code Control Flow Graph
Author:
  • 摘要
  • | |
  • 访问统计
  • |
  • 参考文献
  • |
  • 相似文献
  • |
  • 引证文献
  • | |
  • 文章评论
    摘要:

    区块链在加密货币投资领域展现出强劲的生命力, 吸引了大量投资者的参与. 然而, 由于区块链的匿名性, 导致了许多欺诈行为, 其中庞氏骗局智能合约就是一种典型的欺诈性投资活动, 给投资者带来了巨大的经济损失. 因此, 对以太坊上的庞氏骗局合约进行检测变得尤为重要. 但是, 现有研究大都忽略了庞氏骗局合约源代码中的控制流信息. 为提取庞氏骗局合约更丰富的语义信息和结构信息, 提出一种基于代码控制流图的庞氏骗局合约检测模型. 首先, 该模型将获取的合约源代码构建成控制流图的形式. 然后, 使用Word2Vec算法提取了包括数据流信息和代码结构信息在内的关键特征. 考虑到每个智能合约的功能不同、代码篇幅差异明显, 导致提取的特征向量维度差异较大, 对不同智能合约生成的特征向量进行对齐操作, 使得所有的特征向量具有相同的维度, 便于之后处理. 其次, 利用基于图卷积和Transformer的特征学习模块, 引入多头注意力机制, 来学习节点特征的依赖关系. 最后, 使用多层感知机实现对庞氏骗局合约的识别. 通过在Xblock网站提供的数据集上将该模型与传统的图特征学习模型进行对比, 验证该模型引入的多头注意力机制的性能. 实验结果证明, 该模型有效地提升对庞氏骗局合约的检测能力.

    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.

    参考文献
    相似文献
    引证文献
引用本文

黄静,王梦晓,韩红桂.基于代码控制流图的庞氏骗局合约检测.软件学报,,():1-17

复制
分享
文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:2024-04-17
  • 最后修改日期:2024-06-26
  • 在线发布日期: 2025-03-26
文章二维码
您是第位访问者
版权所有:中国科学院软件研究所 京ICP备05046678号-3
地址:北京市海淀区中关村南四街4号,邮政编码:100190
电话:010-62562563 传真:010-62562533 Email:jos@iscas.ac.cn
技术支持:北京勤云科技发展有限公司

京公网安备 11040202500063号