Casa Blog - Bitcoin Security Made Easy

For crypto investors, owning ether (ETH) is just one part of the excitement. There’s a wide world of utility you can access with ETH, but that requires you to develop an understanding of gas fees.

Gas is an essential component of conducting ETH transactions and interacting with dapps. You may sometimes hear other investors discussing gas fees and how to avoid spending too much on them.

Casa helps you secure your ETH with multiple keys. In this article, we’ll cover some of the basics around gas, so you can be more confident when venturing into web3.

What are ethereum gas fees?

In ethereum, gas is a transaction fee paid in ETH that reflects computational cost. The ethereum network acts as a decentralized computer where you pay to run programs known as smart contracts.

Since the network’s transition to a Proof of Stake algorithm, gas is paid as a reward to validators in return for staking ETH and process transactions. This provides an economic incentive for validators to enforce consensus on the network.

When do you have to pay a gas fee?

Gas is required for ETH transfers and any other update to the Ethereum Virtual Machine (EVM), the blockchain for the ethereum network. You can expect to pay a gas fee for the following purposes:

  • Sending and receiving ETH
  • Depositing and withdrawing from exchanges
  • Staking tokens
  • Minting assets
  • Participating in a DAO
  • Replacing a key in a Casa vault
  • Performing any computation on the EVM

Why does gas cost so much?

The gas price on ethereum fluctuates according to the dynamics of supply and demand. Sometimes, the network can be congested resulting in higher gas than normal, which is common during a crypto bull market. Conversely, gas may be lower when there is less traffic on the network.

On an individual transaction level, gas increases depending on the extent of the code you intend to execute. This cost prevents bad actors from bogging down the network with spam.

How are gas fees calculated?

Gas Fees = Gas Units x (Base Fee + Priority Fee)

Gas fees are determined according to the above equation, but each variable has its own stipulations.

Each ethereum block has a gas limit which is set to a target rate of 15 million units, though the limit can increase up to twice that amount during times of high demand. Gas units are a calculation of the total computation required in an update to the EVM. A typical ETH transfer can use about 21,000 units.

All blocks contain a base fee, which provides a minimum cost. This is determined according to previous blocks. If you want your transaction or update to be confirmed sooner rather than later, you can designate a priority fee, which is akin to adding an extra tip to move to the front of the queue. Gas fees are denominated in gwei, which is one-billionth of an ETH.

Because gas fees are rather dynamic, it can be a smart practice to check the gas fee market before proceeding with a transaction. There are a variety of tools to help you monitor gas, such as this one from Etherscan. The Casa app can also help you set a maximum fee in advance to avoid paying too much.

Can ethereum gas fees be reduced through Layer 2 scaling solutions?

Indeed, there are several projects in the works across the ETH ecosystem that are aimed at reducing gas fees and overall congestion on the network with a lot of potential.

One premise is to batch transactions together before posting them to the mainnet, a process known as rollups. Additionally, there are also sidechains and state channels, the latter of which uses multisig contracts for off-chain transactions with final settlement on-chain, which is similar to the Lightning network on bitcoin.

Many of these solutions are in active development, so don’t try them at home unless you know what you’re doing or experimenting.

How can users manage the cost of ethereum gas fees when sending transactions or interacting with dapps?

The most important way to keep gas fees down is to only deploy a smart contract when you are highly confident it will work. Ethereum is designed to be Turing-complete, meaning it can theoretically run any program, even ones that don’t work as intended, are not economically feasible or take too long to terminate.

Computation is computation, and gas fees are nonrefundable. Ethereum is designed to reject code that supersedes the gas limit. Additionally, because gas costs scale with the complexity of code, it’s prudent to avoid bloating a transaction with frivolous elements or unnecessary calls to other smart contracts. Less is more. To avoid wasting gas, it is advisable to use standard, professional-tested smart contracts instead of attempting to build your own from scratch.

Final thoughts

Gas is an integral piece of the ETH ecosystem and broader crypto economy. By paying for computation, you can use ethereum to explore dapps, DeFi, and any number of digital assets. With a little forethought, you don’t need to fear the price at the pump.

Protect your ETH with a multi-key vault

Too many accidents and hacks take place in crypto, and it’s easier than ever to take self-custody of your ETH.

Casa helps you secure your ethereum (and bitcoin) with multiple keys so one incident doesn’t mean lost crypto. Interested in learning more about our vaults? Schedule a call with a Casa advisor now.

Read more

How ethereum smart contracts work
What are smart contracts and what can they do? Learn more about the programmable side of ethereum and its potential.