Guide to Ethereum’s Transaction Fees (Hint: It’s a Gas, Gas, Gas!)
While the SEC and CFTC attempt to map the subtle legal distinctions between securities and commodities to the nuanced properties of the many different cryptocurrencies, enterprises must seek safe passage from a compliance point of view until the regulatory dust settles. But the jockeying for jurisdiction is far from over.
By Bob Reselman
Published:January 4, 2023
8 min read
In this Article
- When it comes to how they charge fees for their usage, no two distributed ledgers are exactly the same but most often charge fees in denominations of their native token.
- Developing an appreciation for the nuanced differences in fee structures from one chain to the next will help business executives and IT managers to make more informed decisions related to the total cost of blockchain ownership.
- In 2022, the Ethereum distributed ledger migrated from a Bitcoin-like proof-of-work consensus algorithm to proof-of-stake.
- Ethereum’s fees are tied to an awkwardly named unit of resource consumption called “gas”
- Increases in both transaction priority and smart contract resource requirements will result in increased total cost of ownership
A key factor for a company to consider when thinking about adopting Distributed Ledger Technology (DLT) is the impact that a particular ledger's transaction fees will have on the total cost of ownership (TCO) of a blockchain project. Those fees can be acceptable or exorbitant. It all depends on how the particular ledger administers those fees and how users of the ledger incur them. There is no one-size-fits-all solution. Rather, fees vary according to the distributed ledger and the cryptocurrencies that they support.
In this article, we're going to look at how Ethereum administers transaction fees. Ethereum is the cryptocurrency network with the second highest market capitalization behind Bitcoin. Like Bitcoin, Ethereum uses blockchain as its underlying DLT. While Ethereum is similar in spirit to Bitcoin, there are aspects to the way Ethereum structures and administers transaction fees that make it unique.
This follow-up to Blockchain Journal’s Guide to Bitcoin Transactions Fees will help to develop your appreciation for how transaction fee calculation can differ from one distributed ledger to the next.
Understanding the Ethereum Fee Structure
As mentioned at the beginning of this article, Ethereum is a cryptocurrency network that's similar to Bitcoin. Like Bitcoin, Ethereum uses blockchain as its underlying DLT. However, unlike Bitcoin, which uses proof of work as its consensus mechanism, Ethereum uses proof of stake.
Also, Ethereum supports smart contacts and has done so since its inception. Similar to the architecture of enterprise Java applications, smart contracts on Ethereum and other DLTs typically involve the presence of a virtual machine that offers programmatic access to the DLT's underlying capabilities (e.g., submission of a transaction) as well as support for the execution of custom business logic and workflows.
Today, through Bitcoin's Taproot upgrade at the end of 2021, developers have access to limited smart contract-like programmability that's native to the Bitcoin network. But it hasn't achieved nearly the de facto status for smart contracts that Ethereum has. For a while, Ethereum was the only show in town for enterprise-grade smart contract development. Hence, Ethereum and its programming language, Solidity, became a leader in smart contract programming and as such, transformed blockchain from a mechanism for storing and transferring cryptocurrency-based value to a platform for running business applications.
But, this came with a price.
In addition to charging fees to run typical transactions, such as the transfer of Ethereum's native cryptocurrency (Ether aka ETH) between accounts, Ethereum also charges fees to execute the smart contracts that are hosted on its network. Given the degree to which all consumption of compute resources varies from one smart contract to the next, smart contract storage and execution correspondingly involves its own set of fees. The fees related to executing a smart contract tend to be higher than those for executing a standard transaction between two accounts. Although these fees can be higher, developers have some options for optimizing them. One key to optimizing the cost of executing standard transactions and running smart contracts on the Ethereum network is to clearly understand exactly how transaction fees are determined. It's always better to know than to guess.
Thus, a good place to start is by understanding the way Ethereum prices its transaction fees using a special unit of measure called gas.
What is a Blockchain Gas Fee?
At the conceptual level, Ethereum calculates a transaction fee according to the following formula:
tx_fee = cost_of_computing + priority_fee
This is similar to the way that Bitcoin calculates a transaction fee. However, Ethereum executes the formula in a special manner. Ethereum incorporates a concept called gas when calculating the cost of a transaction.
On Ethereum, as well as other distributed ledgers, gas is the unit of measure for the effort it takes to power a transaction. As with an automobile, it takes a certain amount of gas to do work. Once you know the price of gas you can calculate the cost to do that work. For example, using the automobile analogy, if the car travels at an average of 30 miles per gallon of gas and the cost of a gallon of gas is US$5.99, you can calculate how much it costs to move a car 1 mile using the following formula:
1/30 x 5.99, which calculates to ~$0.19
The same concept can be applied to the cost of processing a transaction in Ethereum. But, instead of pricing gas in US dollars, Ethereum prices gas in gwei, where 1 gwei = 0.000000001 ETH. However, unlike an automobile where the unit of measure for gas in the US is called a gallon, the unit of measure for gas on Ethereum and other chains that involve gas is just called "gas." As a result, awkward phrases such as "that smart contract needs 10 gas to execute" or "5 gas per second" are commonplace in everyday blockchain conversation. For newcomers to the world of distributed ledgers, this can take some getting used to
How to Estimate Ethereum Fees
To calculate the cost of a transaction in Ethereum, you need to consider three variables. The first variable is the units of gas required to execute the given transaction. The second variable is called the base fee. The base fee is the current price of gas. The third variable is called the priority fee or tip. The priority fee, as the name implies, is a fee paid to an operator of a computer on the Ethereum network to prioritize a transaction over other, less lucrative transactions that are pending in Ethereum's unordered transaction pool.
Thus, the logic for calculating a transaction fee in Ethereum can be expressed with the following formula:
tx_fee = units_of_gas_used x (base_fee + priority_fee)
units_of_gas_used is the amount of gas used to execute the transaction as measured in the unit gas.
base_fee is analogous to the cost of computing as measured in gwei.
priority_fee is analogous to the priority premium as measured in gwei.
Be advised that when it comes to determining units_of_gas_used, users can set a gas limit, which declares the most gas a user is willing to allocate for executing the given transaction.
Fortunately, given the 24/7 nature and volume of activity on the Ethereum network, the amount of gas required to execute commonplace transactions is well known. For example, at the time of publication of this article, transferring ETH between two accounts on the Ethereum blockchain currently ran around 21,000 gas. Similar to how consumers exercise their tolerance for paying anything but the going rate for automobile fuel, market knowledge of the going rate for Ethereum transactions (as well as transactions on other blockchains) has made it conventional for DLT users to set gas limits that correspond to their tolerance for fees that match, exceed, or undercut that rate. There are tools such as wallets that store ETH and libraries that calculate the computational labor required by functions in a smart contract that can automatically set gas limits according to a user's preferences and tolerances. Nonetheless, understanding gas limits is important, particularly when it comes to declaring them manually should the situation arise.
Ethereum also has another input value that plays a role in transaction execution called maximum_fee_per_gas, aka "Max Fee." The Max Fee is NOT to be confused with the gas limit.
The Max Fee is the total maximum amount a user or smart contract is willing to pay per unit of gas to execute the contract. You can think of Max Fee as the fee to use should the sum of the base_fee and the declared priority_fee not be enough to pay for the transaction.
Figure 1 is an annotated screenshot from the Blocknative transaction fee estimator. The figure is followed by some examples of calculating Ethereum transaction fees based on the information presented above.
Figure 1: An example for estimating an Ethereum transaction fee using the gas estimator at Blocknative.com.
The following are some examples of calculating the translation fee for executing a simple transfer of ETH between two accounts on the Ethereum network. The examples use a limit of 21,000 gas to power the transaction.
This example runs the calculation according to the base fee and highest priority fee shown above in Figure 1, WHERE:
- units_of_gas = 21,000
- base_fee = 13.36 gwei
- priority_fee = 1.21 gwei
Transaction fee = 21,000 x (13.36 + 1.21)
The cost of the transaction is 305,970 gwei or 0.000376 ETH (approximately US$0.46 at the time this article was written).
This example runs the calculation according to the base fee and lowest priority fee shown above in Figure 4, WHERE:
- units_of_gas = 21,000
- base_fee = 13.36 gwei
- priority_fee = .17 gwei
Transaction fee = 21,000 x (13.36 + 0.17)
The cost of the transaction is 284,130 gwei or 0.00035 ETH (approximately US$0.43 at the time this article was written).
As demonstrated above, it costs between 46¢ and 43¢ (highest to lowest priority) to execute a simple transfer of currency between accounts on Ethereum. This might not seem like a lot of money in the scheme of things and in this sense, it's not. But, imagine that a public company has a smart contract on the Ethereum network that's programmed to disburse dividends to a million shareholders on a quarterly basis payable in ETH. Even with a low-priority transaction fee of 43¢ per transaction, the aggregate cost of those transactions could easily exceed half a million dollars.
Putting It All Together
Getting a handle on transaction fees is essential in order to ensure that the benefit of using a distributed ledger outweighs its operational cost. While the news is full of stories about using cryptocurrencies in investment and speculation schemes, when it comes to day-to-day business operations, cryptocurrency has a more utilitarian value. It's the fuel that drives digital ledgers and their smart contracts.
Organizations looking to optimize the TCO of their DLT usage will find that such optimizations are easier to manage with some chains than others. For example, as noted in Blockchain Journal's overall Guide to Blockchain Fees, the cost of usage for some chains is pegged to the value of the chain's native cryptocurrency and not the US dollar. In those cases, organizations will have less control over TCO because of volatility in the US dollar valuation of that cryptocurrency. Similarly, organizations have limited control over the laws of supply and demand that dictate the going rate for "tips" to ensure timely transaction processing during congestion.
But, as noted in this and all Blockchain Journal articles regarding distributed ledger TCO, even on chains where fees are subject to these market conditions, just knowing exactly how fees work on a given chain is critical to understanding where the opportunities for cost optimization exist. Once transaction fees for a given chain are realized, organizations can then develop methods to help minimize TCO. As just about any business executive will tell you, cost control is equally important to revenue generation as a factor in running a profitable business. Hence, it's important to understand how transaction fees are determined under Ethereum or any ledger that is under consideration for an organization's blockchain project.