Skip to main content

Modeling Smart Contracts with Probabilistic Logic Programming

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Business Information Processing ((LNBIP,volume 394))

Abstract

Smart contracts are computer programs that run in a distributed network, the blockchain. These contracts are used to regulate the interaction among parties in a fully decentralized way without the need of a trusted authority and, once deployed, are immutable. The immutability property requires that the programs should be deeply analyzed and tested, in order to ensure that they behave as expected and to avoid bugs and errors. In this paper, we present a method to translate smart contracts into probabilistic logic programs that can be used to analyse expected values of several smart contract’s utility parameters and to get a quantitative idea on how smart contracts variables changes over time. Finally, we applied this method to study three real smart contracts deployed on the Ethereum blockchain.

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

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 1.

    https://etherscan.io/.

  2. 2.

    https://dappradar.com/.

  3. 3.

    http://www.fe.infn.it/coka/doku.php?id=start.

  4. 4.

    https://www.gnu.org/software/time/.

  5. 5.

    https://gist.github.com/loiluu/0363070e1bada977f6192c8e78348438.

  6. 6.

    https://bitinfocharts.com/ethereum/.

  7. 7.

    http://cplint.eu/.

References

  1. Alberti, M., Cota, G., Riguzzi, F., Zese, R.: Probabilistic logical inference on the web. In: Adorni, G., Cagnoni, S., Gori, M., Maratea, M. (eds.) AI*IA 2016 Advances in Artificial Intelligence. Lecture Notes in Computer Science, vol. 10037, pp. 351–363. Springer, Berlin (2016)

    Chapter  Google Scholar 

  2. Atzei, N., Bartoletti, M., Cimoli, T.: A survey of attacks on Ethereum smart contracts (SoK). In: Maffei, M., Ryan, M. (eds.) POST 2017. LNCS, vol. 10204, pp. 164–186. Springer, Heidelberg (2017). https://doi.org/10.1007/978-3-662-54455-6_8

    Chapter  Google Scholar 

  3. Azzolini, D., Riguzzi, F., Lamma, E.: Studying transaction fees in the Bitcoin blockchain with probabilistic logic programming. Information 10(11), 335 (2019)

    Article  Google Scholar 

  4. Azzolini, D., Riguzzi, F., Lamma, E., Bellodi, E., Zese, R.: Modeling bitcoin protocols with probabilistic logic programming. In: Bellodi, E., Schrijvers, T. (eds.) Proceedings of the 5th International Workshop on Probabilistic Logic Programming, PLP 2018, Co-located with the 28th International Conference on Inductive Logic Programming (ILP 2018), Ferrara, Italy, 1 September 2018, CEUR Workshop Proceedings, vol. 2219, pp. 49–61. CEUR-WS.org (2018)

    Google Scholar 

  5. Azzolini, D., Riguzzi, F., Masotti, F., Lamma, E.: A comparison of MCMC sampling for probabilistic logic programming. In: Alviano, M., Greco, G., Scarcello, F. (eds.) AI*IA 2019. LNCS (LNAI), vol. 11946, pp. 18–29. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-35166-3_2

    Chapter  Google Scholar 

  6. Bartoletti, M., Carta, S., Cimoli, T., Saia, R.: Dissecting Ponzi schemes on Ethereum: identification, analysis, and impact. arXiv preprint arXiv:1703.03779 (2017)

  7. Bartoletti, M., Pes, B., Serusi, S.: Data mining for detecting Bitcoin Ponzi schemes. In: Crypto Valley Conference on Blockchain Technology, CVCBT 2018, Zug, Switzerland, 20–22 June 2018, pp. 75–84. IEEE (2018)

    Google Scholar 

  8. Chatterjee, K., Goharshady, A.K., Velner, Y.: Quantitative analysis of smart contracts. In: Ahmed, A. (ed.) ESOP 2018. LNCS, vol. 10801, pp. 739–767. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-89884-1_26

    Chapter  Google Scholar 

  9. Ciatto, G., Calegari, R., Mariani, S., Denti, E., Omicini, A.: From the blockchain to logic programming and back: research perspectives. In: Cossentino, M., Sabatucci, L., Seidita, V. (eds.) Proceedings of the 19th Workshop from Objects to Agents, Palermo, Italy, 28–29 June 2018, CEUR Workshop Proceedings, vol. 2215, pp. 69–74. CEUR-WS.org (2018)

    Google Scholar 

  10. Darwiche, A., Marquis, P.: A knowledge compilation map. J. Artif. Intell. Res. 17, 229–264 (2002)

    Article  MathSciNet  Google Scholar 

  11. De Raedt, L., Kimmig, A.: Probabilistic (logic) programming concepts. Mach. Learn. 100(1), 5–47 (2015). https://doi.org/10.1007/s10994-015-5494-z

    Article  MathSciNet  MATH  Google Scholar 

  12. Haber, S., Stornetta, W.S.: How to time-stamp a digital document. In: Menezes, A.J., Vanstone, S.A. (eds.) CRYPTO 1990. LNCS, vol. 537, pp. 437–455. Springer, Heidelberg (1991). https://doi.org/10.1007/3-540-38424-3_32

    Chapter  Google Scholar 

  13. Hirai, Y.: Defining the Ethereum virtual machine for interactive theorem provers. In: Brenner, M., et al. (eds.) FC 2017. LNCS, vol. 10323, pp. 520–535. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-70278-0_33

    Chapter  Google Scholar 

  14. Idelberger, F., Governatori, G., Riveret, R., Sartor, G.: Evaluation of logic-based smart contracts for blockchain systems. In: Alferes, J.J.J., Bertossi, L., Governatori, G., Fodor, P., Roman, D. (eds.) RuleML 2016. LNCS, vol. 9718, pp. 167–183. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-42019-6_11

    Chapter  Google Scholar 

  15. Kalra, S., Goel, S., Dhawan, M., Sharma, S.: ZEUS: analyzing safety of smart contracts. In: 25th Annual Network and Distributed System Security Symposium, NDSS 2018, San Diego, California, USA, 18–21 February 2018 (2018)

    Google Scholar 

  16. Koller, D., Friedman, N.: Probabilistic Graphical Models: Principles and Techniques. Adaptive Computation and Machine Learning. MIT Press, Cambridge (2009)

    MATH  Google Scholar 

  17. Luu, L., Chu, D.H., Olickel, H., Saxena, P., Hobor, A.: Making smart contracts smarter. In: Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, pp. 254–269. ACM (2016)

    Google Scholar 

  18. Nakamoto, S.: Bitcoin: A peer-to-peer electronic cash system (2008)

    Google Scholar 

  19. Fadja, A.N., Riguzzi, F.: Probabilistic logic programming in action. In: Holzinger, A., Goebel, R., Ferri, M., Palade, V. (eds.) Towards Integrative Machine Learning and Knowledge Extraction. LNCS (LNAI), vol. 10344, pp. 89–116. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-69775-8_5

    Chapter  Google Scholar 

  20. Riguzzi, F.: MCINTYRE: a Monte Carlo system for probabilistic logic programming. Fund. Inform. 124(4), 521–541 (2013)

    MathSciNet  Google Scholar 

  21. Riguzzi, F.: The distribution semantics for normal programs with function symbols. Int. J. Approximate Reasoning 77, 1–19 (2016)

    Article  MathSciNet  Google Scholar 

  22. Riguzzi, F.: Foundations of Probabilistic Logic Programming. River Publishers, Gistrup (2018)

    MATH  Google Scholar 

  23. Riguzzi, F., Bellodi, E., Lamma, E., Zese, R., Cota, G.: Probabilistic logic programming on the web. Softw. Pract. Experience 46(10), 1381–1396 (2016)

    Article  Google Scholar 

  24. Riguzzi, F., Swift, T.: The PITA system: tabling and answer subsumption for reasoning under uncertainty. Theor. Pract. Logic Program. 11(4–5), 433–449 (2011)

    Article  MathSciNet  Google Scholar 

  25. Sato, T.: A statistical learning method for logic programs with distribution semantics. In: Sterling, L. (ed.) ICLP 1995, pp. 715–729. MIT Press (1995)

    Google Scholar 

  26. Szabo, N.: Smart contracts (1994)

    Google Scholar 

  27. Van Gelder, A., Ross, K.A., Schlipf, J.S.: The well-founded semantics for general logic programs. J. ACM 38(3), 620–650 (1991)

    MathSciNet  MATH  Google Scholar 

  28. Vasek, M., Moore, T.: Analyzing the Bitcoin Ponzi scheme ecosystem. In: Zohar, A., et al. (eds.) FC 2018. LNCS, vol. 10958, pp. 101–112. Springer, Heidelberg (2019). https://doi.org/10.1007/978-3-662-58820-8_8

    Chapter  Google Scholar 

  29. Vennekens, J., Verbaeten, S., Bruynooghe, M.: Logic programs with annotated disjunctions. In: Demoen, B., Lifschitz, V. (eds.) ICLP 2004. LNCS, vol. 3132, pp. 431–445. Springer, Heidelberg (2004). https://doi.org/10.1007/978-3-540-27775-0_30

    Chapter  MATH  Google Scholar 

  30. Wielemaker, J., Schrijvers, T., Triska, M., Lager, T.: SWI-Prolog. Theor. Pract. Logic Program. 12(1–2), 67–96 (2012)

    Article  MathSciNet  Google Scholar 

  31. Wood, G.: Ethereum: A secure decentralised generalised transaction ledger. Ethereum Proj. Yellow Pap. 151, 1–32 (2014)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Damiano Azzolini .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Azzolini, D., Riguzzi, F., Lamma, E. (2020). Modeling Smart Contracts with Probabilistic Logic Programming. In: Abramowicz, W., Klein, G. (eds) Business Information Systems Workshops. BIS 2020. Lecture Notes in Business Information Processing, vol 394. Springer, Cham. https://doi.org/10.1007/978-3-030-61146-0_7

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-61146-0_7

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-61145-3

  • Online ISBN: 978-3-030-61146-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics