Skip to main navigation Skip to search Skip to main content

Modeling and Verification of Solidity Smart Contracts with the B Method

  • Fayçal Baba
  • , Amel Mammar
  • , Marc Frappier
  • , Régine Laleau
  • Université de PARIS XII
  • Université de Sherbrooke

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review

Abstract

Smart contracts written using the Solidity programming language of the Ethereum platform are well-known to be subject to bugs and vulnerabilities, which already have led to the loss of millions of dollars worth of assets. Since smart contract code cannot be updated to patch security flaws, reasoning about smart contract correctness to ensure the absence of vulnerabilities before their deployment is of the utmost importance. In this paper, we present a formal approach for generating correct smart contracts from B specification that verify safety properties. Our approach consists of two phases: first a smart contract and its properties are specified and verified in B, then a set of rules we defined are applied to generate the correct smart contract code in Solidity. The approach is implemented in a tool that can generate Solidity contract from a proven B project. The whole approach is demonstrated by a case study on the ERC-20 (Ethereum Request for Comments 20) Wrapped Ether (WETH) contract, which is abstractly specified in B, with invariants stating correctness properties, modeled checked with ProB for temporal properties, implemented in B0, proven correct, and automatically translated into a Solidity contract.

Original languageEnglish
Title of host publicationEngineering of Complex Computer Systems - 28th International Conference, ICECCS 2024, Proceedings
EditorsGuangdong Bai, Fuyuki Ishikawa, Yamine Ait-Ameur, George A. Papadopoulos
PublisherSpringer Science and Business Media Deutschland GmbH
Pages159-178
Number of pages20
ISBN (Print)9783031664557
DOIs
Publication statusPublished - 1 Jan 2025
Event28th International Conference on Engineering of Complex Computer Systems, ICECCS 2024 - Limassol, Cyprus
Duration: 19 Jun 202421 Jun 2024

Publication series

NameLecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
Volume14784 LNCS
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349

Conference

Conference28th International Conference on Engineering of Complex Computer Systems, ICECCS 2024
Country/TerritoryCyprus
CityLimassol
Period19/06/2421/06/24

Keywords

  • B Method
  • Blockchain
  • Formal modeling and verification
  • Refinement
  • Smart contract
  • Solidity

Fingerprint

Dive into the research topics of 'Modeling and Verification of Solidity Smart Contracts with the B Method'. Together they form a unique fingerprint.

Cite this