Bitcoin Forum
May 04, 2024, 06:32:45 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: About Segwit  (Read 79 times)
This is a self-moderated topic. If you do not want to be moderated by the person who started this topic, create a new topic.
Bronsted (OP)
Newbie
*
Offline Offline

Activity: 11
Merit: 7


View Profile
December 06, 2020, 04:04:52 AM
Merited by o_e_l_e_o (2)
 #1

I have taken the initiative to read up on the scripting of the standard Bitcoin transactions but I do not really understand how beneficial segwit is to bitcoin. For one, I understand that segwit is primarily a backwards compatible increment of the block space as it strips the signature data and put it into the witness.

I am aware of the new virtual bytes or the weight units that are associated with the transactions. However, I do not understand how there are some claims that segwit also helps to make the transaction smaller. As segwit transactions includes the witness as well as the scripts that are used for regular transactions, does it make the transaction bigger than P2PKH or P2SH transactions?

If so, it is less of an optimization and more of a block size increase right?
TalkImg was created especially for hosting images on bitcointalk.org: try it next time you want to post an image
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714804365
Hero Member
*
Offline Offline

Posts: 1714804365

View Profile Personal Message (Offline)

Ignore
1714804365
Reply with quote  #2

1714804365
Report to moderator
SquirrelJulietGarden
Hero Member
*****
Offline Offline

Activity: 1316
Merit: 726



View Profile
December 06, 2020, 04:20:15 AM
 #2

Segwit help to reduce the transaction size and with smaller transaction size, you will have cheaper transaction fee.

Plot your transaction in the mempool
https://bitcoindata.science/plot-your-transaction-in-mempool.html
There are 3 transaction types for you to test it:
- P2PKH: 226 bytes
- P2SH: 247 bytes/  165 vbytes.
- Bech32: 226 bytes / 142 vbytes.
With 1 input, 2 outputs, Bech32 transaction gives you less fee: 0.00000142 BTC if you "Choose your fee per vbyte": is 1 sat/vbyte.

███▄▀██▄▄
░░▄████▄▀████ ▄▄▄
░░████▄▄▄▄░░█▀▀
███ ██████▄▄▀█▌
░▄░░███▀████
░▐█░░███░██▄▄
░░▄▀░████▄▄▄▀█
░█░▄███▀████ ▐█
▀▄▄███▀▄██▄
░░▄██▌░░██▀
░▐█▀████ ▀██
░░█▌██████ ▀▀██▄
░░▀███
▄▄██▀▄███
▄▄▄████▀▄████▄░░
▀▀█░░▄▄▄▄████░░
▐█▀▄▄█████████
████▀███░░▄░
▄▄██░███░░█▌░
█▀▄▄▄████░▀▄░░
█▌████▀███▄░█░
▄██▄▀███▄▄▀
▀██░░▐██▄░░
██▀████▀█▌░
▄██▀▀██████▐█░░
███▀░░
Bronsted (OP)
Newbie
*
Offline Offline

Activity: 11
Merit: 7


View Profile
December 06, 2020, 04:43:18 AM
Merited by BrewMaster (1)
 #3

Segwit help to reduce the transaction size and with smaller transaction size, you will have cheaper transaction fee.
The raw size of segwit transactions isn't smaller right? The difference between a bech32 and a P2PKH is the way that the non witness portion of the script is calculated in terms of vbyte?

If it doesn't decrease the raw transaction size, this makes segwit effectively a block size increase as well right? Just one that does not need a hard fork to achieve.
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18509


View Profile
December 06, 2020, 12:37:35 PM
Merited by BrewMaster (1)
 #4

The raw size of segwit transactions isn't smaller right? The difference between a bech32 and a P2PKH is the way that the non witness portion of the script is calculated in terms of vbyte?
Correct. In fact, depending on the number of inputs and outputs, the raw size of a P2WPKH (SegWit) transaction may actually be larger than an equivalent P2PKH (Legacy) transaction. The raw size of a P2SH-P2WPKH transaction (nested SegWit) will be significantly larger than an equivalent Legacy transaction. As you say, the reason SegWit transactions are cheaper is due to how the raw bytes are calculated in terms of weight units, not because they are physically smaller.

If it doesn't decrease the raw transaction size, this makes segwit effectively a block size increase as well right? Just one that does not need a hard fork to achieve.
Essentially, yes. After SegWit, the limit on block size effectively changed from 1 megabyte to 4 million weight units. The majority of blocks (when the mempool isn't empty) currently have a raw size in the region of 1.3 MB, but the largest block to date - 625861 - had a raw size of 2.4 MB.
Bronsted (OP)
Newbie
*
Offline Offline

Activity: 11
Merit: 7


View Profile
December 06, 2020, 12:43:46 PM
 #5

Correct. In fact, depending on the number of inputs and outputs, the raw size of a P2WPKH (SegWit) transaction may actually be larger than an equivalent P2PKH (Legacy) transaction. The raw size of a P2SH-P2WPKH transaction (nested SegWit) will be significantly larger than an equivalent Legacy transaction. As you say, the reason SegWit transactions are cheaper is due to how the raw bytes are calculated in terms of weight units, not because they are physically smaller.
Thank you for the concise explanation!
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!