Bitcoin Transaction Fees

Bitcoin transaction fees are a confusing topic.  The Bitcoin network requires fees for certain types of transactions to prevent spamming and “Denial of Service” (DoS) attacks. Obviously, a competitive fee must be added to every Bitcoin transaction, but overpayment can cost you money. To understand exactly how they work can help you realize how certain fees can be reduced or avoided.  Bitcoin transaction fees work differently from fees charged by banks. A bank charges fees based on the amount of currency being transacted. The Bitcoin network levies fees based on the amount of data being published.

When you pay a fee, it is actually because your transaction has some properties in common with spamming transactions – even though it is completely legitimate. Most of these properties are invisible to you, as well as completely out of your control. These fees are usually no more than 0.0001 BTC — less than $0.01 USD.

Here are a few things to be aware of which will help you avoid fees:

Sending less than 0.01 BTC to any recipient. The network considers amounts this small to be “dust,” and discourages users from sending them by requiring a fee. If it was not discouraged, a person could take 1.0 BTC, create 1,000,000 transactions of 0.000001 BTC each, and send them for free. Obviously there are those that would do this – and it would clog the network.  Imagine if many did this – the network would grind to a halt.

Spending coins that are too “new”. Each time you send a transaction, you spend “old” coins and create “new” coins. Any time we spend Bitcoin, the amount we spend will always come from funds previously received and currently present in our wallet. The amounts that go into our wallet are not jumbled like the coins in a physical wallet – the amounts don’t mix – but remain separate and distinct, in the exact amounts received, and are known as “UTXOs”.

EXAMPLE:  You create a brand new wallet and, over time, it receives three amounts of 0.01, 0.2 and 3 BTC as follows:

  1. you receive a payment of 0.2 BTC from John;
  2. a payment is received for 0.01 BTC in the new wallet from Joe;
  3. you send yourself 3 BTC to an address for the new wallet.

The wallet shows you a balance of 3.21 BTC.  However, if you virtually look inside the wallet, you see – not 321,000,000 satoshi (321 mil satoshi) – but three distinct amounts grouped together by their original transactions of 0.01, 0.2 and 3 BTC.  These amounts are called the “outputs” of their originating transactions, and wallets always keep “outputs” separate and distinct.

So, now if you SEND 0.15 BTC to Bob, your wallet does not select 0.15 BTC from the total balance, as one would expect.  Instead, the wallet selects a spend “candidate” from the three existing “outputs” sitting in the wallet.  It chooses the “oldest” output, which is 0.2 BTC, unlocks the 0.2 BTC output, and uses the whole amount as an “input” to your new 0.15 BTC transaction going to Bob.  The original 0.2 BTC output is “spent” in the process.

 

Okay – so the 0.05 BTC difference is called “change” – and the transaction will send this back to your wallet via a newly created address.  The 0.05 BTC change amount will reside in your wallet as a new output.  And it now looks like this under the hood…

Three outputs are now in the wallet, and are locked to their receiving addresses until one or more of them are selected as inputs for a new spend transaction. When creating the spend transaction our wallet selects UTXOs (of sufficient value to satisfy the amount we want to send) and typically creates two new outputs: one for the receiver, and one for the change due, which is received back to our wallet. The change becomes a brand new UTXO in our wallet, and the amount we send becomes a new UTXO locked to the recipient’s address. The original UTXO used as input to the transaction is “spent” and destroyed forever.

Most wallets will always select older coins first in a transaction.  But if you are sending a significant chunk of your wallet balance, the network may have no choice but to use these “new” coins to make up the total amount being sent – which requires a fee.  By the same token, if you receive coins in an empty (or new) wallet, and then immediately send bitcoin to someone else (or yourself to another wallet), the network will require a fee. Without this fee, a user with 1.0 BTC could send it back and forth between two addresses millions of times to spam the network.  Different wallets apply different logic rules when selecting UTXOs, but most use older ones first.

Once a UTXO is selected for spending, it requires the private key associated with the address that received it to unlock the bitcoin contained in the transaction, and allow it to be spent. This private key is what redeems the UTXO and allows it to become an input in a new spend transaction. The mechanism in which previous transaction outputs are reused as inputs for new transactions is central to the Bitcoin protocol’s function.  Keep in mind – all this happens invisibly, but it is important to understand what is happening, as it explains why fees are incurred.

Transactions that combine lots of previous transactions. If you receive 100 separate transactions of 0.0001 BTC each, and then send 0.01 BTC to someone else, your transaction will contain references to all those 100 previous transactions. Even though 0.01 BTC is a “small” amount, the size of the transaction in bytes will be very large – vs. one sending a UTXO which equals 0.01 BTC. Very large transactions will require a larger fee. If your wallet mainly receives lots of small transactions, your outgoing transactions will require a larger fee, more often than not.

Fees can also be reduced by publishing transactions at times of low volume. Saturdays and Sundays can see market fees drop by 50% or more compared to weekdays.

 

Bitcoin Transaction Fees Explained

Segregated Witness

Segregated Witness (“segwit”) introduced a new witness transaction format that moves the response script from the input into a witness. Data related to signatures are removed from bitcoin transactions making them smaller in size.  Smaller size will result in lower fees.

Lightning Network

The Lightning Network is expected to allow for a massive increase in the network capacity by moving the bulk of transactions off the Blockchain for quick processing.  Faster processing will result in lower fees.

Conclusion Bitcoin Transaction Fees

Bitcoin transaction fees depend on two factors: the transaction’s size, and the market fee density. Reducing either value reduces the fee. To reduce size, eliminate inputs or use witness transactions. To minimize fee density, make transactions during off-peak times whenever possible.

To pay the lowest fee possible, an estimator is essential. The one offered online by Bitcoin Core is the most advanced. Imput a desired confirmation window and size, the calculator will compute an appropriate fee using an algorithm that takes fees paid by pending and confirmed transactions into account.

Ideally, users shouldn’t need to understand how Bitcoin or Bitcoin transaction fees work under the hood at all – it should just work as expected. But this is an emerging technology, and we’re not there yet.