Prior to 2020, most blockchain transactions were relatively cheap. But now, with the rise of Web3 and NFTs, the price of mandatory blockchain transaction fees — also known as gas fees — serves as one of the largest barriers to entry for mainstream adoption.
For blockchains like Ethereum and Bitcoin, the price of gas fluctuates based on network congestion. That means the more people using the network, the higher the gas fee. And with Web3’s ethos centered around democratization and inclusivity, this fundamental scaling issue largely brings those core tenants into question.
While the concept of gas is fairly straightforward, under the hood it can be rather complex. That’s why we’ve put together this in-depth explainer on gas fees, how they’re calculated, and what Ethereum and other blockchains are doing to make them more affordable.
What is a gas fee?
As defined in our NFT dictionary, gas fees are the payments individuals make to complete a transaction on a blockchain. These fees are used to compensate blockchain miners for the computing power they have to use to verify blockchain transactions. They are typically paid in the blockchain’s native cryptocurrency. While the act of paying for gas is a given (you can’t perform blockchain transactions without it), the price of gas itself is highly volatile and dependent on a multitude of factors.
The two main factors for each blockchain are block time (the time required for the respective blockchain to generate new blocks) and transaction throughput (how many transactions a single block can process). Generally speaking, the faster blocks are generated and the more transactions they can hold, the less block-space competition there will be. This results in cheaper transaction fees for all network users.
Let’s compare the block time and size of Bitcoin, Ethereum, and Solana.
Bitcoin’s block time is around 10 minutes and with a maximum block size of 1 MB, each block can process anywhere from 500 to 4,000+ transactions depending on the transaction size.
Solana has a block size of .4 seconds and a throughput of 20,000 transactions resulting in extremely low gas fees.
Meanwhile, Ethereum has a block time of 13 seconds and a block size of around 70 transactions. Despite Solana’s gas fees being close to $.000025 per transaction (nearly 60,000 times less expensive than Ethereum), Ethereum is still by far and away from the most popular blockchain for NFTs, DeFi, and other Web3 activity. With this small of a block size and such high network usage, it’s easy to see why Ethereum’s gas fees have gotten out of hand.
How are Ethereum gas fees calculated?
To understand how Ethereum gas is calculated, we must first understand the concept of gwei. Gwei is a very small denomination of Ether (1 gwei = 0.000000001 ETH) that is used to measure the cost of gas. For example, a gas fee of 30 gwei would be equivalent to 0.000000030 ETH.
Since Ethereum’s London hard fork in August 2021, Ethereum gas fees follow a simple calculation:
Total Gas Fee = Gas units (limit) x (Base fee + Tip)
Let’s break this down a bit further.
A gas limit is the maximum amount of gas (or energy) that a cryptocurrency user is willing to pay when completing a transaction on the blockchain. For standard Ethereum transactions, most wallets and exchanges set the gas limit at 21,000 gwei, but give users the ability to manually edit this number whenever they please. In gas wars, where many users are competing over transaction priority in the next block, users often raise their gas limits significantly.
That said, Ethereum will only use the exact amount of gas needed to process the transaction. Any difference between your gas limit and the actual amount of gwei needed is refunded to your wallet. Meanwhile, setting your gas limit too low will likely cause your transaction to fail, resulting in wasted gas fees that you can never recoup.
Next up is the base fee. Also introduced as part of the London upgrade, each block has a base fee that is dependent on network congestion. As a deflationary mechanism to offset the issuance of new ETH, each base fee is burned, or discarded from Ethereum’s supply circulation. So to compensate miners for the fee that they would’ve once received, users are encouraged and expected to include a priority fee (tip) with each transaction. The higher the priority fee, the quicker the transaction will process. In wallets like MetaMask, users are able to adjust all three values (the gas limit, max priority fee, and max fee).
So with all that in mind, here is an example of a basic gas fee calculation. Let’s say that James wants to mint an NFT for 1 ETH.
1. The gas limit is 21,000 units, the base fee is 50 gwei, and James includes a tip of 15 gwei.
2. The gas calculation formula is: 21,000 (gas limit) x (50 (base fee) + 15 (Tip)), or 21,000 x (50 + 15). This returns a total gas fee of 1,365,000 gwei or 0.001365 ETH.
3. When James mints the NFT, 1.001365 ETH will be charged from his wallet. The wallet associated with the NFT project will receive 1 ETH, the miner will receive the tip of 0.000315 ETH, and the base fee of 0.00105 ETH will be burned.
Users can also set a maximum fee for the transaction, which gives them full control over the absolute maximum they’d like to pay with the base fee and priority fee included.
But still, while this model makes fees more predictable, it doesn’t solve the issue of congestion-based pricing. That’s why Vitalik Buterin and the Ethereum team are working diligently on a new, scalable version of Ethereum.
Making gas fees more affordable
Despite numerous delays, the Ethereum team has finally announced that its multi-phase Ethereum2.0 upgrade will begin in August 2022. Designed to improve scalability, security, and efficiency, Ethereum 2.0 will be changing from a proof-of-work consensus to a proof-of-stake model. Not only will this significantly improve transaction throughput (Ethereum 1.0 can process around 30 transactions per second, while 2.0 promises to complete 100,000 per second), but it will also significantly reduce gas fees by decreasing the amount of computing power needed for each transaction.
In lieu of the long-awaited upgrade, users have been relying heavily on Layer 2 protocols for quicker and cheaper transactions.
What is Layer 2?
Layer 2 protocols (L2) are secondary scaling frameworks built on top of existing Layer 1 blockchains (like Bitcoin and Ethereum), designed to improve transaction throughput and reduce gas fees. The two most popular and trusted Layer 2s are sidechains and rollups.
A sidechain is a separate blockchain network that connects to a parent blockchain via a two-way bridge. Using smart contracts, sidechains are able to transfer tokens securely back and forth between blockchains. Despite being connected to a main blockchain (mainnet), sidechains operate under their own consensus protocols.
For Bitcoin, not only do sidechains like Rootstock (RSK) increase block time and significantly reduce gas fees, but they also add additional functionality to the blockchain. The RSK blockchain provides the network with scalable smart contract capabilities, further expanding the possible use cases of bitcoin.
Ethereum-wise users tend to rely on Polygon as a quick, cheap, and scalable alternative.
Unlike Ethereum, Polygon operates on a proof-of-stake consensus which allows for significantly quicker transactions, higher throughput, and lower gas fees. Gas is also paid in Polygon’s native token MATIC, which is substantially cheaper than ETH resulting in pennies worth of MATIC instead of hundreds of dollars worth of ETH. With this in mind, Polygon has become a chosen blockchain for DeFi and bulk-NFT trading. But even with all the upside, it’s important to note that sidechains, Polygon included, come with their own sets of issues around security and downtime.
Rollups are scaling solutions that batch together (or roll-up) multiple blockchain transactions at once, storing the transaction data on the main blockchain (on-chain), while executing the transaction themselves on a separate chain (off-chain). By validating the transactions on-chain but relying on off-chain execution, rollups also provide increased throughput and lower gas fees. At the time of writing, there are two main types of rollups: Optimistic rollups and Zero-knowledge proofs (zk proofs). While both options come with advantages and disadvantages, each has already shown promise.
By now you should have a good understanding of gas fees and how they work. While much is still to be seen from ETH 2.0s arrival, it is certain that gas fees will never be fully eradicated. So remember, always keep extra cryptocurrency in your wallet for gas. You’re going to need it.