Transaction fees are paid to miners while transferring bitcoin in order to have your transaction processed by miners. Transaction fees are also called miner fees because they encourage miners to confirm Bitcoin transactions and secure the network.
Bitcoin Transaction Fees Explained in Detail
In essence, a bitcoin transaction is a bunch of data. The balance you see in your BTC wallet is actually comprised of several UTXOs (which stands for unspent transaction output).
A bitcoin transaction has both an input and an output. When you pay someone, the wallet will combine a bunch of UTXOs to form a transaction input, and a new UTXO is created as the transaction output.
New UTXO = (Sum of UTXOs in the transaction) – (Transaction amount) – (Transaction fee)
During the transaction, the ownership of bitcoin is transferred from the sender to the receiver and old UTXOs are consumed and the new ones are created.
So what is the relationship between UTXO and data bytes? Normally, UTXO is the main factor affecting a transaction’s size. A transaction can have multiple inputs and outputs. The more there are, the larger it is.
Here are two transactions:
A consumed 3 UTXOs and created 13 UTXOs and its transaction size is 803 bytes.
B consumed 2 UTXOs and created 4 UTXOs and its transaction size is 379 bytes.
Fee Per Byte
Fees are displayed in Satoshis/byte of data. A satoshi is the smallest unit of a bitcoin, equivalent to 100 millionth of a bitcoin.
Fees not only depend on the data size of your transaction, but also the network conditions at the time. When the bitcoin network is overloaded, you could set a higher transaction fee to get your transaction confirmed quicker.
How to Calculate?
Transaction Fees = Transaction Size (byte) * Fee Per Byte (sat/byte)
Transaction fees are calculated based on the size of the transaction and are paid in bitcoin.
Related Explanation
For miners, each bitcoin reward they earned from mining is a UTXO. When the rewards have accumulated to a certain level, the miner fees for transferring these rewards are expected to be very high due to the excessive amount of UTXO.