O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Smart Contracts are More than Objects: Pro-activeness on the Blockchain

In this this paper we focus on the expressiveness of smart contracts (SC) and its role in blockchain technologies (BCT), by presenting Tenderfone, a prototypical blockchain platform providing SC as pro-active, time-aware, and asynchronous entities.

  • Entre para ver os comentários

  • Seja a primeira pessoa a gostar disto

Smart Contracts are More than Objects: Pro-activeness on the Blockchain

  1. 1. Smart Contracts are more than Objects: Pro-activeness on the Blockchain Giovanni Ciatto1 Alfredo Maffi1 Stefano Mariani2 Andrea Omicini1 giovanni.ciatto@unibo.it alfredo.maffi@studio.unibo.it stefano.mariani@unimore.it andrea.omicini@unibo.it 1Dipartimento di Informatica – Scienza e Ingegneria—Universit`a di Bologna 2Dipartimento di Scienze e Metodi dell’Ingegneria, Universit`a di Modena e Reggio Emilia 1st International Congress on Blockchain and Applications ´Avila, Spain – June 27, 2019 Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 1 / 20
  2. 2. Outline 1 The Problem with Blockchain Smart Contracts 2 Towards Pro-activity & Asynchrony 3 The Tenderfone Language & Interpreter 4 Tenderfone Internals: Overview Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 2 / 20
  3. 3. The Problem with Blockchain Smart Contracts Next in Line. . . 1 The Problem with Blockchain Smart Contracts 2 Towards Pro-activity & Asynchrony 3 The Tenderfone Language & Interpreter 4 Tenderfone Internals: Overview Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 3 / 20
  4. 4. The Problem with Blockchain Smart Contracts Context Most recent and interesting BCT come with Smart Contracts (SC) i.e., trusted, autonomous intermediaries for users transacting on BCT inspired to Szabo’s idea of self-enforcing contracts [Szabo, 1997] an idea which is interesting even beyond financial applications e.g. for enforcing interaction protocols in multi agent systems computationally interpreted through object orientated programming Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 4 / 20
  5. 5. The Problem with Blockchain Smart Contracts Motivation Our claim The mainstream interpretation of SC as objects is inherently flawed the method call semantics for SC comm. is subtle and bug-prone e.g. Ethereum’s unexpected recursion [Luu et al., 2016, Atzei et al., 2017] as objects, SC are constrained in the sorts of things they can do e.g. they are purely user-reative =⇒ no user invocation means no action e.g. lack of time-reactiveness =⇒ no time-dependent behaviour e.g. lack of pro-activeness =⇒ no initiative in rule enforcement Main research questions is OOP the best programming paradigm for SC? is it possible to implement different paradigms? How? Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 5 / 20
  6. 6. The Problem with Blockchain Smart Contracts Motivation Our claim The mainstream interpretation of SC as objects is inherently flawed the method call semantics for SC comm. is subtle and bug-prone e.g. Ethereum’s unexpected recursion [Luu et al., 2016, Atzei et al., 2017] as objects, SC are constrained in the sorts of things they can do e.g. they are purely user-reative =⇒ no user invocation means no action e.g. lack of time-reactiveness =⇒ no time-dependent behaviour e.g. lack of pro-activeness =⇒ no initiative in rule enforcement Main research questions is OOP the best programming paradigm for SC? is it possible to implement different paradigms? How? Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 5 / 20
  7. 7. Towards Pro-activity & Asynchrony Next in Line. . . 1 The Problem with Blockchain Smart Contracts 2 Towards Pro-activity & Asynchrony 3 The Tenderfone Language & Interpreter 4 Tenderfone Internals: Overview Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 6 / 20
  8. 8. Towards Pro-activity & Asynchrony Our Proposal Endowing SC with pro-activity and asynchronous communication support In this work we model a minimal language for SC, supporting such features develop a proof-of-concept SC interpreter (or VM) for it Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 7 / 20
  9. 9. Towards Pro-activity & Asynchrony Our Proposal Endowing SC with pro-activity and asynchronous communication support In this work we model a minimal language for SC, supporting such features develop a proof-of-concept SC interpreter (or VM) for it Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 7 / 20
  10. 10. The Tenderfone Language & Interpreter Next in Line. . . 1 The Problem with Blockchain Smart Contracts 2 Towards Pro-activity & Asynchrony 3 The Tenderfone Language & Interpreter 4 Tenderfone Internals: Overview Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 8 / 20
  11. 11. The Tenderfone Language & Interpreter Tenderfone in a Nutshell Layered perspective Pro-active, logic SC Tenderfone Tendermint + tuProlog Network Our prototype for a SC interpreter consists of a language for pro-active, asynchronous, and logic-based smart contracts plus its operational semantics & an interpreter implementing it based on the Tendermint [Kwon, 2014] consensus engine and the tuProlog framework [Denti et al., 2001] Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 9 / 20
  12. 12. The Tenderfone Language & Interpreter Execution Model – Toy Program Example § init([Delay | OtherArgs]) :- now(Time), Next is Time + Delay, when(Next, foo). receive(foo, Me) :- self(Me), periodically(10 min, bar). receive(bar, Me) :- /* does something once every 10 min */. receive(Message, Sender) :- Answer = /* compute answer */, send(Answer, Sender). ¦ ¥ U A B deploy(Delay) init([Delay]) when(Now + Delay, foo) after Delay seconds receive(foo, A) periodically(10 min, bar) once every 10 minutes receive(bar, A) do something periodic in any moment Message receive(Message, B) compute Answer send(Answer, B) Answer Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 10 / 20
  13. 13. The Tenderfone Language Interpreter How to Support the Desired Features asynchronous communication achieved by changing the semantics of the send/2 primitive asynchronous computation achieved by sending messages to self time-awareness provided by the now/1 predicate time-reactiveness provided by the delay/2 and periodically/2 primitives pro-activeness achieved through (delay/2 | periodically/2 | send/2) + init/1 Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 11 / 20
  14. 14. Tenderfone Internals: Overview Next in Line. . . 1 The Problem with Blockchain Smart Contracts 2 Towards Pro-activity Asynchrony 3 The Tenderfone Language Interpreter 4 Tenderfone Internals: Overview Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 12 / 20
  15. 15. Tenderfone Internals: Overview Tenderfone System Architecture (coarse-grained) I a number of clients, issuing transactions, served by a number of cores which engage consensus, update the blockchain, and execute SC Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 13 / 20
  16. 16. Tenderfone Internals: Overview Tenderfone System Architecture (coarse-grained) II each core is actually composed by a validator and an interpreter validators handle transactions, blocks, cryptography, etc interpreters execute smart contracts Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 14 / 20
  17. 17. Tenderfone Internals: Overview Asynchronous Pro-Active SC through Spontaneous TX beginBlock(Index, Time) Scheduled := get_scheduled(Time) to_tx(Scheduled) spontaneous! for each Tx in current block deliverTx(Tx) State := execute(Tx, State) Outbox += get_outgoing(State) commitBlock() to_tx(Outbox) spontaneous! Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 15 / 20
  18. 18. Tenderfone Internals: Overview About Spontaneous TX conceptually, they carry the messages / scheduled tasks of SC in practice, they are produced by interpreters technically, interpreters act as clients for each message / scheduled task, n TX are actually produced where n is the total amount of interpreters Problem Corrupt interpreters may forge spurious TX, thus faking SC triggers → spontaneous TX are valid only if n copies exist signed by as many interpreters Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 16 / 20
  19. 19. Tenderfone Internals: Overview About Spontaneous TX conceptually, they carry the messages / scheduled tasks of SC in practice, they are produced by interpreters technically, interpreters act as clients for each message / scheduled task, n TX are actually produced where n is the total amount of interpreters Problem Corrupt interpreters may forge spurious TX, thus faking SC triggers → spontaneous TX are valid only if n copies exist signed by as many interpreters Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 16 / 20
  20. 20. Conclusions and Future Work Conclusion Summarising, we discuss how SC need pro-activity, time-reactiveness and asynchrony define a language for SC with such features describe how an interpreter for such SC should work provide a prototype implementation In the future, we plan to provide a formal operational semantics for Tenderfone endow SC with higher-level coordination/synchronisation mechanisms extend Tenderfone to support HyperLedger Fabric’s architecture Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 17 / 20
  21. 21. Conclusions and Future Work Conclusion Summarising, we discuss how SC need pro-activity, time-reactiveness and asynchrony define a language for SC with such features describe how an interpreter for such SC should work provide a prototype implementation In the future, we plan to provide a formal operational semantics for Tenderfone endow SC with higher-level coordination/synchronisation mechanisms extend Tenderfone to support HyperLedger Fabric’s architecture Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 17 / 20
  22. 22. Smart Contracts are more than Objects: Pro-activeness on the Blockchain Giovanni Ciatto1 Alfredo Maffi1 Stefano Mariani2 Andrea Omicini1 giovanni.ciatto@unibo.it alfredo.maffi@studio.unibo.it stefano.mariani@unimore.it andrea.omicini@unibo.it 1Dipartimento di Informatica – Scienza e Ingegneria—Universit`a di Bologna 2Dipartimento di Scienze e Metodi dell’Ingegneria, Universit`a di Modena e Reggio Emilia 1st International Congress on Blockchain and Applications ´Avila, Spain – June 27, 2019 Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 18 / 20
  23. 23. References References I Atzei, N., Bartoletti, M., and Cimoli, T. (2017). A survey of attacks on Ethereum smart contracts (SoK). In Principles of Security and Trust, volume 10204 of LNCS, pages 164–186. Springer. Denti, E., Omicini, A., and Ricci, A. (2001). tuProlog: A light-weight Prolog for Internet applications and infrastructures. In Practical Aspects of Declarative Languages, volume 1990 of LNCS, pages 184–198. Springer. Kwon, J. (2014). Tendermint: Consensus without mining. Luu, L., Chu, D.-H., Olickel, H., Saxena, P., and Hobor, A. (2016). Making smart contracts smarter. In 2016 ACM SIGSAC Conference on Computer and Communications Security (CCS’16), pages 254–269, New York, NY, USA. ACM Press. Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 19 / 20
  24. 24. References References II Szabo, N. (1997). Formalizing and securing relationships on public networks. First Monday, 2(9). Ciatto et al. (UniBo, UniMoRe) Pro-activeness on the Blockchain BCC 2019, Jun 27 20 / 20

×