Miner fees: Difference between revisions

From Bitcoin Wiki
Jump to navigation Jump to search
Hahahafr (talk | contribs)
No edit summary
Ripper234 (talk | contribs)
Add chart
Line 65: Line 65:


* [[Free transaction relay policy]]
* [[Free transaction relay policy]]
* [http://blockchain.info/charts/transaction-fees Transaction fee chart]


[[Category:Technical]]
[[Category:Technical]]
[[Category:Vocabulary]]
[[Category:Vocabulary]]
[[Category:Mining]]
[[Category:Mining]]

Revision as of 07:36, 4 January 2013

Receiving the fees from hundreds of transactions (0.44 BTC)

Transaction fees may be included with any transfer of bitcoins from one address to another. At the moment, many transactions are typically processed in a way where no fee is expected at all, but for transactions which draw coins from many bitcoin addresses and therefore have a large data size, a small transaction fee is usually expected.

The transaction fee is processed by and received by the bitcoin miner. When a new bitcoin block is generated with a successful hash, the information for all of the transactions is included with the block and all transaction fees are collected by that user creating the block, who is free to assign those fees to himself.

Transaction fees are voluntary on the part of the person making the bitcoin transaction, as the person attempting to make a transaction can include any fee or none at all in the transaction. On the other hand, nobody mining new bitcoins necessarily needs to accept the transactions and include them in the new block being created. The transaction fee is therefore an incentive on the part of the bitcoin user to make sure that a particular transaction will get included into the next block which is generated.

It is envisioned that over time the cumulative effect of collecting transaction fees will allow somebody creating new blocks to "earn" more bitcoins than will be mined from new bitcoins created by the new block itself. This is also an incentive to keep trying to create new blocks even if the value of the newly created block from the mining activity is zero in the far future.

Minimum transaction fees

As of 10 June 2012, minimum transaction fees on the original Bitcoin client are:

  • Accept a transaction for inclusion in a block: 0.0005 BTC
  • Relay a transaction to other Bitcoin hosts: 0.0001 BTC

A transaction can be sent without fees if both of these conditions are met:

  • It is smaller than 10 (SI) kilobytes (10.000 bytes).
  • All outputs are 0.01 BTC or larger.

Overview

  • Whoever sends the transaction is often able to guess an appropriate fee based on their own fee rules. The original client will always assess the transaction, and if a fee will typically be expected, it will not allow you to send the transaction without the calculated fee.
  • The user is prompted to confirm the fee before the transaction is sent.
  • The sender makes a transaction with more coins in the In portion than the Out portion so that there are “leftovers” not assigned to any address.
  • Whoever ends up publishing the block which contains this transaction will take these (and any other) leftover coins. They are included with their normal generated coins and is an extra bonus for creating the block.
  • If a mining node receives a transaction that should include a transaction fee but doesn't, they may refuse to include it in their blocks. It might be included in a later block if someone is willing to accept it. Generators can't force a certain fee on transactions -- they can only accept or reject the transaction's “fee offer”.
This balance is made entirely of 0.01 BTC cents. Since sending them requires a lot of data, a very large fee is required.

Rules for calculating minimum fees

Different bitcoin clients and different versions have different rules for determining which transactions to accept and how large a fee to send.

Current default rules for the original Bitcoin client (Bitcoin 0.3.23):

  • minimum TX fee for new transactions reduced to 0.0005 BTC.

Original Bitcoin client version 0.3.20:

  • 0.01 BTC fee if sending any transaction less than 0.01 BTC. This is to help prevent DoS attacks against the network. Remember: fees are not network-enforced, so it's still possible to send these small transactions without the fee -- you just have to generate the blocks that contain them yourself (after modifying Bitcoin).
  • 0.01 BTC fee per kilobyte of transaction, but:
    • If the blocksize (size of all transactions currently waiting to be included in a block) is less than 27 kB, transactions are free.
    • If the blocksize is more than 250 kB, transactions get increasingly more expensive as the blocksize approaches the limit of 500 kB. Sending a transaction when the blocksize is 400 kB will cost 5 times the normal amount; sending when it's 499 kB will cost 500x, etc.
  • Transactions within each fee tier are prioritized based on several factors. Most importantly, a transaction has more priority if the coins it is using have a lot of confirmations. Someone spamming the network will almost certainly be re-using the same coins, which will lower the priority of their transactions. Priority is also increased for transactions with more BTC, and reduced for transactions with more data.
  • If the blocksize is over 4kB, free transactions in the above rules are only allowed if the transaction's priority is above a certain level.

Note that if you want to send a transaction with less than the default rules, or if you are a miner and want to include them in your blocks, you may need to peer with the Free transaction relay network.

An advantage for bitcoin users to include a transaction fee is that the likelihood of getting a transaction included into the next block is going to be higher than if a transaction fee is not included. This is a trade off of time vs. money put forward on the transaction fees, as you can be patient with a low or non-existent fee included in a transaction, or you can make sure that the transaction is processed immediately by including a higher fee than is typical.

The rules are far from set in stone, and the network can support many different rules simultaneously. If there are mining nodes that never require a transaction fee and your client is modified to never send any transaction fee, then your transactions will eventually be picked up by one of those free nodes when they generate a block, though it will probably take a very long time. In the far future, different rules about transaction fees among mining nodes will probably create a clear choice between fees and transaction speed. For example, you might choose to spend 2% for a guaranteed spot in the next block or 0.01% for the transaction to be sent in a few hours.

If you notice that your sent transactions take a very long time to confirm, this is possibly because no fee was included. Using a more recent release of the client will help lessen the chance of sending a transaction without an adequate fee.

Sending a transaction when the sender doesn't have enough money to actually pay the fee

Technical info

Transaction priority is calculated as a value-weighted sum of input age, divided by transaction size in bytes:

priority = sum(input_value_in_base_units * input_age)/size_in_bytes

Transactions need to have a priority above 57,600,000 to avoid the enforced limit (as of client version 0.3.21). This threshold is written in the code as COIN * 144 / 250, suggesting that the threshold represents a one day old, 1 btc coin (144 is the expected number of blocks per day) and a transaction size of 250 bytes.

So, for example, a transaction that has 2 inputs, one of 5 btc with 10 confirmations, and one of 2 btc with 3 confirmations, and has a size of 500bytes, will have a priority of

(500000000 * 10 + 200000000 * 3) / 500 = 11,800,000

See Also