Skip to main content

A Formal Modeling Language for Smart Contracts

  • Conference paper
  • First Online:
Software Engineering and Formal Methods (SEFM 2024)

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 prevents reentrancy attacks, illustrating its efficacy in reinforcing the reliability and security of smart contracts within decentralized systems.

This work is funded by the ATHENE project “Model-centric Deductive Verification of Smart Contracts”.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    State variables in Solidity terminology.

  2. 2.

    As a contract might be associated with multiple locations, by a slight abuse of notation we identify \(\langle \mathcal {S}(v),m_v\rangle \) with \({\langle \kappa _1,m_v\rangle ,\ldots ,\langle \kappa _n,m_v\rangle }\), where \(\mathcal {S}(v) = \{\kappa _1,\ldots ,\kappa _n\)}.

References

  1. Aptos Blockchain. Official Website. https://aptos.dev/en

  2. Diem Blockchain. Official Website. https://www.diem.com/en-us/

  3. Ethereum. Official Website. https://ethereum.org/

  4. Hyperledger Fabric. Official Website. https://www.hyperledger.org/projects/fabric

  5. NXT. Official Website. https://nxt.org/

  6. Sui Foundation. Official Website. https://sui.io/about

  7. The Move Language. https://move-book.com/reference/

  8. Abdellatif, T., Brousmiche, K.L.: Formal verification of smart contracts based on users and blockchain behaviors models. In: NTMS, pp. 1–5. IEEE (2018)

    Google Scholar 

  9. Bashir, I.: Mastering Blockchain. Packt Publishing (2017)

    Google Scholar 

  10. Cecchetti, E., Yao, S., Ni, H., Myers, A.C.: Compositional security for reentrant applications. In: SP, pp. 1249–1267. IEEE (2021)

    Google Scholar 

  11. Coblenz, M., et al.: Obsidian: typestate and assets for safer blockchain programming. arXiv preprint arXiv:1909.03523 (2019)

  12. Das, A., Balzer, S., Hoffmann, J., Pfenning, F., Santurkar, I.: Resource-aware session types for digital contracts. In: 34th IEEE Computer Security Foundations Symposium, CSF 2021, pp. 1–16. IEEE (2021). https://doi.org/10.1109/CSF51468.2021.00004

  13. Lahiri, S.K., Chen, S., Wang, Y., Dillig, I.: Formal specification and verification of smart contracts for azure blockchain. arxiv preprint arXiv:1812.08829 (2018)

  14. Li, A., Choi, J.A., Long, F.: Securing smart contract with runtime validation. In: PLDI, pp. 438–453. ACM (2020)

    Google Scholar 

  15. Luu, L., Chu, D.H., Olickel, H., Saxena, P., Hobor, A.: Making Smart Contracts Smarter. In: CCS, pp. 254–269. ACM (2016)

    Google Scholar 

  16. Plotkin, G.D.: A structural approach to operational semantics. J. Log. Algebraic Methods Program. 60–61, 17–139 (2004)

    MathSciNet  Google Scholar 

  17. Schrans, F., Hails, D., Harkness, A., Drossopoulou, S., Eisenbach, S.: Flint for safer smart contracts. arxiv preprint arXiv:1904.06534 (2019)

  18. Sergey, I., Kumar, A., Hobor, A.: Scilla: a smart contract intermediate-level language. arXiv preprint arXiv:1801.00687 (2018)

  19. Sergey, I., Nagaraj, V., Johannsen, J., Kumar, A., Trunov, A., Hao, K.C.: Safer smart contract programming with Scilla. Proc. ACM Program. Lang. 3(OOPSLA), 185:1–185:30 (2019). https://doi.org/10.1145/3360611

  20. Siegel, D.: Understanding the DAO attack (2023). https://www.coindesk.com/learn/understanding-the-dao-attack/

  21. Tan, B., Mariano, B., Lahiri, S.K., Dillig, I., Feng, Y.: SolType: refinement types for arithmetic overflow in solidity. Proc. ACM Program. Lang. 6(POPL), 1–29 (2022)

    Google Scholar 

  22. Tsankov, P., Dan, A., Drachsler-Cohen, D., Gervais, A., Buenzli, F., Vechev, M.T.: Securify: practical security analysis of smart contracts. arXiv preprint arXiv:1806.01143 (2018)

  23. Veschetti, A., Bubel, R., Hähnle, R.: SmartML: towards a modeling language for smart contracts. arXiv preprint arXiv:2403.06622 (2024)

  24. Wöhrer, M., Zdun, U.: Smart contracts: security patterns in the ethereum ecosystem and solidity. In: IWBOSE@SANER, pp. 2–8. IEEE (2018)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Adele Veschetti .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2025 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Veschetti, A., Bubel, R., Hähnle, R. (2025). A Formal Modeling Language for Smart Contracts. In: Madeira, A., Knapp, A. (eds) Software Engineering and Formal Methods. SEFM 2024. Lecture Notes in Computer Science, vol 15280. Springer, Cham. https://doi.org/10.1007/978-3-031-77382-2_6

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-77382-2_6

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-77381-5

  • Online ISBN: 978-3-031-77382-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics