Diploma and Master Theses (authored and supervised):
"Optimization of Solidity Smart Contracts";
Supervisor: S. Schulte;
Institute of Information Systems Engineering, Distributed Systems Group,
final examination: 2020-04-07.
Smart contracts are computer programs that are deployed on the blockchain and can then be executed. Fees in form of gas have to be paid for deploying a smart contract on the blockchain, depending on the size of the byte code. Additional fees have to be paid, whenever a function of a smart contract is executed, depending on the needed computational steps and required storage space. On the Ethereum blockchain, millions of USD are paid in form of gas fees every single day. Since gas cost can increase if a contract is not well-implemented, there is a lot of incentive to reduce these gas cost in order to save money. We identified 19 optimization strategies from the field of software engineering, which can be applied to Solidity smart contracts in order to reduce the required gas cost. To show how these rules can be used to optimize smart contracts, we developed a prototype. The prototype detects rule violations from 9 of these rules and in addition automatically optimizes 6 of them. The prototype analyzed 3,018 verified open source smart contracts from etherscan.io. We found 471 rule violations in our test data set spread across 204 different contract files. That means, roundabout 6.8% of the data set violated at least one of the rules. We deployed the automatically optimized contracts in a test environment before and after the optimization, to compare the gas usage. We were on average able to save 1,213 gas for deploying an optimized contract version compared to the initial one. For calling an optimized function once, we were able to save on average 123 gas, compared to the initial function call.
Blockchain / Solidity / Ethereum / Smart Contract / Optimization
Created from the Publication Database of the Vienna University of Technology.