According to the Wiki:

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.

What is the exact formula that determines the transaction fee?

3 Answers 3


See GetMinFee() in main.h for the code which determines the minimum transaction fee.

The part you're describing is implemented as follows:

// Raise the price as the block approaches full
if (nBlockSize != 1 && nNewBlockSize >= MAX_BLOCK_SIZE_GEN/2)
    if (nNewBlockSize >= MAX_BLOCK_SIZE_GEN)
        return MAX_MONEY;
    nMinFee *= MAX_BLOCK_SIZE_GEN / (MAX_BLOCK_SIZE_GEN - nNewBlockSize);


  • nBlockSize depends on who we are:
    • if we're a user making a new transaction, nBlockSize is 1
    • if we're a node deciding whether to relay an incoming transaction, nBlockSize is 1000
    • if we're a miner deciding which transactions to include in a new block, nBlockSize is the size of the block we're building before adding the new transaction
  • nNewBlockSize is the size of the block including the new transaction
  • MAX_MONEY is 21 million BTC (all the money in the world)

so it's saying:

  • if we're either deciding whether to relay or mine the transaction, and adding the transaction would make the block over 50% full:
    • never allow a transaction that makes the block 100% full
    • otherwise scale the fee up by a factor of 500kB / (500kB - nNewBlockSize)

Note: by rearranging the symbols, we get exactly what Meni wrote in his answer:

Fee = Normal fee / ((500kB - size) / 500kB) = Normal fee / (1 - size / 500kB)

  • That rule is pretty strange, and doesn't look stable to me, since it's against the miners interests. Commented Apr 9, 2012 at 20:24
  • 3
    It's not against the miner's interests. If the miner fills up the block with low-fee transactions, he loses the opportunity to get high-fee transaction in there. Remember, not all transactions are the same size, so you can't just go in fee order. (The optimum algorithm would be to sort the transactions into two pools, one for fee transactions in fee-per-byte order, the other for free transactions in priority order. Fill a block from the first pool in order if possible until no more paid transactions fit, then take as many from the second pool as fit.) Commented Apr 12, 2012 at 5:23
  • @DavidSchwartz I argue that miners will converge to a fee-per-byte auction instead of this algorithm because that's in their interest. You agree with the fee-per-byte part, but disagree with the current algorithm being against miners interest. So your comment seems inconsistent to me. Commented Apr 16, 2012 at 15:18
  • @CodeInChaos: The effort required to act in their interest would actually make it not in their interest overall. The difference between an ideal algorithm and the current one, today, is about 0.02% or so. It's like driving across town to pay a penny a gallon less for gas. Commented Apr 16, 2012 at 18:20
  • Even if the algorithm wouldn't require a fee, if the the coin used for input is new a fee still could be required: bitcointalk.org/index.php?topic=84434.msg931988#msg931988 Commented May 31, 2012 at 3:56

I don't know the formula from any authoritative source, but based on the examples in the text, it is

Fee = Normal fee / (1 - Block size / 500KB)

Or equivalently (and I suspect the actual code uses this form)

Fee = Normal fee * (500 KB) / (500KB - Block size)
  • Did you add the "Or equivalently" part after posting your initial answer? There's no "edited by..." under your question, but I could swear your answer was originally half its current size. Commented Apr 9, 2012 at 18:57
  • @ChrisMoore: The author of a post can edit it during some time (5 minutes I think) without the change showing up as an edit.
    – D.H.
    Commented Apr 9, 2012 at 19:33
  • @ChrisMoore: You are of course correct, as is D.H. . Commented Apr 10, 2012 at 7:18
  • Where is the "Normal fee" defined for this calculation? Commented May 16, 2012 at 3:59

The other answers describe the rules currently implemented in the client, but I expect those rules to be replaced once block size limits become relevant. Since those rules aren't enforced when clients verify the blockchain, they are only guidelines, and will be violated if they're against the interest of miners.

Miners will simply choose the subset of candidate transactions that respects the limits (blocksize and signature count) and maximizes the fee.

Disregarding a few minor complications (knapsack and dependent transactions) this means that miners sort the transactions by fee/transactionSize if the maximal size is the limiting factor, and fee/signatureCount if the signature count is the limiting factor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.