首页|基于多特征融合的智能合约缺陷检测方法

基于多特征融合的智能合约缺陷检测方法

扫码查看
智能合约是区块链技术最成功的应用之一,随着其广泛应用,智能合约的安全问题也引起了研究人员的关注。尽管已有一些针对智能合约缺陷检测的研究,但对于智能合约代码特征的挖掘还不充分。提出一种采用多特征融合方式的智能合约缺陷检测方法。首先,对智能合约代码进行预处理,其中包括颜色标记、词汇提取、ASCII字符转换以及合约之间继承关系的提取;然后,将颜色标记、词汇提取、ASCII字符转换得到的处理信息输入到由BERT、卷积神经网络(CNN)以及双向长短期记忆(BiLSTM)网络构建的融合模型中进行特征提取,同时将合约之间的继承关系信息输入node2vec随机游走算法,以获得合约关系的特征向量;最后,将所有特征向量连接并输入分类器进行缺陷分类。使用真实的Solidity智能合约数据集对该方法进行验证,实验结果表明,相比其他模型,所提多特征融合模型在F1值实现了 6%~12%的改进,在准确度方面实现了 4%~11%的提升,该方法能够更好地挖掘智能合约代码的深层特征,提高缺陷检测性能,对智能合约的安全性具有一定的应用价值。
Smart Contract Defect Detection Method Based on Multi-Feature Fusion
Smart contracts are one of the most successful applications of the blockchain technology.Owing to their widespread application,the security issues of smart contracts have attracted widespread attention from researchers.Although some studies have been conducted on defect detection in smart contracts,mining of code features in smart contracts remains insufficient.This paper introduces a smart contract defect detection method that employs a multi-feature fusion approach.First,the smart contract code undergoes preprocessing,including color labeling,vocabulary extraction,ASCII character conversion,and extraction of inheritance relationships between contracts.The processing information obtained from the first three steps is then input into a fusion model constructed using Bidirectional Encoder Representations from Transformers(BERT),Convolutional Neural Network(CNN),and Bidirectional Long Short Term Memory(BiLSTM)network for feature extraction.Simultaneously,the information on inheritance relationship between contracts is input into the node2vec random walk algorithm to obtain the feature vector of the contract relationship.Finally,all feature vectors are connected and input into the classifier for defect classification.The multi-feature fusion model is validated using a real Solidity smart contract dataset,and experimental results show that compared with other models,it achieves 6%-12%and 4%-11%improvements in the Fl value and accuracy,respectively.This method can comprehensively explore the inherent characteristics of smart contract code,improve defect detection performance,and find potential applications in preserving the security of smart contracts.

blockchainsmart contractSolidity languagemulti-featuredefect detection

王奕丰、曾诚、全擎宇、王娇然、何鹏

展开 >

湖北大学计算机与信息工程学院,湖北武汉 430062

湖北大学人工智能学院,湖北武汉 430062

湖北大学智能感知系统与安全教育部重点实验室,湖北武汉 430062

湖北大学网络空间安全学院,湖北武汉 430062

展开 >

区块链 智能合约 Solidity语言 多特征 缺陷检测

湖北省重点研发计划湖北省重点研发计划

2021BAA1882021BAA184

2024

计算机工程
华东计算技术研究所 上海市计算机学会

计算机工程

CSTPCD北大核心
影响因子:0.581
ISSN:1000-3428
年,卷(期):2024.50(8)
  • 3