Understanding Network Fees

What are network fees

Levain uses gas fee, transaction fee and network fee interchangeably as these terms would mean the same thing - that it refers to the network fee required to execute a transaction on-chain.

Most blockchain transactions require network fees to be executed on-chain, and they come in all sorts of names. Network fees are never charged by Levain, but rather by the blockchain network itself. Here are some examples:

While Levain handles most of the complexities of network fees for you, we have prepared this guide to help you understand the fundamentals of network fees.

Why do I need to pay network fees

Network fees are required to pay for the computational resources required to execute a transaction on-chain. For example, when you send a transaction on Ethereum, you are paying for the computational resources required to execute the transaction on the Ethereum network. These fees do not go to Levain, but rather to the validators (in a proof-of-stake blockchain) or miners (in a proof-of-work blockchain) who are executing the transaction on the blockchain network.

How much network fees do I need to pay

Network fees are determined by the blockchain network itself, and are not determined by Levain. Generally, the amount of network fees required to execute a transaction on-chain is determined by the following factors:

  • The blockchain network you are using
  • The type of transaction you are executing
  • The amount of computational resources required to execute the transaction
  • The amount of congestion on the blockchain network
  • The amount of gas price you are willing to pay

Choosing a network fee for your transaction

For most blockchains supported by Levain, you will be given the option to choose between a low, standard or high network fee. This will determine the amount of network fees you are willing to pay, and Levain will automatically estimate the amount of network fees required to execute the transaction on-chain.

Network fee selection

Note that the options are only estimates of the amount of network fees required to execute the transaction on-chain. We estimate the amount of network fees from various data sources, such as the current gas price on the blockchain network, and the amount of congestion on the blockchain network.

The actual amount of network fees required to execute the transaction on-chain may differ from the estimate shown to you at the point of you signing the transaction, depending on the amount of congestion on the blockchain network.

Calculation of network fees

EVM-compatible blockchains

The amount of network fees required to execute a transaction on-chain is calculated as follows:

network fees = gas price * gas limit

Where:

  • gas price is the price you are willing to pay per unit of gas, this value is determined by you by way of selecting the low, standard or high network fee option
  • gas limit is the amount of gas required to execute the transaction on-chain, and this value is estimated by Levain

Gas price and gas limit

Gas prices are estimated based on EIP-1559 if the EVM-compatible blockchain supports it, which is the most recent transaction pricing mechanism that includes fixed-per-block network fee that is burned and dynamically expands/contracts block sizes to deal with transient congestion.

Bitcoin

Typical Bitcoin transaction

Bitcoin uses the Unspent Transaction Output (UTXO) model, where each transaction consumes one or more UTXOs and creates one or more new UTXOs. This is in contrast to the Account-based model where native token balances are stored in accounts.

For Bitcoin, the amount of network fees required to execute a transaction on-chain is calculated as follows:

network fees = fee rate * transaction size

Where:

  • fee rate is the amount of miner fee you are willing to pay in satoshi per virtual byte (sat/vB), this value is determined by you by way of selecting the low, standard or high network fee option
  • transaction size is the size of the transaction in bytes, and this value is estimated by Levain based on the data of the transaction

In a typical Bitcoin transaction, the fee rate is expressed in satoshi per byte. For example, a fee rate of 10 satoshi per byte means that for every byte of the transaction, you are willing to pay 10 satoshi as miner fee.

Bitcoin fee and fee rate

Your transaction size can also be found in the block explorer page of the blockchain network you are using. For example, in the screenshot below, the transaction size is 1.26 kvB, for consolidating all UTXOs in a Levain multi-signature wallet. We use virtual bytes (instead of bytes) because the transaction is a Taproot transaction, and the transaction size is calculated in virtual bytes.

Transaction details

Note that because of how UTXO works, transaction size can vary greatly depending on various factors:

  1. The number of inputs used. The more UTXOs you are using as inputs, the larger the transaction size will be. This is because each UTXO is a separate input in a transaction, and needs to be signed separately, which increases the transaction size.
  2. The number of outputs created. The more recipients you are sending to, the more outputs will be created, and the larger the transaction size will be.

In other words, the more complex the transaction, the larger the transaction size will be, and the more network fees you will need to pay.

This also means that sending 1 BTC that was received in your wallet in one transaction, will have lesser fees compared to sending 1 BTC received in your wallet in multiple transactions, assuming the same fee rate is used.

Screenshot showing sending 0.001 BTC with 11 inputs versus 1 input

In the screenshot above, you can see that the same Levain wallet is used to send 0.001 BTC in two different transactions, to the same recipient. The first transaction uses 11 inputs at 1.37 vkB, and the second transaction uses 1 input at 0.21 vkB. The first transaction has a larger transaction size due to the number of inputs, and therefore requires more network fees to be paid, disregarding fee rate.

DeFiChain

DeFiChain, being a fork of Bitcoin, shares the same fee calculation mechanism as Bitcoin, as follows:

network fees = fee rate * transaction size

Where:

  • fee rate is the amount of miner fee you are willing to pay in fi per byte (fi/byte)
  • transaction size is the size of the transaction in bytes

Tron

Tron follows a slightly different model, where there are two types of network fees: bandwidth and energy.

Generally, each Tron wallet is given some bandwidth and energy points daily for free, and bandwidth and energy points are consumed when you send a transaction on-chain. The amount of bandwidth and energy points consumed is determined by the size of the transaction in bytes. If you run out of bandwidth or energy points, you will need to wait for the next day to get more bandwidth or energy points, or you can burn TRX to get more bandwidth or energy points.

Bandwidth and energy

Bandwidth

Bandwidth is consumed when you transfer native TRX or TRC-10 tokens.

Each account is given some bandwidth points daily for free, and bandwidth points are consumed when you send a transaction on-chain. The amount of bandwidth points consumed is determined by the size of the transaction in bytes. If you run out of bandwidth points, you will need to wait for the next day to get more bandwidth points, or you can freeze some TRX to get more bandwidth points.

Energy

Energy is consumed when you transfer TRC-20 tokens or execute smart contracts actions via WalletConnect, for example, when you make a swap on SunSwap. This is on top of the bandwidth consumed.

Each account is given some energy points daily for free, and energy points are consumed when you send a transaction on-chain. The amount of energy points consumed is determined by the size of the transaction in bytes. If you run out of energy points, you will need to wait for the next day to get more energy points, or you can freeze some TRX to get more energy points.