This is indeed an interesting thread.Kudos fellas,very informative.I hope all the technical answers at least are kept updated in the first post (might as well as one of the mods to reserve couple of posts for the thread).
Am I allowed to ask questions ? If anyone want's to,give the below question a try.If the answers is convincing,I'll leave some merits.
My question :
How to calculate transaction fees before sending bitcoins ? Wow that is one tricky question.. i will give it a try:
Since we know fee are calculated per byte. So lesser bytes mean lower fee. That's how miners calculate!
I presume your question is from the consumer (sender) prospective. If we are using segwit fee be can reduced to half. Also most wallets don't tell the size of the transaction at all, so i will leave the exact calculation a side.
On average single transaction usually have 1 input and 2 outputs which will be =>226 bytes,
Now we must know what is average/median fee per byte in recent block to get this we have to get from somewhere like "
https://bitcoinfees.earn.com/" => i got it 30 satoshis/byte (fastest and cheapest)
If I multiply it with bytes 226 x 30 = 6780 satoshis = 0.0000678 => 0.79 US Dollar (fast & min)
So can that's lowest, now from the same website, i can the max 181 satoshis/byte
If I multiply it with bytes 226 x 181 = 40906 satoshis = 0.00040906 BTC => 4.74 US Dollar (max)
May be i went into too technical details
You did not go technical at all. Fees are now calculated using block weight, or vBytes (virtual bytes) with the recent Segwit upgrade. P2SH-P2WPKH address (SegWit nested in P2SH address) transactions are often larger in raw bytes than normal transactions, but have a lower fee because of block weight. The 1 MB block size limit has been replaced with block weight of 4 MB. Normal transaction data counts as 4 times their actual size (100 bytes of normal data would have a weight of 400 bytes), and SegWit data is treated as their normal size. This does not cut the fee in half like you claim, and the savings increase the more complicated (more inputs and outputs) the transaction gets.
The
median transaction has 1 input and 2 outputs, and it is certainly not the average. 226 bytes is only true when Compressed Legacy (legacy, meaning addresses that begin with "1") sends to a Legacy address. If the input is Segwit or not compressed, it has a different size, being approximately 258 bytes and 168 vBytes (249 real) respectively. An output that is bech32 saves an additional 3 bytes, and for reasons I'm unaware of, it appears that sending to P2SH-P2WPKH has the same 3 byte savings.
Please stop recommending bitcoinfees.earn.com, it overestimates fees quite significantly. It was recommending 100 satoshis/byte a few days ago when 5 sat/byte were getting in the same block. Currently it suggests 20 sat/byte, while
Coinb.in suggests 4 sat/byte, and if you look at the
mempool, only 0.28 MB of transactions are paying a fee of 5 sat/byte or higher. Paying 20 sat/byte would just be plain stupid right now, and you would have literally no reason to do so. The best way in my opinion is to check out
Jochen's mempool stats in combination with
Coinb.in to determine the optimal fee to use. Based on the current stats, I'd have to agree that 4 sat/byte is the cheapest, and will get you confirmed in the next block.
Most wallets will either let you pick a satoshi/byte fee, or a fixed amount, and tell you the size of the transaction. This lets you get the correct size, and in turn, the correct fee. I'd argue that most transactions are not 226 bytes any more, with the introduction of SegWit, and from getting many (smaller) inputs. This is more true the higher your transaction value is.
For an actual technical post, I would have expected vBytes to be at the very least mentioned, maybe block weight, and definitely more in depth info on transaction sizes.
This is indeed an interesting thread.Kudos fellas,very informative.I hope all the technical answers at least are kept updated in the first post (might as well as one of the mods to reserve couple of posts for the thread).
Am I allowed to ask questions ? If anyone want's to,give the below question a try.If the answers is convincing,I'll leave some merits.
My question :
How to calculate transaction fees before sending bitcoins ? A one liner answer may be , just use electrum wallet and you should be fine as it has both rbf and cpfp option . In case you need more info, use this website : bitcoinfees.earn.com . With electrum, you can preview size and tx fee too .
Electrum was asking people to overpay just like BitcoinFees.earn.com a few weeks ago. It currently suggests 18 sat/byte for next block on version 3.0.6, which is at least 2 times more than you need. RBF helps if you pay a low fee, but does not prevent you from overpaying.