Fees as you know are tips paid to miners to get your transaction been included into the next block. In bitcoin there is no standard or default amount set as transaction fee rather it depends on how congested the bitcoin network is at that time. There are some block explorers like mempool.space that suggest fee rates. For you to get your transaction confirmed in the next block you need to pay a higher fee according to those fee rates set by some of these explorers, although it is not a criteria but it’s best since mining pools sort there transactions into be included into blocks base on the fees paid.
Transaction fees are calculated base on the size of that transaction and that’s why you see discrepancies on the amounts usually paid for transactions and also the address formats matters too. Below is how they are calculated.
Legacy addresses starts from 1
Nested segwit starts from 3 (although not only nested segwit starts from 3)
Segwit version 0 starts from bc1q
Segwit version 1 starts from bc1p (pay-to-taproot)
This is the formula necessary for the calculation:
Formula:
For legacy address: vbyte= Input*148 + output*34 + 10 plus or minus input
For nested segwit: vbyte= Input*93 + output*32 + 10 plus or minus input
For segwit version 0: vbyte= Input*68 + output*31 + 10 plus or minus input
For pay-to-taproot: vbyte= Input*57.5 + output*43 + 10 plus or minus input
To know more about the input and output virtual size:
https://bitcoinops.org/en/tools/calc-size/To know more about the transaction virtual size:
https://jlopp.github.io/bitcoin-transaction-size-calculator/For mempool (beginners):
https://mempool.space/Mempool for advanced users:
https://jochen-hoenicke.de/queue/#BTC%20(default%20mempool),24h,weightFor example:
If you use the vbyte calculator or that formula above for 1 input and 2 outputs for native segwit addresses, you will get 110 vbyte as the virtual size of 1 input 2 outputs transaction.
To check the fee rate, click on the above second to the last, or last link.
Assuming the fee rate is 5 sat/vbyte.
Fee rate = fee ÷ vbyte
Fee = fee rate * vbyte
Fee = 5 * 110
Fee = 550 sat (0.0000055 BTC). I mean for 1 input and 2 outputs for segwit version 0.
Which means the higher the fee rate, the higher the fee. As mempool is becoming more congested, the fee rate will increase and the fee will increase.
Also if you understand ehat I explained above, you will noticed that as the input count is increasing, the fee will also increase.
Also as the output count is increasing, the fee is also increasing. But if you send to two different addresses separately, the fee would be more. So we can still say increase in the output will make the fee to decrease, despite that the fee is increasing, but lower than sending to each addresses separately.
From the virtual sizes, you can also know that you can save more in fee if you use segwit version 0 and pay-to-taproot addresses while legacy addresses have the highest fee.
Also you will know that pay-to-taproot will be good for consolidation, while segwit version 0 for paying to many addresses.