ABSTRACT
Modern cryptocurrency systems, such as Ethereum, 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.
Smart contract benchmarks run on a JVM with ScalaSTM show that a speedup of 1.33x can be obtained for miners and 1.69x for validators with just three concurrent threads.
- R. D. Blumofe, C. F. Joerg, B. C. Kuszmaul, C. E. Leiserson, K. H. Randall, and Y. Zhou. Cilk: An efficient multithreaded runtime system. In Proceedings of the Fifth ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, PPOPP '95, pages 207--216, New York, NY, USA, 1995. ACM. Google ScholarDigital Library
- R. L. Bocchino, Jr., V. S. Adve, S. V. Adve, and M. Snir. Parallel programming must be deterministic by default. In Proceedings of the First USENIX Conference on Hot Topics in Parallelism, HotPar'09, pages 4--4, Berkeley, CA, USA, 2009. USENIX Association.Google ScholarDigital Library
- N. G. Bronson, J. Casper, H. Chafi, and K. Olukotun. 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, pages 6--15, New York, NY, USA, 2010. ACM. Google ScholarDigital Library
- C. Cachin, S. Schubert, and M. Vukolic. Non-Determinism in Byzantine Fault-Tolerant Replication. In P. Fatourou, E. Jiménez, and F. Pedone, editors, 20th International Conference on Principles of Distributed Systems (OPODIS 2016), volume 70 of Leibniz International Proceedings in Informatics (LIPIcs), pages 24:1--24:16, Dagstuhl, Germany, 2017. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik.Google Scholar
- M. Castro and B. Liskov. Practical byzantine fault tolerance. In Proceedings of the Third Symposium on Operating Systems Design and Implementation, OSDI '99, pages 173--186, Berkeley, CA, USA, 1999. USENIX Association.Google ScholarDigital Library
- DAO. Thedao smart contract. Retrieved 8 February 2017.Google Scholar
- K. Delmolino, M. Arnett, A. Kosba, A. Miller, and E. Shi. Step by Step Towards Creating a Safe Smart Contract: Lessons and Insights from a Cryptocurrency Lab, pages 79--94. Springer Berlin Heidelberg, Berlin, Heidelberg, 2016.Google ScholarCross Ref
- Ethereum. https://github.com/ethereum/.Google Scholar
- Ethereum design Rationale. http://github.com/ethereum/wiki/wiki/Design-Rationale#gas-and-fees.Google Scholar
- R. Guerraoui and M. Kapalka. On the correctness of transactional memory. In Proceedings of the 13th ACM SIGPLAN Symposium on Principles and practice of parallel programming (PPoPP'08), pages 175--184, New York, NY, USA, 2008. ACM. Google ScholarDigital Library
- M. Herlihy and E. Koskinen. 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, pages 207--216, New York, NY, USA, 2008. ACM. Google ScholarDigital Library
- M. Herlihy, V. Luchangco, M. Moir, and W. N. Scherer, III. Software transactional memory for dynamic-sized data structures. In Proceedings of the twenty-second annual symposium on Principles of distributed computing, PODC '03, pages 92--101, New York, NY, USA, 2003. ACM. Google ScholarDigital Library
- N. Herman, J. P. Inala, Y. Huang, L. Tsai, E. Kohler, B. Liskov, and L. Shrira. Type-aware transactions for faster concurrent code. In Proceedings of the Eleventh European Conference on Computer Systems, EuroSys '16, pages 31:1--31:16, New York, NY, USA, 2016. ACM. Google ScholarDigital Library
- Hyperledger white paper. http://www.the-blockchain.com/docs/Hyperledger%20Whitepaper.pdf .Google Scholar
- A. E. Kosba, A. Miller, E. Shi, Z. Wen, and C. Papamanthou. Hawk: The blockchain model of cryptography and privacy-preserving smart contracts. In IEEE Symposium on Security and Privacy, 2015.Google Scholar
- E. Koskinen and M. J. Parkinson. 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 ScholarDigital Library
- E. Koskinen, M. J. Parkinson, and M. Herlihy. Coarse-grained transactions. In Proceedings of the 37th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL'10), pages 19--30. ACM, 2010. Google ScholarDigital Library
- L. Luu, D. Chu, H. Olickel, P. Saxena, and A. Hobor. Making smart contracts smarter. In Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, Vienna, Austria, October 24-28, 2016, pages 254--269, 2016. Google ScholarDigital Library
- L. Luu, J. Teutsch, R. Kulkarni, and P. Saxena. Demystifying incentives in the consensus computer. In Proceedings of the 22Nd ACM SIGSAC Conference on Computer and Communications Security, CCS '15, pages 706--719, New York, NY, USA, 2015. ACM. Google ScholarDigital Library
- S. Nakamoto. Bitcoin: A peer-to-peer electronic cash system. May 2009.Google Scholar
- Scala STM Expert Group. Scalastm. web. Retrieved from http://nbronson.github.com/scala-stm/, 20 November 2011.Google Scholar
- Solidity documentation. http://solidity.readthedocs.io/en/latest/index.html.Google Scholar
- Solidity documentation: Solidity by example. http://solidity.readthedocs.io/en/develop/solidity-by-example.html.Google Scholar
- N. Szabo. Formalizing and securing relationships on public networks. First Monday, 2(9), 1997. Google ScholarCross Ref
- G. Wood. Ethereum: A secure decentralised generalised transaction ledger.Google Scholar
Index Terms
- Adding Concurrency to Smart Contracts
Recommendations
Adding concurrency to smart contracts
AbstractModern 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 ...
Enabling Concurrency on Smart Contracts Using Multiversion Ordering
Web and Big DataAbstractBlockchain-based platforms, such as Ethereum, allow transactions in blocks to call user-defined scripts named smart contracts. In the blockchain network, after being generated by a miner, a block will be validated many times by the peers who ...
OptSmart: a space efficient Optimistic concurrent execution of Smart contracts
AbstractPopular blockchains such as Ethereum and several others execute complex transactions in the block through user-defined scripts known as smart contracts. Serial execution of smart contract transactions/atomic units (AUs) fails to harness the ...
Comments