应用科学学报 ›› 2021, Vol. 39 ›› Issue (1): 1-16.doi: 10.3969/j.issn.0255-8297.2021.01.001

• 区块链 • 上一篇    

带时间约束的智能合约验证

赵颖琪1,2, 朱雪阳1,2, 李广元1,2, 高雅1,2, 包玉龙1,2   

  1. 1. 中国科学院软件研究所 计算机科学国家重点实验室, 北京 100190;
    2. 中国科学院大学, 北京 100049
  • 收稿日期:2020-11-12 发布日期:2021-02-04
  • 通信作者: 朱雪阳,副研究员,研究方向为嵌入式系统设计、形式化方法等。E-mail:zxy@ios.ac.cn E-mail:zxy@ios.ac.cn
  • 基金资助:
    国家自然科学基金(No.62072443)资助

Verification of Smart Contracts with Time Constraints

ZHAO Yingqi1,2, ZHU Xueyang1,2, LI Guangyuan1,2, GAO Ya1,2, BAO Yulong1,2   

  1. 1. State Key Laboratory of Computer Science, Institute of Software, Chinese Academy of Sciences, Beijing 100190, China;
    2. University of the Chinese Academy of Sciences, Beijing 100049, China
  • Received:2020-11-12 Published:2021-02-04

摘要: 在现实生活中有一类智能合约与时间紧密相关,而合约是否满足这类时间性质将直接影响应用的正确性。为了避免合约部署后出现严重的问题,将以太坊上的智能合约为研究对象定义智能合约的时间自动机语义,再将智能合约转换为时间自动机模型,接着用模型检测工具UPPAAL检测智能合约是否满足以时序逻辑公式表示的实时性质。最后对竞拍合约以及飞机保险购买合约进行了实例研究,其结果可以展示合约的实时性质是否得以满足。若不满足则可以根据反例定位合约出现的问题点,显示了该工作的有效性。

关键词: 区块链, 智能合约, Solidity, 时间约束, 模型检测

Abstract: In real life, a type of smart contract is closely related to time constraint, and whether the contract meets its time property will directly affect the correctness of its applications. In order to avoid serious problems after its deployment, this paper focuses on smart contracts of Ethereum, gives a timed automata semantics for smart contracts, after the smart contract is converted into a time automata model, and uses model checking tool UPPAAL to check whether the smart contract meets timed properties expressed by temporal logic formulas. Finally, we study two cases, an auction contract and a flight insurance contract. Experimental results indicate whether the real-time property is satisfied. If not, counter examples can be used to locate the problem points in the smart contract, showing the effectiveness of the work.

Key words: blockchain, smart contract, Solidity, time constraint, model checking

中图分类号: