Smart contracts are small but highly error-prone programs that implement agreements between multiple parties. We present a reactive synthesis approach for the automatic construction of state machines implementing the temporal control flow of smart contracts. To accommodate typical smart contract specifications, we build on temporal stream logic (TSL) and extend it with a tailored form of parameterization. We show how to comprehensively specify the control flow of various types of common smart contracts, including ERC20 token systems, elections, and asset transfer protocols. We develop a synthesis algorithm based on the past-time fragment of TSL with parameters and show how to efficiently translate the resulting infinite-state machine to Solidity code. Our tool SCSynt implements the approach together with a feedback loop that warns the developer of potential specification errors. Our experiments show that SCSynt derives correct-by-construction Solidity code from formal smart contract specifications within seconds.
翻译:智能合同是执行多个当事方之间协议的小型但高度容易出错的方案。 我们为自动建造国家机器以实施智能合同的时间控制流程提供了一种被动的合成方法。 为了适应典型的智能合同规格,我们以时间流逻辑(TSL)为基础,并以量身定做的参数化形式扩展它。 我们展示了如何全面指定各种通用智能合同的控制流程,包括ECRC20象征性系统、选举和资产转移协议。 我们根据过去时段的TPL碎片和参数开发了一个合成算法,并展示了如何将由此产生的无限状态机器有效转换为固态代码。 我们的工具SCSynt将这种方法与一个反馈循环一起实施,警告潜在规格错误的开发者。 我们的实验显示, SSCynt在数秒内从正式的智能合同规范中获取了正确的、逐项构建的固化代码。