1
I'm trying to calculate SegWit transaction fees in bytes, I have two Segwit inputs and 2 segwit outputs. can anyone calculate this transaction fees if I'm paying 100 Sat per byte?
1
I'm trying to calculate SegWit transaction fees in bytes, I have two Segwit inputs and 2 segwit outputs. can anyone calculate this transaction fees if I'm paying 100 Sat per byte?
5
That depends on what those inputs and outputs look like.
The formula, as specified in BIP141, is:
Some reference numbers:
Thanks for your expensive explanation, if I have 2 P2WPKH inputs and 2 P2WPKH output, how can I estimate the fees for this transaction? also practically can we convert vbytes to legacy bytes? – Adam – 2019-04-25T00:38:38.150
1@Adam You can't convert vbyte to bytes as they're independent metrics. Thankfully, legacy bytes are irrelevant for fee calculations. If you have two 2 P2WPKH outputs and inputs, you'll have 10 + 231 + 2101.25 = 274.5 vbytes. Whatever fee you're paying divided by 275 (rounding 274.5 up) gives you the fee/vbyte metric, which is what matters for miners. – Pieter Wuille – 2019-04-25T00:42:48.087
Thanks again for your explanation, as I see in this transaction on blockchain they says transaction size in bytes 191, do you know how did they calculate that? https://www.blockchain.com/btc/tx/87e4a93012116020d7c385d92a0d307363e8040bfb89800c709f66c47ca58316
– Adam – 2019-04-25T00:51:49.933@Adam Stop looking at transaction size, as you've been told elsewhere. The relevant metric for feerate is either virtual size or weight. – Pieter Wuille – 2019-04-25T00:53:38.583
@Adam blockstream.info makes it very confusing by showing you fee/B (which is irrelevant) and not showing vsize. blockstream.info correctly tells you the transaction is 110 vbytes, 138.1 sat/vbyte: https://blockstream.info/tx/87e4a93012116020d7c385d92a0d307363e8040bfb89800c709f66c47ca58316
– Pieter Wuille – 2019-04-25T01:29:07.163as you see on blockstream they did like convert vbytes to byte, how did they do so? – Adam – 2019-04-25T01:54:09.143
@Adam How many times do I need to repeat this? No, you cannot convert vbytes into bytes. They compute bytes by just counting the bytes. They count the vbytes by using the formula in my answer. – Pieter Wuille – 2019-04-25T02:17:58.410
Thanks a lot for your help, I understand that, but I was just wondering how blockchain and others do so. – Adam – 2019-04-25T02:19:31.547
They literally look at the size of the transaction. I'm afraid I can't explain this if it's non-obvious, but it's literally about the simplest operation there is on a transaction. As explained, the size is almost mostly irrelevant. – Pieter Wuille – 2019-04-25T02:24:50.043