Skip to main content

What Is the Ethereum Miner Fee?

tokenviewAbout 3 min

What Is the Ethereum Miner Fee?

In the Ethereum network, any type of transaction incurs a fee known as the miner fee, paid in ETH. The amount of this fee determines the processing speed of the transaction; generally, the higher the miner fee, the faster the transaction is processed.
Taking imToken as an example, there are two ways to set the miner fee:

imtoken

In the Ethereum network, there are two types of miner fee mechanisms: EIP-1559 and Legacy. Before understanding how to set miner fees, we need to first learn about an Ethereum upgrade: the "London upgrade."

What is London upgrade / EIP-1559?

Before the London upgrade, Ethereum had fixed-size blocks. During periods of high network demand, these blocks operated at full capacity. As a result, users often had to wait until demand decreased to have their transactions added to blocks, resulting in a poor user experience. The London upgrade introduced variable-sized blocks to Ethereum.
The way transaction fees on the Ethereum network are calculated changed after the London upgradeopen in new window in August 2021.
Before the London upgrade, there was no distinction between base fee and priority fee in the fee calculation. The calculation of miner fees used the Legacy.
EIP-1559open in new window implemented in the London upgrade, makes the transaction fee mechanism more complex, but improves the predictability of gas fees and makes the transaction fee market more efficient. Users can set maxFeePerGas (corresponding to how much they are willing to pay to execute the transaction) when submitting a transaction, knowing that the amount paid will not exceed the market price of gas (baseFeePerGas) and that the overpayment will be refunded minus the tip.

Miner Fee Calculation Formula

Currently most Ethereum transactions use EIP-1559. Using the traditional legacy to set gas fees may result in slower transaction speeds and higher gas fees.

EIP-1559

Before calculating, you need to know the following 6 concepts first.

  • Gas:the Ethereum network consumes computational resources to execute each transaction, and Gas is the unit of measuring resources.
  • Gas Used: It is the total amount of Gas consumed by users to perform operations. It is a fixed amount. The ETH transfer is 21,000. Since other ERC20 tokens are smart contracts, they are generally more expensive than 21,000. The specific amount is determined by the complexity of the smart contract code.
  • BaseFee:the lowest price of Gas calculated by the Ethereum network to ensure a successful transaction.
  • PriorityFee:the tip you pay for each unit of Gas to speed up the transaction.
  • MaxPriorityFee:the maximum tip you pay for each unit of Gas.
  • MaxFee:the maximum price you pay for each unit of Gas

Calculation formula:

  • Miner Fee = Gas Used *(BaseFee + PriorityFee)

Legacy

Before calculating, you need to know the following 3 concepts first.

  • Gas:the Ethereum network consumes computational resources to execute each transaction, and Gas is the unit of measuring resources.
  • Gas Used: It is the total amount of Gas consumed by users to perform operations. It is a fixed amount. The ETH transfer is 21,000. Since other ERC20 tokens are smart contracts, they are generally more expensive than 21,000. The specific amount is determined by the complexity of the smart contract code.
  • Gas Price:the price you pay for each unit of Gas

Calculation formula:

  • Miner Fee = Gas Used * Gas Price

How to set Gas Price, Base Fee, Priority Fee

Just as gasoline is needed to drive a car, fuel is needed to run applications (transact ETH, deploy contracts), and this fuel is called Gas.
The amount of Gas required for each operation (Gas Used) is fixed, but the price of Gas (Gas Price) fluctuates.
Therefore, we can control the speed of sending transactions to the chain by setting the Gas Price (including Base Fee and Priority Fee).
The following are some websites and APIs that can obtain Gas Price, Base Fee, and Priority Fee.

Reference Websites

Reference API

curl https://services.tokenview.io/vipapi/eth/gas/nextblock?apikey={apikey}
{
    "code": 1,
    "msg": "成功",
    "data": {
        "nextBlockNum": 18210999,
        "midPriorityFee": "0.59",  // Middle Priority Fee
        "highPriorityFee": "1.98", // Hight Priority Fee
        "lowPriorityFee": "0.1",   // Low Priority Fee 
        "nextBlockNumBaseFee": "7.1" // Base Fee
    }
}

About Tokenview Blockchain APIs & Data Service Platform:

Tokenview blockchain APIs & data service platform contained 120+ blockchains has powerful endpoints that simplify complex blockchain data into single API calls. Code for all supported blockchains using unified API calls. From here to easily get transaction, address, gas, contract, token, NFT, logs and any information from chain. And Yes you can also send tx to chain. One-click configuration with APIKey helps developers to Use, to Create, to Build.
Last update: