Transaction fees are something that any bitcoin user faces, especially during times of bull markets when they seem to be particularly high. So I wanted to know more about bitcoin transaction fees, more in particular: Why do bitcoin transaction fees fluctuate? How does my bitcoin wallet application knows which fees to apply?, etc.
How are bitcoin transaction fees calculated? Bitcoin transaction fees are estimated by the bitcoin software you use when making a transaction, based on (1) the transaction fees paid by recent transactions and (2) how saturated the bitcoin network is at that moment in time.
Because the space for data in a bitcoin block is limited, the more transactions are pending, the higher the fees tend to be (free market mechanism). The bitcoin software you use selects the appropriate fees so that the transaction is confirmed within a desired timeframe, measured in number of blocks (on average a new block is mined every 10 minutes).
Estimating the optimal transaction costs can in practice be a complex endeavour. Inaccurate estimates can sometimes lead to overestimating transaction costs, ultimately causing unnecessary expenses for the end user. Let’s explore how transaction fees are calculated in more detail below.
1. How are bitcoin transaction fees determined?
Conceptually, a bitcoin transaction is nothing more than a bunch of information that indicates (1) where the bitcoins are coming from, (2) where they are going, (3) whether the conditions to send them have been met and (4) what the new conditions will be for future spending from the new address.
This information occupies a certain volume, measured in bytes, as does any information, whether it is an MP3 file, an image, or even the line of text that you are reading at the moment. When your transaction is added to a new bitcoin block, it therefore takes up a certain space (in bytes) in said block. And because the maximum size (in bytes) of bitcoin block is relatively small (between 1 and 2 megabytes maximum), it is common that at any given time there are more pending transactions that have been broadcast to the network than there is space available in the next bitcoin block.
A miner who composes a new bitcoin block therefore has the freedom to select and choose which transactions it wishes to include in its newly formed bitcoin block and which transactions it will select for the bitcoin block thereafter. In general, miners seek to maximize the fees they collect per bitcoin block, and therefore will prioritize the transactions with the highest fees. It is this free market mechanism which explains that, generally, the higher the transaction fee, the more likely that such transaction will be selected and included in the very next bitcoin block by a miner.
Bitcoin transaction fees are denominated in “satoshi per byte”. By multiplying this fee rate by the total weight (in bytes) of the transaction, we can calculate the total fees actually paid by a particular transaction. For example, a transaction of 150 bytes at 2 satoshis / byte will have paid a total of 300 satoshis in fees. A satoshi is equal to 0.00000001 bitcoin.
1.1. Transaction fees based on recent transactions
Generally, the wallet app that you use to send a bitcoin transaction will estimate an appropriate transaction fee for you, in view of making sure your transaction will be included within a certain number N of blocks. To this end, your wallet app will categorize all the transactions that have been recently mined in different groups based on their transaction fees. For example, all transactions that paid around 10 satoshis / byte of fees are grouped into the same set, all transactions that paid around 9 satoshis / byte of fees are grouped into the same set, and so on. Then, the wallet app analyzes the groups of transactions in ascending order (i.e. low fees to high fees) and checks per group if a sufficiently large percentage of transactions in the relevant group have been confirmed within the desired N blocks. If not, it analyzes the next group, and so on, until it finds the right group that matches your desired timeframe. By then applying the same fee rate (satoshi per byte) as those in the selected group, the wallet app can make a reasonable assumption that your transaction will also be mined within the desired N blocks.
However, this method is relatively rudimentary as it does not take into account the number of transactions that are in waiting in the mempool. The mempool (short for memory pool) consists of all the unconfirmed transactions which are waiting to be included in a bitcoin block and which are stored by a miner.
1.2. Transaction fees taking into account the status of the mempool
In order to make sure you select an appropriate transaction fee in view of getting your transaction confirmed within a desired timeframe, it is generally recommend to also verify the state of the mempool before sending out your transaction.
If the mempool contains lot’s of unconfirmed transactions, you may want to increase the recommended transaction fee. If the mempool is empty, a lower than recommended transaction fee might be appropriate.
Some more advanced wallet app solutions, such as BlueWallet, already take into account the status of the mempool when making a transaction fee recommendation. In such case, there is no need to manually modify the recommended transaction fee, unless for other reasons. If you use the original Bitcoin Core software, you’ll have to manually verify the status of the mempool and, if need be, manually modify the estimated transaction fee accordingly.
You can verify the status of the mempool at mempool.space.
2. Why do I have to pay bitcoin transaction fees?
There are different reasons for the usefulness of transaction fees on an open and decentralized network like bitcoin. One of these, as we have seen, is that block space is limited, and transaction fees provide a good mechanism for determining which transaction should be confirmed first. However, this justification is insufficient, since one could very well imagine a bitcoin protocol operating on a first come, first served basis, where transactions would be added into blocks in the order that they are received by a miner.
The main reasons for the existence of bitcoin transaction fees lie elsewhere. On the one hand, these fees provide an excellent spam filter. Indeed, in the absence of transaction fees, attackers could literally flood the network with micro transactions at a cost close to zero and render it unusable: this is called a denial of service attack.
On the other hand, the transaction fees constitute part of the remuneration of the bitcoin miners who secure the network with their computing power. Today, transaction fees only represent a minority share of a miner’s income, the bulk of which still comes from the bitcoin block subsidy (i.e. the newly created bitcoins a miner is allowed to allocate to itself if and when it is able to find a valid new block). But as this subsidy decreases over time in accordance with the bitcoin halvings, the transaction fees will gradually become an ever bigger part of a bitcoin miner’s revenue, and eventually around the year 2140 represent 100% of a bitcoin miner’s revenue.
As set forth above, transaction fees are therefore essential for the proper functioning of the bitcoin network. They protect the bitcoin network against certain DOS attacks, they help to align the interests of the bitcoin miners with the security of the network and are a mechanism for selecting and prioritizing transactions.
3. My bitcoin transaction is stuck due to insufficient fees, what should I do?
There are times when the fees required to get a transaction through on time can be misjudged, especially when the market is hectic and the bitcoin network congestion fluctuates rapidly. A transaction may then take longer than expected to be confirmed. If you find yourself in this situation, don’t panic.
First, note that it is likely that the average transaction fee will eventually come down again one day or another, making it likely that a miner will decide to include your transaction in a block at that point. So if there’s no rush, just be patient.
Of course, there are can be situations where waiting is not an option. In this case, it is possible to increase the transaction fees after the transaction has been sent to the bitcoin network, by way of to 2 different mechanisms:
- Replace-By-Fee (RBF) which involves rebroadcasting the same transaction (i.e. involving the same bitcoins) but with a higher fee. If the initial transaction indicates that RBF is enabled (which is the case today by default on many software wallets), then a miner seeing the new transaction with the higher fees will replace the first one with this new one.
- Child Pays For Parent (CPFP) which consists in spending the output of the first transaction pending confirmation in a new transaction with fees high enough to motivate a bitcoin miner to include the two transactions in the same bitcoin block. It therefore does not directly increase the transaction fees of the first transaction which is “stuck”, but the second transaction with higher fees gives an additional incentive to a bitcoin miner to validate both transactions at once in the same bitcoin block.
Written by author Fanis Michalakis
Attention! Do you store your cryptocurrencies on an online platform? Please note, in that case you are not the actual owner of your cryptocurrencies!
In particular, you run the risk of losing all your cryptocurrencies, without any recourse, in the event that the online platform or your personal account falls victim to hacking or in the event of an unexpected closure (e.g. insolvency) of the online platform.
Protect yourself against hacking and take real ownership of your cryptocurrencies by storing your cryptocurrencies offline on your very own Trezor hardware wallet. Don’t wait before it’s too late and take immediate action now!
Click on the ‘Buy Now’ button below to buy a Trezor wallet from the official Trezor website.