高级搜索

留言板

尊敬的读者、作者、审稿人, 关于本刊的投稿、审稿、编辑和出版的任何问题, 您可以本页添加留言。我们将尽快给您答复。谢谢您的支持!

姓名
邮箱
手机号码
标题
留言内容
验证码

基于双层孪生神经网络的区块链智能合约分类方法

郭加树 王琪 李择亚 武梦德 张红霞

郭加树, 王琪, 李择亚, 武梦德, 张红霞. 基于双层孪生神经网络的区块链智能合约分类方法[J]. 电子与信息学报, 2024, 46(3): 1060-1068. doi: 10.11999/JEIT230185
引用本文: 郭加树, 王琪, 李择亚, 武梦德, 张红霞. 基于双层孪生神经网络的区块链智能合约分类方法[J]. 电子与信息学报, 2024, 46(3): 1060-1068. doi: 10.11999/JEIT230185
GUO Jiashu, WANG Qi, LI Zeya, WU Mengde, ZHANG Hongxia. Blockchain Smart Contract Classification Method Based on Double Siamese Neural Network[J]. Journal of Electronics & Information Technology, 2024, 46(3): 1060-1068. doi: 10.11999/JEIT230185
Citation: GUO Jiashu, WANG Qi, LI Zeya, WU Mengde, ZHANG Hongxia. Blockchain Smart Contract Classification Method Based on Double Siamese Neural Network[J]. Journal of Electronics & Information Technology, 2024, 46(3): 1060-1068. doi: 10.11999/JEIT230185

基于双层孪生神经网络的区块链智能合约分类方法

doi: 10.11999/JEIT230185
基金项目: 中石油重大科技项目(ZD2019-183-004),中央高校基本科研业务费专项资金(20CX05019A)
详细信息
    作者简介:

    郭加树:男,博士,副教授,研究方向为机器学习、人工智能等

    王琪:男,硕士生,研究方向为区块链技术、数据挖掘

    李择亚:女,硕士生,研究方向为联邦学习

    武梦德:男,硕士生,研究方向为服务计算

    张红霞:女,博士,副教授,研究方向为边缘计算、区块链技术、服务计算等

    通讯作者:

    郭加树 396105856@qq.com

  • 中图分类号: TN918; TP391

Blockchain Smart Contract Classification Method Based on Double Siamese Neural Network

Funds: The Major Scientific and Technological Projects of CNPC (ZD2019-183-004), The Fundamental Research Funds for the Central Universities (20CX05019A)
  • 摘要: 当前通过深度学习方法进行区块链智能合约分类的方法越来越流行,但基于深度学习的方法往往需要大量的样本标签数据去进行有监督的模型训练,才能达到较高的分类性能。该文针对当前可用智能合约数据集存在数据类别不均衡以及标注数据量过少会导致模型训练困难,分类性能不佳的问题,提出基于双层孪生神经网络的小样本场景下的区块链智能合约分类方法:首先,通过分析智能合约数据特征,构建了可以捕获较长合约数据特征的双层孪生神经网络模型;然后,基于该模型设计了小样本场景下的智能合约训练策略和分类方法。最后,实验结果表明,该文所提方法在小样本场景下的分类性能优于目前最先进的智能合约分类方法,分类准确率达到94.7%,F1值达到94.6%,同时该方法对标签数据的需求更低,仅需同类型其他方法约20%数据量。
  • 图  1  操作码文件

    图  2  智能合约数据类别比例

    图  3  双层孪生神经网络模型

    图  4  模型训练及分类流程图

    图  5  操作码词云图

    图  6  模型预训练损失值对比

    图  7  单双层孪生网络模型损失值变化

    表  1  智能合约类别名称及数据量

    游戏赌博社交金融交换软件DEFINFT媒体钱包交易
    86429915925623210026123610045115
    治理安全Farm财产Tools身份能源健康保险存储
    523372671517151225
    下载: 导出CSV

    表  2  数据集类别

    序号类别序号类别
    1游戏9财产
    2赌博10媒体
    3社交11钱包、存储
    4金融12交易
    5交换13治理
    6软件14Farm
    7DEFI15NFT
    8Tools、能源、健康、保险
    下载: 导出CSV

    表  3  单双层孪生网络模型实验结果对比

    模型PrecisionRecallF1
    Single-Siamese0.8800.8730.874
    Double-Siamese0.9470.9460.946
    下载: 导出CSV

    表  4  向量拼接方式实验结果对比

    向量拼接方式PrecisionRecallF1
    $({\boldsymbol{u}},{\boldsymbol{v}})$0.8480.8440.845
    $(|{\boldsymbol{u}} - {\boldsymbol{v}}|)$0.8890.8330.860
    $({\boldsymbol{u}} \times {\boldsymbol{v}})$0.8940.8800.886
    $({\boldsymbol{u}},{\boldsymbol{v}},{\boldsymbol{u}} \times {\boldsymbol{v}})$0.9270.9200.923
    $(|{\boldsymbol{u}} - {\boldsymbol{v}}|,{\boldsymbol{u}} \times {\boldsymbol{v}})$0.9160.9240.920
    $ ({\boldsymbol{u}},{\boldsymbol{v}},|{\boldsymbol{u}} - {\boldsymbol{v}}|) $0.9470.9460.946
    下载: 导出CSV

    表  5  类别数据量实验结果

    类别数据量PrecisionRecallF1
    10(8/2)0.8670.8330.849
    20(16/4)0.9210.9000.910
    30(24/6)0.9280.9220.924
    40(32/8)0.9300.9250.927
    50(40/10)0.9470.9460.946
    下载: 导出CSV

    表  6  合约分类对比实验结果

    模型PrecisionRecallF1
    支持向量机+交易信息0.8520.8540.852
    神经网络+交易信息0.8890.8810.849
    HANN-SCA0.9310.9200.926
    SCC-BiLSTM0.9170.9060.911
    Double-Siamese0.9470.9460.946
    下载: 导出CSV
  • [1] SZABO N. Formalizing and securing relationships on public networks[J]. First Monday, 1997, 2(9).
    [2] MOHANTA B K, PANDA S S, and JENA D. An overview of smart contract and use cases in blockchain technology[C]. The 9th International Conference on Computing, Communication and Networking Technologies, Bengaluru, India, 2018: 1–4.
    [3] GONG Jianhu and NAVIMIPOUR N J. An in-depth and systematic literature review on the blockchain-based approaches for cloud computing[J]. Cluster Computing, 2022, 25(1): 383–400. doi: 10.1007/s10586-021-03412-2.
    [4] 牛淑芬, 杨平平, 谢亚亚, 等. 区块链上基于云辅助的密文策略属性基数据共享加密方案[J]. 电子与信息学报, 2021, 43(7): 1864–1871. doi: 10.11999/JEIT200124.

    NIU Shufen, YANG Pingping, XIE Yaya, et al. Cloud-assisted ciphertext policy attribute based encryption data sharing encryption scheme based on BlockChain[J]. Journal of Electronics &Information Technology, 2021, 43(7): 1864–1871. doi: 10.11999/JEIT200124.
    [5] ABDELMABOUD A, AHMED A I A, ABAKER M, et al. Blockchain for IoT applications: Taxonomy, platforms, recent advances, challenges and future research directions[J]. Electronics, 2022, 11(4): 630. doi: 10.3390/electronics11040630.
    [6] JOHARI R, KUMAR V, GUPTA K, et al. BLOSOM: BLOckchain technology for security of medical records[J]. ICT Express, 2022, 8(1): 56–60. doi: 10.1016/j.icte.2021.06.002.
    [7] ZHENG Zibin, XIE Shaoan, DAI Hongning, et al. An overview on smart contracts: Challenges, advances and platforms[J]. Future Generation Computer Systems, 2020, 105: 475–491. doi: 10.1016/j.future.2019.12.019.
    [8] CHEN Weili, ZHENG Zibin, NGAI E C H, et al. Exploiting blockchain data to detect smart Ponzi schemes on Ethereum[J]. IEEE Access, 2019, 7: 37575–37586. doi: 10.1109/ACCESS.2019.2905769.
    [9] TORRES C F, STEICHEN M, and STATE R. The art of the scam: Demystifying honeypots in Ethereum smart contracts[C]. The 28th USENIX Conference on Security Symposium, Santa Clara, USA, 2019: 1591–1607.
    [10] LI Yikai, CHEN C L P, and ZHANG Tong. A survey on Siamese network: Methodologies, applications, and opportunities[J]. IEEE Transactions on Artificial Intelligence, 2022, 3(6): 994–1014. doi: 10.1109/TAI.2022.3207112.
    [11] ZHANG Jianwei, ZHANG Xubin, LV Lei, et al. An applicative survey on few-shot learning[J]. Recent Patents on Engineering, 2022, 16(5): 104–124. doi: 10.2174/1872212115666210715121344.
    [12] WANG Zhenzhi, WANG Limin, WU Tao, et al. Negative sample matters: A renaissance of metric learning for temporal grounding[C]. The 36th AAAI Conference on Artificial Intelligence, Vancouver, Canada, 2022: 2613–2623.
    [13] BARTOLETTI M and POMPIANU L. An empirical analysis of smart contracts: Platforms, applications, and design patterns[C]. The International Conference on Financial Cryptography and Data Security, Sliema, Malta, 2017: 494–509.
    [14] 黄步添, 刘琦, 何钦铭, 等. 基于语义嵌入模型与交易信息的智能合约自动分类系统[J]. 自动化学报, 2017, 43(9): 1532–1543. doi: 10.16383/j.aas.2017.c160655.

    HUANG Butian, LIU Qi, HE Qinming, et al. Towards automatic smart-contract codes classification by means of word embedding model and transaction information[J]. Acta Automatica Sinica, 2017, 43(9): 1532–1543. doi: 10.16383/j.aas.2017.c160655.
    [15] MIKOLOV T, SUTSKEVER I, CHEN Kai, et al. Distributed representations of words and phrases and their compositionality[C]. The 26th International Conference on Neural Information Processing Systems, Lake Tahoe, Nevada, 2013: 3111–3119.
    [16] 高飞. 基于区块链技术的智能合约自动分类系统设计[J]. 高原科学研究, 2018, 2(4): 51–59. doi: 10.16249/j.cnki.2096-4617.2018.04.007.

    GAO Fei. Design of intelligent contract automatic classification system based on blockchain technology[J]. Plateau Science Research, 2018, 2(4): 51–59. doi: 10.16249/j.cnki.2096-4617.2018.04.007.
    [17] SUN Xun, LIN Xingwei, and LIAO Zhou. An ABI-based classification approach for Ethereum smart contracts[C]. 2021 IEEE International Conference on Dependable, Autonomic and Secure Computing, International Conference on Pervasive Intelligence and Computing, International Conference on Cloud and Big Data Computing, International Conference on Cyber Science and Technology Congress, Calgary, Canada, 2021: 99–104.
    [18] VASWANI A, SHAZEER N, PARMAR N, et al. Attention is all you need[C]. The 31st International Conference on Neural Information Processing Systems, Long Beach, USA, 2017: 6000-6010.
    [19] 吴雨芯, 蔡婷, 张大斌. 基于层级注意力机制与双向长短期记忆神经网络的智能合约自动分类模型[J]. 计算机应用, 2020, 40(4): 978–984. doi: 10.11772/j.issn.1001-9081.2019081327.

    WU Yuxin, CAI Ting, and ZHANG Dabin. Automatic smart contract classification model based on hierarchical attention mechanism and bidirectional long short-term memory neural network[J]. Journal of Computer Applications, 2020, 40(4): 978–984. doi: 10.11772/j.issn.1001-9081.2019081327.
    [20] ENAMOTO L, SANTOS A R A S, MAIA R, et al. Multi-label legal text classification with BiLSTM and attention[J]. International Journal of Computer Applications in Technology, 2022, 68(4): 369–378. doi: 10.1504/IJCAT.2022.125186.
    [21] TIAN Gang, WANG Qibo, ZHAO Yi, et al. Smart contract classification with a Bi-LSTM based approach[J]. IEEE Access, 2020, 8: 43806–43816. doi: 10.1109/ACCESS.2020.2977362.
    [22] LIU Han, YANG Zhiqiang, LIU Chao, et al. EClone: Detect semantic clones in Ethereum via symbolic transaction sketch[C]. The 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, Lake Buena Vista, USA, 2018: 900–903.
    [23] REIMERS N and GUREVYCH I. Sentence-BERT: Sentence embeddings using Siamese BERT-networks[C]. The 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, Hong Kong, China, 2019.
    [24] DEVLIN J, CHANG Mingwei, LEE K, et al. BERT: Pre-training of deep bidirectional transformers for language understanding[C]. The 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Minneapolis, USA, 2019.
    [25] SUN Chi, QIU Xipeng, XU Yige, et al. How to fine-tune BERT for text classification?[C]. The 18th China National Conference on Chinese Computational Linguistics, Kunming, China, 2019: 194–206.
  • 加载中
图(7) / 表(6)
计量
  • 文章访问数:  447
  • HTML全文浏览量:  252
  • PDF下载量:  49
  • 被引次数: 0
出版历程
  • 收稿日期:  2023-03-22
  • 修回日期:  2023-09-20
  • 网络出版日期:  2023-10-07
  • 刊出日期:  2024-03-27

目录

    /

    返回文章
    返回