Gas Estimation and Optimization for Smart Contracts on Ethereum(Ethereumにおけるスマートコントラクトのガス推定と最適化)
Year: 2021
Type: dissertation
Abstract: Gas Estimation and Optimization for Smart Contracts on EthereumEthereum is currently the most popular public blockchain, not only because it provides a decentralized, shared ledger, allowing all users to participate in the ledger update activities, but also because it builds a "world computer" that can host and execute programs. These programs are so-called smart contracts. Any user can send a transaction for invoking functions on the contract. Once all Ethereum nodes verify the transaction, the Ethereum virtual machine (EVM) will run the contract runtime bytecode on the transaction input data. To prevent resource waste from infinite loops and make sure that contract programs can terminate at a certain point, the computation effort required to execute the EVM instructions is charged in the gas unit. The EVM gas model defines the gas cost for each opcode. In addition to function call and contract creation-related opcodes, the Ethereum storage access opcodes, i.e., SLOAD and SSTORE, charge the highest gas cost among all opcodes, and this is far higher than the costs for other opcodes (e.g., 3 gas for the ADD opcode) because Ethereum storage opcodes are used for updating the Ethereum state and take a long time to process. For a transaction, the actual money cost that the sender needs to pay is the multiplication of gas units and the gas price. The gas price is specified by participating users before the transaction starts and remains the same for all opcodes in the EVM execution process. Currently, two important issues are widely studied regarding gas. One is gas estimation, which aims to predict executional gas consumption before the transaction starts. Different approaches have been proposed for it, but it is still nontrivial in estimating gas costs for transactions to functions involving loops. On the one hand, the loop iteration times might rely on users' inputs and cannot be decided statically. On the other hand, dynamic methods often send transactions to the local testnet and observe the gas cost, whereas this gas usually differs from the actual transaction gas cost because the testnet cannot reflect the state change on the mainnet. This thesis proposes a gas estimation approach to dynamically estimate the gas based on the transaction trace. The insight is that the relationship between the historical transaction traces and their gas costs can be learned to estimate the gas for new transactions. Especially, three different abstractions of the original transaction trace are considered and fed to different machine learning models. The results show that the proposed approach is
Author: Li, Chunmiao
Language: English
Subfield: Information Systems
Field: Computer Science
Domain: Physical Sciences
Open Access status: green
OpenAlex ID: W7208178802
