Formalising Decentralised Exchanges in Coq

Eske Hoy Nielsen, Danil Annenkov, Bas Spitters
3/11/2022
cs.LOcs.CR

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

Abstract

The number of attacks and accidents leading to significant losses of crypto-assets is growing. According to Chainalysis, in 2021, approx. $14 billion has been lost due to various incidents, and this number is dominated by Decentralized Finance (DeFi) applications.

Show full abstract

In order to address these issues, one can use a collection of tools ranging from auditing to formal methods. We use formal verification and provide the first formalisation of a DeFi contract in a foundational proof assistant capturing contract interactions. We focus on Dexter2, a decentralized, non-custodial exchange for the Tezos network similar to Uniswap on Ethereum. The Dexter implementation consists of several smart contracts. This poses unique challenges for formalisation due to the complex contract interactions. Our formalisation includes proofs of functional correctness with respect to an informal specification for the contracts involved in Dexter's implementation. Moreover, our formalisation is the first to feature proofs of safety properties of the interacting smart contracts of a decentralized exchange. We have extracted our contract from Coq into CameLIGO code, so it can be deployed on the Tezos blockchain. Uniswap and Dexter are paradigmatic for a collection of similar contracts. Our methodology thus allows us to implement and verify DeFi applications featuring similar interaction patterns.

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{nielsen2022formalising,
  title  = {Formalising Decentralised Exchanges in Coq},
  author = {Eske Hoy Nielsen and Danil Annenkov and Bas Spitters},
  year   = {2022},
  eprint = {2203.08016},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2203.08016}
}

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/2203.08016.svg)](https://codeofpaper.com/paper/2203.08016)

Discussion