Damus
cheatgebiet · 151w
Hey #[0], I have a question that you might be able to help me with. When you send multiple inputs in a transaction, the size of the transaction increases and so does the miner fee. In my research on h...
mattoshi profile picture
Hey @nostrich​! I’m certainly not an expert but I found these two good posts on how to calculate virtual size for a transaction and did it for the situation you mentioned.

https://bitcoin.stackexchange.com/questions/92689/how-is-the-size-of-a-bitcoin-transaction-calculated

https://bitcoin.stackexchange.com/questions/92587/calculate-transaction-fee-for-external-addresses-which-doesnt-belong-to-my-loca/92600#92600


All transactions will have at least 40 weight units
40 (weight unit of constant* fields in a transaction: version 16, num inputs 4, num outputs 4, locktime 16)
+
2 (this is a segwit tx so need to add marker and flag)
+
(3 * 272) (3 p2wpkh inputs)
+
(2 * 124) (1 p2wpkh output)
= 1106 WU (weight units)

1106 / 4 = 276.5
Need to round this up so it equals = 277vB
1
mattoshi · 151w
I made a slight mistake. I calculated for 2 outputs instead of one like you said