Jump to content

SegWit: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
GreenC bot (talk | contribs)
Rescued 1 archive link; remove 1 link. Wayback Medic 2.1
added paragraph on Bitcoin chain split
Line 3: Line 3:


The formal title "Segregated Witness (Consensus layer)" had Bitcoin Improvement Proposal number BIP141.<ref>[https://github.com/bitcoin/bips/ All Bitcoin Improvement Proposals, including BIP141]</ref> The declared purpose was to solve the bitcoin transaction [[malleability (cryptography)|malleability]].<ref name="coindesk.com">[https://www.coindesk.com/bitcoin-bug-guide-transaction-malleability/ What the 'Bitcoin Bug' Means: A Guide to Transaction Malleability]</ref> It was also intended to mitigate a [[Bitcoin#blockchain|blockchain]] size limitation problem that reduces bitcoin transaction speed. It does this by splitting the transaction into two segments, removing the unlocking signature ("witness" data) from the original portion and appending it as a separate structure at the end.<ref>[http://www.investopedia.com/terms/s/segwit-segregated-witness.asp Investopedia: SegWit (Segregated Witness)]</ref> The original section would continue to hold the sender and receiver data, and the new "witness" structure would contain scripts and signatures. The original data segment would be counted normally, but the "witness" segment would, in effect, be counted as a quarter of its real size.
The formal title "Segregated Witness (Consensus layer)" had Bitcoin Improvement Proposal number BIP141.<ref>[https://github.com/bitcoin/bips/ All Bitcoin Improvement Proposals, including BIP141]</ref> The declared purpose was to solve the bitcoin transaction [[malleability (cryptography)|malleability]].<ref name="coindesk.com">[https://www.coindesk.com/bitcoin-bug-guide-transaction-malleability/ What the 'Bitcoin Bug' Means: A Guide to Transaction Malleability]</ref> It was also intended to mitigate a [[Bitcoin#blockchain|blockchain]] size limitation problem that reduces bitcoin transaction speed. It does this by splitting the transaction into two segments, removing the unlocking signature ("witness" data) from the original portion and appending it as a separate structure at the end.<ref>[http://www.investopedia.com/terms/s/segwit-segregated-witness.asp Investopedia: SegWit (Segregated Witness)]</ref> The original section would continue to hold the sender and receiver data, and the new "witness" structure would contain scripts and signatures. The original data segment would be counted normally, but the "witness" segment would, in effect, be counted as a quarter of its real size.

Some people saw a variety of issues in enabling SegWit on the Bitcoin chain. As a result, Bitcoin split into two chains in August 2017; namely Bitcoin with SegWit enabled as a soft fork and [[Bitcoin Cash]] without SegWit as a hard fork.


==History==
==History==

Revision as of 19:58, 5 July 2018

SegWit Logo

Segregated Witness, or SegWit, is the name used for an implemented soft fork change in the transaction format of the cryptocurrency bitcoin.[1]

The formal title "Segregated Witness (Consensus layer)" had Bitcoin Improvement Proposal number BIP141.[2] The declared purpose was to solve the bitcoin transaction malleability.[3] It was also intended to mitigate a blockchain size limitation problem that reduces bitcoin transaction speed. It does this by splitting the transaction into two segments, removing the unlocking signature ("witness" data) from the original portion and appending it as a separate structure at the end.[4] The original section would continue to hold the sender and receiver data, and the new "witness" structure would contain scripts and signatures. The original data segment would be counted normally, but the "witness" segment would, in effect, be counted as a quarter of its real size.

Some people saw a variety of issues in enabling SegWit on the Bitcoin chain. As a result, Bitcoin split into two chains in August 2017; namely Bitcoin with SegWit enabled as a soft fork and Bitcoin Cash without SegWit as a hard fork.

History

Block size limit

Bitcoin is a cryptocurrency, a form of money using cryptography to keep transactions secure.[5] Each record of a unit of bitcoins is called a "block", and all blocks are tied together sequentially by using a cryptographic hash on the previous block and storing its output in the next. This forms a chain of blocks, or a blockchain.[6]

Each block contains information about who sends and receives a given unit of bitcoin (a transaction), as well as the signature that approves each transaction. Originally, there was no limit to the size of blocks. However, this allowed malicious actors to make up fake "block" data that was very long as a form of denial-of-service attack (DoS attack). These fake blocks would be detected, but doing so would take a very long time, slowing down the whole system.[7]

The solution Satoshi Nakamoto designed was to put a limit on block size, which was 1 MB. This way, attacks using huge blocks would be instantly detected and rejected, without significantly slowing down the network.

Scalability and malleability

The current bitcoin blockchain design is regarded as having two shortcomings.

Scalability

A new block is added to the chain at random intervals averaging, by design, ten minutes (proof-of-work causes this delay). Together with the limit on block-size, this limits the number of transactions that can be processed in a given time. Some sites work around this problem using "off-chain payments", conducting transactions without waiting for confirmation by the bitcoin network.[8]

Others have proposed changes to bitcoin that would reform the blockchain format in a backward-incompatible way.[8] For example, FlexTrans (Flexible Transactions) would make transactions smaller by changing how they are described to a "tag" system, allowing more transactions per block. This is not compatible with systems that do not upgrade.[9]

Malleability

Another property of SegWit is "transaction malleability".[3] Even though every transaction is cryptographically signed, the signature doesn't encompass all transaction data. Many people consider this a flaw because a user can potentially change a transaction ID. This could lead to extra bitcoin being sent if a user claims they never received the bitcoin and the sender checks the original transaction ID to verify (which would not exist on the block chain if the ID was changed).

The reasons malleability was introduced are because it enables signatures to be added after the transaction is created (which is necessary for Lightning Network), and because it reduces the transaction size by 65% [10].

Segregated Witnesses as a solution

SegWit proposes significant backward compatibility. It hides its increased block size by changing the definition of a block to be measured as one million "units" instead of bytes.[citation needed][clarification needed] The signature data called the witness would be separated from the Merkle tree record of who is sending or receiving the bitcoins. The witness data is moved to the end, and each byte of it would only count as one quarter of a "unit". The overall effect would be changing the average block size to about 1.8 MB instead of 1.[clarification needed] This means the existing bitcoin protocol doesn't change, allowing it to work without as much upgrading of software.[11]

It also addresses signature malleability, by moving signatures out of the transaction data, making them impossible to change.[12] The transaction ID is no longer malleable. This makes Bitcoin safer to use with Lightning Network, a way to speed up small payments by bundling them and only writing to the blockchain at the beginning and end of their execution, which would be (slightly) risky while the malleability problem still exists.[13]

Activation

Segregated Witness was activated on August 24, 2017.[14] In the first week of October, the proportion of network transactions using SegWit rose from 7% to 10%, indicating an increase in use rate.[15]

Segregated Witness (BIP141) should not be confused with SegWit2x (SegWit2Mb). SegWit2Mb proposed to first activate Segregated Witness and then a 2 MB hard fork within six months as of May 23, 2017.

In May 2017 Digital Currency Group (not to be confused with the Digital Currency Initiative of the MIT Media Lab) announced it had offered a proposal, referred to as SegWit2x ("the New York Agreement"),[16] activating Segregated Witness at an 80% threshold of the total bitcoin hash rate, signaling at bit 4; and activating a 2 MB block size limit within six months with support in excess of 80% of the total bitcoin hash rate.[17] In June 2017 the Segregated Witness proposal was further complicated with claims that it might violate patents filed with the USIPO.[18]

As of mid-2017 the SegWit2x proposal had support in excess of 90% of the hashrate, however the SegWit2x proposal has been controversial in that work on the project is limited to an invitation only group of developers.[16] In mid-July 2017 it became apparent that miners supported implementation of the Segwit part of the agreement before the 1 August 2017 UASF, thereby attempting to avoid the risk of a hard fork for the bitcoin network.[19][20][21]

On 21 July 2017 bitcoin miners locked-in a software upgrade referred to as Bitcoin Improvement Proposal (BIP) 91, meaning that the Segregated Witness upgrade activated at block 477,120.[22] SegWit alleviates the scaling problem in two ways:

  • SegWit solves Transaction Malleability, thereby enabling the Lightning Network, an overlay network of micropayment channels, hypothetically resolving the scaling problem by enabling virtually unlimited numbers of instant, low-fee transactions to occur "off chain".[23][24]

By 8 August another milestone was reached when 100% of the bitcoin mining pools signaled support for SegWit, although SegWit would not be fully activated until 21 August at the earliest, after which miners would begin rejecting blocks that do not support SegWit.[25] Initially, most bitcoin transactions have not been able to use the upgrade. In the first week of October the proportion of bitcoin transactions using SegWit rose from 7% to 10%.[26]

On November 8, 2017, the developers of SegWit2x announced that the hard fork planned for around November 16, 2017 was canceled due to a lack of consensus.[27][28] As of February 2018, SegWit transactions exceed 30%.[29]

  • BIP141 Segregated Witness (Consensus layer) – activated on August 24, 2017
  • BIP142 Address Format for Segregated Witness – withdrawn, superseded by BIP 173
  • BIP143 Transaction Signature Verification for Version 0 Witness Program [1] – activated on August 24, 2017
  • BIP144 Segregated Witness (Peer Services) – activated on August 24, 2017
  • BIP148 Mandatory activation of segwit deployment – activated (mandated the activation of BIP141, 143, 144)
  • BIP173 Bech32 addresses, released as part of Bitcoin Core version 0.16.0 in February 2018.[30]

References

  1. ^ "SegWit, Explained". Cointelegraph. 20 April 2017. Retrieved 20 December 2017.
  2. ^ All Bitcoin Improvement Proposals, including BIP141
  3. ^ a b What the 'Bitcoin Bug' Means: A Guide to Transaction Malleability
  4. ^ Investopedia: SegWit (Segregated Witness)
  5. ^ Bitcoin protocol documentation
  6. ^ How the Bitcoin protocol actually works
  7. ^ What is the Block Size Limit
  8. ^ a b Is there a better Scaling Solution than SegWit?
  9. ^ Tom's Blog: Flexible Transactions Archived 2017-10-18 at the Wayback Machine
  10. ^ Rosic. "What is Segwit? A Beginners Crash Course!". https://blockgeeks.com/guides/what-is-segwit/. {{cite web}}: |access-date= requires |url= (help); External link in |website= (help); Missing or empty |url= (help)
  11. ^ Segregated Witness, Part 1: How a Clever Hack Could Significantly Increase Bitcoin's Potential
  12. ^ Segregated Witness proposal BIP 141
  13. ^ What is SegWit?
  14. ^ Segregated Witness activation monitor on xbt.eu
  15. ^ Suberg, William (9 October 2017). "Bitcoin: $4600, 50% Dominance, Forks Leave Altcoins No Room For Moon". CoinTelegraph. Retrieved 9 October 2017.
  16. ^ a b Alyssa Hertig (23 June 2017). "Top Secret? Bitcoin Scaling Plan Segwit2x Leaves More Questions Than Answers". CoinDesk. Retrieved 29 June 2017.
  17. ^ "Leading bitcoin ecosystem participants reach consensus on scaling issue". Econo Times. Econo Times. 25 May 2017. Retrieved 23 June 2017.
  18. ^ Jamie Redman (2 June 2017). "Segregated Witness and the Possibility of Patent Infringement". Bitcoin.com. Retrieved 13 Apr 2018.
  19. ^ CNBC (14 July 2017). "Dispute could mean financial panic in Bitcoin". Associated Press. Retrieved 19 July 2017.
  20. ^ Suberg, William (18 July 2017). "Suddenly, Bitcoin Hard Fork Looks Unlikely As Chinese Exchange Readies For SegWit". COINTELEGRAPH. Retrieved 18 July 2017.
  21. ^ Castor, Amy (18 July 2017). "CoinDesk Explainer: How BIP 91 Enacts SegWit While Avoiding a Bitcoin Split". CoinDesk. Retrieved 18 July 2017.
  22. ^ Hertig, Alyssa (21 July 2017). "BIP 91 Locks In: What This Means for Bitcoin and Why It's Not Scaled Yet". CoinDesk. Retrieved 21 July 2017.
  23. ^ Graham, Luke (9 August 2017). "As bitcoin comes off its record high, the next step is to avoid a 'lightning fork'". CNBC. Archived from the original on 1 December 2017. Retrieved 23 November 2017. {{cite web}}: Unknown parameter |deadurl= ignored (|url-status= suggested) (help)
  24. ^ "Lightning Network, Explained". CoinTelegraph. Archived from the original on 17 November 2017. Retrieved 23 November 2017. {{cite web}}: Unknown parameter |deadurl= ignored (|url-status= suggested) (help)
  25. ^ Hertig, Alyssa (8 August 2017). "It's Official: Segregated Witness Will Activate on Bitcoin". CoinDesk. Retrieved 9 August 2017.
  26. ^ Suberg, William (9 October 2017). "Bitcoin: $4600, 50% Dominance, Forks Leave Altcoins No Room For Moon". CoinTelegraph. Retrieved 9 October 2017.
  27. ^ Hertig, Alyssa (8 November 2017). "2x Called Off: Bitcoin Hard Fork Suspended for Lack of Consensus". CoinDesk. Retrieved 8 November 2017.
  28. ^ Vigna, Paul (8 November 2017). "Bitcoin Dodges Split That Threatened Its Surging Price". The Wall Street Journal. Retrieved 8 November 2017.
  29. ^ Torpley, Kyle (28 February 2018). "The Number of Bitcoin Transactions Using SegWit Doubled In 2 Days, Here's Why That Matters". Forbes. Retrieved 1 March 2018.
  30. ^ "New Bitcoin Code Will Finally Boast Full SegWit Support". coindesk.com. Archived from the original on 20 February 2018. Retrieved 20 February 2018. {{cite web}}: Unknown parameter |deadurl= ignored (|url-status= suggested) (help)