Segregated Witness

Segregated Witness (SegWit) Bitcoin Protocol

Segregated Witness (abbreviated as SegWit) is an implemented protocol upgrade intended to provide protection from transaction malleability and increase block capacity. SegWit defines a new structure called a witness that is committed to blocks separately from the transaction merkle tree. This structure contains data required to check transaction validity but is not required to determine transaction effects. In particular, signatures and redeem scripts are moved into this new structure, which does not count towards the traditional 1 MB block size limit.

Instead, a new weight parameter is defined, and blocks are allowed to have at most 4 million weight units (WU). A byte in the original 1 MB zone of the block weighs 4 WU, but a byte in a witness structure only weighs 1 WU, allowing blocks that are technically larger than 1 MB without a hardforking change. After the successful activations of OP_CLTV and OP_CSV, SegWit was the last protocol change needed to make the Lightning Network safe to deploy on the Bitcoin network.

Because the witness structure contains Script versioning, it is also possible to make changes to or introduce new opcodes to SegWit scripts that would have originally required a hardfork to function without SegWit.

Contents

SegWit Review

What is SegWit? – How does SegWit work?

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.

What is SegWit?

SegWit is a softphone offered by the Bitcoin Core advancement group. The motivation behind this proposition is to streamline the piece measure, which later on will illuminate the issues of adaptability of the bitcoin organize, square flood, exchange speed, and lessening of commissions. In straightforward words, SegWit enables you to build the proficiency of the square without expanding the piece estimate.

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 (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 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

As Bitcoin has become more popular, the limit began to slow down transactions. A block is added to the chain every ten minutes. With a limit on its size, only so many transactions can be added, as many as fit in a block. Globally, bitcoin cannot currently support transactions with anything like the speed of other currencies or credit cards. It sometimes takes hours to confirm a transaction.

Some sites work around this problem, by conducting “off-chain payments”, conducting transactions without waiting for confirmation by the blockchain.

Likewise, there are a number of other, unrelated problems that have arisen with the bitcoin protocol.

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 bitcoin. 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.

Activation

SegWit – Bitcoin – Segregated Witness

Segregated Witness was activated on August 24, 2017. Nonetheless, most Bitcoin network transactions have not begun to use the upgrade. 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. SegWit2x proposed to first activate Segregated Witness and then a 2 MB hardfork within six months as of May 23, 2017.

On November 8, 2017, the developers of segwit 2x announced that the hard fork planned for around November 16, 2017 was canceled due to a lack of consensus.

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 segwit 2x (“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 segwit 2x proposal had support in excess of 90% of the hashrate, however the segwit 2x proposal has been controversial in that work on the project is limited to an invitation only group of developers.

On 21 July, BIP 91 locked-in, meaning that Segregated Witness upgrade would activate at block 477,120. 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%.

What is a soft?

Softfork – changing the rules by which the unit passes validation (verification for authenticity) in the blockroom. SoftPhock assumes changes in the code that do not affect the core of the software. Unlike softfork, hardcore (“hard fork”) is a more radical and quick solution, which at the same time can endanger the entire bitcoin protocol if any mistake is made during its implementation. For example, the Bitcoin Unlimited solution offered by the developers is a bit of bitcoin. This allows the main unit to accommodate more transactions, and also eliminates the variability of the identifier of the same transaction.

What will SegWit provide in the future?

Any network node can modify the transaction and broadcast it to the rest. If the modified transaction is included in the block of the primary branch before the original one or later on in a long branch, then the original transaction will be rejected, as it will refer to the used output (the same will be rejected and referenced to it). This creates many problems, so how some systems checked the fact of payment by ID. This also complicates the implementation of higher-level technologies, which are based on Bitcoin’s blockbuster.

First of all, Segregated Witness solves the problem of scalability of the bitcoin network. The solution will optimize the structure of the transaction block since it allows you to separate transaction signatures from the transfer process. As a result, transactions will take up less space, and the blocks, respectively, will become more spacious. Activation of SegWit also eliminates the problem of the plasticity of transactions, creating conditions for increasing the speed of their confirmation (including through the link Segregated Witness with another solution called Lightning Network).

SegWit Advantages

  • The main advantage of Segregated Witness is that excluding signatures from the block in 1Mb can effectively increase the bitcoin block size. This means that in each block it will be possible to record more transactions, or, in other words, to increase the blocking capacity. At the same time, the solution is feasible without violating the existing rules of consensus.
  • To solve the problem of scalability, Segregated Witness involves extracting a transaction signature and placing it in a separate data structure. When the signature is removed from the transaction, the transaction size is reduced. Therefore, each transaction is reduced by approximately 47%. Thus, the block, without changing its size, can accommodate almost twice as many transactions.
  • SegWit will also benefit the holders of “full nodes” because it can reduce the amount of data needed to store on hard disks. In other words, Segregated Witness will reduce the requirements for running a full node and the time it takes to synchronize with the network.
  • Some Altokemins also decided to implement SegWit. Since many altcoins are based on Bitcoin’s code, it did not give developers any special problems. The first of them activated the update of Groestlcoin in January 2017.

What is needed to implement Segregated Witness?

To activate the solution in the network, bitcoins need support from 95% of the miners. More precisely, after reaching the activation threshold, it is necessary that at least 95% of the blocks are mined by the ministers signalling the support of Segregated Witness during one period of complexity in 2016 blocks (approximately two weeks). The release of Bitcoin Core 0.13.1 client with the included SegWit solution took place on October 27, 2016.

See Also on BitcoinWiki

  • BIP 141 Segregated Witness (Consensus layer)
  • BIP 143 Transaction Signature Verification for Version 0 Witness Program
  • BIP 144 Segregated Witness (Peer Services)
  • BIP 145 getblocktemplate Updates for Segregated Witness
  • BIP 147 Dealing with dummy stack element malleability
  • BIP 173 Base32 address format for native v0-16 witness outputs
  • SegWit2x

External Links

Sources