Ethereum smart contracts: Analysis and statistics of their source code and opcodes

Abstract Smart contracts are programs that are used for verifying and enforcing the terms of an agreement. Ethereum is an extensively used platform that can be used to execute smart contracts. These can be defined by using high-level languages such as Solidity, Vyper and Bamboo that are compiled into low-level machine instructions, i.e., bytecode. These instructions define a Turing complete language and are often represented by using a readable format that is referred to as opcodes. Here, we present a novel, more comprehensive, study that aims at gaining a precise understanding on how programmers use the linguistic instructions supported by Ethereum. More precisely, the contracts’ source code has been also analysed, in order to understand the high-level control structures and core instructions that are used for smart contract definitions, and how they are reflected on the opcode level. We have gathered ten of thousands of verified Ethereum smart contracts that have been written by using the Solidity language. This study can lay the groundwork for defining new formalisms and new domain specific languages (DSL). These can support the users in the development of decentralised applications (DAPPs).

[1]  Elaine Shi,et al.  Step by Step Towards Creating a Safe Smart Contract: Lessons and Insights from a Cryptocurrency Lab , 2016, Financial Cryptography Workshops.

[2]  Stefano Bistarelli,et al.  An Analysis of Non-standard Bitcoin Transactions , 2018, 2018 Crypto Valley Conference on Blockchain Technology (CVCBT).

[3]  Massimo Bartoletti,et al.  A Survey of Attacks on Ethereum Smart Contracts (SoK) , 2017, POST.

[4]  Michele Marchesi,et al.  The ICO phenomenon and its relationships with ethereum smart contract environment , 2018, 2018 International Workshop on Blockchain Oriented Software Engineering (IWBOSE).

[5]  Massimo Bartoletti,et al.  Financial Cryptography and Data Security , 2017, Lecture Notes in Computer Science.

[6]  Ralph C. Merkle,et al.  A Digital Signature Based on a Conventional Encryption Function , 1987, CRYPTO.

[7]  Chen Chang,et al.  Blockchain‐based trusted data sharing among trusted stakeholders in IoT , 2019, Softw. Pract. Exp..

[8]  Stefano Bistarelli,et al.  A Suite of Tools for the Forensic Analysis of Bitcoin Transactions: Preliminary Report , 2018, Euro-Par Workshops.

[9]  Burton H. Bloom,et al.  Space/time trade-offs in hash coding with allowable errors , 1970, CACM.

[10]  Nikhil Swamy,et al.  Formal Verification of Smart Contracts: Short Paper , 2016, PLAS@CCS.

[11]  Stefano Bistarelli,et al.  Go with the -Bitcoin- Flow, with Visual Analytics , 2017, ARES.

[12]  Albert Rubio,et al.  EthIR: A Framework for High-Level Analysis of Ethereum Bytecode , 2018, ATVA.

[13]  Alan Mislove,et al.  Analyzing Ethereum's Contract Topology , 2018, Internet Measurement Conference.