| Ethereum is a blockchain platform that supports cryptocurrency(ether)and smart contracts.Although more than 8 million smart contracts have been deployed on Ethereum,little is known about the characteristics of its users,the activity of the smart contracts,and the interactions between them.Smart contract,a form of software that uses blockchain mechanisms(running on Ethereum virtual machines)to execute code,is getting more and more attention because of its advantages.In order to ensure the implementation of smart contract can terminate and prevent the abuse of resources,to the deployment of the Ethereum smart contract fees from the developers and users of smart contract,the others unoptimized smart contracts spend more transaction costs than the smart contracts after the optimization,and the optimization of smart contracts can start from two aspects:the underlying opcode sequence and the high-level statement logic structure.In addition,recent studies have found that a large number of smart contracts can be detected as having serious security problems by using static program analysis techniques.For the smart contract,most of the static program analysis techniques need to build its control flow graph first,and the control flow graph needs to be concatenated with the basic code blocks through control flow transfer(CFTs)for the next analysis.In view of the above problems,this thesis completes four works based on complex network analysis technique,program bytecode optimization technique,program control flow transfer(CFT)technique,and gas inefficiency feature optimization technique to achieve a more comprehensive study and understanding of Ethereum.The main research contents of this thesis are as follows:After completing a systematic study of Ethereum through network graph analysis,this thesis proposes a new method to collect all transaction data,and then constructs a money transfer network graph(MFG),a smart contract creation graph(CCG),and a smart contract invocation graph(CIG)to describe the main activities on Ethereum.By analyzing various network graph coefficients(such as clustering coefficient)on MFG,CCG,and CIG,observations and insights on Ethereum are obtained.These results allow researchers to better understand Ethereum's ecosystem.Aiming at the three important security issues of Ethereum attack forensics,anomaly detection and deanonymization,this thesis proposes three detection methods based on three network graphs and verifies the validity of the detection methods through the analysis of practical cases.Aiming at the optimization of the underlying opcode sequence,this thesis proposes24 optimized feature code sequences that waste gas when deploying and invoking the smart contract,and determines the corresponding efficient code to replace the instance of the optimized feature code sequence.In this thesis,a smart contract bytecode level workflow is designed,which can automatically detect the optimized feature code sequence and replace it with the corresponding efficient code.This thesis experimented with deployed smart contracts and their execution records and detected a large number of instances of optimizable feature code.This thesis completed a large-scale CFT identification analysis of smart contracts,conducted a comprehensive comparison of six widely used tools,examined all deployed smart contracts,and ultimately gained many insights that can be applied to other tools.This thesis uses EVM to recover the historical execution traces of the smart contract,uses these traces to evaluate these tools,and finds that the execution traces can significantly supplement the CFT found by the tools.Based on the above observations,this thesis used CFT extracted from the execution traces to enhance oyente,and a large number of experiments have shown that this enhancement can reduce its false-negative rate.Aiming at the high-level statement logic structure,this thesis proposes 10 kinds of gas inefficient smart contract pattern codes,and designs a detection method for gas inefficient pattern based on symbolic execution technique.This thesis makes an extensive empirical study of deployed contracts in Ethereum and analyzes the prevalence of gas inefficient pattern.In addition,experiments are carried out on different versions of compilers in this thesis to determine the elimination effect of compiler version upgrade on gas inefficient pattern. |