作者投稿和查稿 主编审稿 专家审稿 编委审稿 远程编辑

计算机工程 ›› 2026, Vol. 52 ›› Issue (1): 254-265. doi: 10.19678/j.issn.1000-3428.0070479

• 网络空间安全 • 上一篇    下一篇

基于BERT模型的跨链异常交易检测

申振龙, 童燕翔*(), 王萧, 王奔, 张鹏程   

  1. 河海大学计算机与软件学院, 江苏 南京 210023
  • 收稿日期:2024-10-12 修回日期:2024-12-31 出版日期:2026-01-15 发布日期:2026-01-15
  • 通讯作者: 童燕翔
  • 作者简介:

    申振龙, 男, 硕士研究生, 主研方向为跨链漏洞检测

    童燕翔(通信作者), 讲师

    王萧, 博士研究生

    王奔, 博士研究生

    张鹏程, 教授、博士生导师

  • 基金资助:
    国家自然科学基金(U21B2016); 国家自然科学基金(62272145)

Cross-chain Anomalous Transaction Detection Based on BERT Model

SHEN Zhenlong, TONG Yanxiang*(), WANG Xiao, WANG Ben, ZHANG Pengcheng   

  1. School of Computer and Software, Hohai University, Nanjing 210023, Jiangsu, China
  • Received:2024-10-12 Revised:2024-12-31 Online:2026-01-15 Published:2026-01-15
  • Contact: TONG Yanxiang

摘要:

跨链是一种打破区块链网络"信息孤岛", 实现不同区块链网络之间互操作的重要技术。作为跨链实现的产物, 跨链桥已成为异构区块链之间实现资产转移和信息传递的重要解决方案。近几年, 针对跨链桥漏洞的攻击频繁发生, 攻击导致的跨链交易异常已造成高达数十亿的经济损失。然而, 目前对跨链桥的异常交易问题研究较少, 且仅有的一些检测工作高度依赖于人工总结的交易序列异常模式。针对这一问题, 提出一种基于BERT(Bidirectional Encoder Representations from Transformers)模型的跨链异常交易检测方法, 通过提供基于特征提取的2种检测模式, 克服现有检测方法对人工经验依赖的局限性。第1种模式旨在更精准地提取特征, 先根据交易状态从跨链原生交易数据中自动抽取具有关键特征的跨链交易序列, 再通过跨链交易序列文本数据微调BERT-Base-Uncased预训练模型适应异常交易检测任务; 第2种模式旨在弥补仅考虑关键跨链交易序列可能带来的特征不足, 直接通过具有全面特征的原始交易文本数据微调BERT-Base-Uncased预训练模型进而解决异常交易检测任务。实验使用现有工作的真实跨链数据评估所提检测方法, 结果表明, 2种检测模式均能有效检测出异常的跨链交易, 精确率、召回率及F1值均达到了100%。

关键词: 区块链, 跨链桥, 跨链交易, 漏洞, 交易序列

Abstract:

Cross-chain is an important technology that breaks the ″information silos″ of blockchain networks and facilitates interoperability between different blockchain networks. Cross-chain bridges have become an important technique for asset and information transfer between heterogeneous blockchains. In recent years, attacks against cross-chain bridge vulnerabilities have occurred frequently, and the cross-chain transaction anomalies caused by these attacks have resulted in economic losses of up to billions. However, research on the problem of anomalous transactions in cross-chain bridges is lacking and detection efforts are highly dependent on manually summarized anomalous patterns of transaction sequences. In this study, a cross-chain anomalous transaction detection method based on the Bidirectional Encoder Representations from Transformer (BERT) model is proposed, which overcomes the limitations of existing detection methods that rely on manual experience by providing two detection modes based on feature extraction. The first mode aims to extract features more accurately by automatically extracting cross-chain transaction sequences with key features from cross-chain native transaction data based on the transaction status and then fine-tuning the BERT-Base-Uncased pretrained model to adapt to the anomalous transaction detection task using cross-chain transaction sequence text data. The second mode aims to compensate for the possible feature inadequacies that may occur by considering only key cross-chain transaction sequences and to solve the anomaly detection task by directly fine-tuning the BERT-Base-Uncased pretrained model using the original transaction text data with comprehensive features. The experiments use real cross-chain data from existing studies to evaluate the proposed detection methods. The results show that both detection modes can effectively detect anomalous cross-chain transactions, that is, the precision rate, recall rate, and F1 value reach 100%.

Key words: blockchain, cross-chain bridge, cross-chain transaction, vulnerability, transaction sequence