基于录制重放的区块链交易执行追溯方法
作者:
作者单位:

作者简介:

陈胜(1972-),男,高级工程师,主要研究领域为区块链核心组件架构,区块链技术的应用;方明哲(1989-),男,博士,工程师,主要研究领域为区块链;蒋步云(1972-),男,高级工程师,主要研究领域为区块链;李春晓(1968-),女,高级工程师,CCF专业会员,主要研究领域为区块链,数字博物馆,数字图书馆;左春(1959-),男,研究员,主要研究领域为软件工程;李玉成(1961-),男,研究员,主要研究领域为并行软件,计算科学;梁赓(1962-),男,正高级工程师,主要研究领域为区块链,计算机应用.

通讯作者:

梁赓,E-mail:lianggeng@iscas.ac.cn

中图分类号:

基金项目:

国家重点研发计划(2020YFC1523203)


Tracing Method for Blockchain Transaction Execution Based on Recoding and Replay
Author:
Affiliation:

Fund Project:

  • 摘要
  • |
  • 图/表
  • |
  • 访问统计
  • |
  • 参考文献
  • |
  • 相似文献
  • |
  • 引证文献
  • |
  • 资源附件
  • |
  • 文章评论
    摘要:

    区块链上运行的智能合约具有一经部署难以修改、调用执行需经过共识等特点, 现有的需要修改智能合约代码或打断其执行过程的调试方法难以直接应用到智能合约上. 由于智能合约的运行过程由区块链交易顺序执行过程组成, 实现对区块链交易执行过程的追溯是提升智能合约可调试性的一个有效途径. 对区块链交易执行过程进行追溯主要目标是找出一条已经出块的区块链交易是如何得到当前的执行结果的. 区块链交易的执行依赖于区块链内部状态, 且该状态取决于之前区块链交易的执行结果, 因此存在着传递性依赖. 区块链交易的依赖性和区块链所提供的执行环境的特点给区块链交易执行追溯带来了挑战. 区块链交易执行追溯面临的挑战主要有3方面, 即如何从智能合约部署的生产环境中获取足够追溯的信息、如何获取区块链交易之间的依赖关系, 以及如何保证追溯结果与实际在线执行过程一致. 提出了一种基于录制重放的区块链交易执行追溯方法, 在合约容器中建立录制重放机制, 无需修改合约代码即可支持交易执行中对状态读写操作的录制, 并且不会打断智能合约运行; 提出了基于状态读写的交易依赖分析算法, 支持对存在依赖关系的前序交易进行按需回溯; 此外, 设计了录制读写操作记录的验证机制, 确保重放的执行过程与真实执行过程之间的一致性可被验证. 所提出的方法能够追溯区块链交易调用智能合约的执行过程, 可用于智能合约调试, 并且当智能合约异常造成损失时可用于举证. 在实验中对比了将录制的读写操作记录存储于链上和存储于链下之间的性能差异, 通过案例研究展示了所提方法在追溯区块链交易执行方面的有效性和优点.

    Abstract:

    Smart contracts running on the blockchain can hardly be modified after deployment, and their call and execution rely on a consensus procedure. Consequently, existing debugging methods that require the modification of the smart contract code or the interruption of execution cannot be directly applied to smart contracts. Since the running of a smart contract is composed of ordered execution of blockchain transactions, tracing the execution of the transactions is an effective approach to render the smart contract more debuggable. The major goal of tracing blockchain transaction execution is to unveil how a blockchain transaction produces such a result in execution. The execution of a blockchain transaction relies on the internal state of the blockchain, and this state is determined by the execution results of previous transactions, which results in transitive dependencies. Such dependencies and the characteristics of the execution environment the blockchain provides bring challenges to tracing. The tracing of blockchain transaction execution is mainly faced with three challenges: how to obtain enough information for tracing from the production environment in which the smart contract is deployed, how to obtain the dependencies among the blockchain transactions, and how to ensure the consistency between the result of tracing and the real execution online. This study proposes a tracing method for blockchain transaction execution based on recording and replay. By building a recording and replay mechanism in the contract container, the proposed method enables the recording of state reading and writing operations during transaction execution without modifying the contract code and interrupting the running of the smart contract. A transaction dependency analysis method based on state reading and writing is proposed to support the retracing of previous transactions linked by dependencies on demand. Moreover, a verification mechanism for reading and writing operation recording is designed to ensure that the consistency between the replaying execution and the real online execution can be verified. The tracing method can trace the execution of the blockchain transaction that calls the smart contract, which can be used in debugging of smart contracts. When loss is caused by the failure of smart contracts, the tracing result can be used as evidence. Experiments are conducted for a performance comparison between storing recorded reading and writing operations on chain and off chain. The advantages and effectiveness of the proposed method in tracing blockchain transaction execution are revealed by a case study.

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

陈胜,方明哲,蒋步云,李春晓,左春,李玉成,梁赓.基于录制重放的区块链交易执行追溯方法.软件学报,2023,34(10):4681-4704

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

京公网安备 11040202500063号