Bitcoin Forum
October 22, 2018, 08:51:09 AM *
News: Make sure you are not using versions of Bitcoin Core other than 0.17.0 [Torrent], 0.16.3, 0.15.2, or 0.14.3. More info.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: How to calculate transaction fees ?  (Read 295 times)
ronmike
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
January 25, 2018, 11:14:22 AM
 #1

I am using bitcore server https://github.com/bitpay/bitcore and below is the code for making a transaction

Code:

var tx = bitcore.Transaction();
tx.from(utxos);
tx.to(address2,50000);
tx.change(address);
tx.sign(privateKey);
tx.serialize();

How much transaction fees are taken for executing the above transaction.? and I want to check before the transaction goes for the execution.
1540198269
Hero Member
*
Offline Offline

Posts: 1540198269

View Profile Personal Message (Offline)

Ignore
1540198269
Reply with quote  #2

1540198269
Report to moderator
1540198269
Hero Member
*
Offline Offline

Posts: 1540198269

View Profile Personal Message (Offline)

Ignore
1540198269
Reply with quote  #2

1540198269
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1540198269
Hero Member
*
Offline Offline

Posts: 1540198269

View Profile Personal Message (Offline)

Ignore
1540198269
Reply with quote  #2

1540198269
Report to moderator
1540198269
Hero Member
*
Offline Offline

Posts: 1540198269

View Profile Personal Message (Offline)

Ignore
1540198269
Reply with quote  #2

1540198269
Report to moderator
1540198269
Hero Member
*
Offline Offline

Posts: 1540198269

View Profile Personal Message (Offline)

Ignore
1540198269
Reply with quote  #2

1540198269
Report to moderator
AGD
Legendary
*
Offline Offline

Activity: 1706
Merit: 1026


HODLER SINCE 2013


View Profile
January 25, 2018, 12:24:54 PM
 #2

You can read everything about Bitcoin fees here: https://en.bitcoin.it/wiki/Transaction_fees

Bitcoin is not a bubble, it's the pin!
+++ GPG Public key FFBD756C24B54962E6A772EA1C680D74DB714D40 +++ http://pgp.mit.edu/pks/lookup?op=get&search=0x1C680D74DB714D40
Marrying_Couch
Newbie
*
Offline Offline

Activity: 182
Merit: 0


View Profile
January 25, 2018, 03:44:20 PM
 #3

You can read everything about Bitcoin fees here: https://en.bitcoin.it/wiki/Transaction_fees

all is available here, we just understand what we do not understand, so no one in the deal.
akiash
Newbie
*
Offline Offline

Activity: 152
Merit: 0


View Profile
January 25, 2018, 05:00:31 PM
 #4

You can read everything about Bitcoin fees here: https://en.bitcoin.it/wiki/Transaction_fees

Hi AGD,
I would really appreciate if you could give me piece of advice on this. What is the best way to send cryptocurrency from one exchange to another. I can see that if I send BTC, is has higher fees.
Stedsm
Legendary
*
Offline Offline

Activity: 1456
Merit: 1044


View Profile
January 25, 2018, 06:16:58 PM
 #5

You can read everything about Bitcoin fees here: https://en.bitcoin.it/wiki/Transaction_fees

Hi AGD,
I would really appreciate if you could give me piece of advice on this. What is the best way to send cryptocurrency from one exchange to another. I can see that if I send BTC, is has higher fees.

That's something already fixed that you're asking about. Exchanges charge a "fixed" fee for a transaction that they execute on their end and you are bound to pay those fees if you are withdrawing your coins from an exchange to exchange or even a wallet. You can only decide fee while you are sending "your" coins that you have in your wallet, and not an exchange. The "fixed" fee charged by them is what they take per transaction, not the fee they actually send while sending you your "withdrawn" amount. One more thing, each exchange has different "fixed" fee levels, like Polo charges 0.0005 BTC per withdrawal, Bittrex takes 0.001 BTC and so on.

Salmen
Legendary
*
Offline Offline

Activity: 976
Merit: 1006


View Profile WWW
January 25, 2018, 07:32:55 PM
Merited by AGD (1)
 #6

If no fee is given, a transaction with an optimal fee according to the size and network traffic will be sent. Otherwise, if a custom-fee is given which can be done like the example on the below, you overwrite the fee amount.

Code:
var transaction = new Transaction()
    .from(utxos)          // Feed information about what unspent outputs one can use
    .to(address, amount)  // Add an output with the given amount of satoshis
    .change(address)      // Sets up a change address where the rest of the funds will go
    .sign(privkeySet)     // Signs all the inputs it can
var transaction = new Transaction().fee(5430); // Minimum non-dust amount
var transaction = new Transaction().fee(1e8);  // Generous fee of 1 BTC

To record this transaction on the blockchain, you have to serialize the variable transaction, and thereby, push to the network through https://blockchain.info/pushtx.

Source: https://bitcore.io/api/lib/transaction

akiash
Newbie
*
Offline Offline

Activity: 152
Merit: 0


View Profile
January 25, 2018, 09:14:40 PM
 #7

You can read everything about Bitcoin fees here: https://en.bitcoin.it/wiki/Transaction_fees

Hi AGD,
I would really appreciate if you could give me piece of advice on this. What is the best way to send cryptocurrency from one exchange to another. I can see that if I send BTC, is has higher fees.

That's something already fixed that you're asking about. Exchanges charge a "fixed" fee for a transaction that they execute on their end and you are bound to pay those fees if you are withdrawing your coins from an exchange to exchange or even a wallet. You can only decide fee while you are sending "your" coins that you have in your wallet, and not an exchange. The "fixed" fee charged by them is what they take per transaction, not the fee they actually send while sending you your "withdrawn" amount. One more thing, each exchange has different "fixed" fee levels, like Polo charges 0.0005 BTC per withdrawal, Bittrex takes 0.001 BTC and so on.
Thanks. That helps. Recently I transferred some BTC from coinbase to binance and they charged me around 18 USD for that transaction. If I'm going to transfer some money from binance to other exchange, what is the best format of cryptocurrency I should send in order to minimize the fees.
AGD
Legendary
*
Offline Offline

Activity: 1706
Merit: 1026


HODLER SINCE 2013


View Profile
January 26, 2018, 06:03:27 AM
 #8

You can read everything about Bitcoin fees here: https://en.bitcoin.it/wiki/Transaction_fees

Hi AGD,
I would really appreciate if you could give me piece of advice on this. What is the best way to send cryptocurrency from one exchange to another. I can see that if I send BTC, is has higher fees.

That's something already fixed that you're asking about. Exchanges charge a "fixed" fee for a transaction that they execute on their end and you are bound to pay those fees if you are withdrawing your coins from an exchange to exchange or even a wallet. You can only decide fee while you are sending "your" coins that you have in your wallet, and not an exchange. The "fixed" fee charged by them is what they take per transaction, not the fee they actually send while sending you your "withdrawn" amount. One more thing, each exchange has different "fixed" fee levels, like Polo charges 0.0005 BTC per withdrawal, Bittrex takes 0.001 BTC and so on.
Thanks. That helps. Recently I transferred some BTC from coinbase to binance and they charged me around 18 USD for that transaction. If I'm going to transfer some money from binance to other exchange, what is the best format of cryptocurrency I should send in order to minimize the fees.

Most of the Altcoins have a lower fee, but you will lose some % when you want to exchange back in BTC.

Bitcoin is not a bubble, it's the pin!
+++ GPG Public key FFBD756C24B54962E6A772EA1C680D74DB714D40 +++ http://pgp.mit.edu/pks/lookup?op=get&search=0x1C680D74DB714D40
cry4crypto
Member
**
Offline Offline

Activity: 140
Merit: 31


View Profile
January 26, 2018, 02:03:05 PM
Merited by Welsh (3)
 #9

There are also multiple online fee calculators out there if you don't feel like calculating yourself. To name a few:

https://estimatefee.com/
http://bitfees.info/
https://www.cheaperfee.com/
https://coinb.in/#fees

I am in no way affiliated with any of these sites by the way, but hope you find either of them useful.
buwaytress
Hero Member
*****
Offline Offline

Activity: 770
Merit: 708


I bit, therefore I am


View Profile
January 26, 2018, 03:07:47 PM
Merited by LFC_Bitcoin (2), achow101 (1), Welsh (1)
 #10

To add in on the other answers here, since OP still wants to know how to calculate tx fees... the most important piece of information you need is the size of your transactions. Doesn't seem to be in those lines of code, but they do have pieces of info that you can use to estimate size (not very accurately but close enough):

- number of inputs you're using, a
- number of outputs you'll create, b

Then: a*180 + b*34 + 10 +/- 1

which is why a 1 input, 1 output tx, the most common one, results in a typical tx size of 225 bytes. If you're using SegWit, your txs are going to be smaller (edit: added "in weight"), so this is a safe formula to use.

Easiest for me is to use the rough formula automatically done in site suggested above (estimate fee) so that's your best point to start finding out tx size, and then you crosscheck with another estimator with an easier to see structure like bitcoinfees.earn.com to see how much you need to pay per byte, for the estimated confirmation time you're comfortable with.

achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 1554
Merit: 1704


3F1Y9yquzvY6RWvKbw2n2zeo9V5mvBhADU


View Profile WWW
January 26, 2018, 04:03:10 PM
 #11

Then: a*180 + b*34 + 10 +/- 1
Unless you are using uncompressed public keys (and very few wallets do this anymore), the input multiplier will be 148 instead of 180.

Carlton Banks
Legendary
*
Offline Offline

Activity: 2156
Merit: 1385



View Profile
January 26, 2018, 06:07:59 PM
Merited by Welsh (1), veleten (1), Jet Cash (1), hatshepsut93 (1), buwaytress (1), Samarkand (1)
 #12

and then you crosscheck with another estimator with an easier to see structure like bitcoinfees.earn.com to see how much you need to pay per byte, for the estimated confirmation time you're comfortable with.

Strongly recommend against using bitcoinfees.earn.com (which is the same as bitcoinfees.21.co), especially for those that aren't familiar with Bitcoin fee estimating, bitcoinfees.21.co/bitcoinfees.earn.com suggests incorrect estimates for confirmation times.

The text delivering the "answer" is highly misleading: "The fastest and cheapest transaction fee is currently: 220 satoshis/byte" (which at this point in time is around 10 times more than an equally fast fee rate).

The site's conf-time estimate seems to erroneously deem the "cheapest and fastest" fee to be that which is paid very near to the highest within the top 1MB of it's mempool, when in fact every transaction within the top 1MB will be equally fast (yet not equally cheap).

It's likely no coincidence that 200 sat/byte transactions are heavily represented in the typical Bitcoin mempool. Very little mempool space is occupied inbetween this so called "cheapest and fastest" threshold and the lowest fee within the top 1 MB of the mempool (which is 10 times lower than 200 sat/byte right now).

Their method for calculating fees therefore always presents users with a false impression of confirmation times, and likely distorts the fee market against the user's interests. I am most embarrassed to have recommended this website in the past.

Vires in numeris
hatshepsut93
Hero Member
*****
Offline Offline

Activity: 938
Merit: 601


Vires in numeris


View Profile
January 26, 2018, 09:31:06 PM
Merited by achow101 (2), buwaytress (1)
 #13

and then you crosscheck with another estimator with an easier to see structure like bitcoinfees.earn.com to see how much you need to pay per byte, for the estimated confirmation time you're comfortable with.

Strongly recommend against using bitcoinfees.earn.com (which is the same as bitcoinfees.21.co), especially for those that aren't familiar with Bitcoin fee estimating, bitcoinfees.21.co/bitcoinfees.earn.com suggests incorrect estimates for confirmation times.


Probably the best way to check the current fees is to go to https://dedi.jochen-hoenicke.de/queue/#2h and look at the mempool size to see what fees are getting included in recent blocks by looking at spike drops. Also, this should be another incentive to run a full node, as SPV clients have to trust their servers to get fee estimations (correct me if I'm wrong).

buwaytress
Hero Member
*****
Offline Offline

Activity: 770
Merit: 708


I bit, therefore I am


View Profile
January 27, 2018, 10:00:49 AM
Merited by Carlton Banks (1), achow101 (1)
 #14

and then you crosscheck with another estimator with an easier to see structure like bitcoinfees.earn.com to see how much you need to pay per byte, for the estimated confirmation time you're comfortable with.

Strongly recommend against using bitcoinfees.earn.com (which is the same as bitcoinfees.21.co), especially for those that aren't familiar with Bitcoin fee estimating, bitcoinfees.21.co/bitcoinfees.earn.com suggests incorrect estimates for confirmation times.

The text delivering the "answer" is highly misleading: "The fastest and cheapest transaction fee is currently: 220 satoshis/byte" (which at this point in time is around 10 times more than an equally fast fee rate).

The site's conf-time estimate seems to erroneously deem the "cheapest and fastest" fee to be that which is paid very near to the highest within the top 1MB of it's mempool, when in fact every transaction within the top 1MB will be equally fast (yet not equally cheap).

It's likely no coincidence that 200 sat/byte transactions are heavily represented in the typical Bitcoin mempool. Very little mempool space is occupied inbetween this so called "cheapest and fastest" threshold and the lowest fee within the top 1 MB of the mempool (which is 10 times lower than 200 sat/byte right now).

Their method for calculating fees therefore always presents users with a false impression of confirmation times, and likely distorts the fee market against the user's interests. I am most embarrassed to have recommended this website in the past.


Thanks for pointing that out... I confess I haven't been looking at the explanation paragraphs below the main charts for months and you're right. The graphs themselves are still helpful, I've always used the estimation with confirmation times that more or less correspond. But the "cheapest and fastest" estimation is definitely far from accurate, at least it is right now.

I've been recommending this estimator for months now so am as guilty for possibly getting other users to pay more fees than needed. Complacency...

I do note that the graphs themselves are still a useful tool but now should find something more representative.

Then: a*180 + b*34 + 10 +/- 1
Unless you are using uncompressed public keys (and very few wallets do this anymore), the input multiplier will be 148 instead of 180.

I learn something new every day here, thanks for pointing that out!

Carlton Banks
Legendary
*
Offline Offline

Activity: 2156
Merit: 1385



View Profile
January 29, 2018, 12:38:14 PM
 #15

I confess I haven't been looking at the explanation paragraphs below the main charts for months and you're right. The graphs themselves are still helpful, I've always used the estimation with confirmation times that more or less correspond. But the "cheapest and fastest" estimation is definitely far from accurate, at least it is right now.

I've been recommending this estimator for months now so am as guilty for possibly getting other users to pay more fees than needed. Complacency...

Yeah, like I said, I have recommended bitcoinfees.21.co in the past without fully understanding how inaccurate it's estimates can be. And like you said, the raw information on the site is perfectly usable, but those looking for a simple answer are likely to assume the estimation (or even the "fastest & cheapest") figures are good, which they're not.

Vires in numeris
Hans17
Full Member
***
Offline Offline

Activity: 308
Merit: 102



View Profile
February 05, 2018, 07:17:37 AM
 #16

You can read everything about Bitcoin fees here: https://en.bitcoin.it/wiki/Transaction_fees

Wow didn't know about this and thank you though it really help me and to be honest I am doing some basic search about this , and now I know , thank's a lot though and for my opinion how to calculate the fees I think by the demand of it however the bitcoin or the cryptocurrency's price.

               ♦      GΞMΞRA      ♦     Crypto-Token Backed by Colombian Emeralds     [  WHITEPAPER  ]               
     ▬▬▬    PRE-SALE  ▶  Sep 10th - Oct 24th     JOIN NOW & get 20% BONUS!    ▬▬▬     
♦          TELEGRAM        TWITTER        FACEBOOK        YOUTUBE         MEDIUM         GITHUB         LINKEDIN          ♦
Ulap16
Newbie
*
Offline Offline

Activity: 27
Merit: 0


View Profile
February 06, 2018, 04:24:47 AM
 #17

I didn't know anything about transaction fees and so much information is available here. I'll do my own research now and try to calculate the fees.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!