Table of Contents
Fetching ...

SmartML: Towards a Modeling Language for Smart Contracts

Adele Veschetti, Richard Bubel, Reiner Hähnle

TL;DR

SmartML tackles the prevalence of smart contract vulnerabilities by introducing a platform‑independent modeling language with a formal SOS semantics and a type system focused on safe reentrancy. It defines precise notions of reentrancy safety, contract locations, and a locking mechanism that staticly enforces safe interaction patterns, enabling automatic verification and reducing the risk of attacks. Through a case study, it demonstrates how aliasing and the lock set Δ prevent unsafe reentrant calls across single, cross‑function, and cross‑contract scenarios, while allowing safe tail reentrancy. The work aims to bridge the gap between practical contract development and rigorous verification, offering a foundation for automated proofs, static analysis, and future translation between SmartML and existing languages to enhance security in decentralized systems.

Abstract

Smart contracts codify real-world transactions and automatically execute the terms of the contract when predefined conditions are met. This paper proposes SmartML, a modeling language for smart contracts that is platform independent and easy to comprehend. We detail its formal semantics and type system with a focus on its role in addressing security vulnerabilities. We show along a case study, how SmartML contributes to the prevention of reentrancy attacks, illustrating its efficacy in reinforcing the reliability and security of smart contracts within decentralized systems.

SmartML: Towards a Modeling Language for Smart Contracts

TL;DR

SmartML tackles the prevalence of smart contract vulnerabilities by introducing a platform‑independent modeling language with a formal SOS semantics and a type system focused on safe reentrancy. It defines precise notions of reentrancy safety, contract locations, and a locking mechanism that staticly enforces safe interaction patterns, enabling automatic verification and reducing the risk of attacks. Through a case study, it demonstrates how aliasing and the lock set Δ prevent unsafe reentrant calls across single, cross‑function, and cross‑contract scenarios, while allowing safe tail reentrancy. The work aims to bridge the gap between practical contract development and rigorous verification, offering a foundation for automated proofs, static analysis, and future translation between SmartML and existing languages to enhance security in decentralized systems.

Abstract

Smart contracts codify real-world transactions and automatically execute the terms of the contract when predefined conditions are met. This paper proposes SmartML, a modeling language for smart contracts that is platform independent and easy to comprehend. We detail its formal semantics and type system with a focus on its role in addressing security vulnerabilities. We show along a case study, how SmartML contributes to the prevention of reentrancy attacks, illustrating its efficacy in reinforcing the reliability and security of smart contracts within decentralized systems.
Paper Structure (18 sections, 3 theorems, 10 equations, 2 figures, 7 tables)

This paper contains 18 sections, 3 theorems, 10 equations, 2 figures, 7 tables.

Key Result

Theorem 1

Let $c = \mathtt{contract}~C~\mathtt{extends}~D\; \{\ldots\}$ be a contract with $\vdash c\ \sf{ok}$, $s$ a statement of $c$. If $\Gamma; \Delta; \mathcal{S}; \mathcal{L} \vdash s : \mathit{stm} \Rrightarrow \Gamma'; \Delta';\mathcal{S}';\mathcal{L}'$ and $\mathit{cfg}[\mathit{s}] \leadsto \mathit{c

Figures (2)

  • Figure 1: Type derivation for the example (relevant checks and changes to $\Delta$ only)
  • Figure 2: Overview of the SmartML framework

Theorems & Definitions (15)

  • Definition 1: Domain and State
  • Definition 2: Configuration
  • definition thmcounterdefinition: Reachable Configuration
  • definition thmcounterdefinition: Rentrance
  • definition thmcounterdefinition: Strict Reentrance Safety
  • definition thmcounterdefinition: Non-Modifying Reentrance Safety
  • definition thmcounterdefinition: Modifying Reentrance Safety
  • definition thmcounterdefinition: Contract Identities, Locations
  • definition thmcounterdefinition: Partial State
  • Theorem 1: Type Preservation
  • ...and 5 more