Bitcoin Forum
November 18, 2024, 08:16:14 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Why include witness data in Segwit transactions?  (Read 173 times)
zylstra (OP)
Newbie
*
Offline Offline

Activity: 58
Merit: 0


View Profile
February 02, 2018, 07:07:12 AM
 #1

My understanding is that Segwit transactions that are included in legacy BTC blocks do not contain witness data.  Why then include witness data in Segwit transactions that are included in Segwit blocks?  It seems like we get 2x transaction throughput for 4x block size, or maybe 2x block size on average.  So why even bother with Segwit?
Xynerise
Sr. Member
****
Offline Offline

Activity: 322
Merit: 363

39twH4PSYgDSzU7sLnRoDfthR6gWYrrPoD


View Profile
February 02, 2018, 07:33:04 AM
Merited by ABCbits (1), codewench (1)
 #2

My understanding is that Segwit transactions that are included in legacy BTC blocks do not contain witness data.
When segwit transactions are related to legacy nodes, the witness data is stripped so they can be valid under the consensus rules that legacy nodes follow(i.e 1 million bytes block size limit) That was how Segwit was deployed as a soft fork.

 
Quote
Why then include witness data in Segwit transactions that are included in Segwit blocks?
The so-called "witness data" is essentially the scriptSig(signature, pubkey, etc)
If the witness data isn't included in segwit transactions then how do you validate a transaction without the signature? Huh
The witness data can be over 1 million bytes, that's how the block size increase segwit brings comes into play.
 
Quote
It seems like we get 2x transaction throughput for 4x block size, or maybe 2x block size on average.  So why even bother with Segwit?
There is no block size anymore with Segwit deployment, but block weight.
We get 2x the "block size" as you put it, because that that was the requirement
zylstra (OP)
Newbie
*
Offline Offline

Activity: 58
Merit: 0


View Profile
February 02, 2018, 08:46:55 AM
 #3

Thanks for your reply and help, Xynerise.

My question was because I read this:
Quote from: Jimmy_Song
When serialized to a Legacy node, they will be 400 bytes, 300 bytes and 500 bytes respectively (tx size without witness data). When serialized to a Segwit node, they will be 800 bytes, 1100 bytes and 500 bytes respectively.

If the witness data isn't included in segwit transactions then how do you validate a transaction without the signature? Huh
The same way you validate that same transaction when it's included in legacy blocks?  Or do legacy blocks need not validate segwit transactions?  If not, why not?  As soon as we discovered we don't need witness data in legacy blocks why not simply cut them out?

So we agree that, on average, the block size will increase approximately 2x in Segwit.  With that 2x size increase we will also get 2x throughput?  If so, we could have done just as well simply increasing block size without Segwit.
DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4851



View Profile
February 02, 2018, 09:42:39 AM
Merited by ABCbits (2), pebwindkraft (2)
 #4

My question was because I read this:
Quote from: Jimmy_Song
When serialized to a Legacy node, they will be 400 bytes, 300 bytes and 500 bytes respectively (tx size without witness data). When serialized to a Segwit node, they will be 800 bytes, 1100 bytes and 500 bytes respectively.

That comment is talking about "Legacy Nodes" not "Legacy Blocks".

Where did you come up with the concept of a Legacy Block?  the only Legacy Blocks are the blocks that were created before SegWit was activated. Or are you talking about SegWit blocks stored by a Legacy Node?

If the witness data isn't included in segwit transactions then how do you validate a transaction without the signature? Huh
The same way you validate that same transaction when it's included in legacy blocks?

In Legacy Blocks the witness data is still there.  It just isn't Segregated yet.

If you are asking about SegWit blocks stored by a Legacy Node, then those nodes are fooled into thinking that bitcoins sent to a SegWit address are sent to a "ANYONE CAN SPEND" output.  Therefore, when they try to validate the blocks that spend those bitcoins, they are unable to tell the difference between a block where those bitcoins are validly spent or a block where they are invalidly spent.  In other words, a Legacy Node is unable to fully validate a block that has transactions spending bitcoins that were previously received at a SegWit address. Instead, it must trust that those blocks have been validated by a SegWit node.

Or do legacy blocks need not validate segwit transactions? If not, why not?

There were no SegWit transactions yet back when Legacy Blocks were being created, therefore there was no need to validate them. (You can't validate something that doesn't exist).

If you are asking about SegWit blocks stored by a Legacy Node, then I've already explained that the Legacy Node can't tell the difference between a valid transaction that spends bitcoins which were previously received at a SegWit address and an invalid transaction that spends bitcoins which were previously received at a SegWit address. The Legacy Node must trust that the block has already been validated by a SegWit node.

As soon as we discovered we don't need witness data in legacy blocks why not simply cut them out?

It was never discovered that we don't need witness data.

So we agree that, on average, the block size will increase approximately 2x in Segwit.  With that 2x size increase we will also get 2x throughput?

Yes.

If so, we could have done just as well simply increasing block size without Segwit.

Except that we would miss out on all the benefits that SegWit provides.  SegWit was not intended to be a method of significantly increasing throughput. It was intended to fix some issues with bitcoin transactions (such as maleability), and to make other transaction types easier or possible.
zylstra (OP)
Newbie
*
Offline Offline

Activity: 58
Merit: 0


View Profile
February 02, 2018, 10:01:05 AM
 #5

Or are you talking about SegWit blocks stored by a Legacy Node?
This is it.

If you are asking about SegWit blocks stored by a Legacy Node, then those nodes are fooled into thinking that bitcoins sent to a SegWit address are sent to a "ANYONE CAN SPEND" output.  Therefore, when they try to validate the blocks that spend those bitcoins, they are unable to tell the difference between a block where those bitcoins are validly spent or a block where they are invalidly spent.  In other words, a Legacy Node is unable to fully validate a block that has transactions spending bitcoins that were previously received at a SegWit address. Instead, it must trust that those blocks have been validated by a SegWit node.
This is what I was looking for.  Thanks.

If you are asking about SegWit blocks stored by a Legacy Node, then I've already explained that the Legacy Node can't tell the difference between a valid transaction that spends bitcoins which were previously received at a SegWit address and an invalid transaction that spends bitcoins which were previously received at a SegWit address. The Legacy Node must trust that the block has already been validated by a SegWit node.
More confirmation.  Good stuff.

Except that we would miss out on all the benefits that SegWit provides.  SegWit was not intended to be a method of significantly increasing throughput. It was intended to fix some issues with bitcoin transactions (such as maleability), and to make other transaction types easier or possible.
Ah, yes, true dat.

Thanks again.
Carlton Banks
Legendary
*
Offline Offline

Activity: 3430
Merit: 3080



View Profile
February 02, 2018, 10:40:18 AM
 #6

So we agree that, on average, the block size will increase approximately 2x in Segwit.  With that 2x size increase we will also get 2x throughput?  If so, we could have done just as well simply increasing block size without Segwit.

No, that would have been reckless.

Segwit (amongst other fixes already mentioned) fixed a Denial of Service attack. That DoS attack was increasingly more effective as blocks became larger. This could have been used to force the Bitcoin network into long waits between blocks while CPUs struggled to process the attack blocks.

So, it wasn't safe to increase the size of blocks without mitigating the attack. Segwit constrained that attack, and increased the maximum block size at the same time.

Vires in numeris
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!