If you want to perform any sort of transaction on the blockchain, be it Bitcoin or Ethereum, then it’s going to cost you. Depending on market forces and network activity, those fees can be small...or extremely large! But whether you like it or not, the fees are an essential part of the blockchain ecosystem. But why? What exactly are transaction fees and how do they work?
Let’s find out.
As mentioned, transaction fees are essential to the blockchain. They serve two main purposes:
Transactions on the blockchain don’t just magically happen. They have to be checked, validated, and added to the blockchain— a process that requires a considerable amount of computational power.
This power is provided by “miners” with sophisticated software that solves complex mathematical problems. The transaction fees are therefore an incentive to participate in maintaining the integrity of the decentralized ledger and a reward for doing so.
In terms of protection, the simple fact that conducting any sort of transaction on the blockchain incurs a fee, acts as a deterrent to bad actors. People are less likely to spam if they have to pay to do it.
It’s worth noting that transaction fees are not the same as the fees charged by crypto exchanges. Those additional processing fees go directly to the exchange, while blockchain transaction fees go to the miner of the block.
Generally, fees are tied to the size of the transaction and the throughput of the network.
The more complex the transaction, the higher the fees. For example, executing a smart contract on Ethereum requires more computational power than a standard transaction, therefore, it costs more.
When a blockchain is heavily congested, users can attach a higher transaction fee to entice miners to prioritize their transactions and validate them first. Blocks contain a limited amount of space so miners tend to focus on adding transactions with higher fees first.
This creates a sort of bidding war for users who want to have their transactions validated, which pushes the fee price up.
But how transaction fees work really depends on what blockchain you’re talking about. To explain, we’ll focus on the big two... Bitcoin and Ethereum.
Bitcoin was created to be a deflationary currency with its purchasing power increasing over time. To achieve this, the concept of scarcity is built into the Bitcoin cryptocurrency which is what makes it valuable, much like gold.
Bitcoin’s scarcity is created through a process of “halving”. After every 210,000 blocks are mined the block reward halves and will continue halving until the block reward per block becomes 0.
This halving increases the cost of mining while decreasing the miner rewards. So, Bitcoin transaction fees are hugely important in incentivizing miners to continue validating new blocks.
Without fees, there are no miners.
Without miners, there is no blockchain.
Bitcoin fees are not dependent on the amount of cryptocurrency within a transaction but are based on the transaction size (in bytes). More complicated transactions, ones that have more inputs and outputs, will involve more data and therefore will be more expensive.
The fees are measured in satoshis— the smallest divisible unit of bitcoin. A satoshi (sat) is 100 millionth of a bitcoin shown as 0.00000001 BTC.
Bitcoin fees are shown as sats/vByte meaning satoshi per unit of data the transaction will consume. If a transaction is 400 bytes, and the average transaction fee is 80 satoshis per byte, you would pay 32,000 satoshis (or 0.00032 BTC) to have your transaction added to the next block.
Usually, your wallet or exchange will give you three different fee rates for the speed at which you want your transaction processed. For example, it might be fast, slow, or standard – the faster route will cost more while the slower will of course be cheaper but will mean waiting longer for confirmation.
Unlike Bitcoin fees that are based on bytes, Ethereum fees are based on the computational power it takes to validate the transaction. This power is called “gas”.
Just as a car needs gas to move, you need gas to move anything on the Ethereum blockchain.
Moving ether (ETH), Ethereum’s native cryptocurrency, between addresses, minting NFTs, executing smart contracts, or exchanging ETH for other tokens, all of these actions cost gas.
Stated in gwei which stands for giga-wei (wei being the smallest denomination of ETH), gas fees are made up of two things, the gas limit— the maximum amount of gas that you’re willing to pay to run a transaction; and the gas price— the amount you want to pay per unit of gas.
Recently, Ethereum moved from a first-price auction fee model to a transaction pricing mechanism. This hard fork, called the London Upgrade, saw the implementation of EIP-1559 (EIP - Ethereum Improvement Proposal) which introduced a new fee model that works through a fixed-per-block network fee. The proposal aims to reduce the volatility of the gas fees and the congestion of the network.
Here’s how it works:
A base fee is set per block, but this base fee can be increased or reduced depending on how busy the network is. When the network is at more than 50% utilization, the base fee is increased. When it’s lower than 50% utilization, the base fee is decreased.
The change in base fee is constrained to a 12.5% maximum increase or decrease, which allows for more predictable fee estimation.
As well as the base fee, EIP-1559 introduced a separate fee called a miner tip.
To avoid the risk of miners artificially inflating the base fee for their own gain, the base fee is burned (destroyed) and only the user-submitted miner tip is received as the miner reward.
With the rise of dApps and the acceptance of cryptocurrency as legal tender, more and more businesses are integrating their services with the blockchain.
Having an understanding of how blockchain transaction fees work is therefore necessary for predicting expenditure— before executing a transaction, you need to know how much it’s going to cost. There have been instances of users paying more in fees than the amount of cryptocurrency they are trying to buy, sell or exchange.
So how can you make wise fee decisions?
Thankfully, you don’t need to try to calculate gas or fees by yourself.
Here’s what you can do:
This endpoint is specifically for the Ethereum blockchain. It gives information for gas expenses when sending ether or making a transaction with additional data in it.
You can use Estimate Gas Limit to get details such as:
The Estimate Token Gas Limit is for Ethereum, Ethereum Classic, and the Ethereum compatible Binance Smart Chain. You can access information for gas expenses for a specific contract when sending ether or making a transaction with additional data in it.
The details returned include:
Our Get Fee Recommendation endpoint provides recommendations done in real-time and based on Mempool data. This makes them much more accurate than fees based on already mined blocks.
You can receive fee recommendations per byte calculated from unconfirmed transactions for the different priority levels, fast, slow, and standard.
Using this endpoint customers can get the gas price for Ethereum and Ethereum Classic. It also returns details for other blockchains such Bitcoin, Bitcoin Cash, Dogecoin, Dash, Litecoin, Binance Smart Chain, Zcash, and XRP.
Through the Estimate Transaction Smart Fee endpoint, you can estimate the approximate fee per kilobyte needed for a transaction to begin confirmation within the confirmationTarget blocks when possible. After which it will return the number of blocks for which the estimate is valid. This endpoint can be used to return estimates for Bitcoin, Litecoin, and Dash.
Through the Get EIP 1559 Fee Recommendations endpoint, customers can obtain fee recommendations specifically for the London Upgrade EIP 1559 fee model, including:
Crypto APIs give you greater control over how much you spend on fees so you can optimize your business operations. To learn more about our unified endpoints check out our documentation.