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 grouping several instructions together; (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智能合同语言SCRIPT在互动理论证明Agda中以Bitcoin智能合同语言 SCRIPT 编写的程序。 它侧重于管理比特币分销的 SCIAPT 程序访问控制的安全性。 它主张,Hoare 3 中最弱的先决条件是核查访问控制的适当概念。 它旨在获得关于最弱的先决条件的可读描述,以缩小用户要求和智能合同正式规格之间的验证差距。 作为拟议方法的示例, 该文件侧重于两个标准 SCRIPT 程序, 管理比特币分销、 向公用钥匙 Hash (P2P2PKH) 和向Multisig (P2MS) 的准入控制安全性。 该文件介绍了用于P2PKH3 3 3 的最弱的先决条件的操作性说明。 它在Agda 校正助理中正式化, 并解释使用HA3 3 。 讨论两种获取最弱先决条件的可读描述方法:(1) 智能PBIBT 方法, 它通过指令进行反向方向教学, 有时分, 有时将一些指示, 预变为AKMLTLTLID 。