Reducing the Gas Usage of Ethereum Smart Contracts without a Sidechain
Soroush Farokhnia, Amir Kafshdar Goharshady
Abstract
To prevent DoS attacks, Ethereum assigns a fixed gas cost to every atomic operation in the EVM and the party who creates a transaction has to pay for its overall gas usage. While the gas model is successful in preventing DoS attacks, it causes significant costs in transaction fees. For example, in June-September 2022, the average daily gas usage of Ethereum was almost four million dollars. We propose a solution to minimize these fees by moving most of the execution of a contract off-chain and storing only the bare minimum on-chain. We then trigger an on-chain execution only if there is a disagreement between the parties to the contract, which is in turn only possible if at least one party is acting dishonestly. In such cases, our approach can identify and penalize the dishonest party by making them pay not only for the gas usage of their own function calls, but also calls made by other parties. Thus, it is game-theoretically irrational to behave dishonestly in this protocol. If all parties are rational, the total gas usage goes down significantly. Notably, our approach does not require a sidechain and works directly on the main Ethereum blockchain. We also provide extensive experiments over real-world Ethereum smart contracts, demonstrating that our protocol reduces their gas usage by 40.09%.