Advertisement

Adding concurrency to smart contracts

  • Thomas Dickerson
  • Paul Gazzillo
  • Maurice Herlihy
  • Eric KoskinenEmail author
Article

Abstract

Modern cryptocurrency systems, such as the Ethereum project, permit complex financial transactions through scripts called smart contracts. These smart contracts are executed many, many times, always without real concurrency. First, all smart contracts are serially executed by miners before appending them to the blockchain. Later, those contracts are serially re-executed by validators to verify that the smart contracts were executed correctly by miners. Serial execution limits system throughput and fails to exploit today’s concurrent multicore and cluster architectures. Nevertheless, serial execution appears to be required: contracts share state, and contract programming languages have a serial semantics. This paper presents a novel way to permit miners and validators to execute smart contracts in parallel, based on techniques adapted from software transactional memory. Miners execute smart contracts speculatively in parallel, allowing non-conflicting contracts to proceed concurrently, and “discovering” a serializable concurrent schedule for a block’s transactions, This schedule is captured and encoded as a deterministic fork-join program used by validators to re-execute the miner’s parallel schedule deterministically but concurrently. We have proved that the validator’s execution is equivalent to miner’s execution. Smart contract benchmarks run on a JVM with ScalaSTM show that a speedup of 1.39\(\times \) can be obtained for miners and 1.59\(\times \) for validators with just three concurrent threads.

Keywords

Smart contracts Blockchain Miners Ethereum Transactional boosting Concurrency 

Notes

References

  1. 1.
    Androulaki, E., Barger, A., Bortnikov, V., Cachin, C., Christidis, K., De Caro, A., Enyeart, D., Ferris, C., Laventman, G., Manevich, Y., et al.: Hyperledger fabric: a distributed operating system for permissioned blockchains. In: Proceedings of the Thirteenth EuroSys Conference, ACM, p. 30 (2018)Google Scholar
  2. 2.
    Blumofe, R.D., Joerg, C.F., Kuszmaul, B.C., Leiserson, C.E., Randall, K.H., Zhou, Y.: Cilk: an efficient multithreaded runtime system. In: Proceedings of the Fifth ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, PPOPP ’95, ACM, New York, NY, USA, pp. 207–216 (1995). https://doi.org/10.1145/209936.209958
  3. 3.
    Bocchino Jr., R.L., Adve, V.S., Adve, S.V., Snir, M.: Parallel programming must be deterministic by default. In: Proceedings of the First USENIX Conference on Hot Topics in Parallelism, HotPar’09, USENIX Association, Berkeley, CA, USA, pp. 4–4 (2009). URL http://dl.acm.org/citation.cfm?id=1855591.1855595
  4. 4.
    Bronson, N.G., Casper, J., Chafi, H., Olukotun, K.: Transactional predication: high-performance concurrent sets and maps for stm. In: Proceedings of the 29th ACM SIGACT-SIGOPS Symposium on Principles of Distributed Computing, PODC ’10, ACM, New York, NY, USA, pp. 6–15 (2010). https://doi.org/10.1145/1835698.1835703
  5. 5.
    Cachin, C., Schubert, S., Vukolic, M.: Non-determinism in byzantine fault-tolerant replication. In: Fatourou, P., Jiménez, F., Pedone, F. (eds.) 20th International Conference on Principles of Distributed Systems (OPODIS 2016), Leibniz International Proceedings in Informatics (LIPIcs), vol. 70, Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany, pp. 24:1–24:16 (2017). https://doi.org/10.4230/LIPIcs.OPODIS.2016.24. http://drops.dagstuhl.de/opus/volltexte/2017/7093
  6. 6.
    Castro, M., Liskov, B.: Practical byzantine fault tolerance. In: Proceedings of the Third Symposium on Operating Systems Design and Implementation, OSDI ’99, USENIX Association, Berkeley, CA, USA, pp. 173–186 (1999). URL http://dl.acm.org/citation.cfm?id=296806.296824
  7. 7.
    DAO: Thedao smart contract. Retrieved 8 February (2017)Google Scholar
  8. 8.
    Delmolino, K., Arnett, M., Kosba, A., Miller, A., Shi, E.: Step by Step Towards Creating a Safe Smart Contract: Lessons and Insights from a Cryptocurrency Lab, Springer, Berlin, pp. 79–94 (2016). https://doi.org/10.1007/978-3-662-53357-4_6
  9. 9.
  10. 10.
  11. 11.
    Herlihy, M., Koskinen, E.: Transactional boosting: a methodology for highly-concurrent transactional objects. In: Proceedings of the 13th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, PPoPP ’08, ACM, New York, NY, USA, pp. 207–216 (2008). https://doi.org/10.1145/1345206.1345237
  12. 12.
    Herlihy, M., Luchangco, V., Moir, M., Scherer III, W.N.: Software transactional memory for dynamic-sized data structures. In: Proceedings of the Twenty-second Annual Symposium on Principles of Distributed Computing, PODC ’03, ACM, New York, NY, USA, pp. 92–101 (2003). https://doi.org/10.1145/872035.872048
  13. 13.
    Herman, N., Inala, J.P., Huang, Y., Tsai, L., Kohler, E., Liskov, B., Shrira, L.: Type-aware transactions for faster concurrent code. In: Proceedings of the Eleventh European Conference on Computer Systems, EuroSys ’16, ACM, New York, NY, USA, pp. 31:1–31:16 (2016). https://doi.org/10.1145/2901318.2901348
  14. 14.
  15. 15.
    Kosba, A.E., Miller, A., Shi, E., Wen, Z., Papamanthou, C.: Hawk: the blockchain model of cryptography and privacy-preserving smart contracts. In: IEEE Symposium on Security and Privacy (2015)Google Scholar
  16. 16.
    Koskinen, E., Parkinson, M.J.: The push/pull model of transactions. In: Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’15), Portland, OR, USA. ACM (2015)Google Scholar
  17. 17.
    Luu, L., Chu, D., Olickel, H., Saxena, P., Hobor, A.: Making smart contracts smarter. In: Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, Vienna, Austria, October 24–28, pp. 254–269 (2016)Google Scholar
  18. 18.
    Luu, L., Teutsch, J., Kulkarni, R., Saxena, P.: Demystifying incentives in the consensus computer. In: Proceedings of the 22Nd ACM SIGSAC Conference on Computer and Communications Security, CCS ’15, ACM, New York, NY, USA, pp. 706–719 (2015). https://doi.org/10.1145/2810103.2813659
  19. 19.
    Nakamoto, S.: Bitcoin: A peer-to-peer electronic cash system (2009). URL http://www.bitcoin.org/bitcoin.pdf
  20. 20.
    Scala STM Expert Group.: Scalastm. web. Retrieved from http://nbronson.github.com/scala-stm/, 20 November (2011)
  21. 21.
  22. 22.
    Solidity documentation: Solidity by example: http://solidity.readthedocs.io/en/develop/solidity-by-example.html
  23. 23.
    Szabo, N.: Formalizing and securing relationships on public networks. First Monday 2(9) (1997). http://firstmonday.org/ojs/index.php/fm/article/view/548
  24. 24.
    Wood, G.: Ethereum: a secure decentralised generalised transaction ledger. http://gavwood.com/Paper.pdf
  25. 25.

Copyright information

© Springer-Verlag GmbH Germany, part of Springer Nature 2019

Authors and Affiliations

  • Thomas Dickerson
    • 1
  • Paul Gazzillo
    • 2
  • Maurice Herlihy
    • 1
  • Eric Koskinen
    • 3
    Email author
  1. 1.Brown UniversityProvidenceUSA
  2. 2.Stevens InstituteHobokenUSA
  3. 3.University of Central FloridaOrlandoUSA

Personalised recommendations