This paper contributes to the verification of programs written in Bitcoin's smart contract language script in the interactive theorem prover Agda. It focuses on the security property of access control for script programs that govern the distribution of Bitcoins. It advocates that weakest preconditions in the context of Hoare triples are the appropriate notion for verifying access control. It aims at obtaining human-readable descriptions of weakest preconditions in order to close the validation gap between user requirements and formal specification of smart contracts. As examples for the proposed approach, the paper focuses on two standard script programs that govern the distribution of Bitcoins, Pay to Public Key Hash (P2PKH) and Pay to Multisig (P2MS). The paper introduces an operational semantics of the script commands used in P2PKH and P2MS, which is formalised in the Agda proof assistant and reasoned about using Hoare triples. Two methodologies for obtaining human-readable descriptions of weakest preconditions are discussed: (1) a step-by-step approach, which works backwards instruction by instruction through a script, sometimes stepping over several instructions in one go; (2) symbolic execution of the code and translation into a nested case distinction, which allows to read off weakest preconditions as the disjunction of conjunctions of conditions along accepting paths. A syntax for equational reasoning with Hoare Triples is defined in order to formalise those approaches in Agda. Keywords and phrases: Blockchain; Cryptocurrency; Bitcoin; Agda; Verification; Hoare logic; Bitcoin script; P2PKH; P2MS; Access control; Weakest precondition; Predicate transformer semantics; Provable correctness; Symbolic execution; Smart contracts
翻译:本文有助于核实 Bitcoin 智能合同语言脚本在互动理论验证器 Agda 中写入的程序。 它侧重于用于管理 Bitcoins 分布的脚本程序访问控制的安全性。 它主张, Hoare 三进制背景下最弱的先决条件是核查访问控制的适当概念。 它旨在获取最弱先决条件的可读描述,以缩小用户要求和智能合同正式规格之间的验证差距。 作为拟议方法的例子, 该文件侧重于两个标准脚本程序, 用于管理 Bitcoins 的分布, 向公钥 Hash (P2PKH) 支付 和向 Multisig (P2MS) 支付 。 该文件介绍了P2P2PKHA 和 P2MS 中使用的脚本命令的操作性修饰性。 它在 Agda 校验助理中正式化了对最弱先决条件的描述, 以人类可读性描述最弱先决条件的两种方法。 讨论:(1) 递增方法, 它通过脚本方法, 有时在多个指令上跳过几个指令; (2) 象征性地执行HOrilleal- train intribilate rialationalationalate; 将代码转换变成变为标准; 。