Author

Topic: is it too late to ask what is Segwit and how does it work? (Read 750 times)

staff
Activity: 3458
Merit: 6793
Just writing some code
Does it means that there will be one blockchain with blocks >1mb (sw) and blocks <1mb?
No. There is only one blockchain.

What does it means that SW transaction is seen by older nodes as a anyone-can-spend?
Yes. They are also non-standard, and given that the majority of nodes and miners are enforcing segwit, those transactions are not actually anyone-can-spend.
full member
Activity: 163
Merit: 100
Luk, soy tu padreeee
Very interesting!!

Does it means that there will be one blockchain with blocks >1mb (sw) and blocks <1mb?

What does it means that SW transaction is seen by older nodes as a anyone-can-spend?
hero member
Activity: 1036
Merit: 520
it never occured to me to check the BIPS! and they are exactly what i was looking for. thanks.

and thanks for patiently answering all my questions. it helped a lot.
staff
Activity: 3458
Merit: 6793
Just writing some code
now here is where i get confused.
can we use a real example. lets take this transaction that i got from blockchain.info
Quote
010000000118d68350c1dcda804cc1cf5d9137fea5ea90a2ec3ffee63c47881b42043197d301000 0006b483045022100b4004f6cc5fe81527b62b090a9c5cf0343e8d7e0092b749f797a0363cd1f8b9d022 03440e3f4dc6dc29f095b0a93eccf66b3fd9ac88713695bd71dc8ee61cc89776a012103424bf6a8 1b8b327631f044e11f18eb8fc665288739c5e72377614d3e7580721bffffffff0240933402000000001976a9140177884fc893f5264be7e424781f7574c7b3a6b788ac4 d3ed118000000001976a9141595049c14d3b94e24069e33480f9d182c518fea88ac00000000

i have made the scriptsig into bold. i am assuming this is what you call "the witness" correct?
No. The scriptsig and witness are two separate things. The data that goes in the witness is the data that would go in the scriptsig if a witness output were a normal p2pkh or p2sh output. In this example transaction, if the output it is spending from was a pay-to-witness-pubkey-hash (p2wpkh), then the data that is in the scriptsig would be found in the witness. However, since the output is p2pkh, the data currently in the scriptsig would remain where it is even after segwit activates.

my confussion is about where is this "field" really located. is it still inside the transaction?
Yes. It is still part of the transaction. The transaction format has been extended for segwit.

if so then how will it look and how is it different?
Suppose that the example transaction you posted were spending from a p2wpkh output instead of a p2pkh output. The transaction would look like this:
and also by "not counted" do you mean it is not included in the 1 MB block if so how can you verify the transaction later on?
The data in the witness is not counted as part of the 1 MB block. The transaction is still verified as it normally would be since any node that can understand segwit will require that the transactions it receives are in the segwit serialization format. This means that it must receive the witnesses or the transaction will be considered invalid. The same goes with blocks; all transactions in a block that have witnesses must be in the segwit serialization format otherwise the block will be considered invalid.

so how will the new blocks look like?
They will look like they do now, but transactions that have witnesses will be in the segwit serialization format.

will they take a larger space on the whole blockchain
Yes. After segwit activates, the amount of space that a block can take up is 4 MB.

sorry if the questions are too newbish. i recently started getting a better technical understanding of bitcoin and reading the bitcoin wiki, ... i can easily understand things but when it comes to segwit, everything becomes complicated probably because i have not found anything as well written as the wiki and also there is no examples helping me "visualize it" Smiley
The BIPs contain all of this information with some examples too. Segwit is specified by BIPs 141, 143, and 144
hero member
Activity: 1036
Merit: 520
now here is where i get confused.
can we use a real example. lets take this transaction that i got from blockchain.info
Segwit creates a new type of output which moves the signature out of the scriptsig into a new field, the witness. it is also not counted as part of the 1 MB block size.
my confussion is about where is this "field" really located. is it still inside the transaction? if so then how will it look and how is it different?
and also by "not counted" do you mean it is not included in the 1 MB block if so how can you verify the transaction later on?

and if not, and it is included then i am more confused about the capacity increase:

Quote
Regarding the block size, technically segwit defines a new limit which supersedes the block size limit, a block weight limit. The block weight is defined as 3 * non-witness data + all data in a block. The maximum block weight is then 4 million weight units (basically bytes).

so how will the new blocks look like? will they take a larger space on the whole blockchain

sorry if the questions are too newbish. i recently started getting a better technical understanding of bitcoin and reading the bitcoin wiki, ... i can easily understand things but when it comes to segwit, everything becomes complicated probably because i have not found anything as well written as the wiki and also there is no examples helping me "visualize it" Smiley
staff
Activity: 3458
Merit: 6793
Just writing some code
Segwit creates a new type of output which moves the signature out of the scriptsig into a new field, the witness. The witness is not included in calculating the transaction id and it is also not counted as part of the 1 MB block size. This effectively reduces the size of a transaction (the part counted for the 1 MB) so that more transactions can be included. With witnesses, a block is now allowed to be 4 MB. Removing the witnesses from the transaction id calculation also makes transactions that spend from segwit outputs non-malleable.

Regarding the block size, technically segwit defines a new limit which supersedes the block size limit, a block weight limit. The block weight is defined as 3 * non-witness data + all data in a block. The maximum block weight is then 4 million weight units (basically bytes).
hero member
Activity: 1036
Merit: 520
i haven't been around much and i missed a lot and being not-techy (not zero knowledge but very little) is hard for me to understand what segwit is and how it is going to work for example in increasing the capacity.

i would like a simplified, in your own words explanation because i have read some stuff online but as i said being non-techy makes it hard for me to fully understand how it works.
for example this from bitcoincore.org
Quote
Block capacity/size increase

Since old nodes will only download the witness-stripped block, they only enforce the 1 MB block size limit rule on that data. New nodes, which understand the full block with witness data, are therefore free to replace this limit with a new one, allowing for larger block sizes. Segregated witness therefore takes advantage of this opportunity to raise the block size limit to nearly 4 MB, and adds a new cost limit to ensure blocks remain balanced in their resource use (this effectively results in an effective limit closer to 1.6 to 2 MB).

does this mean the new blocks are going to have new types of transaction which don't have any signature (scriptsig?) to make them technically bigger but still 1 MB?

and will this mean the new clients will hold blocks that are bigger? like 4 MB blocks?
Jump to: