Author

Topic: Bitcoin fee calculator (Read 404 times)

legendary
Activity: 3472
Merit: 10611
October 23, 2017, 01:13:35 AM
#5
you can put together some calculator using the available services and their APIs.
1. get the unspent outputs:
https://blockchain.info/unspent?active=$address

2. figure out you are using a compressed or uncompressed public key.
if you are reusing your address this will find out: https://blockchain.info/q/pubkeyaddr/$address

3.
if (uncompressed && !multisig)
    in*180 + out*34 + 10 plus or minus 'in'
else if (compressed && !multisig)
    in*148 + out*34 + 10 plus or minus 'in'

4. https://bitcoinfees.21.co/api/v1/fees/recommended
if (fast)
    *fastestFee
else if (medium)
    *halfHourFee
else if (slow)
    * hourFee

now translate these steps to a programming language you like (PHP, Python, Java, C++, C#,..) and you get yourself a fee calculator Wink
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
October 22, 2017, 07:00:39 PM
#4
Is there any calculator which allows me to choose inputs and lets me know the minimum viable fee?

I mean, I understand how fees work, that's why the calculator must have input chooser.

You can use bitcoinfees.21.co.
If you get the sat/byte of the optimum fee and then use a calculator to take:
150 bytes per input
50 bytes per output
and a 20 byte minimum starter
so one input with two outputs would be 150+50+50+20=270bytes (it's an overestimate but will help make a high enough fee).
Would that account for all possible input sizes?

Yes, you'll have to work out how many inputs are needed. Multiply that number by 150.
Then work out the number of outputs (if you're sending to only 1 address, then there'll be 2 outputs normally), multiply this number by 50.

Then take these two numbers and add them along with an extra 20 bytes which is the base amount for a transaction and you'll get the size you want. You can then calculate the fee from this information.
hero member
Activity: 896
Merit: 527
₿₿₿₿₿₿₿
October 22, 2017, 06:57:00 PM
#3
Is there any calculator which allows me to choose inputs and lets me know the minimum viable fee?

I mean, I understand how fees work, that's why the calculator must have input chooser.

You can use bitcoinfees.21.co.
If you get the sat/byte of the optimum fee and then use a calculator to take:
150 bytes per input
50 bytes per output
and a 20 byte minimum starter
so one input with two outputs would be 150+50+50+20=270bytes (it's an overestimate but will help make a high enough fee).
Would that account for all possible input sizes?
copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
October 22, 2017, 06:15:52 PM
#2
Is there any calculator which allows me to choose inputs and lets me know the minimum viable fee?

I mean, I understand how fees work, that's why the calculator must have input chooser.

You can use bitcoinfees.21.co.
If you get the sat/byte of the optimum fee and then use a calculator to take:
150 bytes per input
50 bytes per output
and a 20 byte minimum starter
so one input with two outputs would be 150+50+50+20=270bytes (it's an overestimate but will help make a high enough fee).
hero member
Activity: 896
Merit: 527
₿₿₿₿₿₿₿
October 22, 2017, 04:53:17 PM
#1
Is there any calculator which allows me to choose inputs and lets me know the minimum viable fee?

I mean, I understand how fees work, that's why the calculator must have input chooser.
Jump to: