Defining the Ethereum Virtual Machine for Interactive Theorem Provers

  • Yoichi HiraiEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10323)


Smart contracts in Ethereum are executed by the Ethereum Virtual Machine (EVM). We defined EVM in Lem, a language that can be compiled for a few interactive theorem provers. We tested our definition against a standard test suite for Ethereum implementations. Using our definition, we proved some safety properties of Ethereum smart contracts in an interactive theorem prover Isabelle/HOL. To our knowledge, ours is the first formal EVM definition for smart contract verification that implements all instructions. Our definition can serve as a basis for further analysis and generation of Ethereum smart contracts.



We thank Sami Mäkelä for enabling Isabelle and Coq extractions and finding mistakes in our formalization. We thank Sidney Amani, Christian Reitwießner and the anonymous referees for their time and valuable comments on this paper.


  1. 1.
    The Coq proof assistant. Accessed 19 Dec 2016
  2. 2.
    Ethereum VM tests. Accessed 02 Jan 2017
  3. 3.
    Solidity 0.4.8-develop documentation. Accessed 19 Dec 2016
  4. 4.
    WebAssembly. Accessed 16 Dec 2016
  5. 5.
    Atzei, N., Bartoletti, M., Cimoli, T.: A survey of attacks on Ethereum smart contracts. Cryptology ePrint Archive (2016).
  6. 6.
    Batty, M., Owens, S., Sarkar, S., Sewell, P., Weber, T.: Mathematizing C++ concurrency. SIGPLAN Not. 46(1), 55–66 (2011)CrossRefzbMATHGoogle Scholar
  7. 7.
    Becker, H., et al.: Combining mechanized proofs and model-based testing in the formal analysis of a hypervisor. In: Fitzgerald, J., Heitmeyer, C., Gnesi, S., Philippou, A. (eds.) FM 2016. LNCS, vol. 9995, pp. 69–84. Springer, Cham (2016). CrossRefGoogle Scholar
  8. 8.
    Bhargavan, K., Delignat-Lavaud, A., Fournet, C., Gollamudi, A., Gonthier, G., Kobeissi, N., Kulatova, N., Rastogi, A., Sibut-Pinote, T., Swamy, N., Zanella-Béguelin, S.: Formal verification of smart contracts: short paper. In: PLAS 2016, pp. 91–96. ACM (2016)Google Scholar
  9. 9.
    Boyer, R.S., Yu, Y.: Automated proofs of object code for a widely used microprocessor. J. ACM 43(1), 166–192 (1996)MathSciNetCrossRefzbMATHGoogle Scholar
  10. 10.
    Fox, A.: Formal specification and verification of ARM6. In: Basin, D., Wolff, B. (eds.) TPHOLs 2003. LNCS, vol. 2758, pp. 25–40. Springer, Heidelberg (2003). CrossRefGoogle Scholar
  11. 11.
    Kennedy, A., Benton, N., Jensen, J.B., Dagand, P.E.: Coq: the world’s best macro assembler? In: PPDP 2013, pp. 13–24. ACM (2013)Google Scholar
  12. 12.
    Klein, G., Nipkow, T.: A machine-checked model for a Java-like language, virtual machine and compiler. ACM Trans. Program. Lang. Syst. 28(4), 619–695 (2006)CrossRefGoogle Scholar
  13. 13.
    Kumar, R., Myreen, M.O., Norrish, M., Owens, S.: CakeML: a verified implementation of ML. In: POPL 2014, pp. 179–191. ACM, New York (2014)Google Scholar
  14. 14.
    Leroy, X.: Formal verification of a realistic compiler. Commun. ACM 52(7), 107–115 (2009)CrossRefGoogle Scholar
  15. 15.
    Luu, L., Chu, D.H., Olickel, H., Saxena, P., Hobor, A.: Making smart contracts smarter. In: CCS 2016, pp. 254–269. ACM (2016)Google Scholar
  16. 16.
    Mulligan, D.P., Owens, S., Gray, K.E., Ridge, T., Sewell, P.: Lem: reusable engineering of real-world semantics. SIGPLAN Not. 49(9), 175–188 (2014)CrossRefzbMATHGoogle Scholar
  17. 17.
    Myreen, M.O., Gordon, M.J.C., Slind, K.: Decompilation into logic-improved. FMCAD 2012, 78–81 (2012)Google Scholar
  18. 18.
    Myreen, M.O., Fox, A.C.J., Gordon, M.J.C.: Hoare logic for ARM machine code. In: Arbab, F., Sirjani, M. (eds.) FSEN 2007. LNCS, vol. 4767, pp. 272–286. Springer, Heidelberg (2007). CrossRefGoogle Scholar
  19. 19.
    Nipkow, T., Wenzel, M., Paulson, L.C. (eds.): Isabelle/HOL: A Proof Assistant for Higher-Order Logic. LNCS, vol. 2283. Springer, Heidelberg (2002). zbMATHGoogle Scholar
  20. 20.
    Owens, S., Myreen, M.O., Kumar, R., Tan, Y.K.: Functional big-step semantics. In: Thiemann, P. (ed.) ESOP 2016. LNCS, vol. 9632, pp. 589–615. Springer, Heidelberg (2016). CrossRefGoogle Scholar
  21. 21.
    Ramananandro, T., Dos Reis, G., Leroy, X.: Formal verification of object layout for C++ multiple inheritance. SIGPLAN Not. 46(1), 67–80 (2011)CrossRefzbMATHGoogle Scholar
  22. 22.
    Roşu, G., Şerbănuţă, T.F.: An overview of the K semantic framework. J. Log. Algebr. Program. 79(6), 397–434 (2010)MathSciNetCrossRefzbMATHGoogle Scholar
  23. 23.
    Slind, K., Norrish, M.: A brief overview of HOL4. In: Mohamed, O.A., Muñoz, C., Tahar, S. (eds.) TPHOLs 2008. LNCS, vol. 5170, pp. 28–32. Springer, Heidelberg (2008). CrossRefGoogle Scholar
  24. 24.
    Tan, G., Appel, A.W.: A compositional logic for control flow. In: Emerson, E.A., Namjoshi, K.S. (eds.) VMCAI 2006. LNCS, vol. 3855, pp. 80–94. Springer, Heidelberg (2005). CrossRefGoogle Scholar
  25. 25.
    Wiedijk, F.: Pollack-inconsistency. Electron. Notes Theor. Comput. Sci. 285, 85–100 (2012)CrossRefzbMATHGoogle Scholar
  26. 26.
    Wood, G.: Ethereum: a secure decentralised generalised transaction ledger-EIP-150 revision. Accessed 19 Dec 2016

Copyright information

© International Financial Cryptography Association 2017

Authors and Affiliations

  1. 1.Ethereum FoundationBerlinGermany

Personalised recommendations