Verification of Bitcoin Script in Agda using Weakest Preconditions for Access Control

03/06/2022
by   Fahad F. Alhabardi, et al.
0

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

READ FULL TEXT

page 3

page 5

page 6

page 7

page 11

page 13

page 16

page 17

research
05/29/2020

WhylSon: Proving your Michelson Smart Contracts in Why3

This paper introduces WhylSon, a deductive verification tool for smart c...
research
11/28/2020

Verification of recursive Bitcoin contracts

Smart contracts - computer protocols that regulate the exchange of crypt...
research
06/07/2019

Smart Contract Design Meets State Machine Synthesis: Case Studies

Modern blockchain systems support creation of smart contracts -- statefu...
research
10/11/2018

FEther: An Extensible Definitional Interpreter for Smart-contract Verifications in Coq

Blockchain technology adds records to a list using cryptographic links. ...
research
09/26/2018

Towards Safer Smart Contracts: A Survey of Languages and Verification Methods

With a market capitalisation of over USD 205 billion in just under ten y...
research
03/16/2023

Smart Contract Generation for Inter-Organizational Process Collaboration

Currently, inter-organizational process collaboration (IOPC) has been wi...
research
08/26/2018

Optimization of Executable Formal Interpreters developed in Higher-order Theorem Proving Systems

In recent publications, we presented a novel formal symbolic process vir...

Please sign up or login with your details

Forgot password? Click here to reset