Bitcoins are stored on the public blockchain, in the form of unspent transaction outputs (UTXO). A bitcoin wallet does not hold any bitcoins, rather it contains a collection of key pairs that are necessary for a user to be able to spend his bitcoins (i.e. unlock the UTXOs).
When a user signs a bitcoin transaction, he unlocks the UTXOs associated with his private key. The user is then able to use the unlocked UTXOs as “inputs” for a new bitcoin transaction. The result of a bitcoin transaction are newly locked UTXOs, which can only be unlocked with the private key of the new owner(s). In other words, bitcoin transactions move value from transaction “inputs” (i.e. unlocked UTXOs) to transaction “outputs” (i.e. newly locked UTXOs), which in turn can be used as future transaction “inputs”. This endless cycle of interlinked transaction inputs and outputs, grouped together in blocks by miners, represents an uninterrupted chain of ownership. Hence the name ‘blockchain’.
In most cases, bitcoin transactions will include transaction fees, which are paid to the miners as a compensation for securing the network. Yet, these transaction fees do not show up as transaction “outputs” in a block explorer.
Let us therefore ask ourselves the question “Why are fees not transaction outputs?” Transaction fees are not transaction outputs because (1) the destination address for the fees is unknown at the time of a transaction and (2) adding transaction outputs would be very burdensome for the network. The difference between the aggregated inputs and outputs of a transaction represents the transaction fees.
Let’s explore this answer more in depth below, but let us first examine a few preliminary questions, such as: If transaction fees are not part of the transaction outputs, how are miners able to collect the transaction fees? What is the purpose of paying transaction fees to miners? How are transaction fees calculated?
What is the purpose of bitcoin miners?
Bitcoin miners are essential for securing the bitcoin network.
Miners validate transactions and record transactions (grouped together in a block) on the bitcoin blockchain. On average, a new block with transactions is added to the bitcoin blockchain every 10 minutes. To achieve this, miners compete to solve a difficult mathematical problem, the ‘proof-of-work’ cryptographic hash algorithm. Finding a solution to the proof-of-wok algorithm requires the spending of large amounts of processing power and costly electricity. In order to be compensated for its efforts, the miner that finds the solution to the proof-of-work algorithm earns the right to record a block of transactions on the bitcoin blockchain. Once the solution is found, the race is reset and a new competition starts for the next block.
How are transaction fees paid?
The first transaction that is added by a miner to any new block is what is known as the coinbase transaction.
The coinbase transaction contains two elements:
(a) the coinbase reward (also referred to as the ‘block reward’), which is a fixed amount of newly created bitcoin (i.e. 12.5 bitcoin at the time of writing). The coinbase reward is halved every 210,000 blocks, which is approximately every 4 years; and
(b) the transaction fees, which is the excess amount that remains after all outputs of a transaction have been deducted from all inputs of a transaction.
The output of the coinbase transaction is payable to the miner’s own bitcoin address.
In other words, the coinbase transaction is the mechanism through which a bitcoin miner is able to collect the coinbase reward and the transaction fees for all the transactions that are included in the block, for which it was able to find the solution to the proof-of-work algorithm.
Why are fees not part of transaction outputs?
Now that we know the mechanism through which transaction fees are paid, it becomes obvious why transaction fees are not transaction outputs. As already mentioned at the beginning of this article, we can identify 2 main reasons for that.
The first and most obvious reason is that transaction fees are for the benefit of the miner who is able to solve the proof-of-work algorithm first, earning him the right to record a block on the bitcoin blockchain. Hence, until a solution is found for the proof-of-work algorithm, it is unknown which of the miners will be rewarded with the coinbase reward and the transaction fees that are part of the mined block. Therefore, it would be simply impossible to determine a destination address for a transaction fee output at the time the transaction is initiated.
The second reason that fees are not transaction outputs, is that this would be extremely inefficient. This would effectively double the amount of outputs needed for the same amount of transactions, taking up unnecessary space in a block and clogging the bitcoin network. In addition, these additional outputs would not make any sense taking into account the fact that all transaction fees of one block go to a single winning miner.
What is the purpose of paying transaction fees to miners?
Paying transaction fees to miners serves 3 major purposes:
- Prioritizing transactions;
- Disincentivizing spam; and
- Securing the bitcoin network.
Prioritizing transactions
Including a transaction fee in a transaction is optional. However, most wallets automatically calculate and propose to include a transaction fee with each transaction. The reason is that a transaction fee incentivizes miners to include your transaction into a block.
Transactions are selected and added by miners to a new block, based on a particular priority metric. Miners will prioritize the highest-fee transactions first, because they will reap a higher reward for their mining efforts, and take into account a few additional priority criteria, such as:
(a) the “age” of the UTXO(s) used as transaction input(s). The “age” is determined as the number of blocks that have elapsed since the UTXO was recorded on the blockchain; and
(b) the value of the transaction input(s).
If you want to make sure a certain transaction is recorded in the next available block, it is therefore better to include a higher than average transaction fee.
Disincentive against spamming the bitcoin network
An added benefit of incentivizing users to add transaction fees, in order to have miners process their transactions first, is the fact that transaction fees protect the bitcoin network against spam transactions. In order for a user to effectively spam the bitcoin network with many bogus transactions, that user will have to bear the costs of many transaction fees. Transactions with no fees will simply be held in the back of the queue (in the mempool of each miner) and not be processed by the miners until the transactions reach a high enough priority (e.g. based on the age of the UTXO used as input) to eventually be included in a block.
Securing the bitcoin network
A cornerstone of bitcoin’s consensus mechanism is that each new block is independently verified by every node on the bitcoin network. An invalid block that is broadcasted to the network by a miner will therefore be immediately detected by other nodes on the network and be rejected.
The proof-of-work algorithm, combined with bitcoin’s compensation mechanism, ensures that miners are incentivised to act honestly. Miners behaving dishonestly will not only lose the opportunity to receive the coinbase reward and the transaction fees for their invalid block, but will also have expended large amounts of electricity for having solved the proof-of-work algorithm, at their own expense.
Today, transaction fees constitute only a very small percentage of a miner’s reward for solving the proof-of-work algorithm. By far the largest part of a miner’s income consists of the coinbase reward. However, the coinbase reward is continuously decreasing over time (halves every 210,000 blocks) and will eventually hit zero (estimated to happen in 2140). From that point onwards, a miner’s earnings will exclusively consist of transaction fees, which, by that time, will have become paramount for bitcoin’s security.
How are transaction fees calculated?
As mentioned above, transaction fees are not mandatory. Most wallets will however automatically calculate proposed transaction fees for a user.
The amount of the fee will be calculated based on the size (in kilobytes) of the transaction (not the value of the transaction!), and taking into account the network capacity and transaction volume. In this regard transactions with multiple inputs and outputs will be larger in size than transactions with single inputs or outputs. The minimum fee size is 0.0001 bitcoin.
Conclusion
Transaction fees are not transaction outputs because:
- a transaction output would require a destination address, which is unknown at the time the transaction is initiated. The transaction fees of a block will be collected by the miner who is able to solve the proof-of-work algorithm first, an event which will happen in the future.
- adding a transaction output for every transaction fee would be very burdensome for the bitcoin network. Moreover, this would not make sense, taking into account the fact that all transaction fees of one block are awarded to a single winning miner.
Paying transaction fees to miners serves 3 major purposes:
- Prioritizing transactions;
- Disincentivizing spam; and
- Securing the bitcoin network.
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.