Bitcoin users are paying more on transaction fees than usual, this is as a result of many wallets not supporting segwit, some do not make segwit as default, some bitcoin users do not even know what segwit address is. Not only that, many exchanges also do not support segwit but typically legacy. Some Bitcoin users even have access to segwit addresses but due to not having enough knowledge about bitcoin makes them paying more than usual. But, all these and ways to minimize bitcoin fee will be discussed.
The Lightning NetworkFocus will be on onchain transactions while lightning network is offchain but really worth to mention. LN is a way bitcoin users can pay very low amount of bitcoin, but block fees will be paid while opening and closing a channel, the block fees are fee collected by miners while using onchain payment method. After opening a channel, only very low amount of bitcoin are deducted as fee, can be as low as less than 100 satoshi.
Transaction Inputs, outputs and UTXOsInputs are the bitcoin received into an address, while bitcoin transaction create an output which is recorded on blockchain ledger. Outputs are the bitcoin sent to another address. UTXOs are the unspent transaction outputs which are the spendable chunks of bitcoin which is recognized by the whole network and available for the owner to spend in a future transaction.
Inputs consolidation and sending to multiple addressesOne of the reasons for high transaction fees are high inputs, inputs carry more data weight which makes it more responsible for high fee, but also increase in transaction output is also responsible for high fee but not as high compared to inputs. This is revealed in the calculation below.
Assuming Bob received few satoshi of 0.001BTC in total from faucet 10 different times using a compressed legacy bitcoin address, this means the transaction will have 10 inputs. If Bob wants to send the whole bitcoin to Alice single uncompressed legacy address at ones, this is how the fee will look like.
vbyte= Input*149 + output*34 + 10 plus or minus input
vbytes= 10*149 + 1*34 + 10 +/- 10
vbyte= 1544
Assuming the feerate= 100 sat/vbytes
Fee= feerate*vbyte
Fee= 100*1544
Fee= 154400 Satoshi
Fee= 0.001544BTC. Okay, let us assume that Bob received 1BTC from Alice in a single transaction from compressed legacy address to compressed legacy address, and Bob wants to send the whole 1BTC to 10 addresses, that means the transaction will have 1 input and 10 outputs
vbyte= Input*149 + output*34 + 10 plus or minus input
vbyes= 1*149 + 10*34 + 10 +/- 1
vbytes= 500
Assuming the feerate= 100 sat/vbytes
Fee= feerate*vbyte
Fee= 100*500
Fee= 50000
Fee= 0.0005BTCAssuming Bob has 1BTC received from only one legacy address and sending it to Alice legacy address. That means it has 1 input and 1 output. But, if Bob decided to send some like 0.001BTC, he will collect change which will be sent back to another address on his wallet called change address, in this second case, the transaction will have 1 input and 2 outputs.
Using the formalar above
For 1 inputs and 1 outputs, the vbyte= 192vbytes
Assuming the feerate= 100 sat/vbytes
Fee= 100*192
Fee= 19200 satoshi
Fee= 0.000192BTCThe reason to consolidate inputsConsolidating input means to send all the bitcoin with many inputs to only one address back on your wallet so that the input will become one. Although, there are cases to increase privacy and want to only use coin control to consolidate few inputs, but with these explainations, it is clear that consolidating input will bring about a wallet being able to use lesser fee for transactions. Not only that, it is also included that the more the output, the more the fee, but not as high compared inputs.
Sending to multiple addresses will increase the fee but better than sending to one address one after the other. In the example above, sending to 10 addresses only cost 0005BTC, if sending to one address one after the other, for 10 transactions with 1 input and 1 output:
Fee= 000192BTC*10
Fee= 0.00192BTC which is far higher than 0005BTC
The sender will even use more fee because as he sends from one address, the input will be increasing which will significantly increase the fee.
Regarding input consolidations, it's good to mention that the best time to perform consolidations is during the weekend when the fees are generally lower. But during bull runs, even that is not often the case.
Using segwitThis reduces the weight of transactions, possibly because of the vbytes metric, it is a common misconception that segwit somehow makes transactions much smaller—but this is incorrect. A 300-byte transaction is 300 bytes on-disk and over-the-wire. Segwit just counts those bytes differently toward the maximum block size of 4M weight units.
The maximum size of a block in bytes is nearly equal in number to the maximum amount of block weight units, so 4M weight units allows a block of almost 4M bytes (4MB). This is not a somehow "made-up" size; the maximum block size is really almost 4MB on-disk and over-the-wire. However, this maximum can only be reached if the block is full of very weirdly-formatted transactions, so it should not usually be seen.
Comparing segwit and legacy transactionsThere are native segwit and nested segwit, legacy addresses start from 1, nested segwit starts from 3 while native which is the real segwit starts from bc1. In the comparing, 1 input and 1 output will be used.
Legacyvbyte= Input*149 + output*34 + 10 plus or minus input
For 1 inputs and 1 outputs, the vbyte= 192vbytes
Assuming the feerate= 100 sat/vbytes
Fee= 100*192
Fee= 19200 satoshi
Fee= 0.000192BTCNested segwit vbyte= Input*93 + output*32 + 10 plus or minus input
For 1 inputs and 1 outputs, the vbyte= 134vbytes
Assuming the feerate= 100 sat/vbytes
Fee= 100*134
Fee= 13400 satoshi
Fee= 0.000134BTCSegwit (native segwit)vbyte= Input*68 + output*31 + 10 plus or minus input
For 1 inputs and 1 outputs, the vbyte= 108vbytes
Assuming the feerate= 100 sat/vbytes
Fee= 100*108
Fee= 10800 satoshi
Fee= 0.000108BTCFrom the calculation above, it is clear that legacy address have more fee to be paid compared to nested segwit, while native segwit (segwit) have the lowest fee.
3. Fee estimationMost if not all wallets do not estimate fee rightly, a wallet fee estimation algorithm may not calculate the fee needed to get transaction in a block faster accurately, and it may be accurate at times. But the best to do is to also make use of online fee estimators. There are some that are not recommended, like bitcoinfees.earn.com which do gives wrong estimation, but there are some recommended ones like mempool.observer, mempool.space and jochen-hoenicke.de. Before sending bitcoin, checking the fee using reputed online fee estimators and comparing like two will be good because wallets estimators can over estimates at times in why leading to paying higher fee than usual.
One popular questionI paid higher fee than what I am seeing on blockchain
Normally, the most used blockchain explorer by novice is blockchain.com/explorer which do not display fee in vsize/vbyte but in bytes. You can pay 0.0005BTC fee in vbyte which will only be 0.0003BTC in bytes. This do confuse people thinking that the fee paid is less to what the wallets estimated, but no. It is good to make use of blockchain explorers that also estimate the fee in vbytes, the most recommended for now is blockchair.com.
https://en.bitcoin.it/wiki/Weight_unitshttps://github.com/bitcoinbook/bitcoinbook/blob/develop/ch06.asciidoc