Understand Transaction Fees

How Fordefi calculates transaction fees on EVM chains.

Transaction fees are a significant aspect of blockchain networks, serving multiple purposes, including resource allocation, security, economic incentives, monetary policy, and sustainability. They enable the functioning of decentralized systems by aligning the interests of participants and ensuring the efficient operation of the network.

The fee mechanism works differently, depending on the chain. Among the EVM chains supported by Fordefi, some still use the legacy fee structure, while some upgraded to the EIP-1559 standard. This page describes how Fordefi supports both transaction fee mechanisms.

Legacy fee

The legacy fee model requires the provision of a single fee parameter: the Gas Price. The gas price is the price the transaction sender is willing to pay for each calculation unit (that is, gas unit).

Since the entire transaction fee goes to the miners and the amount of gas consumed depends on the state of the chain and on the mempool, the miners prioritize transactions based on their gas price: the higher the gas price, the faster the transaction will be mined.

In the Fordefi platform, users can set the gas price to low, medium, or high, meaning 1.1, 1.2, or 1.25 times the gas_price, returned by the node.

The total transaction fee is calculated by multiplying the gas limit by the gas price that is specified by the sender in the transaction. For example, if a transaction has a gas limit of 21,000 and a gas price of 100 gwei (1 gwei = 0.000000001 ETH), then the total fee would be 21,000 * 100 gwei, meaning 0.0021 ETH.

EIP-1559

EIP-1559 fee structure is based on two factors: base fee and priority fee, which are described below. These factors are not controlled by the sender wallet. The wallet specifies two parameters in the transaction: max priority fee and max total fee, which are described below, too.

Base fee

The base fee is a component of the total transaction fee that is burned. It's called the "base fee" because it represents the minimum amount required to include a transaction in a block, determined by network congestion. When the network is busy, the base fee increases; when the network is less congested, it decreases. The base fee is automatically adjusted, block by block, to keep the network operating smoothly.

At Fordefi, we take the base fee from the last block and add the following percentile, based on the fee level:

  • low: 10%
  • medium: 20%
  • high: 25%

Priority fee

The priority fee is an optional fee that the sender can include in their transaction to incentivize miners to include it in the next block. Unlike the base fee, which is burned, the priority fee is paid directly to the miner who includes the transaction in a block. It allows users to specify an additional amount they are willing to pay, beyond the base fee, to expedite their transaction's processing.

At Fordefi, we estimate the priority fee, based on transactions in recent blocks and divide them into three levels:

  • low: 10%
  • medium: 20%
  • high: 30

When sending a transaction with the EIP-1559 fee structure, the user specifies two fields:

  • Maximum Priority Fee: The maximum priority fee the user is willing to pay in the transaction.
  • Maximum Total Fee: The maximum total transaction fee, base + priority the user is willing to pay for the transaction.

Fordefi’s fee estimation sums both base and priority fees for each level and this is the recommended fee, while medium is the default level.

For both legacy and EIP-1559, Fordefi allows users to set custom fees.

Gas limit

What is common to both standards is that the transaction needs to include the Gas Limit parameter Gas Limit represents the maximum amount of computational work (that is, gas) the transaction is allowed to perform. In case the transaction needs to exceed the amount of gas it consumes during its runtime, the transaction will fail and the sender wallet will lose the fee paid for that transaction up to that point. That is why Fordefi’s wallets always add a “buffer” of an additional 50% on top of the node’s estimation.

For reference, a native transfer consumes 21,000 gas units (for native transfers, Fordefi does not add a buffer), where the majority of contract calls are in the range of 45,000 to 80,000 gas units.

EVM chains and their fee mechanisms

The following table shows the EVM chains that are currently supported by Fordefi and the fee mechanisms they use:

ChainFee
Arbitrum OneLegacy
AvalancheEIP-1559
BaseEIP-1559
BNBEIP-1559
BlastLegacy
CantoEIP-1559
ConfluxLegacy
DymensionEIP-1559
EthereumEIP-1559
FantomLegacy
GnosisEIP-1559
KavaLegacy
LineaEIP-1559
Manta PacificEIP-1559
MantleEIP-1559
MerlinLegacy
OptimismEIP-1559
PolygonEIP-1559
Polygon zkEvmLegacy
zkSync EraEIP-1559