Glossary | Transaction Fee
$4,133.51/BTCBuy

Transaction Fee

A transaction fee is the remainder of a bitcoin transaction.

input0 = 0.8; output0 = 0.6; output1 = 0.15

Math Using the example above:

transaction fee = (sum of inputs) - (sum of outputs)
transaction fee = (0.8)           - (0.6 + 0.15)
transaction fee = 0.8             - 0.75
transaction fee = 0.05

Usage

Transaction fees are claimed through the coinbase transaction.

Miners have the opportunity claim the fees from all of the transactions they put in to their candidate block.

Miners have the opportunity claim the fees from all of the transactions they put in to their candidate block.

Why use a transaction fee? A transaction fee acts as an incentive for a miner to include your transaction in their candidate block.

If there are more transactions in the memory pool than can fit in to a block, a miner will select transactions with the highest fees.

If there are more transactions in the memory pool than can fit in to a block, a miner will select transactions with the highest fees.

So if there are a lot of bitcoin transactions floating around the memory pool and not all of them can fit in to a block, a transaction fee can be used as a way to "buy space" in a block.

Fee-per-byte

  • Bitcoin blocks are limited to 1MB (1,000,000 bytes) in size.
  • Transaction data takes up space in a block (roughly 250 bytes for a typical small one).

So when a miner fills up a block with transactions, they will want to maximize the amount of money they can collect in fees. They do this by selecting transactions that give them the most money in fees for the space they take up in the block.

The second transaction has a higher absolute fee, but if you fill up a block with those transactions you're not going to be able to collect as much in total fees.

The second transaction has a higher absolute fee, but if you fill up a block with those transactions you're not going to be able to collect as much in total fees.

So when you're working out your transaction fee size, the important metric is the fee-per-byte.

Examples

TXID Fee (BTC) Size (bytes) Fee-per-Byte
bf09e5531c0b1a4189b5a8e571007f7711b8d17f2d2afb1e6489bfa377e18542 0.00067868 226 0.00000300
dee09e37ba2e8a51706e71e587bcdb9e13545a3419d93e77bf4d6fcb48a19745 0.00229300 2,290 0.00000100
b1eeb475c72a82745bca1f9cc1bdb5020a1633eec0dd7022962e2a4d162e7e05 0.00011300 225 0.00000050

Notes

The remainder of any bitcoin transaction is the transaction fee. All of it.

If you create a bitcoin transaction that uses a 10 BTC input, and only create a 0.1 BTC output, all of that remaining 0.9 BTC will be counted as the transaction fee.

Unfortunate Examples: