What is the difference between Segwit and non-segwit?

1

What's the difference? What is the definition of these two terms?

Greg Wisor

Posted 2017-12-26T10:33:45.033

Reputation: 9

Well Greg, That's a bit of a longer explanation for me to do, but you can check this link: https://bitcointalk.org/index.php?topic=2251039.0 I think it will help you understand the whole thing better! Hope it helps! Cheers

Hollossy 2017-12-26T11:05:28.817

Answers

1

Seg-Wit or Segregated Witness term can literally be explained, that we are segregating (separating) Witness (Signature Data) from something.

Now What is Witness?

For spending a unspent bitcoin output, one has to create and sign a transaction. The signature along with public key is included in scriptSig field,which is used to validate the transaction. This validation content (scriptSig) is referred to here as witness. (If multiple outputs are spent, there will be multiple scriptSig fields for corresponding inputs).

Why are we segregating (separating) it and from where?

Under SegWit contents of scriptSig fields are removed from transaction inputs [txins] and placed separately under witness field. So, format of transaction now changed from:

[nVersion][txins][txouts][nLockTime]

to

[nVersion][marker][flag][txins][txouts][witness][nLockTime]

Why it was necessary?

Transaction ID generated in bitcoin system is double SHA256 of the serialized transaction structure. Generation of txid in Non-SegWit transaction structure had a annoying bug known as transaction malleability, after broadcasting transaction with TXID1, any node in network could slightly alter content of scriptSig field still maintaining transaction validity, changes Transaction ID TXID1 to TXID2. Now for same transaction system has two txid's.

Other Benefits

Block Capacity Increase, as transactions are clubbed in blocks, current size limit being 1MB, separating scriptSig content from [txin] to new witness field, results in inclusion of more number of transactions.

Further Reading:

A good & simple explanation of SegWit : http://learnmeabitcoin.com/faq/segregated-witness

Benefits of SegWit : https://bitcoincore.org/en/2016/01/26/segwit-benefits/

BIP 141: https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki

kherwa

Posted 2017-12-26T10:33:45.033

Reputation: 141