Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: wsxdrfv on June 12, 2018, 04:38:02 AM



Title: How to decide transaction fee?
Post by: wsxdrfv on June 12, 2018, 04:38:02 AM
So if I want to make custom wallet web application, how to make transaction fee part?

So there are wallets that enable user to choosing fee from 3 stages, (low, standard, high) speed rises as fee rises.

Make this is easy, but how to choose/or decide exact fee for those 3 stages?

And if this fee is decided, it is static forever? or should be changed at times?




Title: Re: How to decide transaction fee?
Post by: HCP on June 12, 2018, 05:43:12 AM
Going for static fees is a "bad idea"™. The bitcoin network is a very dynamic system. Currently, fees are around 1-5 sats/byte... 6 months ago they were 1000 sats/byte. If you had static fees, there is a high probability that you will underpay during periods of high network activity and increasing fees (and end up with "stuck" transactions and long confirmation times)... and that you will overpay during periods of low network activity and decreasing fees (and pay way more for fees than you should).

In my opinion, a "good" wallet will provide "presets" that dynamically change with current network conditions so that casual users can simply choose a low/standard/high setting... but also provide a "custom" setting for more advanced users so they can specify exactly what the fee rate used will be.

There is a nice overview of how fee estimation within Bitcoin Core is handled (or was, prior to v0.15) here: https://bitcointechtalk.com/an-introduction-to-bitcoin-core-fee-estimation-27920880ad0
The article regarding what happened from v0.15 with regards to fee estimation is here: https://bitcointechtalk.com/whats-new-in-bitcoin-core-v0-15-part-2-41b6d0493136


Title: Re: How to decide transaction fee?
Post by: rpstatic on June 12, 2018, 08:01:15 AM
There are many sites that show you stats about the current pending transactions and what fee they used, e.g.
https://bitcoinfees.earn.com/

So, you can write your own function to calculate the best fee according to this information or just search for an API that already provides suggestions.


Title: Re: How to decide transaction fee?
Post by: Welsh on June 13, 2018, 08:43:45 PM
There are many sites that show you stats about the current pending transactions and what fee they used, e.g.
https://bitcoinfees.earn.com/

So, you can write your own function to calculate the best fee according to this information or just search for an API that already provides suggestions.

These are estimations, and aren't always accurate. It's good for a reference point perhaps, but if you want to determine the optimal fee depending on the current network then I would suggest using: https://jochen-hoenicke.de/queue/#0,24h

This displays the fees which are getting included in transactions that are in the mempool. You could cross reference the two sites if you so wished.


Title: Re: How to decide transaction fee?
Post by: aleksej996 on June 13, 2018, 10:30:26 PM
If your really want to add something neat, you should add RBF to your wallet, so if a user decides that he wants to increase the fee, he can make another transaction with a bigger fee.


Title: Re: How to decide transaction fee?
Post by: wsxdrfv on June 15, 2018, 07:18:47 AM
There are many sites that show you stats about the current pending transactions and what fee they used, e.g.
https://bitcoinfees.earn.com/

So, you can write your own function to calculate the best fee according to this information or just search for an API that already provides suggestions.
Thanks for link. 
Then how about other coins?


Title: Re: How to decide transaction fee?
Post by: bob123 on June 15, 2018, 07:24:09 AM
Thanks for link.  
Then how about other coins?

What about reading the other answers?

Since you are able to build a web application, you shouldn't have any problems understanding the links mentioned by HCP:
There is a nice overview of how fee estimation within Bitcoin Core is handled (or was, prior to v0.15) here: https://bitcointechtalk.com/an-introduction-to-bitcoin-core-fee-estimation-27920880ad0
The article regarding what happened from v0.15 with regards to fee estimation is here: https://bitcointechtalk.com/whats-new-in-bitcoin-core-v0-15-part-2-41b6d0493136

You will be able to estimate the fee yourself after reading those articles. The implementation itself is trivial. Examples can be found on the internet (https://www.google.com/).
By implementing it yourself you are independent from API service provider (which can have wrong information / downtimes and do not exist for all cryptos).