Bitcoin Fees Explained – How to Calculate and Solve Pending Transactions

This guide will explain the basics of fees from how they are calculated to what you can do in case you didn’t pay a big enough fee.

Post summary

Bitcoin transaction fees (sometimes referred to as mining fees) allow users to prioritize their transaction (sometimes referred to as tx) over others and get included faster into Bitcoin’s ledger of transactions known as the blockchain.

To determine whether to include a transaction in the blockchain is worth their while, miners will take a look at which transaction has the highest fee attached.  Not paying enough fees can sometimes get your transaction stuck for a very long time.

Here’s what we’ll go over:

  1. What are Bitcoin transaction fees?
  2. Feerate – How fees are calculated
  3. Reducing transaction fees
  4. How wallets deal with fees
  5. Dealing with unconfirmed / pending transactions
  6. Conclusion and what’s stored up ahead

Don’t like to read? Watch our video guide instead


What are Bitcoin transaction fees?

Fees are what bitcoins owners pay to bitcoin miners whenever they transfer funds to another bitcoin address. In order to understand fees in detail we first need to understand what happens when you send Bitcoins to another address:

1. The transaction is checked by every computer holding a copy of the Bitcoin blockchain for validity (these computers are also known as nodes). Basically, at this stage the nodes are checking Bitcoin’s transaction history to prove that you actually have the Bitcoins you want to spend in your balance.

2. After a transaction is deemed valid it goes into the Mempool (short for Memory Pool – you can read more about it here). This is sort of a “waiting room” where the transaction sits and waits for a miner to pick it up and pack it into a block of transactions. At this point the tx is considered an “unconfirmed transaction” or a “0 confirmation transaction”. You can view the current state of the Mempool here.

3. Once a miner picks up the transaction and includes it in a successfully mined block the transaction is considered to be confirmed.

A block can only hold a finite amount of transactions (at the moment the average amount is 2500), so at times when the network is crowded and there are a lot of transactions waiting to be confirmed the miner will prioritize which transactions to pick up based on the miner fee attached to the transaction.

Mempool transaction fees

Transaction fees of pending transactions inside the mempool

So fees are a way of signalling to the miner how urgent your transaction is. If you want to get confirmed faster you’ll attach a larger fee. If you’re not so time sensitive you can do with a smaller fee.

Fees are always paid for by the sender of the transaction.

Feerate – How are fees calculated

In the past, fees had different rules than what they do today. You could send transactions for free if your transaction was small enough in size or if it had “priority”. Today however, things have changed, and every transaction requires a fee in order to get mined.

Calculating the appropriate Bitcoin transaction fee isn’t as straightforward as it seems so let me explain a bit about how it’s done:

Every transaction has a size, just like a file size on your computer. Since miners want to maximize their profit, they will prioritize transactions that have a larger fee to size ratio, or feerate for short. Let’s explain with an example from a different market.

When you come to buy or rent an apartment there’s usually a cost per square foot. The apartment price is similar to the total fee your pay, but how you measure the apartment’s expensiveness is through how much are you willing to pay per square foot. Feerate is Bitcoin’s cost per square foot.

Feerate is measured in Satoshis per byte. It basically means how many Satoshis (the smallest unit of account in Bitcoin) you are willing to pay for every byte (unit of size) of your transaction. At any given moment you can check here what’s the estimated required feerate that will get your tx included into the next block. This rate varies depending on how much the network is crowded with transactions.

feerate table

When the network isn’t crowded you can get confirmed in the next block with 1 Sat/byte as shown above

The transaction size depends on a number of different factors, the most significant ones are :

1. Number of inputs

Each Bitcoin you own, at its core, is just a reference to past transactions that were sent to you, adding up to the amount you own. These references are known as inputs. When you send Bitcoins to someone you are basically selecting different inputs sent to you in the past and forwarding them to the recipient as outputs. The more inputs your transaction is comprised of, the bigger its size.

For example, let’s say you own 1 Bitcoin. That Bitcoin is actually comprised of references to many transactions sent to you in the past  (assuming accumulated that one Bitcoin from several sources). When you send this 1 Bitcoin to someone else, your transaction will be composed of all of these previous references.

2. Number of outputs

Simply put, outputs are the number of addresses you’re paying to. For example, if you’re only paying to one address, it’s highly likely you’ll actually generate two outputs. One for the address you’re sending to, and another one to “pay yourself back”  the change from your initial payment (for an explanation about change take a look at the video above).

Note: If the sum of your inputs equals exactly how much you need to pay, there will be no change output.

3. Script complexity

some transactions use special features like multisig. These features increase the transaction size.

Having said all that, it is still very difficult for the average user to calculate the transaction size based on these factors. Luckily, your Bitcoin wallet will do this for you and suggest the fee you should pay, based on the average feerate at the moment of transaction.

Nice to know – How fees show up on the blockchain

The Bitcoin blockchain doesn’t list the fee paid for each transaction explicitly. The only way to deduce what fee was paid by the sender is to calculate the difference between how many Bitcoins were sent minus how many were received and how many were returned as change (more on Bitcoin change here).

TX exampleReducing transaction fees – Best practice

There are several ways you can avoid paying high fees. Let’s explore some of them:

Avoid sending transactions when the network is busy

When the Bitcoin network is extremely busy (e.g. when the price spikes and many people are looking to buy Bitcoin) users will bid up their fees in order to prioritize their transactions. This can cause fees to become ridiculously expensive. If you can delay a transaction to a time when the network is less crowded you may be able to save a lot of money on fees.

Use a wallet that support SegWit

SegWit (short for Segregated Witness) is a Bitcoin protocol upgrade which configures the transaction’s data in such a way as to create a file that is smaller in size. Many wallets already support this feature and it can cut costs substantially.

Group your inputs

The more inputs you need to create your transaction the bigger its size, thus the more fees you’ll need to pay for it. If you want to keep fees low, every once in a while you can consolidate your inputs. This is done  by sending many small inputs to an address you own at a time when fees are low. This way, you will significantly reduce your future fees since you will only have one input.

Grouping your outputs

Aside from consolidating inputs you can also group multiple outputs (or payments) to one transaction. Not all wallets support this feature, but if your wallet allows this, you will be able to send payments to several addresses in one transaction which will reduce the required fee.

How different Bitcoin wallets deal with fees

Bitcoin wallets attempt to recommend a reasonable fee, based on the current and recent levels of activity  of the bitcoin network. Some wallets and services manage fees poorly and overbid fees, thus driving up the fees for everyone else as well.

Most wallets allow you to adjust your fees or at least set a general fee preference (low, medium or high). As we said earlier, to choose the right fee you’ll first need to know your transaction size. If your wallet supplies you with that info, you can then use the feerate estimation table to figure out how much you need to pay in order to be included in the next block.

Here’s in example:

If your transaction size is 16,000 bytes and at the moment of transaction the average feerate to be included in the next block is 10 Satoshis/byte, you’ll need to pay 10 X 16,000 i.e. 160,000 Satoshis as a transaction fee, for a good chance to be included in the next block.

Now that we know what fees are, let’s move on to when fees go wrong…

My Bitcoin transaction is stuck in “Unconfirmed” – what do I do?

While reading this guide sheds some light on the topic of fees, most Bitcoin users aren’t “fee experts”. Therefore, more often than not (and especially when the price rallies and the network is crowded) you’ll hear of people complaining that their transaction is stuck as “unconfirmed” or “pending”.

What gets a transaction “stuck”?

One of two things:

  1. You didn’t pay a high enough fee so miners prioritize other transactions over your own.
  2. You are trying to send coins from a transaction you received that hasn’t been confirmed yet (yes, some wallets allow this).

So what can you do? Here are your options:

Method 1: Wait

Sometimes, waiting is the best thing to do. If your transaction isn’t urgent, take a break, and forget about it for at least 72 hours. There’s a good chance that it’ll sort itself out—one way or another.

Method 2: Replace by Fee (RBF)

Replace By Fee (RBF) is a feature that allows a wallet to rebroadcast a transaction with a higher fee. Bear in mind that only few wallets support RBF, and in certain wallets RBF is an opt-in feature. If your wallet does support RBF, it can save you a lot of fee-related headaches, and there’s really no downside to using it.

Method 3: Transaction accelerators

There are different tx accelerators which are operated by mining pools. They’ll add your transaction to the next block they mine if they have the capacity to do so. Some are free, while others are free below certain size limits, some pools charge upfront, while some pools will request tips.

In order to get your transaction into an accelerator you’ll need your tx id. This is your unique transaction identifier and it usually can be found inside the list of transactions in your wallet.

tx id

Here are some recommended transaction accelerators:

  1. The ConfirmTX accelerator provides free processing of transactions below 300 bytes. Larger transactions incur $5 payments.
  2. When dealing with a stuck transaction, the forum thread for the Coolwave accelerator is also worth a try. To be able to submit your transaction, you will need to register an account on the BitcoinTalk forum, but it’s probably worth your time.
  3. ViaBTC’s accelerator is free, but it’s often unavailable, as it only accepts 100 unconfirmed transactions per hour. Therefore, in order for it to be accepted, you will likely have to repeatedly resubmit your tx id at the top of every hour. ViaBTC also offers a payment option, but they only accept Bitcoin Cash.

Last resort

If all else fails you are left with two final options:

  • Try to double spend the transaction
  • Use “Child Pays for Parent”

Double-spending: This action sends the same transaction again, but with a higher fee. It’s much like RBF, but with one big difference: RBF transactions conform to established protocol rules, and are incorporated in several wallet designs. On the other hand, double-spending is explicitly considered something you shouldn’t do. It’s actually one of the major problems that Bitcoin was created to solve and all wallets are designed to prevent.

Child Pays for Parent (or CPFP): In this type of transaction you essentially spend coins that are incoming but are yet unconfirmed, which is something  I previously advised against. The idea behind this is that the fees on a new outgoing transaction will be high enough to cover both themselves and the unconfirmed incoming transactions they depend on.

A miner may be enticed to mine the old, low-fee unconfirmed transaction, in order to claim the new, high-fee CPFP transaction (as it’s impossible to claim the new transaction before the old one is confirmed).

Both these processes are rather difficult procedures which may place your funds at risk and are not intended for the average user so we won’t go over them in this guide. This Bitcoin wiki details the methods for both processes.

Can my transaction be stuck forever?

Short answer – no.

Correct answer – probably not, but it depends. Earlier in this post I talked about the transaction waiting in the mempool to get picked up by a miner.

Well, the mempool doesn’t exist in just one place. Each computer (or node) that validates transactions, has a part in its hard drive that is dedicated for storing pending transaction. So different nodes have different versions of the mempool, depending on which transactions they know about and remember.

If a transaction is not confirmed for a long period of time, it will eventually be erased from a node’s mempool. The current default timeout is 72 hours but nodes may set their own duration. The transactions with the lowest value will also be dropped from the mempool, as higher fee transactions are entered and the mempool is limited in size.

This is why waiting for at least 72 hours will probably yield one of two results: Either your transaction will get confirmed, or it will get erased from all of the mempools in the network and the funds will be returned to your wallet.

Having said that, it’s possible that a certain node will never forget about your transaction, and may even occasionally rebroadcast it, which reminds other nodes about it. In that case, your tx can be stuck forever.

Conclusion and what’s stored up ahead

As you can see the issue of fees is pretty complex and can be a topic for a lot of controversy. In fact, the main reason Bitcoin Cash was created was to address the Bitcoin block size, which limits the amount of transactions Bitcoin can process with each block. This in turn generated a very long queue of pending transactions, resulting in extremely high transaction fees.

Keeping fees low is important since having a cheap peer to peer payment system is one of the goals Bitcoin was created to achieve, but as always there are other considerations to take into account, aside of low fees (more on that in another post).

As Bitcoin grows in popularity, more and more people will being using it and the network needs to find new solutions to handle the demand. One promising candidate for such a solution is the Lightning Network.

While it’s not quite ready for mainstream adoption, the Lightning Network promises nearly instant, free transactions to all Bitcoiners. You can read more about it in our guide.

Bitcoin Video Crash Course 

Dummy-proof explainer videos enjoyed by over 100,000 students. One email a day for 7 days, short and educational, guaranteed.

We hate spam as much as you do. You can unsubscribe with one click.

3
Leave a Reply

avatar
2 Comment threads
1 Thread replies
5 Followers
 
Most reacted comment
Hottest comment thread
3 Comment authors
Steven HayPeterJORGE CABRAL Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Peter
Guest
Peter

I would use https://bitcoinfees.gitlab.io/ instead of earn.com as the first provide much better UX for beginners.

JORGE CABRAL
Guest
JORGE CABRAL

Great explanation as always, One doubt I have is how to transale from BITCOIN TO AMERICAN DOLLARS since the majority of prices are in dollars. lets say I have 1.00555 BC how much is that in amrican dollars? or 0.0357 translate to fiat money? Hope you can help me to understand this
thanks