Extracting Smart Contracts Tested and Verified in Coq

Danil Annenkov, Mikkel Milo, Jakob Botsch Nielsen, Bas Spitters
12/16/2020
14 citations
cs.PLcs.LO

Official code: AU-COBRA/ConCert (128 stars, Rocq Prover, MIT, last commit 2026-08-25).

Abstract

We implement extraction of Coq programs to functional languages based on MetaCoq's certified erasure. As part of this, we implement an optimisation pass removing unused arguments.

Show full abstract

We prove the pass correct wrt. a conventional call-by-value operational semantics of functional languages. We apply this to two functional smart contract languages, Liquidity and Midlang, and to the functional language Elm. Our development is done in the context of the ConCert framework that enables smart contract verification. We contribute a verified boardroom voting smart contract featuring maximum voter privacy such that each vote is kept private except under collusion of all other parties. We also integrate property-based testing into ConCert using QuickChick and our development is the first to support testing properties of interacting smart contracts. We test several complex contracts such as a DAO-like contract, an escrow contract, an implementation of a Decentralized Finance (DeFi) contract which includes a custom token standard (Tezos FA2), and more. In total, this gives us a way to write dependent programs in Coq, test them semi-automatically, verify, and then extract to functional smart contract languages, while retaining a small trusted computing base of only MetaCoq and the pretty-printers into these languages.

View on arXivView PDF

Code Implementations(1)

AU-COBRA/ConCertOfficial100%
MIT

A framework for smart contract verification in Coq

12823Rocq Prover, RustJan 10, 20193 months agoMIT
blockchaincoqsmart-contractsverification

Similar Papers

Cite this paper

@article{annenkov2020extracting,
  title  = {Extracting Smart Contracts Tested and Verified in Coq},
  author = {Danil Annenkov and Mikkel Milo and Jakob Botsch Nielsen and Bas Spitters},
  year   = {2020},
  eprint = {2012.09138},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2012.09138}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2012.09138.svg)](https://codeofpaper.com/paper/2012.09138)

Discussion