Bitcoin Forum
June 30, 2024, 10:16:17 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin fee calculator  (Read 382 times)
poordeveloper (OP)
Hero Member
*****
Offline Offline

Activity: 896
Merit: 527


₿₿₿₿₿₿₿


View Profile WWW
October 22, 2017, 09: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.

🎰 Bitcoin Casinos ⭐⭐⭐⭐⭐
.
🔵 Buy Bitcoin (Visa / Mastercard / SEPA / Bank Transfer / Western Union / MoneyGram / RIA)
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
October 22, 2017, 11: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).
poordeveloper (OP)
Hero Member
*****
Offline Offline

Activity: 896
Merit: 527


₿₿₿₿₿₿₿


View Profile WWW
October 22, 2017, 11: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?

🎰 Bitcoin Casinos ⭐⭐⭐⭐⭐
.
🔵 Buy Bitcoin (Visa / Mastercard / SEPA / Bank Transfer / Western Union / MoneyGram / RIA)
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
October 23, 2017, 12:00:39 AM
 #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.
pooya87
Legendary
*
Offline Offline

Activity: 3500
Merit: 10693



View Profile
October 23, 2017, 06: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

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!