Thanks for explaining , Now everything is clear , Alice is paying transaction fees for 1 input and 2 output (generating more bytes in transaction) that will be definitely more if Alice transactions contains only 1 input and 1 output.
Now it become tricky that how we pay the merchant , Alice can do 2 small transaction to make up the sum for the Merchant but Merchant might not be happy as Merchant will get 2 Input and merchant will incur double transactions fess while sending out (so profit decreased .)
Here how the transaction fees is calculated:Size of transaction = Number inputs * (Input Size) + Number of outputs * (Output Size) + 10 Bytes extra fixed fee required for the framework of the transaction
How to get the P2PKH input size ?
PREVOUT + SCRIPTSIG + sequence = 32 + 4 + 1 + 1 + (71 or 72) + 1 + 33 (Compressed) + 4 = 147 or 148
PREVOUT: hash (32 bytes)
index (4 bytes)
SCRIPTSIG: length (1 byte)
CONTENTS: push opcode (1 byte)
signature (71 or 72 bytes)
push opcode (1 byte)
pubkey (33 bytes for compressed, 65 for uncompressed)
sequence (4 bytes)
Source: https://bitcoin.stackexchange.com/questions/48279/how-big-is-the-input-of-a-p2pkh-transaction Legacy input size: 148 bytes (compressed)
Legacy output size: 34 bytes (compressed)
Segwit input size: 104 bytes
Segwit output size: 32 bytes
Outputs for P2PKH and P2SH are both the same size: 34 bytes
So let's take an example and calculate the size:
https://blockchain.info/tx/7e46a5ea9d9c19cd4d0c3d0a287419d7c1ae13049ac7ab8860b6ee0cec4ead17We have 1 input
There 2 Output
So the transaction size ~= 13 * 148 + 2 * 34 + 10 ~= 226 Bytes
Check this link, you will learn more about it:
https://blog.rmcsoft.com/how-to-calculate-bitcoin-transaction-fee/