Skip to main content

Translation Certification for Smart Contracts

  • Conference paper
  • First Online:
Functional and Logic Programming (FLOPS 2022)

Abstract

Compiler correctness is an old problem, but with the emergence of smart contracts on blockchains that problem presents itself in a new light. Smart contracts are self-contained pieces of software that control (valuable) assets in an adversarial environment; once committed to the blockchain, these smart contracts cannot be modified. Smart contracts are typically developed in a high-level contract language and compiled to low-level virtual machine code before being committed to the blockchain. For a smart contract user to trust a given piece of low-level code on the blockchain, they must convince themselves that (a) they are in possession of the matching source code and (b) that the compiler has correctly translated the source code to the given low-level code.

Classic approaches to compiler correctness tackle the second point. We argue that translation certification also squarely addresses the first. We describe the proof architecture of a novel translation certification framework, implemented in Coq, for a functional smart contract language. We demonstrate that we can model the compilation pipeline as a sequence of translation relations that facilitate a modular verification methodology and are robust in the face of an evolving compiler implementation.

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.

    https://developers.cardano.org/docs/smart-contracts/plutus/.

  2. 2.

    http://cardano.org is, at the time of writing, the 5th largest public blockchain by market capitalisation.

  3. 3.

    https://arxiv.org/abs/2201.04919.

  4. 4.

    https://etherscan.io/verifyContract.

References

  1. Abadi, M., Cardelli, L., Plotkin, G.: Types for the Scott numerals (1993)

    Google Scholar 

  2. Ahmed, A.: Step-indexed syntactic logical relations for recursive and quantified types. In: Sestoft, P. (ed.) ESOP 2006. LNCS, vol. 3924, pp. 69–83. Springer, Heidelberg (2006). https://doi.org/10.1007/11693024_6

    Chapter  Google Scholar 

  3. Anand, A., et al.: CertiCoq: a verified compiler for Coq. In: The Third International Workshop on Coq for Programming Languages (CoqPL) (2017)

    Google Scholar 

  4. Annenkov, D., Nielsen, J.B., Spitters, B.: ConCert: a smart contract certification framework in Coq. In: Proceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and Proofs, pp. 215–228 (2020)

    Google Scholar 

  5. Maffei, M., Ryan, M. (eds.): POST 2017. LNCS, vol. 10204. Springer, Heidelberg (2017). https://doi.org/10.1007/978-3-662-54455-6

    Book  Google Scholar 

  6. Barras, B., et al.: The Coq proof assistant reference manual: Version 6.1. Ph.D. thesis, Inria (1997)

    Google Scholar 

  7. Barthe, G., Fournet, C., Grégoire, B., Strub, P.Y., Swamy, N., Zanella-Béguelin, S.: Probabilistic relational verification for cryptographic implementations. ACM SIGPLAN Not. 49(1), 193–205 (2014)

    Article  Google Scholar 

  8. Bernardo, B., Cauderlier, R., Hu, Z., Pesin, B., Tesson, J.: Mi-Cho-Coq, a framework for certifying tezos smart contracts. In: Sekerinski, E., et al. (eds.) FM 2019. LNCS, vol. 12232, pp. 368–379. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-54994-7_28

    Chapter  Google Scholar 

  9. Bertot, Y., Castéran, P.: Interactive Theorem Proving and Program Development: Coq’Art: The Calculus of Inductive Constructions. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-662-07964-5

    Book  MATH  Google Scholar 

  10. Bhargavan, K., et al.: Formal verification of smart contracts: short paper. In: Proceedings of the 2016 ACM Workshop on Programming Languages and Analysis for Security, pp. 91–96 (2016)

    Google Scholar 

  11. Breitner, J., Spector-Zabusky, A., Li, Y., Rizkallah, C., Wiegley, J., Weirich, S.: Ready, set, verify! applying hs-to-coq to real-world Haskell code (experience report). In: Proceedings of the ACM on Programming Languages 2(ICFP), pp. 1–16 (2018)

    Google Scholar 

  12. Buterin, V.: CRITICAL UPDATE Re: DAO Vulnerability (2016). https://blog.ethereum.org/2016/06/17/critical-update-re-dao-vulnerability/, Accessed 10 Dec 2021

  13. Hutton, G. (ed.): MPC 2019. LNCS, vol. 11825. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-33636-3

    Book  MATH  Google Scholar 

  14. Dral, J.: Verified Compiler Optimisations. Master’s thesis, Utrecht University (2022)

    Google Scholar 

  15. GHC Team: GHC 9.0 User Manual. https://downloads.haskell.org/~ghc/9.0.1/docs/html/users_guide/extending_ghc.html

  16. Giegerich, R., Möncke, U.: Invariance of approximative semantics with respect to program transformations. In: GI-11. Jahrestagung, pp. 1–10. Springer, Heidelberg (1981). https://doi.org/10.1007/978-3-662-01089-1_1

  17. Gonthier, G., Le, R.S.: An Ssreflect Tutorial. Ph.D. thesis, INRIA (2009)

    Google Scholar 

  18. IOHK: The Plutus Platform and Marlowe 1.0.0 documentation. https://plutus.readthedocs.io/en/latest/plutus/tutorials/plutus-tx.html

  19. Jones, M.P., Gkoumas, V., Kireev, R., MacKenzie, K., Nester, C., Wadler, P.: Unraveling recursion: compiling an IR with recursion to system F. In: Hutton, G. (ed.) MPC 2019. LNCS, vol. 11825, pp. 414–443. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-33636-3_15

    Chapter  Google Scholar 

  20. Kumar, R., Myreen, M.O., Norrish, M., Owens, S.: CakeML: a verified implementation of ML. ACM SIGPLAN Not. 49(1), 179–191 (2014)

    Article  Google Scholar 

  21. Leroy, X., Blazy, S., Kästner, D., Schommer, B., Pister, M., Ferdinand, C.: CompCert–a formally verified optimizing compiler. In: ERTS 2016: Embedded Real Time Software and Systems, 8th European Congress (2016)

    Google Scholar 

  22. Li, J.M., Appel, A.W.: Deriving efficient program transformations from rewrite rules. Proc. ACM Program. Lang. 5(ICFP), 1–29 (2021)

    Google Scholar 

  23. Necula, G.C.: Proof-carrying code. In: Proceedings of the 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 106–119 (1997)

    Google Scholar 

  24. Necula, G.C., Lee, P.: The design and implementation of a certifying compiler. SIGPLAN Not. 39(4), 612–625 (2004)

    Article  Google Scholar 

  25. O’Connor, L., et al.: Cogent: uniqueness types and certifying compilation. J. Funct. Program. 31, e25 (2021)

    Google Scholar 

  26. Lahiri, S.K., Wang, C. (eds.): CAV 2020. LNCS, vol. 12224. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-53288-8

    Book  Google Scholar 

  27. Pnueli, A., Siegel, M., Singerman, E.: Translation validation. In: Steffen, B. (ed.) TACAS 1998. LNCS, vol. 1384, pp. 151–166. Springer, Heidelberg (1998). https://doi.org/10.1007/BFb0054170

    Chapter  Google Scholar 

  28. Sozeau, M., et al.: The MetaCoq project. J. Autom. Reas. 64, 947–999 (2020)

    Article  MathSciNet  Google Scholar 

  29. Spector-Zabusky, A., Breitner, J., Rizkallah, C., Weirich, S.: Total Haskell is reasonable Coq. In: Proceedings of the 7th ACM SIGPLAN International Conference on Certified Programs and Proofs, pp. 14–27 (2018)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Jacco O. G. Krijnen .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2022 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Krijnen, J.O.G., Chakravarty, M.M.T., Keller, G., Swierstra, W. (2022). Translation Certification for Smart Contracts. In: Hanus, M., Igarashi, A. (eds) Functional and Logic Programming. FLOPS 2022. Lecture Notes in Computer Science, vol 13215. Springer, Cham. https://doi.org/10.1007/978-3-030-99461-7_6

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-99461-7_6

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-99460-0

  • Online ISBN: 978-3-030-99461-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics