This article is released as a part of the Deepwaters Ponder catalog, which is intended for educational purposes and furthering the public’s understanding of decentralized finance.

Why do Gas Fees Exist?

“Gas fees” compensate miners for the computational costs of the blockchain, taking an order to go from the mempool to the next node (point of confirmation). Mempools are essentially a waiting room for unconfirmed transactions to be stored until they are processed.

To process and validate transactions, users pay miners a transaction fee in the form of “gas”. The miners provide the computational power for the users in exchange for the yield they receive through fees. Gas fees prevent traders from spamming the blockchain, in addition to preventing infinity loops.

Gas fees are most commonly associated with the ethereum blockchain and are unavoidable for the transactions on it as a proof-of-work protocol. However, a higher gas fee makes a transaction more likely to be included in each subsequent block mined, meaning that some may choose to pay more if it suits their needs.

How do Gas Fees Work?

Gas fees are paid in small denominations of ethereum known as “gwei”, with one gwei representing 0.000000001 ETH. The gas fee paid by a trader is determined by gas units multiplied by gas price per unit.

The number of gas units needed depends on how complex the task is, which means that the smart contracts in lending protocols often require more power than a simple transfer.

The price of those gas units depends on the volume of activity on the blockchain at a given time, as the price is determined by demand for processing.

E.g. Megan wishes to send 1 ETH from her wallet to Callum’s wallet. However, many people are trying to transact at the same time, meaning that the gas fees for her transfer will cost more than they would on a slower day.

Megan’s transfer costs the standard 21,000 unit fee, due to the simple nature of the transaction.

The gas price is 500 gwei due to the high trading volume.

1 ETH is worth 3000 USD at the time of Megan’s transfer.

21,000 x 500 = 10,500,000 GWEI

10,500,000 GWEI = 0.0105 ETH

0.0105 x 3000 = 31.5 USD

Megan will pay 31.5 USD for her transfer at this time.

Some platforms and wallets (such as Metamask) allow users to set a “gas limit”, which acts as a stop-loss mechanism for gas fees. Users can set their limit so that the gas fees they pay are capped, meaning that a transfer which exceeds the limit will not be processed and transfers under the limit will execute the order and return the difference.

Users may choose to pay higher gas fees for faster transaction speeds, tipping miners for priority service, akin to FastPass at a Disney theme park. When used to buy or sell a token, a higher gas limit can provide a competitive advantage for price volatility.

E.g. The following month, Megan intends to purchase 1 ETH, but the price of ETH is quickly rising and Megan believes that this trend will continue. Megan increases her gas limit to ensure that her purchase will be completed promptly, thereby reducing the potential for price slippage due to a slow transaction speed while the price is rising.

How do Gas Fees Impact DeFi?

Gas fees may make DeFi platforms less attractive to users, especially for small transactions, as the gas fees paid can be high. Most actions taken - originating a loan, making a “swap” or exchange, or staking tokens - require the use of smart contracts, and therefore have much higher fees than simple transactions such as sending tokens to a different wallet address. These fees are also multiplied with each step required. Taking out the loan by staking collateral and paying off the loan with interest would each require a gas fee, which in the case of small loans may be greater than the interest, thereby significantly driving up the costs associated with the transaction.

For those yield farming, the lending process takes time for gains to accrue and gas fees apply when withdrawing profit, meaning that it may take months for the cost of the withdrawal to be covered if the amount deposited is small. 

How do DeFi Platforms Mitigate Gas Fees for Their Users?

Although DeFi users can wait for activity to dwindle or set limits and check sites tracking the price of gas, these strategies provide limited protection against high fees.

Ethereum Layer 2 platforms offer new solutions for capital efficiency, with respect to gas fees. Two solutions offered by popular DeFi platforms are sidechain integration and rollups, with each outsourcing activity from the 1st (mainchain) to 2nd (sidechain) layer. 

Sidechains operate in tandem with layer 1 to mitigate the congestion and the associated gas fees. Rollups, however, execute transactions on layer 2, but store account balances on Ethereum, so that independent sidechains are not entrusted with users’ security.

As Web3 continues to evolve, DeFi projects have developed new ways to enhance user experience and retain financial autonomy.

Do you you want to enter the deep waters? Join our newsletter.