Bitcoin Forum
May 15, 2024, 03:22:18 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Transaction Fees Native SegWit / Wrapped SegWit etc  (Read 200 times)
Waldschrat2 (OP)
Full Member
***
Offline Offline

Activity: 262
Merit: 135



View Profile
February 08, 2021, 04:29:32 AM
 #1

Hey,

Avid user of mempool.space here which I think is a pretty awesome tool to improve transaction efficiency on the Bitcoin main chain.

I am currently looking to find information what the approximate difference in fees (%-wise) is when spending *to*

- Legacy Address
- Wrapped SegWit
- Native SegWit

I know that generally the major impact on the transaction fees come from which type of address you spend, but I know that there are also (more negligible) tx size/fee differences depending if one is sending to a Legacy/Wrapped SegWit or Native SegWit address.

If somebody has a link to some guidance / data table / Dataviz or whatever else might be useful in understanding the differences, would be highly appreciative.  Smiley

Thanks in advance!

BitcoinVN - Premier Bitcoin Exchange in Vietnam (est.2014)

BitcoinVN Shop - Authorized Hardware Wallet supplier in Vietnam (Coldcard, Blockstream Jade, Ledger, Trezor...)
pooya87
Legendary
*
Offline Offline

Activity: 3444
Merit: 10562



View Profile
February 08, 2021, 04:41:11 AM
Merited by Waldschrat2 (1)
 #2

There is https://coinb.in/#fees which lets you change the input type and count and lets you see the approximate transaction sizes. You can use that to measure legacy versus SegWit transactions but not nested/wrapped SegWit. However these wrapped ones have an additional 22 bytes in their signature script, add that to total size of a SegWit tx and to get their weight it has to be multiplied by 4 and added to the whole sum (4*22=88 extra weight).

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Waldschrat2 (OP)
Full Member
***
Offline Offline

Activity: 262
Merit: 135



View Profile
February 08, 2021, 04:49:52 AM
 #3

There is https://coinb.in/#fees which lets you change the input type and count and lets you see the approximate transaction sizes. You can use that to measure legacy versus SegWit transactions but not nested/wrapped SegWit. However these wrapped ones have an additional 22 bytes in their signature script, add that to total size of a SegWit tx and to get their weight it has to be multiplied by 4 and added to the whole sum (4*22=88 extra weight).

That's helpful already - thanks!

So basically if I pay e.g. 10 Sats/vByte the difference would be 880 Sats in Fees between Native & Wrapped SegWit in this example, correct?

BitcoinVN - Premier Bitcoin Exchange in Vietnam (est.2014)

BitcoinVN Shop - Authorized Hardware Wallet supplier in Vietnam (Coldcard, Blockstream Jade, Ledger, Trezor...)
pooya87
Legendary
*
Offline Offline

Activity: 3444
Merit: 10562



View Profile
February 08, 2021, 04:59:26 AM
Merited by Waldschrat2 (1)
 #4

So basically if I pay e.g. 10 Sats/vByte the difference would be 880 Sats in Fees between Native & Wrapped SegWit in this example, correct?
It's a bit more complicated than that.
Weight is 3*(size with witnesses stripped) + total size (the raw byte size of all parts including witness)
Virtual size is weight / 4

This means anything that goes into witness part will increase the virtual size by 1/4x of its size while anything added to legacy part adds 1x of its size.
So when we add the 22 bytes to signature script those bytes exist both in "size with witness stripped" and "raw byte size" and when calculating weight it will be 3*22 + 22 = 4*22 ergo the virtual size is 4*22/4 = 22.
=> For 10 sat/vbyte it adds 220 satoshi.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
PrimeNumber7
Copper Member
Legendary
*
Offline Offline

Activity: 1624
Merit: 1899

Amazon Prime Member #7


View Profile
February 08, 2021, 05:02:56 AM
Merited by Waldschrat2 (1)
 #5

So basically if I pay e.g. 10 Sats/vByte the difference would be 880 Sats in Fees between Native & Wrapped SegWit in this example, correct?
It's a bit more complicated than that.
Weight is 3*(size with witnesses stripped) + total size (the raw byte size of all parts including witness)
Virtual size is weight / 4

This means anything that goes into witness part will increase the virtual size by 1/4x of its size while anything added to legacy part adds 1x of its size.
So when we add the 22 bytes to signature script those bytes exist both in "size with witness stripped" and "raw byte size" and when calculating weight it will be 3*22 + 22 = 4*22 ergo the virtual size is 4*22/4 = 22.
=> For 10 sat/vbyte it adds 220 satoshi.
You are referring to the cost of a transaction based on the type of address the transaction is sent from. The OP is asking about the cost of a transaction based on the type of address the transaction is sent to.
pooya87
Legendary
*
Offline Offline

Activity: 3444
Merit: 10562



View Profile
February 08, 2021, 05:23:22 AM
Merited by o_e_l_e_o (2), Waldschrat2 (1)
 #6

You are referring to the cost of a transaction based on the type of address the transaction is sent from. The OP is asking about the cost of a transaction based on the type of address the transaction is sent to.
I'm sorry I missed that Sad
Here are the "output" or "txout" sizes of each type that includes the 8 byte amount + the pubkey script:
Legacy (P2PKH): 34
Legacy (P2SH): 32
Legacy (P2PK): 44/76 for comp/uncomp pubkey
SegWit (P2WPKH): 31
SegWit (P2WSH): 43
Wrapped SegWit (P2SH-P2WPKH): 32 (same as P2SH)
Wrapped SegWit (P2SH-P2WSH): 32 (same as P2SH)

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6745


bitcoincleanup.com / bitmixlist.org


View Profile WWW
February 08, 2021, 05:30:35 AM
Merited by Waldschrat2 (1)
 #7

You are referring to the cost of a transaction based on the type of address the transaction is sent from. The OP is asking about the cost of a transaction based on the type of address the transaction is sent to.

Then you'd count the size of the locking script. We can get the script type and therefore it's bytes from the types of the receiving addresses but that's about it. But this is probably a moot point since in segwit their hashes are put in the transaction anyway, which are 32 bytes each along with a bunch of other fields in the txout (and txin) which have a fixed format and whose sizes can be predetermined.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
dkbit98
Legendary
*
Offline Offline

Activity: 2226
Merit: 7153



View Profile WWW
February 08, 2021, 10:09:15 AM
Merited by Waldschrat2 (1)
 #8

There are several Bitcoin transaction calculators and I collected them all in one topic Bitcoin Transaction Size Calculators.
Jameson Lopp website is probably most complete with all address formats and explanations.

If you like using mempool.space website you can check out and test our open source browser extension for monitoring Bitcoin mempool in your browser ticker HERE and it works in both Firefox and Chrome browsers.
Feel free to write us a feedback and suggestions if you can.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
Waldschrat2 (OP)
Full Member
***
Offline Offline

Activity: 262
Merit: 135



View Profile
March 08, 2021, 05:12:21 PM
 #9

Thanks everybody for the answers - very enlightening and got pointed in a few good directions on the matter!

A lot of good resources I/we will certainly take a regular look on  Smiley

When it comes to these topics, the good ol' Bitcointalk still shining  Smiley

You are referring to the cost of a transaction based on the type of address the transaction is sent from. The OP is asking about the cost of a transaction based on the type of address the transaction is sent to.
I'm sorry I missed that Sad
Here are the "output" or "txout" sizes of each type that includes the 8 byte amount + the pubkey script:
Legacy (P2PKH): 34
Legacy (P2SH): 32
Legacy (P2PK): 44/76 for comp/uncomp pubkey
SegWit (P2WPKH): 31
SegWit (P2WSH): 43
Wrapped SegWit (P2SH-P2WPKH): 32 (same as P2SH)
Wrapped SegWit (P2SH-P2WSH): 32 (same as P2SH)

BitcoinVN - Premier Bitcoin Exchange in Vietnam (est.2014)

BitcoinVN Shop - Authorized Hardware Wallet supplier in Vietnam (Coldcard, Blockstream Jade, Ledger, Trezor...)
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!