Segregated Witness, or SegWit, is the name used for an implemented soft fork change in the transaction format of the cryptocurrency Bitcoin, which has also been implemented on currencies such as Litecoin, DigiByte and Vertcoin.
The formal title "Segregated Witness (Consensus layer)" had Bitcoin Improvement Proposal number BIP141. The purpose was to solve malleability. 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. 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.
Video SegWit
History
Block size limit
Bitcoin is a cryptocurrency, a form of money using cryptography to keep transactions secure. 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 in the next. This forms a chain of blocks, or a blockchain.
Each block of bitcoins 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 these blocks. But this meant that malicious people could make up fake "block" data that was very long as a form of denial-of-service attack (DoS attack). Their fake blocks would be detected, but doing so would take a very long time, slowing down the whole system.
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
A block is added to the chain every ten minutes (proof-of-work causes this delay). The limit on block-size limits the number of transactions fitting into a given block. Some sites work around this problem, by conducting "off-chain payments", conducting transactions without waiting for confirmation by the blockchain.
Others have proposed changes to Bitcoin that would reform the way it's done, but that would not be backward-compatible. For example, FlexTrans (Flexible Transactions) would make transactions smaller by changing how they are described to a "tag" system, allowing more in blocks of the current size. But it is not compatible with systems that do not upgrade.
The most important is "transaction malleability". While a transaction is signed, the signature doesn't include all transaction data, and at one time checking that the signature was correct was not even required. This means that several different ways of losing or stealing bitcoins are possible. While a number of different fixes have made this unlikely to happen, the flaw still exists.
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. The "witness" signature data 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. This means the existing Bitcoin protocol doesn't change, allowing it to work without as much upgrading of software.
It also addresses signature malleability, by moving signatures out of the transaction data, making them impossible to change. 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.
Adoption
In early 2018 segregated witness transactions have been in the 10-14% range.
Maps SegWit
Activation
Segregated Witness was activated on August 24, 2017. In the first week of October, the proportion of network transactions using SegWit rose from 7% to 10%, indicating a greater increase in use rate.
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"), activating Segregated Witness at an 80% threshold of the total Bitcoin hashrate, 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. In June 2017 the Segregated Witness proposal was further complicated with claims that it might violate patents filed with the USIPO.
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. 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.
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. SegWit alleviates the scaling problem in two ways:
- One can fit roughly 2 times as many SegWit transactions per block because the one-megabyte limit will only apply to their "witness-stripped" versions, which are smaller in size.
- SegWit enables the Lightning Network, a second layer to run on top of the base blockchain layer, hypothetically resolving the scaling problem by enabling virtually unlimited numbers of instant, low-fee transactions to occur "off chain".
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. 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%.
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.
Related BIPs
- 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.
References
External links
- The author of SegWit Pieter Wuille (sipa), explains SegWit in 2015
Source of the article : Wikipedia