Top 10 Factors Determining Gas Fee in a Blockchain

By Dhirendra Das
8 Min Read

The gas fee is the cost paid to the validators when you make any transaction on the blockchain. In any blockchain, gas represents the amount of work required to validate a transaction. 

Since the gas fee is always floating, its price can never be fixed. This article lists the most important factors that impact the gas price at any given instant.

Do you know blockchains also support Gasless Transactions?

How Gas Fee is Calculated

The gas fee is basically calculated by adding a priority fee to the base fee. The priority fee helps you put your transactions at a higher priority than others and this helps you speed them up.

In the case of Ethereum and Ethereum-based blockchains, the following formula is used to calculate the gas fee.

Gas Fee = Gas Limit x (Base Fee + Priority Fee)

Here, gas limit refers to the value set in a blockchain to process a transaction. Currently, Ethereum’s gas limit is at 21,000 units of gas.

gas fees level
Ethereum Gas Fee based on 3 Transaction Speeds.

Here is a detailed article on Gas Fee Calculations

Factor 1: Demand for Gas

Gas demand has the highest impact on the gas fee at any given point in time. Higher gas demand is usually seen when there is a mass event, such as a popular NFT mint, a FOMO rally, or a panic sell-off. However, these events occur once in a while.

Understand how demand and supply impact the price of gas

Factor 2: Priority

The second most important factor impacting gas fees is the priority of the transaction. The faster you want the transaction, the higher the gas fee you need to pay.

For example, in Ethereum, suppose the base fee is around 1 Gwei. This is the minimum amount you need to pay to transact on the chain. You can either choose to transact on this speed or pay an additional fee called a priority fee. This priority fee helps you skip the transaction queue.

Factor 3: Transaction Complexity

Any transaction on a blockchain causes a small change in the blockchain, called the “State Change.” The main use of the gas fee is to pay the validators who are authorized to change this state by adding your transaction to the chain.

Typically, the more complex the change, the higher the fee charged. For example, if an ordinary peer-to-peer transaction costs 0.01 ETH, then an NFT sale (which is a bigger change) costs 0.03 ETH.

A blockchain supports multiple types of transactions, such as ordinary transactions, NFT transfers, swapping, etc. All these changes have different gas costs associated with them.

Factor 4: Block Size

In any blockchain, the block size refers to the amount of data a single block can hold. The bigger the block, the more data it can carry and, hence, the cheaper it becomes to transact on that blockchain.

Blockchains such as Ethereum, which have a lower block size(~6.88 MB), carry less data and, hence, charge more gas fees than blockchains such as Solana (~78 MB).

Please note that these are native values and do not include the compression provided by scaling solutions or third-party protocols.

Factor 5: Validators/Miners

The availability of validators and miners also impacts the gas fee. Other than just the numbers, the way through which validators and miners validate transactions also plays a key role in determining gas fees.

If fewer validators are present at any point, they might charge a higher fee because of a higher demand. Alternatively, the presence of a high number of validators in the blockchain network helps lower the gas fees.

However, there is a twist. Though Ethereum has a high number of validators (1.05 million), it has a higher gas fee than Solana (1500 validators). The reason is that Ethereum validators are not segregated. 

Factor 6: Network Forks

Blockchain forks play a lesser role but become very important when fee-related upgrades are done. For example, the Dencun Upgrade (a soft fork) effectively reduced the gas fee in Ethereum by 99%.

Here is an in-depth article on Dencun Upgrade

Factor 7: Token Standards

Different token standards require different gas limits to get executed. Regardless of the blockchain, an NFT would always need more gas than a swap transaction.

Even within a single token standard, there could be a difference in gas fees based on their usage. For example, if the ERC-1155 standard is used to produce 5 NFTs, it would incur a different gas fee than creating 5 memecoins.

Factor 8: Involvement of Oracles

Oracles typically deliver real-life information to the blockchain since the latter cannot interact with the outer world on its own. Oracles are generally used by platforms like exchanges, betting platforms, prediction markets and a few other similar cases.

The usage of oracles generally incurs a higher gas fee than an ordinary transaction because to interact with the oracle, a blockchain smart contract must send a query and then receive the oracle data. Even if data is fed automatically, still the smart contract has to process the data on its virtual machine which needs additional gas. 

Factor 9: Wallet Settings

Wallet settings are an important factor impacting the gas fee that you need to pay. For example, MetaMask, one of the most popular wallets in the crypto world, lets you adjust your wallet’s gas limits so that you can prioritize transactions accordingly.

The image below displays three settings that can be done on a MetaMask wallet to alter its gas fee. They are:

  • Max Base Fee
  • Priority Fee
  • Gas Limit

All of these factors are explained in detail in this article on Gas Fee Calculations.

metamask
Gas Fee Settings in MetaMask.

Factor 10: Smart Contracts

Smart contracts can also modify gas fees based on their preferences. Usually these preferences are set so that at any point in time, a smart contract is not overwhelmed by the number of users.

Smart contracts can increase gas fees based on the demand for gas in a blockchain network. Some scenarios where this is done are:

  1. Failed transactions incur gas fees even if they are incomplete. This happens when a transaction is accompanied by insufficient gas.
  2. Multiple interactions with the transacting wallet.
  3. Dynamic data handling, where continuous but dynamic data is fed to the smart contract.
  4. Complex transactions.
Dhirendra Das has been an active crypto trader and journalist since 2020. He spent most of his career as an SEO for blockchain native companies and holds an MBA Finance degree from Jain University.