Calculation for transaction input-output balling:


To roughly calculate transaction send size in bytes we do:


We want to make a transaction using two inputs of 0.01BTC (Amount to send = 0.015BTC, change left over = 0.005BTC). Number of outputs in this case will be two; as we have two inputs, one of which we are 'tearing-in-two' creating change that will be sent back to us (we are the second output so the change is not lost).

So to calculate the fee

  • We calculate the value of each input in BTC multiplied by the age of the input in blocks
  • Add up all the answers into a total priority
  • Divide the priority by the size of the transaction in bytes
  • If this gives a number less than 0.576 then the transaction requires a fee
  • Also if the transaction size exceeds 1000 bytes it requires a fee

If both inputs were 1000 conformations old, a fee would be required:

((0.01*1000) + (0.01*1000)) = 20 //priority
((2*148)+(2*34)+10) = 374 //bytes
20 / 374 = 0.053475935828877004

If both inputs were 11000 conformations old, a fee would not be required:

((0.01*11000) + (0.01*11000)) = 220 //priority
((2*148)+(2*34)+10) = 374 //bytes
220 / 374 = 0.5882352941176471

Is this correct?

If one input was old dust and the other new and large (this looks free to me):

((0.00001*11000) + (1*1000)) = 1000.11 //priority
((2*148)+(2*34)+10) = 374 //bytes
1000.11 / 374 = 2.6740909090909093

Does this explain how you can put a dust-input with a large-input to rescue dust?

Will the threshold of 0.576 change in the future and if so how will we find out?


Posted 2014-06-11T02:18:08.677

Reputation: 137

where does you initial formula come from? Is it form you or from some wiki? – Dennis Kriechel – 2014-06-11T07:04:15.480 – BENZ.404 – 2014-06-11T13:50:50.543

The whole section about priority is not relevant anymore; free transaction mining doesn't happen in any significant amount anymore and software support for it has been removed in various places. Every transaction just pays bytes * feerate in fee. – Pieter Wuille – 2017-06-20T07:07:26.637

No answers